@atlaskit/editor-wikimarkup-transformer 11.20.16 → 12.0.0

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 (142) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/char/package.json +1 -8
  3. package/dist/cjs/encoder/marks/__base.js +12 -8
  4. package/dist/cjs/parser/builder/list-builder.js +5 -3
  5. package/dist/cjs/parser/builder/table-builder.js +5 -3
  6. package/dist/cjs/parser/nodes/mediaSingle.js +5 -6
  7. package/dist/cjs/parser/tokenize/common-formatter.js +5 -8
  8. package/dist/cjs/parser/tokenize/dash-token-creator.js +5 -3
  9. package/dist/cjs/parser/tokenize/issue-key.js +2 -1
  10. package/dist/cjs/parser/tokenize/link-text.js +5 -7
  11. package/dist/cjs/parser/tokenize/links/url-link.js +4 -3
  12. package/dist/cjs/parser/utils/text.js +5 -3
  13. package/dist/es2019/encoder/marks/__base.js +12 -8
  14. package/dist/es2019/parser/builder/list-builder.js +5 -3
  15. package/dist/es2019/parser/builder/table-builder.js +5 -3
  16. package/dist/es2019/parser/nodes/mediaSingle.js +5 -6
  17. package/dist/es2019/parser/tokenize/common-formatter.js +6 -8
  18. package/dist/es2019/parser/tokenize/dash-token-creator.js +5 -3
  19. package/dist/es2019/parser/tokenize/issue-key.js +2 -1
  20. package/dist/es2019/parser/tokenize/link-text.js +5 -7
  21. package/dist/es2019/parser/tokenize/links/url-link.js +4 -3
  22. package/dist/es2019/parser/utils/text.js +5 -3
  23. package/dist/esm/encoder/marks/__base.js +12 -8
  24. package/dist/esm/parser/builder/list-builder.js +5 -3
  25. package/dist/esm/parser/builder/table-builder.js +5 -3
  26. package/dist/esm/parser/nodes/mediaSingle.js +5 -6
  27. package/dist/esm/parser/tokenize/common-formatter.js +6 -8
  28. package/dist/esm/parser/tokenize/dash-token-creator.js +5 -3
  29. package/dist/esm/parser/tokenize/issue-key.js +2 -1
  30. package/dist/esm/parser/tokenize/link-text.js +5 -7
  31. package/dist/esm/parser/tokenize/links/url-link.js +4 -3
  32. package/dist/esm/parser/utils/text.js +5 -3
  33. package/interfaces/package.json +1 -8
  34. package/package.json +8 -16
  35. package/dist/types-ts4.5/char.d.ts +0 -1
  36. package/dist/types-ts4.5/encoder/emoji-unicode-mapping.d.ts +0 -3
  37. package/dist/types-ts4.5/encoder/index.d.ts +0 -9
  38. package/dist/types-ts4.5/encoder/marks/__base.d.ts +0 -5
  39. package/dist/types-ts4.5/encoder/marks/code.d.ts +0 -2
  40. package/dist/types-ts4.5/encoder/marks/color.d.ts +0 -2
  41. package/dist/types-ts4.5/encoder/marks/em.d.ts +0 -2
  42. package/dist/types-ts4.5/encoder/marks/link.d.ts +0 -2
  43. package/dist/types-ts4.5/encoder/marks/strike.d.ts +0 -2
  44. package/dist/types-ts4.5/encoder/marks/strong.d.ts +0 -6
  45. package/dist/types-ts4.5/encoder/marks/subsup.d.ts +0 -2
  46. package/dist/types-ts4.5/encoder/marks/underline.d.ts +0 -2
  47. package/dist/types-ts4.5/encoder/nodes/block-card.d.ts +0 -2
  48. package/dist/types-ts4.5/encoder/nodes/blockquote.d.ts +0 -2
  49. package/dist/types-ts4.5/encoder/nodes/bodied-sync-block.d.ts +0 -2
  50. package/dist/types-ts4.5/encoder/nodes/bullet-list.d.ts +0 -2
  51. package/dist/types-ts4.5/encoder/nodes/caption.d.ts +0 -2
  52. package/dist/types-ts4.5/encoder/nodes/code-block.d.ts +0 -2
  53. package/dist/types-ts4.5/encoder/nodes/date.d.ts +0 -2
  54. package/dist/types-ts4.5/encoder/nodes/decisionItem.d.ts +0 -3
  55. package/dist/types-ts4.5/encoder/nodes/decisionList.d.ts +0 -2
  56. package/dist/types-ts4.5/encoder/nodes/doc.d.ts +0 -2
  57. package/dist/types-ts4.5/encoder/nodes/embed-card.d.ts +0 -2
  58. package/dist/types-ts4.5/encoder/nodes/emoji.d.ts +0 -2
  59. package/dist/types-ts4.5/encoder/nodes/expand.d.ts +0 -2
  60. package/dist/types-ts4.5/encoder/nodes/hard-break.d.ts +0 -2
  61. package/dist/types-ts4.5/encoder/nodes/heading.d.ts +0 -2
  62. package/dist/types-ts4.5/encoder/nodes/inline-card.d.ts +0 -2
  63. package/dist/types-ts4.5/encoder/nodes/inlines.d.ts +0 -2
  64. package/dist/types-ts4.5/encoder/nodes/listItem.d.ts +0 -3
  65. package/dist/types-ts4.5/encoder/nodes/media-group.d.ts +0 -2
  66. package/dist/types-ts4.5/encoder/nodes/media-inline.d.ts +0 -2
  67. package/dist/types-ts4.5/encoder/nodes/media.d.ts +0 -2
  68. package/dist/types-ts4.5/encoder/nodes/mention.d.ts +0 -2
  69. package/dist/types-ts4.5/encoder/nodes/ordered-list.d.ts +0 -2
  70. package/dist/types-ts4.5/encoder/nodes/panel.d.ts +0 -2
  71. package/dist/types-ts4.5/encoder/nodes/paragraph.d.ts +0 -2
  72. package/dist/types-ts4.5/encoder/nodes/rule.d.ts +0 -2
  73. package/dist/types-ts4.5/encoder/nodes/status.d.ts +0 -2
  74. package/dist/types-ts4.5/encoder/nodes/table.d.ts +0 -2
  75. package/dist/types-ts4.5/encoder/nodes/taskItem.d.ts +0 -3
  76. package/dist/types-ts4.5/encoder/nodes/taskList.d.ts +0 -2
  77. package/dist/types-ts4.5/encoder/nodes/text.d.ts +0 -2
  78. package/dist/types-ts4.5/encoder/nodes/unknown.d.ts +0 -2
  79. package/dist/types-ts4.5/index.d.ts +0 -15
  80. package/dist/types-ts4.5/interfaces.d.ts +0 -74
  81. package/dist/types-ts4.5/parser/abstract-tree.d.ts +0 -11
  82. package/dist/types-ts4.5/parser/builder/list-builder.d.ts +0 -66
  83. package/dist/types-ts4.5/parser/builder/table-builder.d.ts +0 -45
  84. package/dist/types-ts4.5/parser/color.d.ts +0 -3
  85. package/dist/types-ts4.5/parser/error.d.ts +0 -1
  86. package/dist/types-ts4.5/parser/nodes/mediaGroup.d.ts +0 -3
  87. package/dist/types-ts4.5/parser/nodes/mediaSingle.d.ts +0 -5
  88. package/dist/types-ts4.5/parser/nodes/paragraph.d.ts +0 -7
  89. package/dist/types-ts4.5/parser/nodes/rule.d.ts +0 -3
  90. package/dist/types-ts4.5/parser/nodes/text.d.ts +0 -2
  91. package/dist/types-ts4.5/parser/text.d.ts +0 -10
  92. package/dist/types-ts4.5/parser/tokenize/adf-macro.d.ts +0 -2
  93. package/dist/types-ts4.5/parser/tokenize/anchor-macro.d.ts +0 -2
  94. package/dist/types-ts4.5/parser/tokenize/blockquote.d.ts +0 -2
  95. package/dist/types-ts4.5/parser/tokenize/citation.d.ts +0 -2
  96. package/dist/types-ts4.5/parser/tokenize/code-macro.d.ts +0 -2
  97. package/dist/types-ts4.5/parser/tokenize/color-macro.d.ts +0 -2
  98. package/dist/types-ts4.5/parser/tokenize/common-formatter.d.ts +0 -10
  99. package/dist/types-ts4.5/parser/tokenize/common-macro.d.ts +0 -10
  100. package/dist/types-ts4.5/parser/tokenize/dash-token-creator.d.ts +0 -2
  101. package/dist/types-ts4.5/parser/tokenize/deleted.d.ts +0 -2
  102. package/dist/types-ts4.5/parser/tokenize/double-dash-symbol.d.ts +0 -2
  103. package/dist/types-ts4.5/parser/tokenize/emoji.d.ts +0 -15
  104. package/dist/types-ts4.5/parser/tokenize/emphasis.d.ts +0 -2
  105. package/dist/types-ts4.5/parser/tokenize/file-link.d.ts +0 -3
  106. package/dist/types-ts4.5/parser/tokenize/force-line-break.d.ts +0 -2
  107. package/dist/types-ts4.5/parser/tokenize/hardbreak.d.ts +0 -2
  108. package/dist/types-ts4.5/parser/tokenize/heading.d.ts +0 -2
  109. package/dist/types-ts4.5/parser/tokenize/index.d.ts +0 -55
  110. package/dist/types-ts4.5/parser/tokenize/inserted.d.ts +0 -2
  111. package/dist/types-ts4.5/parser/tokenize/issue-key.d.ts +0 -20
  112. package/dist/types-ts4.5/parser/tokenize/keyword.d.ts +0 -19
  113. package/dist/types-ts4.5/parser/tokenize/link-text.d.ts +0 -3
  114. package/dist/types-ts4.5/parser/tokenize/links/attachment-link.d.ts +0 -4
  115. package/dist/types-ts4.5/parser/tokenize/links/issue-link.d.ts +0 -4
  116. package/dist/types-ts4.5/parser/tokenize/links/link-format.d.ts +0 -2
  117. package/dist/types-ts4.5/parser/tokenize/links/link-parser.d.ts +0 -17
  118. package/dist/types-ts4.5/parser/tokenize/links/link-resolver.d.ts +0 -5
  119. package/dist/types-ts4.5/parser/tokenize/links/mention-link.d.ts +0 -4
  120. package/dist/types-ts4.5/parser/tokenize/links/url-link.d.ts +0 -4
  121. package/dist/types-ts4.5/parser/tokenize/list.d.ts +0 -3
  122. package/dist/types-ts4.5/parser/tokenize/media.d.ts +0 -2
  123. package/dist/types-ts4.5/parser/tokenize/monospace.d.ts +0 -2
  124. package/dist/types-ts4.5/parser/tokenize/noformat-macro.d.ts +0 -2
  125. package/dist/types-ts4.5/parser/tokenize/panel-macro.d.ts +0 -2
  126. package/dist/types-ts4.5/parser/tokenize/quadruple-dash-symbol.d.ts +0 -2
  127. package/dist/types-ts4.5/parser/tokenize/quote-macro.d.ts +0 -8
  128. package/dist/types-ts4.5/parser/tokenize/ruler.d.ts +0 -2
  129. package/dist/types-ts4.5/parser/tokenize/strong.d.ts +0 -2
  130. package/dist/types-ts4.5/parser/tokenize/subscript.d.ts +0 -2
  131. package/dist/types-ts4.5/parser/tokenize/superscript.d.ts +0 -2
  132. package/dist/types-ts4.5/parser/tokenize/table.d.ts +0 -2
  133. package/dist/types-ts4.5/parser/tokenize/triple-dash-symbol.d.ts +0 -2
  134. package/dist/types-ts4.5/parser/tokenize/whitespace.d.ts +0 -3
  135. package/dist/types-ts4.5/parser/utils/attrs.d.ts +0 -3
  136. package/dist/types-ts4.5/parser/utils/color-name-mapping.d.ts +0 -10
  137. package/dist/types-ts4.5/parser/utils/escape.d.ts +0 -2
  138. package/dist/types-ts4.5/parser/utils/normalize.d.ts +0 -5
  139. package/dist/types-ts4.5/parser/utils/panel-type.d.ts +0 -3
  140. package/dist/types-ts4.5/parser/utils/text.d.ts +0 -25
  141. package/dist/types-ts4.5/parser/utils/title.d.ts +0 -7
  142. package/dist/types-ts4.5/parser/utils/url.d.ts +0 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/editor-wikimarkup-transformer
2
2
 
3
+ ## 12.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
8
+ Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
9
+
10
+ Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
11
+
12
+ Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
13
+
14
+ ```diff
15
+ - "typesVersions": {
16
+ - ">=4.5 <4.9": {
17
+ - "*": [
18
+ - "dist/types-ts4.5/*",
19
+ - "dist/types-ts4.5/index.d.ts"
20
+ - ]
21
+ - }
22
+ - },
23
+ ```
24
+
25
+ ### Patch Changes
26
+
27
+ - [`eb0de97776ce5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eb0de97776ce5) -
28
+ cleanup to prefer static regex as part of ees019
29
+ - Updated dependencies
30
+
3
31
  ## 11.20.16
4
32
 
5
33
  ### Patch Changes
package/char/package.json CHANGED
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/char.js",
5
5
  "module:es2019": "../dist/es2019/char.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/char.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/char.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/char.d.ts"
15
8
  }
@@ -4,23 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.baseMarkPattern = void 0;
7
+ // Ignored via go/ees005
8
+ // eslint-disable-next-line require-unicode-regexp
9
+ var ONLY_WHITESPACE_REGEX = /^\s*$/;
10
+ // Ignored via go/ees005
11
+ // eslint-disable-next-line require-unicode-regexp
12
+ var LEADING_WHITESPACE_REGEX = /^\s*/;
13
+ // Ignored via go/ees005
14
+ // eslint-disable-next-line require-unicode-regexp
15
+ var TRAILING_WHITESPACE_REGEX = /\s*$/;
16
+
7
17
  /**
8
18
  * For text that has leading and ending space. We don't want to
9
19
  * convert it to `* strong *. Instead, we need it to be ` *strong* `
10
20
  */
11
21
  var baseMarkPattern = exports.baseMarkPattern = function baseMarkPattern(text, token) {
12
- // Ignored via go/ees005
13
- // eslint-disable-next-line require-unicode-regexp
14
- if (/^\s*$/.test(text)) {
22
+ if (ONLY_WHITESPACE_REGEX.test(text)) {
15
23
  /**
16
24
  * If it's a string with only whitespaces, wiki renderer
17
25
  * will behave incorrect if we apply format on it
18
26
  */
19
27
  return text;
20
28
  }
21
- // Ignored via go/ees005
22
- // eslint-disable-next-line require-unicode-regexp
23
- // Ignored via go/ees005
24
- // eslint-disable-next-line require-unicode-regexp
25
- return text.replace(/^\s*/, "$&".concat(token)).replace(/\s*$/, "".concat(token, "$&"));
29
+ return text.replace(LEADING_WHITESPACE_REGEX, "$&".concat(token)).replace(TRAILING_WHITESPACE_REGEX, "".concat(token, "$&"));
26
30
  };
@@ -15,13 +15,15 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
15
15
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
16
  var supportedContentType = ['paragraph', 'orderedList', 'bulletList', 'mediaSingle', 'codeBlock'];
17
17
 
18
+ // Ignored via go/ees005
19
+ // eslint-disable-next-line require-unicode-regexp
20
+ var ORDERED_LIST_REGEX = /#$/;
21
+
18
22
  /**
19
23
  * Return the type of a list from the bullets
20
24
  */
21
25
  function getType(bullets) {
22
- // Ignored via go/ees005
23
- // eslint-disable-next-line require-unicode-regexp
24
- return /#$/.test(bullets) ? 'orderedList' : 'bulletList';
26
+ return ORDERED_LIST_REGEX.test(bullets) ? 'orderedList' : 'bulletList';
25
27
  }
26
28
  var ListBuilder = exports.ListBuilder = /*#__PURE__*/function () {
27
29
  function ListBuilder(schema, bullets) {
@@ -11,13 +11,15 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
12
12
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
13
13
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
14
+ // Ignored via go/ees005
15
+ // eslint-disable-next-line require-unicode-regexp
16
+ var TABLE_HEADER_REGEX = /\|\|/;
17
+
14
18
  /**
15
19
  * Return the cell type based on the delimeter
16
20
  */
17
21
  function getType(style) {
18
- // Ignored via go/ees005
19
- // eslint-disable-next-line require-unicode-regexp
20
- return /\|\|/.test(style) ? 'tableHeader' : 'tableCell';
22
+ return TABLE_HEADER_REGEX.test(style) ? 'tableHeader' : 'tableCell';
21
23
  }
22
24
  var TableBuilder = exports.TableBuilder = /*#__PURE__*/function () {
23
25
  function TableBuilder(schema) {
@@ -9,6 +9,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _linkText = require("../tokenize/link-text");
10
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ // Ignored via go/ees005
13
+ // eslint-disable-next-line require-unicode-regexp
14
+ var WRAPPING_QUOTES_REGEX = /^"(.+)"$/;
12
15
  var defaultWidth = 200;
13
16
  var defaultHeight = 183;
14
17
  var clamp = function clamp(input, lower, upper) {
@@ -64,18 +67,14 @@ function getMediaSingleNodeView(schema, filename, attrs) {
64
67
  }
65
68
  }
66
69
  if (attrs.href) {
67
- // Ignored via go/ees005
68
- // eslint-disable-next-line require-unicode-regexp
69
- var href = attrs.href.replace(/^"(.+)"$/, '$1');
70
+ var href = attrs.href.replace(WRAPPING_QUOTES_REGEX, '$1');
70
71
  mediaMarks.push(link.create({
71
72
  href: href
72
73
  }));
73
74
  }
74
75
  if (attrs.alt) {
75
76
  // strip wrapping quotes if they exist
76
- // Ignored via go/ees005
77
- // eslint-disable-next-line require-unicode-regexp
78
- var altText = attrs.alt.replace(/^"(.+)"$/, '$1');
77
+ var altText = attrs.alt.replace(WRAPPING_QUOTES_REGEX, '$1');
79
78
  mediaNodeAttrs.alt = altText;
80
79
  }
81
80
  if (filename.match(_linkText.LINK_TEXT_REGEXP)) {
@@ -9,6 +9,9 @@ var _linkFormat = require("./links/link-format");
9
9
  var _whitespace = require("./whitespace");
10
10
  var _keyword = require("./keyword");
11
11
  var _escape = require("../utils/escape");
12
+ // Ignored via go/ees005
13
+ // eslint-disable-next-line require-unicode-regexp
14
+ var ALPHANUMERIC_OR_NON_ASCII_REGEX = /[a-zA-Z0-9]|[^\u0000-\u007F]/;
12
15
  var processState = {
13
16
  START: 0,
14
17
  BUFFER: 1,
@@ -38,10 +41,7 @@ function commonFormatter(input, position, schema, opt) {
38
41
  * formatter
39
42
  */
40
43
  var charBeforeOpening = input.charAt(position - 1);
41
- if (!openingWrapped &&
42
- // Ignored via go/ees005
43
- // eslint-disable-next-line require-unicode-regexp
44
- /[a-zA-Z0-9]|[^\u0000-\u007F]/.test(charBeforeOpening) && charBeforeOpening !== "\xA0") {
44
+ if (!openingWrapped && ALPHANUMERIC_OR_NON_ASCII_REGEX.test(charBeforeOpening) && charBeforeOpening !== "\xA0") {
45
45
  return fallback(input, index, openingSymbolLength);
46
46
  }
47
47
  }
@@ -100,10 +100,7 @@ function commonFormatter(input, position, schema, opt) {
100
100
  */
101
101
  if (index < input.length) {
102
102
  var charAfterEnd = input.charAt(index);
103
- if (!closingWrapped &&
104
- // Ignored via go/ees005
105
- // eslint-disable-next-line require-unicode-regexp
106
- /[a-zA-Z0-9]|[^\u0000-\u007F]/.test(charAfterEnd) && charAfterEnd !== "\xA0") {
103
+ if (!closingWrapped && ALPHANUMERIC_OR_NON_ASCII_REGEX.test(charAfterEnd) && charAfterEnd !== "\xA0") {
107
104
  buffer.push(charsMatchClosingSymbol);
108
105
  state = processState.BUFFER;
109
106
  continue;
@@ -28,8 +28,10 @@ var createDashTokenParser = exports.createDashTokenParser = function createDashT
28
28
  return token;
29
29
  };
30
30
  };
31
+
32
+ // Ignored via go/ees005
33
+ // eslint-disable-next-line require-unicode-regexp
34
+ var WHITESPACE_REGEX = /\s/;
31
35
  var isSpace = function isSpace(char) {
32
- // Ignored via go/ees005
33
- // eslint-disable-next-line require-unicode-regexp
34
- return /\s/.test(char);
36
+ return WHITESPACE_REGEX.test(char);
35
37
  };
@@ -70,8 +70,9 @@ var withInlineCardFromTextStamp = function withInlineCardFromTextStamp(issue) {
70
70
 
71
71
  // Ignored via go/ees005
72
72
  // eslint-disable-next-line require-unicode-regexp
73
+ var ALLOWED_CHARS_REGEX = /\s|\(|\)|!|\.|\,|\/|\:/;
73
74
  var isNotAllowedChars = function isNotAllowedChars(char) {
74
- return !/\s|\(|\)|!|\.|\,|\/|\:/.test(char);
75
+ return !ALLOWED_CHARS_REGEX.test(char);
75
76
  };
76
77
  var buildIssueKeyRegex = exports.buildIssueKeyRegex = function buildIssueKeyRegex(inlineCardConversion) {
77
78
  if (!inlineCardConversion) {
@@ -63,13 +63,11 @@ function fallback(input, position) {
63
63
  };
64
64
  }
65
65
 
66
+ // Ignored via go/ees005
67
+ // eslint-disable-next-line require-unicode-regexp
68
+ var BAD_END_CHARS_REGEX = /[.,>)\];}"\'!]*$/;
69
+
66
70
  // removes bad characters from the end of regex match
67
71
  function trimBadEndChar(input) {
68
- return [
69
- // Ignored via go/ees005
70
- // eslint-disable-next-line require-unicode-regexp
71
- input[0].replace(/[.,>)\];}"\'!]*$/, ''), input[1],
72
- // Ignored via go/ees005
73
- // eslint-disable-next-line require-unicode-regexp
74
- input[2].replace(/[.,>)\];}"\'!]*$/, '')];
72
+ return [input[0].replace(BAD_END_CHARS_REGEX, ''), input[1], input[2].replace(BAD_END_CHARS_REGEX, '')];
75
73
  }
@@ -10,6 +10,9 @@ var _index = require("../index");
10
10
  var _adfSchema = require("@atlaskit/adf-schema");
11
11
  var _text = require("../../text");
12
12
  var _text2 = require("../../utils/text");
13
+ // Ignored via go/ees005
14
+ // eslint-disable-next-line require-unicode-regexp
15
+ var MAILTO_PREFIX_REGEX = /^mailto:/;
13
16
  function urlLinkResolver(link, schema, context) {
14
17
  var output = [];
15
18
  var url = link.notLinkBody;
@@ -22,9 +25,7 @@ function urlLinkResolver(link, schema, context) {
22
25
  ignoreTokenTypes: ignoreTokenTypes,
23
26
  schema: schema,
24
27
  context: context,
25
- // Ignored via go/ees005
26
- // eslint-disable-next-line require-unicode-regexp
27
- input: textRepresentation.replace(/^mailto:/, '')
28
+ input: textRepresentation.replace(MAILTO_PREFIX_REGEX, '')
28
29
  });
29
30
  var decoratedContent = rawContent.map(function (n) {
30
31
  var mark = schema.marks.link.create({
@@ -21,10 +21,12 @@ function hasAnyOfMarks(node, types) {
21
21
  }) !== -1;
22
22
  }) !== -1;
23
23
  }
24
+
25
+ // Ignored via go/ees005
26
+ // eslint-disable-next-line require-unicode-regexp
27
+ var DIGIT_REGEX = /^\d$/;
24
28
  function isDigit(value) {
25
- // Ignored via go/ees005
26
- // eslint-disable-next-line require-unicode-regexp
27
- return !!value.match(/^\d$/);
29
+ return !!value.match(DIGIT_REGEX);
28
30
  }
29
31
  function isBlank(value) {
30
32
  return value === null || value.trim() === '';
@@ -1,20 +1,24 @@
1
+ // Ignored via go/ees005
2
+ // eslint-disable-next-line require-unicode-regexp
3
+ const ONLY_WHITESPACE_REGEX = /^\s*$/;
4
+ // Ignored via go/ees005
5
+ // eslint-disable-next-line require-unicode-regexp
6
+ const LEADING_WHITESPACE_REGEX = /^\s*/;
7
+ // Ignored via go/ees005
8
+ // eslint-disable-next-line require-unicode-regexp
9
+ const TRAILING_WHITESPACE_REGEX = /\s*$/;
10
+
1
11
  /**
2
12
  * For text that has leading and ending space. We don't want to
3
13
  * convert it to `* strong *. Instead, we need it to be ` *strong* `
4
14
  */
5
15
  export const baseMarkPattern = (text, token) => {
6
- // Ignored via go/ees005
7
- // eslint-disable-next-line require-unicode-regexp
8
- if (/^\s*$/.test(text)) {
16
+ if (ONLY_WHITESPACE_REGEX.test(text)) {
9
17
  /**
10
18
  * If it's a string with only whitespaces, wiki renderer
11
19
  * will behave incorrect if we apply format on it
12
20
  */
13
21
  return text;
14
22
  }
15
- // Ignored via go/ees005
16
- // eslint-disable-next-line require-unicode-regexp
17
- // Ignored via go/ees005
18
- // eslint-disable-next-line require-unicode-regexp
19
- return text.replace(/^\s*/, `$&${token}`).replace(/\s*$/, `${token}$&`);
23
+ return text.replace(LEADING_WHITESPACE_REGEX, `$&${token}`).replace(TRAILING_WHITESPACE_REGEX, `${token}$&`);
20
24
  };
@@ -1,13 +1,15 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  const supportedContentType = ['paragraph', 'orderedList', 'bulletList', 'mediaSingle', 'codeBlock'];
3
3
 
4
+ // Ignored via go/ees005
5
+ // eslint-disable-next-line require-unicode-regexp
6
+ const ORDERED_LIST_REGEX = /#$/;
7
+
4
8
  /**
5
9
  * Return the type of a list from the bullets
6
10
  */
7
11
  export function getType(bullets) {
8
- // Ignored via go/ees005
9
- // eslint-disable-next-line require-unicode-regexp
10
- return /#$/.test(bullets) ? 'orderedList' : 'bulletList';
12
+ return ORDERED_LIST_REGEX.test(bullets) ? 'orderedList' : 'bulletList';
11
13
  }
12
14
  export class ListBuilder {
13
15
  constructor(schema, bullets) {
@@ -1,11 +1,13 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ // Ignored via go/ees005
3
+ // eslint-disable-next-line require-unicode-regexp
4
+ const TABLE_HEADER_REGEX = /\|\|/;
5
+
2
6
  /**
3
7
  * Return the cell type based on the delimeter
4
8
  */
5
9
  function getType(style) {
6
- // Ignored via go/ees005
7
- // eslint-disable-next-line require-unicode-regexp
8
- return /\|\|/.test(style) ? 'tableHeader' : 'tableCell';
10
+ return TABLE_HEADER_REGEX.test(style) ? 'tableHeader' : 'tableCell';
9
11
  }
10
12
  export class TableBuilder {
11
13
  constructor(schema) {
@@ -1,4 +1,7 @@
1
1
  import { LINK_TEXT_REGEXP } from '../tokenize/link-text';
2
+ // Ignored via go/ees005
3
+ // eslint-disable-next-line require-unicode-regexp
4
+ const WRAPPING_QUOTES_REGEX = /^"(.+)"$/;
2
5
  const defaultWidth = 200;
3
6
  const defaultHeight = 183;
4
7
  const clamp = (input, lower, upper) => {
@@ -56,18 +59,14 @@ export default function getMediaSingleNodeView(schema, filename, attrs, context
56
59
  }
57
60
  }
58
61
  if (attrs.href) {
59
- // Ignored via go/ees005
60
- // eslint-disable-next-line require-unicode-regexp
61
- const href = attrs.href.replace(/^"(.+)"$/, '$1');
62
+ const href = attrs.href.replace(WRAPPING_QUOTES_REGEX, '$1');
62
63
  mediaMarks.push(link.create({
63
64
  href
64
65
  }));
65
66
  }
66
67
  if (attrs.alt) {
67
68
  // strip wrapping quotes if they exist
68
- // Ignored via go/ees005
69
- // eslint-disable-next-line require-unicode-regexp
70
- const altText = attrs.alt.replace(/^"(.+)"$/, '$1');
69
+ const altText = attrs.alt.replace(WRAPPING_QUOTES_REGEX, '$1');
71
70
  mediaNodeAttrs.alt = altText;
72
71
  }
73
72
  if (filename.match(LINK_TEXT_REGEXP)) {
@@ -3,6 +3,10 @@ import { linkFormat } from './links/link-format';
3
3
  import { parseNewlineOnly } from './whitespace';
4
4
  import { parseMacroKeyword } from './keyword';
5
5
  import { escapeHandler } from '../utils/escape';
6
+
7
+ // Ignored via go/ees005
8
+ // eslint-disable-next-line require-unicode-regexp
9
+ const ALPHANUMERIC_OR_NON_ASCII_REGEX = /[a-zA-Z0-9]|[^\u0000-\u007F]/;
6
10
  const processState = {
7
11
  START: 0,
8
12
  BUFFER: 1,
@@ -32,10 +36,7 @@ export function commonFormatter(input, position, schema, opt) {
32
36
  * formatter
33
37
  */
34
38
  const charBeforeOpening = input.charAt(position - 1);
35
- if (!openingWrapped &&
36
- // Ignored via go/ees005
37
- // eslint-disable-next-line require-unicode-regexp
38
- /[a-zA-Z0-9]|[^\u0000-\u007F]/.test(charBeforeOpening) && charBeforeOpening !== '\u00A0') {
39
+ if (!openingWrapped && ALPHANUMERIC_OR_NON_ASCII_REGEX.test(charBeforeOpening) && charBeforeOpening !== '\u00A0') {
39
40
  return fallback(input, index, openingSymbolLength);
40
41
  }
41
42
  }
@@ -94,10 +95,7 @@ export function commonFormatter(input, position, schema, opt) {
94
95
  */
95
96
  if (index < input.length) {
96
97
  const charAfterEnd = input.charAt(index);
97
- if (!closingWrapped &&
98
- // Ignored via go/ees005
99
- // eslint-disable-next-line require-unicode-regexp
100
- /[a-zA-Z0-9]|[^\u0000-\u007F]/.test(charAfterEnd) && charAfterEnd !== '\u00A0') {
98
+ if (!closingWrapped && ALPHANUMERIC_OR_NON_ASCII_REGEX.test(charAfterEnd) && charAfterEnd !== '\u00A0') {
101
99
  buffer.push(charsMatchClosingSymbol);
102
100
  state = processState.BUFFER;
103
101
  continue;
@@ -21,8 +21,10 @@ export const createDashTokenParser = (token, fallback) => ({
21
21
  }
22
22
  return token;
23
23
  };
24
+
25
+ // Ignored via go/ees005
26
+ // eslint-disable-next-line require-unicode-regexp
27
+ const WHITESPACE_REGEX = /\s/;
24
28
  const isSpace = char => {
25
- // Ignored via go/ees005
26
- // eslint-disable-next-line require-unicode-regexp
27
- return /\s/.test(char);
29
+ return WHITESPACE_REGEX.test(char);
28
30
  };
@@ -60,7 +60,8 @@ const withInlineCardFromTextStamp = issue => INLINE_CARD_FROM_TEXT_STAMP.test(is
60
60
 
61
61
  // Ignored via go/ees005
62
62
  // eslint-disable-next-line require-unicode-regexp
63
- const isNotAllowedChars = char => !/\s|\(|\)|!|\.|\,|\/|\:/.test(char);
63
+ const ALLOWED_CHARS_REGEX = /\s|\(|\)|!|\.|\,|\/|\:/;
64
+ const isNotAllowedChars = char => !ALLOWED_CHARS_REGEX.test(char);
64
65
  export const buildIssueKeyRegex = inlineCardConversion => {
65
66
  if (!inlineCardConversion) {
66
67
  return undefined;
@@ -58,13 +58,11 @@ function fallback(input, position) {
58
58
  };
59
59
  }
60
60
 
61
+ // Ignored via go/ees005
62
+ // eslint-disable-next-line require-unicode-regexp
63
+ const BAD_END_CHARS_REGEX = /[.,>)\];}"\'!]*$/;
64
+
61
65
  // removes bad characters from the end of regex match
62
66
  function trimBadEndChar(input) {
63
- return [
64
- // Ignored via go/ees005
65
- // eslint-disable-next-line require-unicode-regexp
66
- input[0].replace(/[.,>)\];}"\'!]*$/, ''), input[1],
67
- // Ignored via go/ees005
68
- // eslint-disable-next-line require-unicode-regexp
69
- input[2].replace(/[.,>)\];}"\'!]*$/, '')];
67
+ return [input[0].replace(BAD_END_CHARS_REGEX, ''), input[1], input[2].replace(BAD_END_CHARS_REGEX, '')];
70
68
  }
@@ -2,6 +2,9 @@ import { TokenType } from '../index';
2
2
  import { isSafeUrl } from '@atlaskit/adf-schema';
3
3
  import { parseString } from '../../text';
4
4
  import { hasAnyOfMarks } from '../../utils/text';
5
+ // Ignored via go/ees005
6
+ // eslint-disable-next-line require-unicode-regexp
7
+ const MAILTO_PREFIX_REGEX = /^mailto:/;
5
8
  export function urlLinkResolver(link, schema, context) {
6
9
  const output = [];
7
10
  const url = link.notLinkBody;
@@ -14,9 +17,7 @@ export function urlLinkResolver(link, schema, context) {
14
17
  ignoreTokenTypes,
15
18
  schema,
16
19
  context,
17
- // Ignored via go/ees005
18
- // eslint-disable-next-line require-unicode-regexp
19
- input: textRepresentation.replace(/^mailto:/, '')
20
+ input: textRepresentation.replace(MAILTO_PREFIX_REGEX, '')
20
21
  });
21
22
  const decoratedContent = rawContent.map(n => {
22
23
  const mark = schema.marks.link.create({
@@ -4,10 +4,12 @@
4
4
  export function hasAnyOfMarks(node, types) {
5
5
  return node.marks.findIndex(m => types.findIndex(t => m.type.name === t) !== -1) !== -1;
6
6
  }
7
+
8
+ // Ignored via go/ees005
9
+ // eslint-disable-next-line require-unicode-regexp
10
+ const DIGIT_REGEX = /^\d$/;
7
11
  export function isDigit(value) {
8
- // Ignored via go/ees005
9
- // eslint-disable-next-line require-unicode-regexp
10
- return !!value.match(/^\d$/);
12
+ return !!value.match(DIGIT_REGEX);
11
13
  }
12
14
  export function isBlank(value) {
13
15
  return value === null || value.trim() === '';
@@ -1,20 +1,24 @@
1
+ // Ignored via go/ees005
2
+ // eslint-disable-next-line require-unicode-regexp
3
+ var ONLY_WHITESPACE_REGEX = /^\s*$/;
4
+ // Ignored via go/ees005
5
+ // eslint-disable-next-line require-unicode-regexp
6
+ var LEADING_WHITESPACE_REGEX = /^\s*/;
7
+ // Ignored via go/ees005
8
+ // eslint-disable-next-line require-unicode-regexp
9
+ var TRAILING_WHITESPACE_REGEX = /\s*$/;
10
+
1
11
  /**
2
12
  * For text that has leading and ending space. We don't want to
3
13
  * convert it to `* strong *. Instead, we need it to be ` *strong* `
4
14
  */
5
15
  export var baseMarkPattern = function baseMarkPattern(text, token) {
6
- // Ignored via go/ees005
7
- // eslint-disable-next-line require-unicode-regexp
8
- if (/^\s*$/.test(text)) {
16
+ if (ONLY_WHITESPACE_REGEX.test(text)) {
9
17
  /**
10
18
  * If it's a string with only whitespaces, wiki renderer
11
19
  * will behave incorrect if we apply format on it
12
20
  */
13
21
  return text;
14
22
  }
15
- // Ignored via go/ees005
16
- // eslint-disable-next-line require-unicode-regexp
17
- // Ignored via go/ees005
18
- // eslint-disable-next-line require-unicode-regexp
19
- return text.replace(/^\s*/, "$&".concat(token)).replace(/\s*$/, "".concat(token, "$&"));
23
+ return text.replace(LEADING_WHITESPACE_REGEX, "$&".concat(token)).replace(TRAILING_WHITESPACE_REGEX, "".concat(token, "$&"));
20
24
  };
@@ -7,13 +7,15 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
7
7
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
8
8
  var supportedContentType = ['paragraph', 'orderedList', 'bulletList', 'mediaSingle', 'codeBlock'];
9
9
 
10
+ // Ignored via go/ees005
11
+ // eslint-disable-next-line require-unicode-regexp
12
+ var ORDERED_LIST_REGEX = /#$/;
13
+
10
14
  /**
11
15
  * Return the type of a list from the bullets
12
16
  */
13
17
  export function getType(bullets) {
14
- // Ignored via go/ees005
15
- // eslint-disable-next-line require-unicode-regexp
16
- return /#$/.test(bullets) ? 'orderedList' : 'bulletList';
18
+ return ORDERED_LIST_REGEX.test(bullets) ? 'orderedList' : 'bulletList';
17
19
  }
18
20
  export var ListBuilder = /*#__PURE__*/function () {
19
21
  function ListBuilder(schema, bullets) {
@@ -4,13 +4,15 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
5
5
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
6
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ // Ignored via go/ees005
8
+ // eslint-disable-next-line require-unicode-regexp
9
+ var TABLE_HEADER_REGEX = /\|\|/;
10
+
7
11
  /**
8
12
  * Return the cell type based on the delimeter
9
13
  */
10
14
  function getType(style) {
11
- // Ignored via go/ees005
12
- // eslint-disable-next-line require-unicode-regexp
13
- return /\|\|/.test(style) ? 'tableHeader' : 'tableCell';
15
+ return TABLE_HEADER_REGEX.test(style) ? 'tableHeader' : 'tableCell';
14
16
  }
15
17
  export var TableBuilder = /*#__PURE__*/function () {
16
18
  function TableBuilder(schema) {
@@ -2,6 +2,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { LINK_TEXT_REGEXP } from '../tokenize/link-text';
5
+ // Ignored via go/ees005
6
+ // eslint-disable-next-line require-unicode-regexp
7
+ var WRAPPING_QUOTES_REGEX = /^"(.+)"$/;
5
8
  var defaultWidth = 200;
6
9
  var defaultHeight = 183;
7
10
  var clamp = function clamp(input, lower, upper) {
@@ -57,18 +60,14 @@ export default function getMediaSingleNodeView(schema, filename, attrs) {
57
60
  }
58
61
  }
59
62
  if (attrs.href) {
60
- // Ignored via go/ees005
61
- // eslint-disable-next-line require-unicode-regexp
62
- var href = attrs.href.replace(/^"(.+)"$/, '$1');
63
+ var href = attrs.href.replace(WRAPPING_QUOTES_REGEX, '$1');
63
64
  mediaMarks.push(link.create({
64
65
  href: href
65
66
  }));
66
67
  }
67
68
  if (attrs.alt) {
68
69
  // strip wrapping quotes if they exist
69
- // Ignored via go/ees005
70
- // eslint-disable-next-line require-unicode-regexp
71
- var altText = attrs.alt.replace(/^"(.+)"$/, '$1');
70
+ var altText = attrs.alt.replace(WRAPPING_QUOTES_REGEX, '$1');
72
71
  mediaNodeAttrs.alt = altText;
73
72
  }
74
73
  if (filename.match(LINK_TEXT_REGEXP)) {
@@ -3,6 +3,10 @@ import { linkFormat } from './links/link-format';
3
3
  import { parseNewlineOnly } from './whitespace';
4
4
  import { parseMacroKeyword } from './keyword';
5
5
  import { escapeHandler } from '../utils/escape';
6
+
7
+ // Ignored via go/ees005
8
+ // eslint-disable-next-line require-unicode-regexp
9
+ var ALPHANUMERIC_OR_NON_ASCII_REGEX = /[a-zA-Z0-9]|[^\u0000-\u007F]/;
6
10
  var processState = {
7
11
  START: 0,
8
12
  BUFFER: 1,
@@ -32,10 +36,7 @@ export function commonFormatter(input, position, schema, opt) {
32
36
  * formatter
33
37
  */
34
38
  var charBeforeOpening = input.charAt(position - 1);
35
- if (!openingWrapped &&
36
- // Ignored via go/ees005
37
- // eslint-disable-next-line require-unicode-regexp
38
- /[a-zA-Z0-9]|[^\u0000-\u007F]/.test(charBeforeOpening) && charBeforeOpening !== "\xA0") {
39
+ if (!openingWrapped && ALPHANUMERIC_OR_NON_ASCII_REGEX.test(charBeforeOpening) && charBeforeOpening !== "\xA0") {
39
40
  return fallback(input, index, openingSymbolLength);
40
41
  }
41
42
  }
@@ -94,10 +95,7 @@ export function commonFormatter(input, position, schema, opt) {
94
95
  */
95
96
  if (index < input.length) {
96
97
  var charAfterEnd = input.charAt(index);
97
- if (!closingWrapped &&
98
- // Ignored via go/ees005
99
- // eslint-disable-next-line require-unicode-regexp
100
- /[a-zA-Z0-9]|[^\u0000-\u007F]/.test(charAfterEnd) && charAfterEnd !== "\xA0") {
98
+ if (!closingWrapped && ALPHANUMERIC_OR_NON_ASCII_REGEX.test(charAfterEnd) && charAfterEnd !== "\xA0") {
101
99
  buffer.push(charsMatchClosingSymbol);
102
100
  state = processState.BUFFER;
103
101
  continue;