securemark 0.230.1 → 0.231.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.231.2
4
+
5
+ - Refactoring.
6
+
7
+ ## 0.231.1
8
+
9
+ - Fix comment syntax.
10
+ - Fix ReDoS.
11
+
12
+ ## 0.231.0
13
+
14
+ - Refine hashtag syntax.
15
+
3
16
  ## 0.230.1
4
17
 
5
18
  - Refactoring.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.230.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.231.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
2
2
  require = function () {
3
3
  function r(e, n, t) {
4
4
  function o(i, f) {
@@ -896,12 +896,16 @@ require = function () {
896
896
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
897
897
  if (k2 === undefined)
898
898
  k2 = k;
899
- Object.defineProperty(o, k2, {
900
- enumerable: true,
901
- get: function () {
902
- return m[k];
903
- }
904
- });
899
+ var desc = Object.getOwnPropertyDescriptor(m, k);
900
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
901
+ desc = {
902
+ enumerable: true,
903
+ get: function () {
904
+ return m[k];
905
+ }
906
+ };
907
+ }
908
+ Object.defineProperty(o, k2, desc);
905
909
  } : function (o, m, k, k2) {
906
910
  if (k2 === undefined)
907
911
  k2 = k;
@@ -1147,12 +1151,16 @@ require = function () {
1147
1151
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1148
1152
  if (k2 === undefined)
1149
1153
  k2 = k;
1150
- Object.defineProperty(o, k2, {
1151
- enumerable: true,
1152
- get: function () {
1153
- return m[k];
1154
- }
1155
- });
1154
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1155
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1156
+ desc = {
1157
+ enumerable: true,
1158
+ get: function () {
1159
+ return m[k];
1160
+ }
1161
+ };
1162
+ }
1163
+ Object.defineProperty(o, k2, desc);
1156
1164
  } : function (o, m, k, k2) {
1157
1165
  if (k2 === undefined)
1158
1166
  k2 = k;
@@ -2502,7 +2510,7 @@ require = function () {
2502
2510
  [privates.scope](child) {
2503
2511
  if (child.element.tagName !== 'STYLE')
2504
2512
  return;
2505
- const target = /(^|[,}])(\s*)\$scope(?![\w-])(?=[^;{}]*{)/g;
2513
+ const target = /(^|[,}]|\*\/)(\s*)\$scope(?=[\s~+[{:>,])/g;
2506
2514
  const style = child.element.innerHTML;
2507
2515
  if (!target.test(style))
2508
2516
  return;
@@ -3081,12 +3089,16 @@ require = function () {
3081
3089
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
3082
3090
  if (k2 === undefined)
3083
3091
  k2 = k;
3084
- Object.defineProperty(o, k2, {
3085
- enumerable: true,
3086
- get: function () {
3087
- return m[k];
3088
- }
3089
- });
3092
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3093
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3094
+ desc = {
3095
+ enumerable: true,
3096
+ get: function () {
3097
+ return m[k];
3098
+ }
3099
+ };
3100
+ }
3101
+ Object.defineProperty(o, k2, desc);
3090
3102
  } : function (o, m, k, k2) {
3091
3103
  if (k2 === undefined)
3092
3104
  k2 = k;
@@ -4015,12 +4027,16 @@ require = function () {
4015
4027
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
4016
4028
  if (k2 === undefined)
4017
4029
  k2 = k;
4018
- Object.defineProperty(o, k2, {
4019
- enumerable: true,
4020
- get: function () {
4021
- return m[k];
4022
- }
4023
- });
4030
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4031
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4032
+ desc = {
4033
+ enumerable: true,
4034
+ get: function () {
4035
+ return m[k];
4036
+ }
4037
+ };
4038
+ }
4039
+ Object.defineProperty(o, k2, desc);
4024
4040
  } : function (o, m, k, k2) {
4025
4041
  if (k2 === undefined)
4026
4042
  k2 = k;
@@ -4329,7 +4345,7 @@ require = function () {
4329
4345
  function headers(source) {
4330
4346
  var _a;
4331
4347
  const [el] = parse(source);
4332
- return (_a = el === null || el === void 0 ? void 0 : el.textContent.trimEnd().slice(el.firstChild.textContent.length).split(/[^\S\n]*\n/)) !== null && _a !== void 0 ? _a : [];
4348
+ return (_a = el === null || el === void 0 ? void 0 : el.textContent.trimEnd().slice(el.firstChild.textContent.length).split('\n')) !== null && _a !== void 0 ? _a : [];
4333
4349
  }
4334
4350
  exports.headers = headers;
4335
4351
  function parse(source) {
@@ -6257,10 +6273,10 @@ require = function () {
6257
6273
  channel_1.channel,
6258
6274
  account_1.account,
6259
6275
  (0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/),
6260
- (0, source_1.str)(/^(?:[0-9A-Za-z]|[^\x00-\x7F\s])(?=#)/u),
6276
+ (0, source_1.str)(new RegExp(String.raw`^(?:[^\p{C}\p{S}\p{P}\s]|${ hashtag_1.emoji }|['_])(?=#)`, 'u')),
6261
6277
  hashtag_1.hashtag,
6262
6278
  hashnum_1.hashnum,
6263
- (0, source_1.str)(/^#+(?:[0-9A-Za-z'_]|[^\x00-\x7F\s])*/),
6279
+ (0, source_1.str)(new RegExp(String.raw`^#+(?:[^\p{C}\p{S}\p{P}\s]|${ hashtag_1.emoji }|['_])*`, 'u')),
6264
6280
  anchor_1.anchor
6265
6281
  ])))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
6266
6282
  },
@@ -6287,7 +6303,7 @@ require = function () {
6287
6303
  const source_1 = _dereq_('../../source');
6288
6304
  const typed_dom_1 = _dereq_('typed-dom');
6289
6305
  exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([
6290
- (0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:[0-9A-Za-z-]{0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:[0-9A-Za-z-]{0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1),
6306
+ (0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1),
6291
6307
  (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)
6292
6308
  ])), (0, combinator_1.context)({
6293
6309
  syntax: {
@@ -6374,7 +6390,7 @@ require = function () {
6374
6390
  const combinator_1 = _dereq_('../../../combinator');
6375
6391
  const source_1 = _dereq_('../../source');
6376
6392
  const typed_dom_1 = _dereq_('typed-dom');
6377
- exports.email = (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*@[0-9A-Za-z](?:[0-9A-Za-z-]{0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:[0-9A-Za-z-]{0,61}[0-9A-Za-z])?)*/), ([source]) => source.indexOf('@') <= 64 && source.length <= 255), source => [
6393
+ exports.email = (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*@[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*(?![0-9A-Za-z])/), ([source]) => source.indexOf('@') <= 64 && source.length <= 255), source => [
6378
6394
  [(0, typed_dom_1.html)('a', {
6379
6395
  class: 'email',
6380
6396
  href: `mailto:${ source }`
@@ -6395,9 +6411,10 @@ require = function () {
6395
6411
  exports.hashnum = void 0;
6396
6412
  const combinator_1 = _dereq_('../../../combinator');
6397
6413
  const link_1 = _dereq_('../link');
6414
+ const hashtag_1 = _dereq_('./hashtag');
6398
6415
  const source_1 = _dereq_('../../source');
6399
6416
  const typed_dom_1 = _dereq_('typed-dom');
6400
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(/^[0-9]{1,16}(?![0-9A-Za-z'_]|[^\x00-\x7F\s])/)), (0, combinator_1.context)({
6417
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(String.raw`^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|${ hashtag_1.emoji }|['_])`, 'u'))), (0, combinator_1.context)({
6401
6418
  syntax: {
6402
6419
  inline: {
6403
6420
  link: true,
@@ -6413,6 +6430,7 @@ require = function () {
6413
6430
  '../../../combinator': 27,
6414
6431
  '../../source': 128,
6415
6432
  '../link': 114,
6433
+ './hashtag': 96,
6416
6434
  'typed-dom': 26
6417
6435
  }
6418
6436
  ],
@@ -6420,14 +6438,20 @@ require = function () {
6420
6438
  function (_dereq_, module, exports) {
6421
6439
  'use strict';
6422
6440
  Object.defineProperty(exports, '__esModule', { value: true });
6423
- exports.hashtag = void 0;
6441
+ exports.hashtag = exports.emoji = void 0;
6424
6442
  const combinator_1 = _dereq_('../../../combinator');
6425
6443
  const link_1 = _dereq_('../link');
6426
6444
  const source_1 = _dereq_('../../source');
6427
6445
  const typed_dom_1 = _dereq_('typed-dom');
6446
+ exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
6428
6447
  exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([
6429
- (0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:[0-9A-Za-z-]{0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:[0-9A-Za-z-]{0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1),
6430
- (0, combinator_1.verify)((0, source_1.str)(/^(?=(?:[0-9]{1,127}_?)?(?:[A-Za-z]|[^\x00-\x7F\s]))(?:[0-9A-Za-z]|[^\x00-\x7F\s]|'(?!')|_(?=[0-9A-Za-z]|[^\x00-\x7F\s])){1,128}(?:_?\((?=(?:[0-9]{1,127}_?)?(?:[A-Za-z]|[^\x00-\x7F\s]))(?:[0-9A-Za-z]|[^\x00-\x7F\s]|'(?!')|_(?=[0-9A-Za-z]|[^\x00-\x7F\s])){1,125}\))?(?![0-9A-Za-z'_]|[^\x00-\x7F\s])/), ([source]) => source.length <= 128)
6448
+ (0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1),
6449
+ (0, combinator_1.verify)((0, source_1.str)(new RegExp([
6450
+ '^',
6451
+ String.raw`(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|${ exports.emoji }))`,
6452
+ String.raw`(?:[^\p{C}\p{S}\p{P}\s]|${ exports.emoji }|_(?=[^\p{C}\p{S}\p{P}\s]|${ exports.emoji })){1,128}`,
6453
+ String.raw`(?!_?(?:[^\p{C}\p{S}\p{P}\s]|${ exports.emoji })|')`
6454
+ ].join(''), 'u')), ([source]) => source.length <= 128)
6431
6455
  ])), (0, combinator_1.context)({
6432
6456
  syntax: {
6433
6457
  inline: {
@@ -6493,10 +6517,7 @@ require = function () {
6493
6517
  const source_1 = _dereq_('../source');
6494
6518
  const typed_dom_1 = _dereq_('typed-dom');
6495
6519
  const array_1 = _dereq_('spica/array');
6496
- const index = new RegExp(`^(?:${ [
6497
- /(?:0|[1-9]\d*)(?:\.(?:0|[1-9]\d*))+/,
6498
- /[0-9]{1,4}|[A-Za-z]/
6499
- ].map(r => r.source).join('|') })`);
6520
+ const index = /^(?:[0-9]+(?:\.[0-9]+)*|[A-Za-z])/;
6500
6521
  const indexFW = new RegExp(index.source.replace(/[019AZaz](?!,)/g, c => String.fromCharCode(c.charCodeAt(0) + 65248)));
6501
6522
  exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([
6502
6523
  (0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(index), (0, source_1.str)(')'), false, ([as, bs = [], cs], rest) => [
@@ -6574,8 +6595,8 @@ require = function () {
6574
6595
  const htmlentity_1 = _dereq_('./htmlentity');
6575
6596
  const source_1 = _dereq_('../source');
6576
6597
  const typed_dom_1 = _dereq_('typed-dom');
6577
- exports.comment = (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^\[(#+)\s+(?!\s|\1\]|\[\1\s)((?:\S+\s+)+?)(\1\]|(?=\[\1(?:$|\s)))/, ([whole, , body, closer]) => (rest, context) => {
6578
- [whole, body] = `${ whole }\0${ body.trimEnd() }`.replace(/\x1B/g, '').split('\0', 2);
6598
+ exports.comment = (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^\[(#+)(?!\S|\s+\1\]|\s*\[\1(?:$|\s))((?:\s+\S+)+?)(?:\s+(\1\])|\s*(?=\[\1(?:$|\s)))/, ([whole, , body, closer]) => (rest, context) => {
6599
+ [whole, body] = `${ whole }\0${ body.trimStart() }`.replace(/\x1B/g, '').split('\0', 2);
6579
6600
  if (!closer)
6580
6601
  return [
6581
6602
  [(0, typed_dom_1.html)('sup', {
@@ -7116,7 +7137,7 @@ require = function () {
7116
7137
  rest
7117
7138
  ] : global_1.undefined)), ([, tag]) => tag, new cache_1.Cache(1000)))
7118
7139
  ])))));
7119
- exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\n"])*")?(?=[^\S\n]|>)/)]);
7140
+ exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]);
7120
7141
  function elem(tag, as, bs, cs, context) {
7121
7142
  var _a, _b, _c, _d, _e, _f;
7122
7143
  if (!tags.includes(tag))
@@ -7297,7 +7318,7 @@ require = function () {
7297
7318
  if ((_a = (0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))) === null || _a === void 0 ? void 0 : _a.some(node => typeof node === 'object'))
7298
7319
  return;
7299
7320
  const INSECURE_URI = params.shift();
7300
- const el = create(INSECURE_URI, (0, util_1.trimNode)((0, typed_dom_1.defrag)(content)), new url_1.ReadonlyURL(resolve(INSECURE_URI, (_b = context.host) !== null && _b !== void 0 ? _b : global_1.location, (_d = (_c = context.url) !== null && _c !== void 0 ? _c : context.host) !== null && _d !== void 0 ? _d : global_1.location), ((_e = context.host) === null || _e === void 0 ? void 0 : _e.href) || global_1.location.href), ((_f = context.host) === null || _f === void 0 ? void 0 : _f.origin) || global_1.location.origin);
7321
+ const el = elem(INSECURE_URI, (0, util_1.trimNode)((0, typed_dom_1.defrag)(content)), new url_1.ReadonlyURL(resolve(INSECURE_URI, (_b = context.host) !== null && _b !== void 0 ? _b : global_1.location, (_d = (_c = context.url) !== null && _c !== void 0 ? _c : context.host) !== null && _d !== void 0 ? _d : global_1.location), ((_e = context.host) === null || _e === void 0 ? void 0 : _e.href) || global_1.location.href), ((_f = context.host) === null || _f === void 0 ? void 0 : _f.origin) || global_1.location.origin);
7301
7322
  if (el.classList.contains('invalid'))
7302
7323
  return [
7303
7324
  [el],
@@ -7314,7 +7335,7 @@ require = function () {
7314
7335
  ]);
7315
7336
  exports.option = (0, combinator_1.union)([
7316
7337
  (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]),
7317
- (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\n"])*")?(?=[^\S\n]|})/),
7338
+ (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/),
7318
7339
  (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+(?=})/), () => []),
7319
7340
  (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\n{}]+/), opt => [` \\${ opt.slice(1) }`])
7320
7341
  ]);
@@ -7322,7 +7343,7 @@ require = function () {
7322
7343
  switch (true) {
7323
7344
  case uri.slice(0, 2) === '^/':
7324
7345
  const last = host.pathname.slice(host.pathname.lastIndexOf('/') + 1);
7325
- return last.includes('.') && /^[0-9]*[a-z][0-9a-z]*$/i.test(last.slice(last.lastIndexOf('.') + 1)) ? `${ host.pathname.slice(0, -last.length) }${ uri.slice(2) }` : `${ host.pathname.replace(/\/?$/, '/') }${ uri.slice(2) }`;
7346
+ return last.includes('.') && /^[0-9]*[A-Za-z][0-9A-Za-z]*$/.test(last.slice(last.lastIndexOf('.') + 1)) ? `${ host.pathname.slice(0, -last.length) }${ uri.slice(2) }` : `${ host.pathname.replace(/\/?$/, '/') }${ uri.slice(2) }`;
7326
7347
  case host.origin === source.origin && host.pathname === source.pathname:
7327
7348
  case uri.slice(0, 2) === '//':
7328
7349
  return uri;
@@ -7332,7 +7353,7 @@ require = function () {
7332
7353
  }
7333
7354
  }
7334
7355
  exports.resolve = resolve;
7335
- function create(INSECURE_URI, content, uri, origin) {
7356
+ function elem(INSECURE_URI, content, uri, origin) {
7336
7357
  let type;
7337
7358
  let description;
7338
7359
  switch (uri.protocol) {
@@ -7692,8 +7713,8 @@ require = function () {
7692
7713
  const typed_dom_1 = _dereq_('typed-dom');
7693
7714
  const array_1 = _dereq_('spica/array');
7694
7715
  exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.validate)('[', ')', '\n', (0, combinator_1.sequence)([
7695
- (0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\[\]\n])+(?=]\()/, text), ']'),
7696
- (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\(\)\n])+(?=\))/, text), ')')
7716
+ (0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\[\]\n])+(?=]\()/, text), ']'),
7717
+ (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\(\)\n])+(?=\))/, text), ')')
7697
7718
  ])), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies], rest) => {
7698
7719
  const tail = typeof texts[texts.length - 1] === 'object' ? [texts.pop()] : [];
7699
7720
  tail.length === 0 && texts[texts.length - 1] === '' && texts.pop();
@@ -8659,10 +8680,10 @@ require = function () {
8659
8680
  'InvisibleComma',
8660
8681
  'ic'
8661
8682
  ];
8662
- const blankline = new RegExp(String.raw`^(?!$|\n)(?:\\?\s|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>|\[(#+)\s+(?!\s|\1\]|\[\1\s)(?:\S+\s+)+?(?:\1\]|(?=\[\1(?:$|\s))))*\\?(?:$|\n)`, 'gm');
8683
+ const blankline = new RegExp(String.raw`^(?!$)(?:\\$|\\?[^\S\n]|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>|\[(#+)(?!\S|\s+\1\]|\s*\[\1(?:$|\s))((?:\s+\S+)+?)(?:\s+(\1\])|\s*(?=\[\1(?:$|\s))))+(?=$|(\S))`, 'gm');
8663
8684
  function visualize(parser) {
8664
8685
  return (0, combinator_1.union)([
8665
- (0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<\[]/g, '\x1B$&')), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))),
8686
+ (0, combinator_1.convert)(source => source.replace(blankline, (line, ...$) => !$[3] ? line.replace(/[\\&<\[]/g, '\x1B$&') : line), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))),
8666
8687
  (0, combinator_1.some)((0, combinator_1.union)([
8667
8688
  source_1.linebreak,
8668
8689
  source_1.unescsource
@@ -8942,12 +8963,16 @@ require = function () {
8942
8963
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
8943
8964
  if (k2 === undefined)
8944
8965
  k2 = k;
8945
- Object.defineProperty(o, k2, {
8946
- enumerable: true,
8947
- get: function () {
8948
- return m[k];
8949
- }
8950
- });
8966
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8967
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8968
+ desc = {
8969
+ enumerable: true,
8970
+ get: function () {
8971
+ return m[k];
8972
+ }
8973
+ };
8974
+ }
8975
+ Object.defineProperty(o, k2, desc);
8951
8976
  } : function (o, m, k, k2) {
8952
8977
  if (k2 === undefined)
8953
8978
  k2 = k;
@@ -9256,11 +9281,12 @@ require = function () {
9256
9281
  }
9257
9282
  exports.youtube = youtube;
9258
9283
  function resolve(url) {
9284
+ var _a;
9259
9285
  switch (url.origin) {
9260
9286
  case 'https://www.youtube.com':
9261
- return url.pathname === '/watch/' ? url.href.replace(/.+?=/, '').replace('&', '?') : undefined;
9287
+ return url.pathname.match(/^\/watch\/?$/) ? (_a = url.searchParams.get('v')) === null || _a === void 0 ? void 0 : _a.concat(url.search.replace(/([?&])v=[^&#]*&?/g, '$1'), url.hash) : undefined;
9262
9288
  case 'https://youtu.be':
9263
- return url.pathname.match(/^\/[\w-]+$/) ? url.href.slice(url.href.indexOf('/', 9) + 1) : undefined;
9289
+ return url.pathname.match(/^\/[\w-]+\/?$/) ? url.href.slice(url.origin.length) : undefined;
9264
9290
  default:
9265
9291
  return;
9266
9292
  }
@@ -9599,12 +9625,16 @@ require = function () {
9599
9625
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
9600
9626
  if (k2 === undefined)
9601
9627
  k2 = k;
9602
- Object.defineProperty(o, k2, {
9603
- enumerable: true,
9604
- get: function () {
9605
- return m[k];
9606
- }
9607
- });
9628
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9629
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9630
+ desc = {
9631
+ enumerable: true,
9632
+ get: function () {
9633
+ return m[k];
9634
+ }
9635
+ };
9636
+ }
9637
+ Object.defineProperty(o, k2, desc);
9608
9638
  } : function (o, m, k, k2) {
9609
9639
  if (k2 === undefined)
9610
9640
  k2 = k;
package/gulpfile.js CHANGED
@@ -98,7 +98,27 @@ gulp.task('ts:dev', () =>
98
98
  gulp.task('ts:test', () =>
99
99
  compile(config.ts.test.src)
100
100
  .pipe($.rename({ extname: '.test.js' }))
101
- .pipe(gulp.dest(config.ts.test.dest)));
101
+ .pipe(gulp.dest(config.ts.test.dest))
102
+ .pipe($.eslint({
103
+ 'parserOptions': {
104
+ 'ecmaVersion': 2020,
105
+ },
106
+ 'env': {
107
+ 'es2020': true,
108
+ },
109
+ 'plugins': ['redos'],
110
+ 'rules': {
111
+ 'redos/no-vulnerable': [
112
+ 'error',
113
+ {
114
+ ignoreErrors: false,
115
+ timeout: 30000,
116
+ },
117
+ ],
118
+ },
119
+ }))
120
+ .pipe($.eslint.format())
121
+ .pipe($.eslint.failAfterError()));
102
122
 
103
123
  gulp.task('ts:dist', () =>
104
124
  compile(config.ts.dist.src)