@lynx-js/rspeedy-canary 0.11.3-canary-20250919-f4528d19 → 0.11.3-canary-20250919-8c33d3e1

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 (50) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/0~src_config_validate_ts.js +40795 -0
  3. package/dist/0~src_plugins_api_plugin_ts.js +33 -0
  4. package/dist/0~src_plugins_rsdoctor_plugin_ts.js +54 -0
  5. package/dist/1~src_plugins_chunkLoading_plugin_ts.js +37 -0
  6. package/dist/1~src_plugins_dev_plugin_ts.js +144 -0
  7. package/dist/1~src_plugins_emitOnErrors_plugin_ts.js +22 -0
  8. package/dist/1~src_plugins_index_ts.js +52 -0
  9. package/dist/1~src_plugins_inspect_plugin_ts.js +49 -0
  10. package/dist/1~src_plugins_minify_plugin_ts.js +86 -0
  11. package/dist/1~src_plugins_optimization_plugin_ts.js +26 -0
  12. package/dist/1~src_plugins_output_plugin_ts.js +47 -0
  13. package/dist/1~src_plugins_resolve_plugin_ts.js +22 -0
  14. package/dist/1~src_plugins_sourcemap_plugin_ts.js +100 -0
  15. package/dist/1~src_plugins_swc_plugin_ts.js +40 -0
  16. package/dist/1~src_plugins_target_plugin_ts.js +46 -0
  17. package/dist/{vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js → 1~vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js} +1 -1
  18. package/dist/1~vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js.js +1068 -0
  19. package/dist/1~vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js +417 -0
  20. package/dist/cli/main.js +1 -1
  21. package/dist/index.js +1 -1
  22. package/package.json +1 -1
  23. /package/dist/{src_cli_exit_ts.js → 0~src_cli_exit_ts.js} +0 -0
  24. /package/dist/{src_plugins_chunkLoading_plugin_ts.js → 0~src_plugins_chunkLoading_plugin_ts.js} +0 -0
  25. /package/dist/{src_plugins_dev_plugin_ts.js → 0~src_plugins_dev_plugin_ts.js} +0 -0
  26. /package/dist/{src_plugins_emitOnErrors_plugin_ts.js → 0~src_plugins_emitOnErrors_plugin_ts.js} +0 -0
  27. /package/dist/{src_plugins_index_ts.js → 0~src_plugins_index_ts.js} +0 -0
  28. /package/dist/{src_plugins_inspect_plugin_ts.js → 0~src_plugins_inspect_plugin_ts.js} +0 -0
  29. /package/dist/{src_plugins_minify_plugin_ts.js → 0~src_plugins_minify_plugin_ts.js} +0 -0
  30. /package/dist/{src_plugins_optimization_plugin_ts.js → 0~src_plugins_optimization_plugin_ts.js} +0 -0
  31. /package/dist/{src_plugins_output_plugin_ts.js → 0~src_plugins_output_plugin_ts.js} +0 -0
  32. /package/dist/{src_plugins_resolve_plugin_ts.js → 0~src_plugins_resolve_plugin_ts.js} +0 -0
  33. /package/dist/{src_plugins_sourcemap_plugin_ts.js → 0~src_plugins_sourcemap_plugin_ts.js} +0 -0
  34. /package/dist/{src_plugins_swc_plugin_ts.js → 0~src_plugins_swc_plugin_ts.js} +0 -0
  35. /package/dist/{src_plugins_target_plugin_ts.js → 0~src_plugins_target_plugin_ts.js} +0 -0
  36. /package/dist/{vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js.js → 0~vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js.js} +0 -0
  37. /package/dist/{vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js → 0~vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js} +0 -0
  38. /package/dist/{events-fs-fs_promises-os-path-stream.js → 1~events-fs-fs_promises-os-path-stream.js} +0 -0
  39. /package/dist/{node_child_process-node_events-node_fs-node_path.js → 1~node_child_process-node_events-node_fs-node_path.js} +0 -0
  40. /package/dist/{src_cli_build_ts.js → 1~src_cli_build_ts.js} +0 -0
  41. /package/dist/{src_cli_commands_ts.js → 1~src_cli_commands_ts.js} +0 -0
  42. /package/dist/{src_cli_dev_ts.js → 1~src_cli_dev_ts.js} +0 -0
  43. /package/dist/{src_cli_inspect_ts.js → 1~src_cli_inspect_ts.js} +0 -0
  44. /package/dist/{src_cli_preview_ts.js → 1~src_cli_preview_ts.js} +0 -0
  45. /package/dist/{src_config_validate_ts.js → 1~src_config_validate_ts.js} +0 -0
  46. /package/dist/{src_plugins_api_plugin_ts.js → 1~src_plugins_api_plugin_ts.js} +0 -0
  47. /package/dist/{src_plugins_rsdoctor_plugin_ts.js → 1~src_plugins_rsdoctor_plugin_ts.js} +0 -0
  48. /package/dist/{src_version_ts.js → 1~src_version_ts.js} +0 -0
  49. /package/dist/{vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt → 1~vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt} +0 -0
  50. /package/dist/{vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js → 1~vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js} +0 -0
@@ -0,0 +1,1068 @@
1
+ export const __webpack_id__ = "vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js";
2
+ export const __webpack_ids__ = [
3
+ "vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js"
4
+ ];
5
+ export const __webpack_modules__ = {
6
+ "../../../node_modules/.pnpm/ipaddr.js@2.2.0/node_modules/ipaddr.js/lib/ipaddr.js": function(module) {
7
+ (function(root) {
8
+ 'use strict';
9
+ const ipv4Part = '(0?\\d+|0x[a-f0-9]+)';
10
+ const ipv4Regexes = {
11
+ fourOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, 'i'),
12
+ threeOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}$`, 'i'),
13
+ twoOctet: new RegExp(`^${ipv4Part}\\.${ipv4Part}$`, 'i'),
14
+ longValue: new RegExp(`^${ipv4Part}$`, 'i')
15
+ };
16
+ const octalRegex = new RegExp("^0[0-7]+$", 'i');
17
+ const hexRegex = new RegExp("^0x[a-f0-9]+$", 'i');
18
+ const zoneIndex = '%[0-9a-z]{1,}';
19
+ const ipv6Part = '(?:[0-9a-f]+::?)+';
20
+ const ipv6Regexes = {
21
+ zoneIndex: new RegExp(zoneIndex, 'i'),
22
+ native: new RegExp(`^(::)?(${ipv6Part})?([0-9a-f]+)?(::)?(${zoneIndex})?$`, 'i'),
23
+ deprecatedTransitional: new RegExp(`^(?:::)(${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?)$`, 'i'),
24
+ transitional: new RegExp(`^((?:${ipv6Part})|(?:::)(?:${ipv6Part})?)${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}\\.${ipv4Part}(${zoneIndex})?$`, 'i')
25
+ };
26
+ function expandIPv6(string, parts) {
27
+ if (string.indexOf('::') !== string.lastIndexOf('::')) return null;
28
+ let colonCount = 0;
29
+ let lastColon = -1;
30
+ let zoneId = (string.match(ipv6Regexes.zoneIndex) || [])[0];
31
+ let replacement, replacementCount;
32
+ if (zoneId) {
33
+ zoneId = zoneId.substring(1);
34
+ string = string.replace(/%.+$/, '');
35
+ }
36
+ while((lastColon = string.indexOf(':', lastColon + 1)) >= 0)colonCount++;
37
+ if ('::' === string.substr(0, 2)) colonCount--;
38
+ if ('::' === string.substr(-2, 2)) colonCount--;
39
+ if (colonCount > parts) return null;
40
+ replacementCount = parts - colonCount;
41
+ replacement = ':';
42
+ while(replacementCount--)replacement += '0:';
43
+ string = string.replace('::', replacement);
44
+ if (':' === string[0]) string = string.slice(1);
45
+ if (':' === string[string.length - 1]) string = string.slice(0, -1);
46
+ parts = function() {
47
+ const ref = string.split(':');
48
+ const results = [];
49
+ for(let i = 0; i < ref.length; i++)results.push(parseInt(ref[i], 16));
50
+ return results;
51
+ }();
52
+ return {
53
+ parts: parts,
54
+ zoneId: zoneId
55
+ };
56
+ }
57
+ function matchCIDR(first, second, partSize, cidrBits) {
58
+ if (first.length !== second.length) throw new Error('ipaddr: cannot match CIDR for objects with different lengths');
59
+ let part = 0;
60
+ let shift;
61
+ while(cidrBits > 0){
62
+ shift = partSize - cidrBits;
63
+ if (shift < 0) shift = 0;
64
+ if (first[part] >> shift !== second[part] >> shift) return false;
65
+ cidrBits -= partSize;
66
+ part += 1;
67
+ }
68
+ return true;
69
+ }
70
+ function parseIntAuto(string) {
71
+ if (hexRegex.test(string)) return parseInt(string, 16);
72
+ if ('0' === string[0] && !isNaN(parseInt(string[1], 10))) {
73
+ if (octalRegex.test(string)) return parseInt(string, 8);
74
+ throw new Error(`ipaddr: cannot parse ${string} as octal`);
75
+ }
76
+ return parseInt(string, 10);
77
+ }
78
+ function padPart(part, length) {
79
+ while(part.length < length)part = `0${part}`;
80
+ return part;
81
+ }
82
+ const ipaddr = {};
83
+ ipaddr.IPv4 = function() {
84
+ function IPv4(octets) {
85
+ if (4 !== octets.length) throw new Error('ipaddr: ipv4 octet count should be 4');
86
+ let i, octet;
87
+ for(i = 0; i < octets.length; i++){
88
+ octet = octets[i];
89
+ if (!(0 <= octet && octet <= 255)) throw new Error('ipaddr: ipv4 octet should fit in 8 bits');
90
+ }
91
+ this.octets = octets;
92
+ }
93
+ IPv4.prototype.SpecialRanges = {
94
+ unspecified: [
95
+ [
96
+ new IPv4([
97
+ 0,
98
+ 0,
99
+ 0,
100
+ 0
101
+ ]),
102
+ 8
103
+ ]
104
+ ],
105
+ broadcast: [
106
+ [
107
+ new IPv4([
108
+ 255,
109
+ 255,
110
+ 255,
111
+ 255
112
+ ]),
113
+ 32
114
+ ]
115
+ ],
116
+ multicast: [
117
+ [
118
+ new IPv4([
119
+ 224,
120
+ 0,
121
+ 0,
122
+ 0
123
+ ]),
124
+ 4
125
+ ]
126
+ ],
127
+ linkLocal: [
128
+ [
129
+ new IPv4([
130
+ 169,
131
+ 254,
132
+ 0,
133
+ 0
134
+ ]),
135
+ 16
136
+ ]
137
+ ],
138
+ loopback: [
139
+ [
140
+ new IPv4([
141
+ 127,
142
+ 0,
143
+ 0,
144
+ 0
145
+ ]),
146
+ 8
147
+ ]
148
+ ],
149
+ carrierGradeNat: [
150
+ [
151
+ new IPv4([
152
+ 100,
153
+ 64,
154
+ 0,
155
+ 0
156
+ ]),
157
+ 10
158
+ ]
159
+ ],
160
+ private: [
161
+ [
162
+ new IPv4([
163
+ 10,
164
+ 0,
165
+ 0,
166
+ 0
167
+ ]),
168
+ 8
169
+ ],
170
+ [
171
+ new IPv4([
172
+ 172,
173
+ 16,
174
+ 0,
175
+ 0
176
+ ]),
177
+ 12
178
+ ],
179
+ [
180
+ new IPv4([
181
+ 192,
182
+ 168,
183
+ 0,
184
+ 0
185
+ ]),
186
+ 16
187
+ ]
188
+ ],
189
+ reserved: [
190
+ [
191
+ new IPv4([
192
+ 192,
193
+ 0,
194
+ 0,
195
+ 0
196
+ ]),
197
+ 24
198
+ ],
199
+ [
200
+ new IPv4([
201
+ 192,
202
+ 0,
203
+ 2,
204
+ 0
205
+ ]),
206
+ 24
207
+ ],
208
+ [
209
+ new IPv4([
210
+ 192,
211
+ 88,
212
+ 99,
213
+ 0
214
+ ]),
215
+ 24
216
+ ],
217
+ [
218
+ new IPv4([
219
+ 198,
220
+ 18,
221
+ 0,
222
+ 0
223
+ ]),
224
+ 15
225
+ ],
226
+ [
227
+ new IPv4([
228
+ 198,
229
+ 51,
230
+ 100,
231
+ 0
232
+ ]),
233
+ 24
234
+ ],
235
+ [
236
+ new IPv4([
237
+ 203,
238
+ 0,
239
+ 113,
240
+ 0
241
+ ]),
242
+ 24
243
+ ],
244
+ [
245
+ new IPv4([
246
+ 240,
247
+ 0,
248
+ 0,
249
+ 0
250
+ ]),
251
+ 4
252
+ ]
253
+ ],
254
+ as112: [
255
+ [
256
+ new IPv4([
257
+ 192,
258
+ 175,
259
+ 48,
260
+ 0
261
+ ]),
262
+ 24
263
+ ],
264
+ [
265
+ new IPv4([
266
+ 192,
267
+ 31,
268
+ 196,
269
+ 0
270
+ ]),
271
+ 24
272
+ ]
273
+ ],
274
+ amt: [
275
+ [
276
+ new IPv4([
277
+ 192,
278
+ 52,
279
+ 193,
280
+ 0
281
+ ]),
282
+ 24
283
+ ]
284
+ ]
285
+ };
286
+ IPv4.prototype.kind = function() {
287
+ return 'ipv4';
288
+ };
289
+ IPv4.prototype.match = function(other, cidrRange) {
290
+ let ref;
291
+ if (void 0 === cidrRange) {
292
+ ref = other;
293
+ other = ref[0];
294
+ cidrRange = ref[1];
295
+ }
296
+ if ('ipv4' !== other.kind()) throw new Error('ipaddr: cannot match ipv4 address with non-ipv4 one');
297
+ return matchCIDR(this.octets, other.octets, 8, cidrRange);
298
+ };
299
+ IPv4.prototype.prefixLengthFromSubnetMask = function() {
300
+ let cidr = 0;
301
+ let stop = false;
302
+ const zerotable = {
303
+ 0: 8,
304
+ 128: 7,
305
+ 192: 6,
306
+ 224: 5,
307
+ 240: 4,
308
+ 248: 3,
309
+ 252: 2,
310
+ 254: 1,
311
+ 255: 0
312
+ };
313
+ let i, octet, zeros;
314
+ for(i = 3; i >= 0; i -= 1){
315
+ octet = this.octets[i];
316
+ if (!(octet in zerotable)) return null;
317
+ zeros = zerotable[octet];
318
+ if (stop && 0 !== zeros) return null;
319
+ if (8 !== zeros) stop = true;
320
+ cidr += zeros;
321
+ }
322
+ return 32 - cidr;
323
+ };
324
+ IPv4.prototype.range = function() {
325
+ return ipaddr.subnetMatch(this, this.SpecialRanges);
326
+ };
327
+ IPv4.prototype.toByteArray = function() {
328
+ return this.octets.slice(0);
329
+ };
330
+ IPv4.prototype.toIPv4MappedAddress = function() {
331
+ return ipaddr.IPv6.parse(`::ffff:${this.toString()}`);
332
+ };
333
+ IPv4.prototype.toNormalizedString = function() {
334
+ return this.toString();
335
+ };
336
+ IPv4.prototype.toString = function() {
337
+ return this.octets.join('.');
338
+ };
339
+ return IPv4;
340
+ }();
341
+ ipaddr.IPv4.broadcastAddressFromCIDR = function(string) {
342
+ try {
343
+ const cidr = this.parseCIDR(string);
344
+ const ipInterfaceOctets = cidr[0].toByteArray();
345
+ const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
346
+ const octets = [];
347
+ let i = 0;
348
+ while(i < 4){
349
+ octets.push(parseInt(ipInterfaceOctets[i], 10) | 255 ^ parseInt(subnetMaskOctets[i], 10));
350
+ i++;
351
+ }
352
+ return new this(octets);
353
+ } catch (e) {
354
+ throw new Error('ipaddr: the address does not have IPv4 CIDR format');
355
+ }
356
+ };
357
+ ipaddr.IPv4.isIPv4 = function(string) {
358
+ return null !== this.parser(string);
359
+ };
360
+ ipaddr.IPv4.isValid = function(string) {
361
+ try {
362
+ new this(this.parser(string));
363
+ return true;
364
+ } catch (e) {
365
+ return false;
366
+ }
367
+ };
368
+ ipaddr.IPv4.isValidCIDR = function(string) {
369
+ try {
370
+ this.parseCIDR(string);
371
+ return true;
372
+ } catch (e) {
373
+ return false;
374
+ }
375
+ };
376
+ ipaddr.IPv4.isValidFourPartDecimal = function(string) {
377
+ if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) return true;
378
+ return false;
379
+ };
380
+ ipaddr.IPv4.networkAddressFromCIDR = function(string) {
381
+ let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
382
+ try {
383
+ cidr = this.parseCIDR(string);
384
+ ipInterfaceOctets = cidr[0].toByteArray();
385
+ subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
386
+ octets = [];
387
+ i = 0;
388
+ while(i < 4){
389
+ octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
390
+ i++;
391
+ }
392
+ return new this(octets);
393
+ } catch (e) {
394
+ throw new Error('ipaddr: the address does not have IPv4 CIDR format');
395
+ }
396
+ };
397
+ ipaddr.IPv4.parse = function(string) {
398
+ const parts = this.parser(string);
399
+ if (null === parts) throw new Error('ipaddr: string is not formatted like an IPv4 Address');
400
+ return new this(parts);
401
+ };
402
+ ipaddr.IPv4.parseCIDR = function(string) {
403
+ let match;
404
+ if (match = string.match(/^(.+)\/(\d+)$/)) {
405
+ const maskLength = parseInt(match[2]);
406
+ if (maskLength >= 0 && maskLength <= 32) {
407
+ const parsed = [
408
+ this.parse(match[1]),
409
+ maskLength
410
+ ];
411
+ Object.defineProperty(parsed, 'toString', {
412
+ value: function() {
413
+ return this.join('/');
414
+ }
415
+ });
416
+ return parsed;
417
+ }
418
+ }
419
+ throw new Error('ipaddr: string is not formatted like an IPv4 CIDR range');
420
+ };
421
+ ipaddr.IPv4.parser = function(string) {
422
+ let match, part, value;
423
+ if (match = string.match(ipv4Regexes.fourOctet)) return function() {
424
+ const ref = match.slice(1, 6);
425
+ const results = [];
426
+ for(let i = 0; i < ref.length; i++){
427
+ part = ref[i];
428
+ results.push(parseIntAuto(part));
429
+ }
430
+ return results;
431
+ }();
432
+ if (match = string.match(ipv4Regexes.longValue)) {
433
+ value = parseIntAuto(match[1]);
434
+ if (value > 0xffffffff || value < 0) throw new Error('ipaddr: address outside defined range');
435
+ return (function() {
436
+ const results = [];
437
+ let shift;
438
+ for(shift = 0; shift <= 24; shift += 8)results.push(value >> shift & 0xff);
439
+ return results;
440
+ })().reverse();
441
+ }
442
+ if (match = string.match(ipv4Regexes.twoOctet)) return function() {
443
+ const ref = match.slice(1, 4);
444
+ const results = [];
445
+ value = parseIntAuto(ref[1]);
446
+ if (value > 0xffffff || value < 0) throw new Error('ipaddr: address outside defined range');
447
+ results.push(parseIntAuto(ref[0]));
448
+ results.push(value >> 16 & 0xff);
449
+ results.push(value >> 8 & 0xff);
450
+ results.push(0xff & value);
451
+ return results;
452
+ }();
453
+ if (match = string.match(ipv4Regexes.threeOctet)) return function() {
454
+ const ref = match.slice(1, 5);
455
+ const results = [];
456
+ value = parseIntAuto(ref[2]);
457
+ if (value > 0xffff || value < 0) throw new Error('ipaddr: address outside defined range');
458
+ results.push(parseIntAuto(ref[0]));
459
+ results.push(parseIntAuto(ref[1]));
460
+ results.push(value >> 8 & 0xff);
461
+ results.push(0xff & value);
462
+ return results;
463
+ }();
464
+ return null;
465
+ };
466
+ ipaddr.IPv4.subnetMaskFromPrefixLength = function(prefix) {
467
+ prefix = parseInt(prefix);
468
+ if (prefix < 0 || prefix > 32) throw new Error('ipaddr: invalid IPv4 prefix length');
469
+ const octets = [
470
+ 0,
471
+ 0,
472
+ 0,
473
+ 0
474
+ ];
475
+ let j = 0;
476
+ const filledOctetCount = Math.floor(prefix / 8);
477
+ while(j < filledOctetCount){
478
+ octets[j] = 255;
479
+ j++;
480
+ }
481
+ if (filledOctetCount < 4) octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8;
482
+ return new this(octets);
483
+ };
484
+ ipaddr.IPv6 = function() {
485
+ function IPv6(parts, zoneId) {
486
+ let i, part;
487
+ if (16 === parts.length) {
488
+ this.parts = [];
489
+ for(i = 0; i <= 14; i += 2)this.parts.push(parts[i] << 8 | parts[i + 1]);
490
+ } else if (8 === parts.length) this.parts = parts;
491
+ else throw new Error('ipaddr: ipv6 part count should be 8 or 16');
492
+ for(i = 0; i < this.parts.length; i++){
493
+ part = this.parts[i];
494
+ if (!(0 <= part && part <= 0xffff)) throw new Error('ipaddr: ipv6 part should fit in 16 bits');
495
+ }
496
+ if (zoneId) this.zoneId = zoneId;
497
+ }
498
+ IPv6.prototype.SpecialRanges = {
499
+ unspecified: [
500
+ new IPv6([
501
+ 0,
502
+ 0,
503
+ 0,
504
+ 0,
505
+ 0,
506
+ 0,
507
+ 0,
508
+ 0
509
+ ]),
510
+ 128
511
+ ],
512
+ linkLocal: [
513
+ new IPv6([
514
+ 0xfe80,
515
+ 0,
516
+ 0,
517
+ 0,
518
+ 0,
519
+ 0,
520
+ 0,
521
+ 0
522
+ ]),
523
+ 10
524
+ ],
525
+ multicast: [
526
+ new IPv6([
527
+ 0xff00,
528
+ 0,
529
+ 0,
530
+ 0,
531
+ 0,
532
+ 0,
533
+ 0,
534
+ 0
535
+ ]),
536
+ 8
537
+ ],
538
+ loopback: [
539
+ new IPv6([
540
+ 0,
541
+ 0,
542
+ 0,
543
+ 0,
544
+ 0,
545
+ 0,
546
+ 0,
547
+ 1
548
+ ]),
549
+ 128
550
+ ],
551
+ uniqueLocal: [
552
+ new IPv6([
553
+ 0xfc00,
554
+ 0,
555
+ 0,
556
+ 0,
557
+ 0,
558
+ 0,
559
+ 0,
560
+ 0
561
+ ]),
562
+ 7
563
+ ],
564
+ ipv4Mapped: [
565
+ new IPv6([
566
+ 0,
567
+ 0,
568
+ 0,
569
+ 0,
570
+ 0,
571
+ 0xffff,
572
+ 0,
573
+ 0
574
+ ]),
575
+ 96
576
+ ],
577
+ discard: [
578
+ new IPv6([
579
+ 0x100,
580
+ 0,
581
+ 0,
582
+ 0,
583
+ 0,
584
+ 0,
585
+ 0,
586
+ 0
587
+ ]),
588
+ 64
589
+ ],
590
+ rfc6145: [
591
+ new IPv6([
592
+ 0,
593
+ 0,
594
+ 0,
595
+ 0,
596
+ 0xffff,
597
+ 0,
598
+ 0,
599
+ 0
600
+ ]),
601
+ 96
602
+ ],
603
+ rfc6052: [
604
+ new IPv6([
605
+ 0x64,
606
+ 0xff9b,
607
+ 0,
608
+ 0,
609
+ 0,
610
+ 0,
611
+ 0,
612
+ 0
613
+ ]),
614
+ 96
615
+ ],
616
+ '6to4': [
617
+ new IPv6([
618
+ 0x2002,
619
+ 0,
620
+ 0,
621
+ 0,
622
+ 0,
623
+ 0,
624
+ 0,
625
+ 0
626
+ ]),
627
+ 16
628
+ ],
629
+ teredo: [
630
+ new IPv6([
631
+ 0x2001,
632
+ 0,
633
+ 0,
634
+ 0,
635
+ 0,
636
+ 0,
637
+ 0,
638
+ 0
639
+ ]),
640
+ 32
641
+ ],
642
+ benchmarking: [
643
+ new IPv6([
644
+ 0x2001,
645
+ 0x2,
646
+ 0,
647
+ 0,
648
+ 0,
649
+ 0,
650
+ 0,
651
+ 0
652
+ ]),
653
+ 48
654
+ ],
655
+ amt: [
656
+ new IPv6([
657
+ 0x2001,
658
+ 0x3,
659
+ 0,
660
+ 0,
661
+ 0,
662
+ 0,
663
+ 0,
664
+ 0
665
+ ]),
666
+ 32
667
+ ],
668
+ as112v6: [
669
+ [
670
+ new IPv6([
671
+ 0x2001,
672
+ 0x4,
673
+ 0x112,
674
+ 0,
675
+ 0,
676
+ 0,
677
+ 0,
678
+ 0
679
+ ]),
680
+ 48
681
+ ],
682
+ [
683
+ new IPv6([
684
+ 0x2620,
685
+ 0x4f,
686
+ 0x8000,
687
+ 0,
688
+ 0,
689
+ 0,
690
+ 0,
691
+ 0
692
+ ]),
693
+ 48
694
+ ]
695
+ ],
696
+ deprecated: [
697
+ new IPv6([
698
+ 0x2001,
699
+ 0x10,
700
+ 0,
701
+ 0,
702
+ 0,
703
+ 0,
704
+ 0,
705
+ 0
706
+ ]),
707
+ 28
708
+ ],
709
+ orchid2: [
710
+ new IPv6([
711
+ 0x2001,
712
+ 0x20,
713
+ 0,
714
+ 0,
715
+ 0,
716
+ 0,
717
+ 0,
718
+ 0
719
+ ]),
720
+ 28
721
+ ],
722
+ droneRemoteIdProtocolEntityTags: [
723
+ new IPv6([
724
+ 0x2001,
725
+ 0x30,
726
+ 0,
727
+ 0,
728
+ 0,
729
+ 0,
730
+ 0,
731
+ 0
732
+ ]),
733
+ 28
734
+ ],
735
+ reserved: [
736
+ [
737
+ new IPv6([
738
+ 0x2001,
739
+ 0,
740
+ 0,
741
+ 0,
742
+ 0,
743
+ 0,
744
+ 0,
745
+ 0
746
+ ]),
747
+ 23
748
+ ],
749
+ [
750
+ new IPv6([
751
+ 0x2001,
752
+ 0xdb8,
753
+ 0,
754
+ 0,
755
+ 0,
756
+ 0,
757
+ 0,
758
+ 0
759
+ ]),
760
+ 32
761
+ ]
762
+ ]
763
+ };
764
+ IPv6.prototype.isIPv4MappedAddress = function() {
765
+ return 'ipv4Mapped' === this.range();
766
+ };
767
+ IPv6.prototype.kind = function() {
768
+ return 'ipv6';
769
+ };
770
+ IPv6.prototype.match = function(other, cidrRange) {
771
+ let ref;
772
+ if (void 0 === cidrRange) {
773
+ ref = other;
774
+ other = ref[0];
775
+ cidrRange = ref[1];
776
+ }
777
+ if ('ipv6' !== other.kind()) throw new Error('ipaddr: cannot match ipv6 address with non-ipv6 one');
778
+ return matchCIDR(this.parts, other.parts, 16, cidrRange);
779
+ };
780
+ IPv6.prototype.prefixLengthFromSubnetMask = function() {
781
+ let cidr = 0;
782
+ let stop = false;
783
+ const zerotable = {
784
+ 0: 16,
785
+ 32768: 15,
786
+ 49152: 14,
787
+ 57344: 13,
788
+ 61440: 12,
789
+ 63488: 11,
790
+ 64512: 10,
791
+ 65024: 9,
792
+ 65280: 8,
793
+ 65408: 7,
794
+ 65472: 6,
795
+ 65504: 5,
796
+ 65520: 4,
797
+ 65528: 3,
798
+ 65532: 2,
799
+ 65534: 1,
800
+ 65535: 0
801
+ };
802
+ let part, zeros;
803
+ for(let i = 7; i >= 0; i -= 1){
804
+ part = this.parts[i];
805
+ if (!(part in zerotable)) return null;
806
+ zeros = zerotable[part];
807
+ if (stop && 0 !== zeros) return null;
808
+ if (16 !== zeros) stop = true;
809
+ cidr += zeros;
810
+ }
811
+ return 128 - cidr;
812
+ };
813
+ IPv6.prototype.range = function() {
814
+ return ipaddr.subnetMatch(this, this.SpecialRanges);
815
+ };
816
+ IPv6.prototype.toByteArray = function() {
817
+ let part;
818
+ const bytes = [];
819
+ const ref = this.parts;
820
+ for(let i = 0; i < ref.length; i++){
821
+ part = ref[i];
822
+ bytes.push(part >> 8);
823
+ bytes.push(0xff & part);
824
+ }
825
+ return bytes;
826
+ };
827
+ IPv6.prototype.toFixedLengthString = function() {
828
+ const addr = (function() {
829
+ const results = [];
830
+ for(let i = 0; i < this.parts.length; i++)results.push(padPart(this.parts[i].toString(16), 4));
831
+ return results;
832
+ }).call(this).join(':');
833
+ let suffix = '';
834
+ if (this.zoneId) suffix = `%${this.zoneId}`;
835
+ return addr + suffix;
836
+ };
837
+ IPv6.prototype.toIPv4Address = function() {
838
+ if (!this.isIPv4MappedAddress()) throw new Error('ipaddr: trying to convert a generic ipv6 address to ipv4');
839
+ const ref = this.parts.slice(-2);
840
+ const high = ref[0];
841
+ const low = ref[1];
842
+ return new ipaddr.IPv4([
843
+ high >> 8,
844
+ 0xff & high,
845
+ low >> 8,
846
+ 0xff & low
847
+ ]);
848
+ };
849
+ IPv6.prototype.toNormalizedString = function() {
850
+ const addr = (function() {
851
+ const results = [];
852
+ for(let i = 0; i < this.parts.length; i++)results.push(this.parts[i].toString(16));
853
+ return results;
854
+ }).call(this).join(':');
855
+ let suffix = '';
856
+ if (this.zoneId) suffix = `%${this.zoneId}`;
857
+ return addr + suffix;
858
+ };
859
+ IPv6.prototype.toRFC5952String = function() {
860
+ const regex = /((^|:)(0(:|$)){2,})/g;
861
+ const string = this.toNormalizedString();
862
+ let bestMatchIndex = 0;
863
+ let bestMatchLength = -1;
864
+ let match;
865
+ while(match = regex.exec(string))if (match[0].length > bestMatchLength) {
866
+ bestMatchIndex = match.index;
867
+ bestMatchLength = match[0].length;
868
+ }
869
+ if (bestMatchLength < 0) return string;
870
+ return `${string.substring(0, bestMatchIndex)}::${string.substring(bestMatchIndex + bestMatchLength)}`;
871
+ };
872
+ IPv6.prototype.toString = function() {
873
+ return this.toRFC5952String();
874
+ };
875
+ return IPv6;
876
+ }();
877
+ ipaddr.IPv6.broadcastAddressFromCIDR = function(string) {
878
+ try {
879
+ const cidr = this.parseCIDR(string);
880
+ const ipInterfaceOctets = cidr[0].toByteArray();
881
+ const subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
882
+ const octets = [];
883
+ let i = 0;
884
+ while(i < 16){
885
+ octets.push(parseInt(ipInterfaceOctets[i], 10) | 255 ^ parseInt(subnetMaskOctets[i], 10));
886
+ i++;
887
+ }
888
+ return new this(octets);
889
+ } catch (e) {
890
+ throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
891
+ }
892
+ };
893
+ ipaddr.IPv6.isIPv6 = function(string) {
894
+ return null !== this.parser(string);
895
+ };
896
+ ipaddr.IPv6.isValid = function(string) {
897
+ if ('string' == typeof string && -1 === string.indexOf(':')) return false;
898
+ try {
899
+ const addr = this.parser(string);
900
+ new this(addr.parts, addr.zoneId);
901
+ return true;
902
+ } catch (e) {
903
+ return false;
904
+ }
905
+ };
906
+ ipaddr.IPv6.isValidCIDR = function(string) {
907
+ if ('string' == typeof string && -1 === string.indexOf(':')) return false;
908
+ try {
909
+ this.parseCIDR(string);
910
+ return true;
911
+ } catch (e) {
912
+ return false;
913
+ }
914
+ };
915
+ ipaddr.IPv6.networkAddressFromCIDR = function(string) {
916
+ let cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
917
+ try {
918
+ cidr = this.parseCIDR(string);
919
+ ipInterfaceOctets = cidr[0].toByteArray();
920
+ subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
921
+ octets = [];
922
+ i = 0;
923
+ while(i < 16){
924
+ octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
925
+ i++;
926
+ }
927
+ return new this(octets);
928
+ } catch (e) {
929
+ throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`);
930
+ }
931
+ };
932
+ ipaddr.IPv6.parse = function(string) {
933
+ const addr = this.parser(string);
934
+ if (null === addr.parts) throw new Error('ipaddr: string is not formatted like an IPv6 Address');
935
+ return new this(addr.parts, addr.zoneId);
936
+ };
937
+ ipaddr.IPv6.parseCIDR = function(string) {
938
+ let maskLength, match, parsed;
939
+ if (match = string.match(/^(.+)\/(\d+)$/)) {
940
+ maskLength = parseInt(match[2]);
941
+ if (maskLength >= 0 && maskLength <= 128) {
942
+ parsed = [
943
+ this.parse(match[1]),
944
+ maskLength
945
+ ];
946
+ Object.defineProperty(parsed, 'toString', {
947
+ value: function() {
948
+ return this.join('/');
949
+ }
950
+ });
951
+ return parsed;
952
+ }
953
+ }
954
+ throw new Error('ipaddr: string is not formatted like an IPv6 CIDR range');
955
+ };
956
+ ipaddr.IPv6.parser = function(string) {
957
+ let addr, i, match, octet, octets, zoneId;
958
+ if (match = string.match(ipv6Regexes.deprecatedTransitional)) return this.parser(`::ffff:${match[1]}`);
959
+ if (ipv6Regexes.native.test(string)) return expandIPv6(string, 8);
960
+ if (match = string.match(ipv6Regexes.transitional)) {
961
+ zoneId = match[6] || '';
962
+ addr = match[1];
963
+ if (!match[1].endsWith('::')) addr = addr.slice(0, -1);
964
+ addr = expandIPv6(addr + zoneId, 6);
965
+ if (addr.parts) {
966
+ octets = [
967
+ parseInt(match[2]),
968
+ parseInt(match[3]),
969
+ parseInt(match[4]),
970
+ parseInt(match[5])
971
+ ];
972
+ for(i = 0; i < octets.length; i++){
973
+ octet = octets[i];
974
+ if (!(0 <= octet && octet <= 255)) return null;
975
+ }
976
+ addr.parts.push(octets[0] << 8 | octets[1]);
977
+ addr.parts.push(octets[2] << 8 | octets[3]);
978
+ return {
979
+ parts: addr.parts,
980
+ zoneId: addr.zoneId
981
+ };
982
+ }
983
+ }
984
+ return null;
985
+ };
986
+ ipaddr.IPv6.subnetMaskFromPrefixLength = function(prefix) {
987
+ prefix = parseInt(prefix);
988
+ if (prefix < 0 || prefix > 128) throw new Error('ipaddr: invalid IPv6 prefix length');
989
+ const octets = [
990
+ 0,
991
+ 0,
992
+ 0,
993
+ 0,
994
+ 0,
995
+ 0,
996
+ 0,
997
+ 0,
998
+ 0,
999
+ 0,
1000
+ 0,
1001
+ 0,
1002
+ 0,
1003
+ 0,
1004
+ 0,
1005
+ 0
1006
+ ];
1007
+ let j = 0;
1008
+ const filledOctetCount = Math.floor(prefix / 8);
1009
+ while(j < filledOctetCount){
1010
+ octets[j] = 255;
1011
+ j++;
1012
+ }
1013
+ if (filledOctetCount < 16) octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - prefix % 8;
1014
+ return new this(octets);
1015
+ };
1016
+ ipaddr.fromByteArray = function(bytes) {
1017
+ const length = bytes.length;
1018
+ if (4 === length) return new ipaddr.IPv4(bytes);
1019
+ if (16 === length) return new ipaddr.IPv6(bytes);
1020
+ throw new Error('ipaddr: the binary input is neither an IPv6 nor IPv4 address');
1021
+ };
1022
+ ipaddr.isValid = function(string) {
1023
+ return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string);
1024
+ };
1025
+ ipaddr.isValidCIDR = function(string) {
1026
+ return ipaddr.IPv6.isValidCIDR(string) || ipaddr.IPv4.isValidCIDR(string);
1027
+ };
1028
+ ipaddr.parse = function(string) {
1029
+ if (ipaddr.IPv6.isValid(string)) return ipaddr.IPv6.parse(string);
1030
+ if (ipaddr.IPv4.isValid(string)) return ipaddr.IPv4.parse(string);
1031
+ throw new Error('ipaddr: the address has neither IPv6 nor IPv4 format');
1032
+ };
1033
+ ipaddr.parseCIDR = function(string) {
1034
+ try {
1035
+ return ipaddr.IPv6.parseCIDR(string);
1036
+ } catch (e) {
1037
+ try {
1038
+ return ipaddr.IPv4.parseCIDR(string);
1039
+ } catch (e2) {
1040
+ throw new Error('ipaddr: the address has neither IPv6 nor IPv4 CIDR format');
1041
+ }
1042
+ }
1043
+ };
1044
+ ipaddr.process = function(string) {
1045
+ const addr = this.parse(string);
1046
+ if ('ipv6' === addr.kind() && addr.isIPv4MappedAddress()) return addr.toIPv4Address();
1047
+ return addr;
1048
+ };
1049
+ ipaddr.subnetMatch = function(address, rangeList, defaultName) {
1050
+ let i, rangeName, rangeSubnets, subnet;
1051
+ if (null == defaultName) defaultName = 'unicast';
1052
+ for(rangeName in rangeList)if (Object.prototype.hasOwnProperty.call(rangeList, rangeName)) {
1053
+ rangeSubnets = rangeList[rangeName];
1054
+ if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) rangeSubnets = [
1055
+ rangeSubnets
1056
+ ];
1057
+ for(i = 0; i < rangeSubnets.length; i++){
1058
+ subnet = rangeSubnets[i];
1059
+ if (address.kind() === subnet[0].kind() && address.match.apply(address, subnet)) return rangeName;
1060
+ }
1061
+ }
1062
+ return defaultName;
1063
+ };
1064
+ if (module.exports) module.exports = ipaddr;
1065
+ else root.ipaddr = ipaddr;
1066
+ })(this);
1067
+ }
1068
+ };