@zowe/cli 8.37.1 → 8.39.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 (186) hide show
  1. package/lib/zosfiles/edit/Edit.utils.d.ts.map +1 -1
  2. package/lib/zosfiles/edit/Edit.utils.js.map +1 -1
  3. package/node_modules/@zowe/core-for-zowe-sdk/lib/constants/Core.constants.d.ts +8 -0
  4. package/node_modules/@zowe/core-for-zowe-sdk/lib/constants/Core.constants.d.ts.map +1 -1
  5. package/node_modules/@zowe/core-for-zowe-sdk/lib/constants/Core.constants.js +31 -0
  6. package/node_modules/@zowe/core-for-zowe-sdk/lib/constants/Core.constants.js.map +1 -1
  7. package/node_modules/@zowe/core-for-zowe-sdk/package.json +3 -3
  8. package/node_modules/@zowe/imperative/lib/config/src/ProfileCredentials.d.ts.map +1 -1
  9. package/node_modules/@zowe/imperative/lib/config/src/ProfileCredentials.js +15 -1
  10. package/node_modules/@zowe/imperative/lib/config/src/ProfileCredentials.js.map +1 -1
  11. package/node_modules/@zowe/imperative/lib/imperative/src/config/cmd/report-env/EnvQuery.d.ts.map +1 -1
  12. package/node_modules/@zowe/imperative/lib/imperative/src/config/cmd/report-env/EnvQuery.js +1 -2
  13. package/node_modules/@zowe/imperative/lib/imperative/src/config/cmd/report-env/EnvQuery.js.map +1 -1
  14. package/node_modules/@zowe/imperative/lib/rest/index.d.ts +1 -0
  15. package/node_modules/@zowe/imperative/lib/rest/index.d.ts.map +1 -1
  16. package/node_modules/@zowe/imperative/lib/rest/index.js +1 -0
  17. package/node_modules/@zowe/imperative/lib/rest/index.js.map +1 -1
  18. package/node_modules/@zowe/imperative/lib/rest/src/session/AbstractSession.d.ts +16 -2
  19. package/node_modules/@zowe/imperative/lib/rest/src/session/AbstractSession.d.ts.map +1 -1
  20. package/node_modules/@zowe/imperative/lib/rest/src/session/AbstractSession.js +57 -9
  21. package/node_modules/@zowe/imperative/lib/rest/src/session/AbstractSession.js.map +1 -1
  22. package/node_modules/@zowe/imperative/lib/rest/src/session/SessConstants.d.ts +29 -0
  23. package/node_modules/@zowe/imperative/lib/rest/src/session/SessConstants.d.ts.map +1 -1
  24. package/node_modules/@zowe/imperative/lib/rest/src/session/SessConstants.js +32 -1
  25. package/node_modules/@zowe/imperative/lib/rest/src/session/SessConstants.js.map +1 -1
  26. package/node_modules/@zowe/imperative/lib/rest/src/session/doc/IApimlDecision.d.ts +44 -0
  27. package/node_modules/@zowe/imperative/lib/rest/src/session/doc/IApimlDecision.d.ts.map +1 -0
  28. package/node_modules/@zowe/imperative/lib/rest/src/session/doc/IApimlDecision.js +40 -0
  29. package/node_modules/@zowe/imperative/lib/rest/src/session/doc/IApimlDecision.js.map +1 -0
  30. package/node_modules/@zowe/imperative/lib/rest/src/session/doc/ISession.d.ts +11 -0
  31. package/node_modules/@zowe/imperative/lib/rest/src/session/doc/ISession.d.ts.map +1 -1
  32. package/node_modules/@zowe/imperative/package.json +2 -2
  33. package/node_modules/@zowe/imperative/web-help/package-lock.json +62 -61
  34. package/node_modules/@zowe/provisioning-for-zowe-sdk/package.json +4 -4
  35. package/node_modules/@zowe/secrets-for-zowe-sdk/package.json +1 -1
  36. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.darwin-arm64.node +0 -0
  37. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.darwin-x64.node +0 -0
  38. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-arm-gnueabihf.node +0 -0
  39. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-arm64-gnu.node +0 -0
  40. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-arm64-musl.node +0 -0
  41. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-ia32-gnu.node +0 -0
  42. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-x64-gnu.node +0 -0
  43. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.linux-x64-musl.node +0 -0
  44. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-arm64-msvc.node +0 -0
  45. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-ia32-msvc.node +0 -0
  46. package/node_modules/@zowe/secrets-for-zowe-sdk/prebuilds/keyring.win32-x64-msvc.node +0 -0
  47. package/node_modules/@zowe/secrets-for-zowe-sdk/src/keyring/index.js +86 -18
  48. package/node_modules/@zowe/zos-console-for-zowe-sdk/package.json +4 -4
  49. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/constants/ZosFiles.messages.d.ts.map +1 -1
  50. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/constants/ZosFiles.messages.js +27 -0
  51. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/constants/ZosFiles.messages.js.map +1 -1
  52. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.d.ts.map +1 -1
  53. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.js +57 -2
  54. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/create/Create.js.map +1 -1
  55. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.d.ts.map +1 -1
  56. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.js +1 -0
  57. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/delete/Delete.js.map +1 -1
  58. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.d.ts.map +1 -1
  59. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.js +1 -0
  60. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/list/List.js.map +1 -1
  61. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.d.ts +10 -0
  62. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.d.ts.map +1 -1
  63. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.js +43 -17
  64. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/methods/utilities/Utilities.js.map +1 -1
  65. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.d.ts +25 -0
  66. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.d.ts.map +1 -1
  67. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.js +53 -0
  68. package/node_modules/@zowe/zos-files-for-zowe-sdk/lib/utils/ZosFilesUtils.js.map +1 -1
  69. package/node_modules/@zowe/zos-files-for-zowe-sdk/package.json +5 -5
  70. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/CancelJobs.d.ts.map +1 -1
  71. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/CancelJobs.js +2 -0
  72. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/CancelJobs.js.map +1 -1
  73. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DeleteJobs.d.ts.map +1 -1
  74. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DeleteJobs.js +2 -0
  75. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DeleteJobs.js.map +1 -1
  76. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DownloadJobs.d.ts.map +1 -1
  77. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DownloadJobs.js +3 -0
  78. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/DownloadJobs.js.map +1 -1
  79. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/GetJobs.d.ts.map +1 -1
  80. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/GetJobs.js +8 -0
  81. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/GetJobs.js.map +1 -1
  82. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsMessages.d.ts.map +1 -1
  83. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsMessages.js +24 -0
  84. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsMessages.js.map +1 -1
  85. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsUtils.d.ts +39 -0
  86. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsUtils.d.ts.map +1 -0
  87. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsUtils.js +72 -0
  88. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/JobsUtils.js.map +1 -0
  89. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/ModifyJobs.d.ts.map +1 -1
  90. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/ModifyJobs.js +2 -0
  91. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/ModifyJobs.js.map +1 -1
  92. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/SearchJobs.d.ts.map +1 -1
  93. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/SearchJobs.js +3 -0
  94. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/lib/SearchJobs.js.map +1 -1
  95. package/node_modules/@zowe/zos-jobs-for-zowe-sdk/package.json +5 -5
  96. package/node_modules/@zowe/zos-logs-for-zowe-sdk/package.json +4 -4
  97. package/node_modules/@zowe/zos-tso-for-zowe-sdk/package.json +5 -5
  98. package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/Shell.d.ts.map +1 -1
  99. package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/Shell.js +1 -1
  100. package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/Shell.js.map +1 -1
  101. package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/SshSession.d.ts.map +1 -1
  102. package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/SshSession.js.map +1 -1
  103. package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/doc/ISshSession.d.ts +14 -0
  104. package/node_modules/@zowe/zos-uss-for-zowe-sdk/lib/doc/ISshSession.d.ts.map +1 -1
  105. package/node_modules/@zowe/zos-uss-for-zowe-sdk/package.json +3 -3
  106. package/node_modules/@zowe/zos-workflows-for-zowe-sdk/lib/Create.d.ts.map +1 -1
  107. package/node_modules/@zowe/zos-workflows-for-zowe-sdk/lib/Create.js +3 -2
  108. package/node_modules/@zowe/zos-workflows-for-zowe-sdk/lib/Create.js.map +1 -1
  109. package/node_modules/@zowe/zos-workflows-for-zowe-sdk/package.json +5 -5
  110. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.profile.d.ts.map +1 -1
  111. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.profile.js +9 -0
  112. package/node_modules/@zowe/zosmf-for-zowe-sdk/lib/constants/Zosmf.profile.js.map +1 -1
  113. package/node_modules/@zowe/zosmf-for-zowe-sdk/package.json +4 -4
  114. package/node_modules/brace-expansion/dist/commonjs/index.d.ts +4 -0
  115. package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -1
  116. package/node_modules/brace-expansion/dist/commonjs/index.js +69 -25
  117. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  118. package/node_modules/brace-expansion/dist/esm/index.d.ts +4 -0
  119. package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -1
  120. package/node_modules/brace-expansion/dist/esm/index.js +68 -24
  121. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  122. package/node_modules/brace-expansion/package.json +2 -1
  123. package/node_modules/cpu-features/.github/workflows/ci.yml +15 -9
  124. package/node_modules/cpu-features/.github/workflows/lint.yml +2 -2
  125. package/node_modules/cpu-features/deps/cpu_features/cpu_features.gyp +1 -0
  126. package/node_modules/cpu-features/package.json +2 -2
  127. package/node_modules/markdown-it/dist/index.cjs.js +3696 -5376
  128. package/node_modules/markdown-it/dist/index.cjs.js.map +1 -0
  129. package/node_modules/markdown-it/dist/markdown-it.js +1446 -4481
  130. package/node_modules/markdown-it/dist/markdown-it.js.map +1 -0
  131. package/node_modules/markdown-it/dist/markdown-it.min.js +3 -2
  132. package/node_modules/markdown-it/dist/markdown-it.min.js.map +1 -0
  133. package/node_modules/markdown-it/lib/common/html_re.mjs +9 -9
  134. package/node_modules/markdown-it/lib/common/utils.mjs +2 -11
  135. package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +1 -1
  136. package/node_modules/markdown-it/lib/parser_block.mjs +9 -9
  137. package/node_modules/markdown-it/lib/parser_core.mjs +7 -7
  138. package/node_modules/markdown-it/lib/parser_inline.mjs +16 -16
  139. package/node_modules/markdown-it/lib/renderer.mjs +2 -2
  140. package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +6 -6
  141. package/node_modules/markdown-it/lib/rules_block/code.mjs +2 -2
  142. package/node_modules/markdown-it/lib/rules_block/fence.mjs +4 -4
  143. package/node_modules/markdown-it/lib/rules_block/heading.mjs +7 -7
  144. package/node_modules/markdown-it/lib/rules_block/hr.mjs +2 -2
  145. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +6 -6
  146. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +8 -8
  147. package/node_modules/markdown-it/lib/rules_block/list.mjs +6 -6
  148. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +5 -5
  149. package/node_modules/markdown-it/lib/rules_block/reference.mjs +1 -1
  150. package/node_modules/markdown-it/lib/rules_block/state_block.mjs +6 -6
  151. package/node_modules/markdown-it/lib/rules_block/table.mjs +4 -4
  152. package/node_modules/markdown-it/lib/rules_core/block.mjs +3 -3
  153. package/node_modules/markdown-it/lib/rules_core/linkify.mjs +46 -20
  154. package/node_modules/markdown-it/lib/rules_core/normalize.mjs +2 -2
  155. package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +48 -27
  156. package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +17 -17
  157. package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +2 -2
  158. package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +8 -8
  159. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +7 -7
  160. package/node_modules/markdown-it/lib/rules_inline/escape.mjs +15 -1
  161. package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +1 -1
  162. package/node_modules/markdown-it/lib/rules_inline/link.mjs +1 -1
  163. package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +27 -9
  164. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +2 -2
  165. package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +10 -10
  166. package/node_modules/markdown-it/lib/token.mjs +12 -12
  167. package/node_modules/markdown-it/package.json +27 -34
  168. package/node_modules/nan/.github/workflows/ci.yml +46 -0
  169. package/node_modules/nan/.pre-commit-config.yaml +8 -0
  170. package/node_modules/nan/CHANGELOG.md +56 -1
  171. package/node_modules/nan/README.md +7 -6
  172. package/node_modules/nan/doc/methods.md +17 -0
  173. package/node_modules/nan/doc/string_bytes.md +19 -0
  174. package/node_modules/nan/doc/v8_internals.md +16 -4
  175. package/node_modules/nan/nan.h +274 -26
  176. package/node_modules/nan/nan_callbacks.h +50 -1
  177. package/node_modules/nan/nan_callbacks_12_inl.h +294 -50
  178. package/node_modules/nan/nan_callbacks_pre_12_inl.h +10 -2
  179. package/node_modules/nan/nan_implementation_12_inl.h +19 -3
  180. package/node_modules/nan/nan_maybe_43_inl.h +7 -2
  181. package/node_modules/nan/nan_maybe_pre_43_inl.h +1 -1
  182. package/node_modules/nan/nan_scriptorigin.h +22 -1
  183. package/node_modules/nan/nan_typedarray_contents.h +1 -1
  184. package/node_modules/nan/nan_weak.h +16 -0
  185. package/node_modules/nan/package.json +5 -5
  186. package/package.json +16 -14
@@ -1,22 +1,22 @@
1
1
  // Regexps to match html elements
2
2
 
3
- const attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*'
3
+ const attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*'
4
4
 
5
- const unquoted = '[^"\'=<>`\\x00-\\x20]+'
5
+ const unquoted = '[^"\'=<>`\\x00-\\x20]+'
6
6
  const single_quoted = "'[^']*'"
7
7
  const double_quoted = '"[^"]*"'
8
8
 
9
- const attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')'
9
+ const attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')'
10
10
 
11
- const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)'
11
+ const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)'
12
12
 
13
- const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'
13
+ const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'
14
14
 
15
- const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'
16
- const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->'
17
- const processing = '<[?][\\s\\S]*?[?]>'
15
+ const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'
16
+ const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->'
17
+ const processing = '<[?][\\s\\S]*?[?]>'
18
18
  const declaration = '<![A-Za-z][^>]*>'
19
- const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>'
19
+ const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>'
20
20
 
21
21
  const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
22
22
  '|' + processing + '|' + declaration + '|' + cdata + ')')
@@ -42,7 +42,6 @@ function arrayReplaceAt (src, pos, newElements) {
42
42
  }
43
43
 
44
44
  function isValidEntityCode (c) {
45
- /* eslint no-bitwise:0 */
46
45
  // broken sequence
47
46
  if (c >= 0xD800 && c <= 0xDFFF) { return false }
48
47
  // never used
@@ -70,8 +69,8 @@ function fromCodePoint (c) {
70
69
  return String.fromCharCode(c)
71
70
  }
72
71
 
73
- const UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g
74
- const ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi
72
+ const UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g
73
+ const ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi
75
74
  const UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi')
76
75
 
77
76
  const DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i
@@ -97,12 +96,6 @@ function replaceEntityPattern (match, name) {
97
96
  return match
98
97
  }
99
98
 
100
- /* function replaceEntities(str) {
101
- if (str.indexOf('&') < 0) { return str; }
102
-
103
- return str.replace(ENTITY_RE, replaceEntityPattern);
104
- } */
105
-
106
99
  function unescapeMd (str) {
107
100
  if (str.indexOf('\\') < 0) { return str }
108
101
  return str.replace(UNESCAPE_MD_RE, '$1')
@@ -172,8 +165,6 @@ function isWhiteSpace (code) {
172
165
  return false
173
166
  }
174
167
 
175
- /* eslint-disable max-len */
176
-
177
168
  // Currently without astral characters support.
178
169
  function isPunctChar (ch) {
179
170
  return ucmicro.P.test(ch) || ucmicro.S.test(ch)
@@ -49,7 +49,7 @@ export default function parseLinkDestination (str, start, max) {
49
49
  if (code < 0x20 || code === 0x7F) { break }
50
50
 
51
51
  if (code === 0x5C /* \ */ && pos + 1 < max) {
52
- if (str.charCodeAt(pos + 1) === 0x20) { break }
52
+ if (str.charCodeAt(pos + 1) === 0x20) { pos++; continue }
53
53
  pos += 2
54
54
  continue
55
55
  }
@@ -22,17 +22,17 @@ import r_paragraph from './rules_block/paragraph.mjs'
22
22
  const _rules = [
23
23
  // First 2 params - rule name & source. Secondary array - list of rules,
24
24
  // which can be terminated by this one.
25
- ['table', r_table, ['paragraph', 'reference']],
26
- ['code', r_code],
27
- ['fence', r_fence, ['paragraph', 'reference', 'blockquote', 'list']],
25
+ ['table', r_table, ['paragraph', 'reference']],
26
+ ['code', r_code],
27
+ ['fence', r_fence, ['paragraph', 'reference', 'blockquote', 'list']],
28
28
  ['blockquote', r_blockquote, ['paragraph', 'reference', 'blockquote', 'list']],
29
- ['hr', r_hr, ['paragraph', 'reference', 'blockquote', 'list']],
30
- ['list', r_list, ['paragraph', 'reference', 'blockquote']],
31
- ['reference', r_reference],
29
+ ['hr', r_hr, ['paragraph', 'reference', 'blockquote', 'list']],
30
+ ['list', r_list, ['paragraph', 'reference', 'blockquote']],
31
+ ['reference', r_reference],
32
32
  ['html_block', r_html_block, ['paragraph', 'reference', 'blockquote']],
33
- ['heading', r_heading, ['paragraph', 'reference', 'blockquote']],
34
- ['lheading', r_lheading],
35
- ['paragraph', r_paragraph]
33
+ ['heading', r_heading, ['paragraph', 'reference', 'blockquote']],
34
+ ['lheading', r_lheading],
35
+ ['paragraph', r_paragraph]
36
36
  ]
37
37
 
38
38
  /**
@@ -17,15 +17,15 @@ import r_smartquotes from './rules_core/smartquotes.mjs'
17
17
  import r_text_join from './rules_core/text_join.mjs'
18
18
 
19
19
  const _rules = [
20
- ['normalize', r_normalize],
21
- ['block', r_block],
22
- ['inline', r_inline],
23
- ['linkify', r_linkify],
24
- ['replacements', r_replacements],
25
- ['smartquotes', r_smartquotes],
20
+ ['normalize', r_normalize],
21
+ ['block', r_block],
22
+ ['inline', r_inline],
23
+ ['linkify', r_linkify],
24
+ ['replacements', r_replacements],
25
+ ['smartquotes', r_smartquotes],
26
26
  // `text_join` finds `text_special` tokens (for escape sequences)
27
27
  // and joins them with the rest of the text
28
- ['text_join', r_text_join]
28
+ ['text_join', r_text_join]
29
29
  ]
30
30
 
31
31
  /**
@@ -26,18 +26,18 @@ import r_fragments_join from './rules_inline/fragments_join.mjs'
26
26
  // Parser rules
27
27
 
28
28
  const _rules = [
29
- ['text', r_text],
30
- ['linkify', r_linkify],
31
- ['newline', r_newline],
32
- ['escape', r_escape],
33
- ['backticks', r_backticks],
34
- ['strikethrough', r_strikethrough.tokenize],
35
- ['emphasis', r_emphasis.tokenize],
36
- ['link', r_link],
37
- ['image', r_image],
38
- ['autolink', r_autolink],
39
- ['html_inline', r_html_inline],
40
- ['entity', r_entity]
29
+ ['text', r_text],
30
+ ['linkify', r_linkify],
31
+ ['newline', r_newline],
32
+ ['escape', r_escape],
33
+ ['backticks', r_backticks],
34
+ ['strikethrough', r_strikethrough.tokenize],
35
+ ['emphasis', r_emphasis.tokenize],
36
+ ['link', r_link],
37
+ ['image', r_image],
38
+ ['autolink', r_autolink],
39
+ ['html_inline', r_html_inline],
40
+ ['entity', r_entity]
41
41
  ]
42
42
 
43
43
  // `rule2` ruleset was created specifically for emphasis/strikethrough
@@ -46,12 +46,12 @@ const _rules = [
46
46
  // Don't use this for anything except pairs (plugins working with `balance_pairs`).
47
47
  //
48
48
  const _rules2 = [
49
- ['balance_pairs', r_balance_pairs],
50
- ['strikethrough', r_strikethrough.postProcess],
51
- ['emphasis', r_emphasis.postProcess],
49
+ ['balance_pairs', r_balance_pairs],
50
+ ['strikethrough', r_strikethrough.postProcess],
51
+ ['emphasis', r_emphasis.postProcess],
52
52
  // rules for pairs separate '**' into its own text tokens, which may be left unused,
53
53
  // rule below merges unused segments back with the rest of the text
54
- ['fragments_join', r_fragments_join]
54
+ ['fragments_join', r_fragments_join]
55
55
  ]
56
56
 
57
57
  /**
@@ -13,7 +13,7 @@ const default_rules = {}
13
13
  default_rules.code_inline = function (tokens, idx, options, env, slf) {
14
14
  const token = tokens[idx]
15
15
 
16
- return '<code' + slf.renderAttrs(token) + '>' +
16
+ return '<code' + slf.renderAttrs(token) + '>' +
17
17
  escapeHtml(token.content) +
18
18
  '</code>'
19
19
  }
@@ -21,7 +21,7 @@ default_rules.code_inline = function (tokens, idx, options, env, slf) {
21
21
  default_rules.code_block = function (tokens, idx, options, env, slf) {
22
22
  const token = tokens[idx]
23
23
 
24
- return '<pre' + slf.renderAttrs(token) + '><code>' +
24
+ return '<pre' + slf.renderAttrs(token) + '><code>' +
25
25
  escapeHtml(tokens[idx].content) +
26
26
  '</code></pre>\n'
27
27
  }
@@ -18,10 +18,10 @@ export default function blockquote (state, startLine, endLine, silent) {
18
18
  // so no point trying to find the end of it in silent mode
19
19
  if (silent) { return true }
20
20
 
21
- const oldBMarks = []
21
+ const oldBMarks = []
22
22
  const oldBSCount = []
23
- const oldSCount = []
24
- const oldTShift = []
23
+ const oldSCount = []
24
+ const oldTShift = []
25
25
 
26
26
  const terminatorRules = state.md.block.ruler.getRules('blockquote')
27
27
 
@@ -181,14 +181,14 @@ export default function blockquote (state, startLine, endLine, silent) {
181
181
  const oldIndent = state.blkIndent
182
182
  state.blkIndent = 0
183
183
 
184
- const token_o = state.push('blockquote_open', 'blockquote', 1)
184
+ const token_o = state.push('blockquote_open', 'blockquote', 1)
185
185
  token_o.markup = '>'
186
186
  const lines = [startLine, 0]
187
- token_o.map = lines
187
+ token_o.map = lines
188
188
 
189
189
  state.md.block.tokenize(state, startLine, nextLine)
190
190
 
191
- const token_c = state.push('blockquote_close', 'blockquote', -1)
191
+ const token_c = state.push('blockquote_close', 'blockquote', -1)
192
192
  token_c.markup = '>'
193
193
 
194
194
  state.lineMax = oldLineMax
@@ -22,9 +22,9 @@ export default function code (state, startLine, endLine/*, silent */) {
22
22
 
23
23
  state.line = last
24
24
 
25
- const token = state.push('code_block', 'code', 0)
25
+ const token = state.push('code_block', 'code', 0)
26
26
  token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\n'
27
- token.map = [startLine, state.line]
27
+ token.map = [startLine, state.line]
28
28
 
29
29
  return true
30
30
  }
@@ -84,11 +84,11 @@ export default function fence (state, startLine, endLine, silent) {
84
84
 
85
85
  state.line = nextLine + (haveEndMarker ? 1 : 0)
86
86
 
87
- const token = state.push('fence', 'code', 0)
88
- token.info = params
87
+ const token = state.push('fence', 'code', 0)
88
+ token.info = params
89
89
  token.content = state.getLines(startLine + 1, nextLine, len, true)
90
- token.markup = markup
91
- token.map = [startLine, state.line]
90
+ token.markup = markup
91
+ token.map = [startLine, state.line]
92
92
 
93
93
  return true
94
94
  }
@@ -9,7 +9,7 @@ export default function heading (state, startLine, endLine, silent) {
9
9
  // if it's indented more than 3 spaces, it should be a code block
10
10
  if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
11
11
 
12
- let ch = state.src.charCodeAt(pos)
12
+ let ch = state.src.charCodeAt(pos)
13
13
 
14
14
  if (ch !== 0x23/* # */ || pos >= max) { return false }
15
15
 
@@ -35,16 +35,16 @@ export default function heading (state, startLine, endLine, silent) {
35
35
 
36
36
  state.line = startLine + 1
37
37
 
38
- const token_o = state.push('heading_open', 'h' + String(level), 1)
38
+ const token_o = state.push('heading_open', 'h' + String(level), 1)
39
39
  token_o.markup = '########'.slice(0, level)
40
- token_o.map = [startLine, state.line]
40
+ token_o.map = [startLine, state.line]
41
41
 
42
- const token_i = state.push('inline', '', 0)
43
- token_i.content = asciiTrim(state.src.slice(pos, max))
44
- token_i.map = [startLine, state.line]
42
+ const token_i = state.push('inline', '', 0)
43
+ token_i.content = asciiTrim(state.src.slice(pos, max))
44
+ token_i.map = [startLine, state.line]
45
45
  token_i.children = []
46
46
 
47
- const token_c = state.push('heading_close', 'h' + String(level), -1)
47
+ const token_c = state.push('heading_close', 'h' + String(level), -1)
48
48
  token_c.markup = '########'.slice(0, level)
49
49
 
50
50
  return true
@@ -32,8 +32,8 @@ export default function hr (state, startLine, endLine, silent) {
32
32
 
33
33
  state.line = startLine + 1
34
34
 
35
- const token = state.push('hr', 'hr', 0)
36
- token.map = [startLine, state.line]
35
+ const token = state.push('hr', 'hr', 0)
36
+ token.map = [startLine, state.line]
37
37
  token.markup = Array(cnt + 1).join(String.fromCharCode(marker))
38
38
 
39
39
  return true
@@ -8,12 +8,12 @@ import { HTML_OPEN_CLOSE_TAG_RE } from '../common/html_re.mjs'
8
8
  //
9
9
  const HTML_SEQUENCES = [
10
10
  [/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true],
11
- [/^<!--/, /-->/, true],
12
- [/^<\?/, /\?>/, true],
13
- [/^<![A-Z]/, />/, true],
11
+ [/^<!--/, /-->/, true],
12
+ [/^<\?/, /\?>/, true],
13
+ [/^<![A-Za-z]/, />/, true],
14
14
  [/^<!\[CDATA\[/, /\]\]>/, true],
15
15
  [new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true],
16
- [new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false]
16
+ [new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false]
17
17
  ]
18
18
 
19
19
  export default function html_block (state, startLine, endLine, silent) {
@@ -72,8 +72,8 @@ export default function html_block (state, startLine, endLine, silent) {
72
72
 
73
73
  state.line = nextLine
74
74
 
75
- const token = state.push('html_block', '', 0)
76
- token.map = [startLine, nextLine]
75
+ const token = state.push('html_block', '', 0)
76
+ token.map = [startLine, nextLine]
77
77
  token.content = state.getLines(startLine, nextLine, state.blkIndent, true)
78
78
 
79
79
  return true
@@ -67,17 +67,17 @@ export default function lheading (state, startLine, endLine/*, silent */) {
67
67
 
68
68
  state.line = nextLine + 1
69
69
 
70
- const token_o = state.push('heading_open', 'h' + String(level), 1)
71
- token_o.markup = String.fromCharCode(marker)
72
- token_o.map = [startLine, state.line]
70
+ const token_o = state.push('heading_open', 'h' + String(level), 1)
71
+ token_o.markup = String.fromCharCode(marker)
72
+ token_o.map = [startLine, state.line]
73
73
 
74
- const token_i = state.push('inline', '', 0)
75
- token_i.content = content
76
- token_i.map = [startLine, state.line - 1]
74
+ const token_i = state.push('inline', '', 0)
75
+ token_i.content = content
76
+ token_i.map = [startLine, state.line - 1]
77
77
  token_i.children = []
78
78
 
79
- const token_c = state.push('heading_close', 'h' + String(level), -1)
80
- token_c.markup = String.fromCharCode(marker)
79
+ const token_c = state.push('heading_close', 'h' + String(level), -1)
80
+ token_c.markup = String.fromCharCode(marker)
81
81
 
82
82
  state.parentType = oldParentType
83
83
 
@@ -156,16 +156,16 @@ export default function list (state, startLine, endLine, silent) {
156
156
  const listTokIdx = state.tokens.length
157
157
 
158
158
  if (isOrdered) {
159
- token = state.push('ordered_list_open', 'ol', 1)
159
+ token = state.push('ordered_list_open', 'ol', 1)
160
160
  if (markerValue !== 1) {
161
161
  token.attrs = [['start', markerValue]]
162
162
  }
163
163
  } else {
164
- token = state.push('bullet_list_open', 'ul', 1)
164
+ token = state.push('bullet_list_open', 'ul', 1)
165
165
  }
166
166
 
167
167
  const listLines = [nextLine, 0]
168
- token.map = listLines
168
+ token.map = listLines
169
169
  token.markup = String.fromCharCode(markerCharCode)
170
170
 
171
171
  //
@@ -218,10 +218,10 @@ export default function list (state, startLine, endLine, silent) {
218
218
  const indent = initial + indentAfterMarker
219
219
 
220
220
  // Run subparser & write tokens
221
- token = state.push('list_item_open', 'li', 1)
221
+ token = state.push('list_item_open', 'li', 1)
222
222
  token.markup = String.fromCharCode(markerCharCode)
223
223
  const itemLines = [nextLine, 0]
224
- token.map = itemLines
224
+ token.map = itemLines
225
225
  if (isOrdered) {
226
226
  token.info = state.src.slice(start, posAfterMarker - 1)
227
227
  }
@@ -270,7 +270,7 @@ export default function list (state, startLine, endLine, silent) {
270
270
  state.sCount[nextLine] = oldSCount
271
271
  state.tight = oldTight
272
272
 
273
- token = state.push('list_item_close', 'li', -1)
273
+ token = state.push('list_item_close', 'li', -1)
274
274
  token.markup = String.fromCharCode(markerCharCode)
275
275
 
276
276
  nextLine = state.line
@@ -32,12 +32,12 @@ export default function paragraph (state, startLine, endLine) {
32
32
 
33
33
  state.line = nextLine
34
34
 
35
- const token_o = state.push('paragraph_open', 'p', 1)
36
- token_o.map = [startLine, state.line]
35
+ const token_o = state.push('paragraph_open', 'p', 1)
36
+ token_o.map = [startLine, state.line]
37
37
 
38
- const token_i = state.push('inline', '', 0)
39
- token_i.content = content
40
- token_i.map = [startLine, state.line]
38
+ const token_i = state.push('inline', '', 0)
39
+ token_i.content = content
40
+ token_i.map = [startLine, state.line]
41
41
  token_i.children = []
42
42
 
43
43
  state.push('paragraph_close', 'p', -1)
@@ -134,7 +134,7 @@ export default function reference (state, startLine, _endLine, silent) {
134
134
  nextLine++
135
135
  }
136
136
  } else if (isSpace(ch)) {
137
- /* eslint no-empty:0 */
137
+ /* Nothing */
138
138
  } else {
139
139
  break
140
140
  }
@@ -7,7 +7,7 @@ function StateBlock (src, md, env, tokens) {
7
7
  this.src = src
8
8
 
9
9
  // link to parser instance
10
- this.md = md
10
+ this.md = md
11
11
 
12
12
  this.env = env
13
13
 
@@ -38,11 +38,11 @@ function StateBlock (src, md, env, tokens) {
38
38
 
39
39
  // required block content indent (for example, if we are
40
40
  // inside a list, it would be positioned after list marker)
41
- this.blkIndent = 0
42
- this.line = 0 // line index in src
43
- this.lineMax = 0 // lines count
44
- this.tight = false // loose/tight mode for lists
45
- this.ddIndent = -1 // indent of the current dd block (-1 if there isn't any)
41
+ this.blkIndent = 0
42
+ this.line = 0 // line index in src
43
+ this.lineMax = 0 // lines count
44
+ this.tight = false // loose/tight mode for lists
45
+ this.ddIndent = -1 // indent of the current dd block (-1 if there isn't any)
46
46
  this.listIndent = -1 // indent of the current list block (-1 if there isn't any)
47
47
 
48
48
  // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
@@ -151,11 +151,11 @@ export default function table (state, startLine, endLine, silent) {
151
151
  for (let i = 0; i < columns.length; i++) {
152
152
  const token_ho = state.push('th_open', 'th', 1)
153
153
  if (aligns[i]) {
154
- token_ho.attrs = [['style', 'text-align:' + aligns[i]]]
154
+ token_ho.attrs = [['style', 'text-align:' + aligns[i]]]
155
155
  }
156
156
 
157
157
  const token_il = state.push('inline', '', 0)
158
- token_il.content = columns[i].trim()
158
+ token_il.content = columns[i].trim()
159
159
  token_il.children = []
160
160
 
161
161
  state.push('th_close', 'th', -1)
@@ -202,11 +202,11 @@ export default function table (state, startLine, endLine, silent) {
202
202
  for (let i = 0; i < columnCount; i++) {
203
203
  const token_tdo = state.push('td_open', 'td', 1)
204
204
  if (aligns[i]) {
205
- token_tdo.attrs = [['style', 'text-align:' + aligns[i]]]
205
+ token_tdo.attrs = [['style', 'text-align:' + aligns[i]]]
206
206
  }
207
207
 
208
208
  const token_il = state.push('inline', '', 0)
209
- token_il.content = columns[i] ? columns[i].trim() : ''
209
+ token_il.content = columns[i] ? columns[i].trim() : ''
210
210
  token_il.children = []
211
211
 
212
212
  state.push('td_close', 'td', -1)
@@ -2,9 +2,9 @@ export default function block (state) {
2
2
  let token
3
3
 
4
4
  if (state.inlineMode) {
5
- token = new state.Token('inline', '', 0)
6
- token.content = state.src
7
- token.map = [0, 1]
5
+ token = new state.Token('inline', '', 0)
6
+ token.content = state.src
7
+ token.map = [0, 1]
8
8
  token.children = []
9
9
  state.tokens.push(token)
10
10
  } else {
@@ -3,8 +3,6 @@
3
3
  // Currently restricted by `md.validateLink()` to http/https/ftp
4
4
  //
5
5
 
6
- import { arrayReplaceAt } from '../common/utils.mjs'
7
-
8
6
  function isLinkOpen (str) {
9
7
  return /^<a[>\s]/i.test(str)
10
8
  }
@@ -23,7 +21,8 @@ export default function linkify (state) {
23
21
  continue
24
22
  }
25
23
 
26
- let tokens = blockTokens[j].children
24
+ const tokens = blockTokens[j].children
25
+ const replacements = []
27
26
 
28
27
  let htmlLinkLevel = 0
29
28
 
@@ -93,42 +92,69 @@ export default function linkify (state) {
93
92
  const pos = links[ln].index
94
93
 
95
94
  if (pos > lastPos) {
96
- const token = new state.Token('text', '', 0)
95
+ const token = new state.Token('text', '', 0)
97
96
  token.content = text.slice(lastPos, pos)
98
- token.level = level
97
+ token.level = level
99
98
  nodes.push(token)
100
99
  }
101
100
 
102
- const token_o = new state.Token('link_open', 'a', 1)
103
- token_o.attrs = [['href', fullUrl]]
104
- token_o.level = level++
105
- token_o.markup = 'linkify'
106
- token_o.info = 'auto'
101
+ const token_o = new state.Token('link_open', 'a', 1)
102
+ token_o.attrs = [['href', fullUrl]]
103
+ token_o.level = level++
104
+ token_o.markup = 'linkify'
105
+ token_o.info = 'auto'
107
106
  nodes.push(token_o)
108
107
 
109
- const token_t = new state.Token('text', '', 0)
108
+ const token_t = new state.Token('text', '', 0)
110
109
  token_t.content = urlText
111
- token_t.level = level
110
+ token_t.level = level
112
111
  nodes.push(token_t)
113
112
 
114
- const token_c = new state.Token('link_close', 'a', -1)
115
- token_c.level = --level
116
- token_c.markup = 'linkify'
117
- token_c.info = 'auto'
113
+ const token_c = new state.Token('link_close', 'a', -1)
114
+ token_c.level = --level
115
+ token_c.markup = 'linkify'
116
+ token_c.info = 'auto'
118
117
  nodes.push(token_c)
119
118
 
120
119
  lastPos = links[ln].lastIndex
121
120
  }
122
121
  if (lastPos < text.length) {
123
- const token = new state.Token('text', '', 0)
122
+ const token = new state.Token('text', '', 0)
124
123
  token.content = text.slice(lastPos)
125
- token.level = level
124
+ token.level = level
126
125
  nodes.push(token)
127
126
  }
128
127
 
129
- // replace current node
130
- blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes)
128
+ replacements.push({ index: i, nodes })
129
+ }
130
+ }
131
+
132
+ if (replacements.length > 0) {
133
+ let newTokensLength = tokens.length
134
+ for (const replacement of replacements) {
135
+ newTokensLength += replacement.nodes.length - 1
136
+ }
137
+
138
+ const newTokens = new Array(newTokensLength)
139
+ let replacementIndex = 0
140
+ let newTokenIndex = 0
141
+
142
+ replacements.reverse()
143
+
144
+ for (let i = 0; i < tokens.length; i++) {
145
+ const replacement = replacements[replacementIndex]
146
+
147
+ if (replacement?.index === i) {
148
+ for (const node of replacement.nodes) {
149
+ newTokens[newTokenIndex++] = node
150
+ }
151
+ replacementIndex++
152
+ } else {
153
+ newTokens[newTokenIndex++] = tokens[i]
154
+ }
131
155
  }
156
+
157
+ blockTokens[j].children = newTokens
132
158
  }
133
159
  }
134
160
  }
@@ -1,8 +1,8 @@
1
1
  // Normalize input string
2
2
 
3
3
  // https://spec.commonmark.org/0.29/#line-ending
4
- const NEWLINES_RE = /\r\n?|\n/g
5
- const NULL_RE = /\0/g
4
+ const NEWLINES_RE = /\r\n?|\n/g
5
+ const NULL_RE = /\0/g
6
6
 
7
7
  export default function normalize (state) {
8
8
  let str