@zohodesk/react-cli 1.1.19-exp.4 → 1.1.19-exp.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (736) hide show
  1. package/lib/configs/webpack.prod.config.js +2 -2
  2. package/lib/loaderUtils/getDevJsLoaders.js +2 -2
  3. package/lib/loaders/docsLoader.js +2 -2
  4. package/lib/loaders/enhancedReactLiveConverter.js +143 -0
  5. package/npm-shrinkwrap.json +19082 -55
  6. package/package.json +1 -4
  7. package/packages/client_build_tool/lib/allCommandsConfigs.js +25 -0
  8. package/packages/client_build_tool/lib/commands/build/commandExecutor.js +17 -0
  9. package/packages/client_build_tool/lib/commands/build/config.js +12 -0
  10. package/packages/client_build_tool/lib/commands/build/optionsProcessor.js +35 -0
  11. package/packages/client_build_tool/lib/commands/build/preProcessor.js +12 -0
  12. package/packages/client_build_tool/lib/commands/buildEs/commandExecutor.js +33 -0
  13. package/packages/client_build_tool/lib/commands/buildEs/config.js +12 -0
  14. package/packages/client_build_tool/lib/commands/buildEs/preProcessor.js +17 -0
  15. package/packages/client_build_tool/lib/commands/buildLib/commandExecutor.js +33 -0
  16. package/packages/client_build_tool/lib/commands/buildLib/config.js +12 -0
  17. package/packages/client_build_tool/lib/commands/buildLib/preProcessor.js +17 -0
  18. package/packages/client_build_tool/lib/commands/mockserver/commandExecutor.js +43 -0
  19. package/packages/client_build_tool/lib/commands/mockserver/config.js +12 -0
  20. package/packages/client_build_tool/lib/commands/pre_process/commandExecutor.js +18 -0
  21. package/packages/client_build_tool/lib/commands/pre_process/config.js +12 -0
  22. package/packages/client_build_tool/lib/commands/start/commandExecutor.js +12 -0
  23. package/packages/client_build_tool/lib/commands/start/config.js +12 -0
  24. package/packages/client_build_tool/lib/commands/start/optionsProcessor.js +30 -0
  25. package/packages/client_build_tool/lib/commands/start/preProcessor.js +12 -0
  26. package/packages/client_build_tool/lib/commands/template/commandExecutor.js +28 -0
  27. package/packages/client_build_tool/lib/commands/template/config.js +12 -0
  28. package/packages/client_build_tool/lib/commands/version/commandExecutor.js +14 -0
  29. package/packages/client_build_tool/lib/commands/version/config.js +12 -0
  30. package/packages/client_build_tool/lib/commandsRouter.js +74 -0
  31. package/packages/client_build_tool/lib/index.js +12 -0
  32. package/packages/client_build_tool/lib/logger.js +34 -0
  33. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/otherTestCases.test.js +234 -0
  34. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/passingDifferentDataTypesToSchema.test.js +103 -0
  35. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/passingEmptyObjects.test.js +41 -0
  36. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByCustomOptions/convertArray.test.js +68 -0
  37. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByCustomOptions/convertNumber.test.js +68 -0
  38. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByCustomOptions/convertObject.test.js +141 -0
  39. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByCustomOptions/convertString.test.js +68 -0
  40. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByCustomOptions/convertUndefinedAndNull.test.js +132 -0
  41. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByProcessEnv/convertArray.test.js +71 -0
  42. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByProcessEnv/convertNumber.test.js +71 -0
  43. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByProcessEnv/convertObject.test.js +73 -0
  44. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByProcessEnv/convertString.test.js +71 -0
  45. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/__test__/replacingSchemaValueByProcessEnv/convertUndefinedAndNull.test.js +138 -0
  46. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/index.js +34 -0
  47. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/isObject.js +10 -0
  48. package/packages/client_build_tool/lib/schemas/applyValuesToSchema/isValid.js +14 -0
  49. package/packages/client_build_tool/lib/schemas/cliArgsToObject.js +39 -0
  50. package/packages/client_build_tool/lib/schemas/defaultConfigValues.js +334 -0
  51. package/packages/client_build_tool/lib/schemas/defaultConfigValuesOnly.js +187 -0
  52. package/packages/client_build_tool/lib/schemas/deprecatedOptionsHandler.js +67 -0
  53. package/packages/client_build_tool/lib/schemas/getNpmVersion.js +22 -0
  54. package/packages/client_build_tool/lib/schemas/giveDefaultValue.js +18 -0
  55. package/packages/client_build_tool/lib/schemas/npmConfigToObject.js +35 -0
  56. package/packages/client_build_tool/lib/schemas/readOptions.js +54 -0
  57. package/packages/client_build_tool/lib/schemas/readOptionsForConfigFile.js +42 -0
  58. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/Map.test.js +15 -0
  59. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/MathAndNumberMethod.test.js +30 -0
  60. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/ObjectAndModules.test.js +47 -0
  61. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/Sets.test.js +18 -0
  62. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/Symbol.test.js +25 -0
  63. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/arrowFunction.test.js +34 -0
  64. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/block-scoping.test.js +18 -0
  65. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/classes.test.js +55 -0
  66. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/defaultParameterValues.test.js +18 -0
  67. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/extraFeatures.test.js +82 -0
  68. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/forOf.test.js +20 -0
  69. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/promise.test.js +22 -0
  70. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/spreadOperator.test.js +20 -0
  71. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/spreadParams.test.js +24 -0
  72. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/stringAndArrayMethods.test.js +67 -0
  73. package/packages/client_build_tool/lib/shared/babel/__test__/es2015/variables.test.js +21 -0
  74. package/packages/client_build_tool/lib/shared/babel/__test__/es2016/array-includes.test.js +13 -0
  75. package/packages/client_build_tool/lib/shared/babel/__test__/es2016/exponentationOperator.test.js +20 -0
  76. package/packages/client_build_tool/lib/shared/babel/__test__/es2017/asyncAndawait.test.js +23 -0
  77. package/packages/client_build_tool/lib/shared/babel/__test__/es2017/object-entries.test.js +24 -0
  78. package/packages/client_build_tool/lib/shared/babel/__test__/es2017/object-getOwnproperties.test.js +24 -0
  79. package/packages/client_build_tool/lib/shared/babel/__test__/es2017/object-values.test.js +24 -0
  80. package/packages/client_build_tool/lib/shared/babel/__test__/es2017/stringMethods.test.js +20 -0
  81. package/packages/client_build_tool/lib/shared/babel/__test__/es2018/asynchronous-iterator.test.js +19 -0
  82. package/packages/client_build_tool/lib/shared/babel/__test__/es2018/object-rest-spread.test.js +24 -0
  83. package/packages/client_build_tool/lib/shared/babel/__test__/es2018/promise-finally.test.js +26 -0
  84. package/packages/client_build_tool/lib/shared/babel/__test__/es2018/regularExpressions.test.js +35 -0
  85. package/packages/client_build_tool/lib/shared/babel/__test__/es2019/Json.stringify.test.js +21 -0
  86. package/packages/client_build_tool/lib/shared/babel/__test__/es2019/arrayMethods.test.js +31 -0
  87. package/packages/client_build_tool/lib/shared/babel/__test__/es2019/object-fromEntriesMethod.test.js +13 -0
  88. package/packages/client_build_tool/lib/shared/babel/__test__/es2019/optionalCatchBinding.test.js +23 -0
  89. package/packages/client_build_tool/lib/shared/babel/__test__/es2019/revisedFunctionToString.test.js +17 -0
  90. package/packages/client_build_tool/lib/shared/babel/__test__/es2019/trim-startAndend-method.test.js +20 -0
  91. package/packages/client_build_tool/lib/shared/babel/__test__/es2020/AssignmentOperator.test.js +27 -0
  92. package/packages/client_build_tool/lib/shared/babel/__test__/es2020/Dynamic-Import.test.js +19 -0
  93. package/packages/client_build_tool/lib/shared/babel/__test__/es2020/NullishOperator.test.js +15 -0
  94. package/packages/client_build_tool/lib/shared/babel/__test__/es2020/bigInt.test.js +13 -0
  95. package/packages/client_build_tool/lib/shared/babel/__test__/es2020/chainOperator.test.js +17 -0
  96. package/packages/client_build_tool/lib/shared/babel/__test__/es2020/export-namespace-from.test.js +12 -0
  97. package/packages/client_build_tool/lib/shared/babel/__test__/es2020/promiseAllSettledMathod.test.js +17 -0
  98. package/packages/client_build_tool/lib/shared/babel/__test__/es2020/stringMatchMethod.test.js +13 -0
  99. package/packages/client_build_tool/lib/shared/babel/__test__/es2021/NumericSeparator.test.js +23 -0
  100. package/packages/client_build_tool/lib/shared/babel/__test__/es2021/logicalOperatorAssignments.test.js +25 -0
  101. package/packages/client_build_tool/lib/shared/babel/__test__/es2021/promiseAny.test.js +16 -0
  102. package/packages/client_build_tool/lib/shared/babel/__test__/es2021/stringReplaceMethod.test.js +16 -0
  103. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/Array-atMethod.test.js +13 -0
  104. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/ObjectKeyCheck.test.js +27 -0
  105. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/ObjecthasOwnMethod.test.js +19 -0
  106. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/RegexMatchIndices.test.js +20 -0
  107. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/String-atMethod.test.js +15 -0
  108. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/error.Cause.test.js +23 -0
  109. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/keysCheckinPrivateFields.test.js +27 -0
  110. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/privateMethodsAndFields.test.js +23 -0
  111. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/staticFieldsAndMethod.test.js +54 -0
  112. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/topLevelAwait.test.js +11 -0
  113. package/packages/client_build_tool/lib/shared/babel/__test__/es2022/weakRef.test.js +17 -0
  114. package/packages/client_build_tool/lib/shared/babel/__test__/utilities.js +28 -0
  115. package/packages/client_build_tool/lib/shared/babel/addDefaultPlugins.js +15 -0
  116. package/packages/client_build_tool/lib/shared/babel/babelWebConfig.js +54 -0
  117. package/packages/client_build_tool/lib/shared/babel/babel_plugins/removeAttributesPlugin.js +23 -0
  118. package/packages/client_build_tool/lib/shared/babel/getBabelPlugin.js +37 -0
  119. package/packages/client_build_tool/lib/shared/babel/runBabelForJSFile.js +24 -0
  120. package/packages/client_build_tool/lib/shared/babel/runBabelForTsFile.js +30 -0
  121. package/packages/client_build_tool/lib/shared/bundler/webpack/common/decidePublicPath.js +52 -0
  122. package/packages/client_build_tool/lib/shared/bundler/webpack/common/libAlias.js +31 -0
  123. package/packages/client_build_tool/lib/shared/bundler/webpack/common/modeUtils.js +39 -0
  124. package/packages/client_build_tool/lib/shared/bundler/webpack/common/nameTemplates.js +101 -0
  125. package/packages/client_build_tool/lib/shared/bundler/webpack/common/resourceBasedPublicPath.js +21 -0
  126. package/packages/client_build_tool/lib/shared/bundler/webpack/configCustomLoaders.js +10 -0
  127. package/packages/client_build_tool/lib/shared/bundler/webpack/cssLoaders.js +16 -0
  128. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/BundleIntegrityReport/index.js +83 -0
  129. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/index.js +119 -0
  130. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/CdnChangePlugin/webpackCustomJsUrlLoader.js +46 -0
  131. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/EFCTemplatePlugin.js +112 -0
  132. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ContributionGuide.md +11 -0
  133. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nFilesEmitPlugin.js +174 -0
  134. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nKeysIdentifer.js +76 -0
  135. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +223 -0
  136. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nSplit.md +95 -0
  137. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/LocaleChunkAssetsStore.js +73 -0
  138. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/ModulesI18nKeysStore.js +88 -0
  139. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/README.md +25 -0
  140. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/constants.js +29 -0
  141. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/createHash.js +24 -0
  142. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/getI18nLoadingRuntimeModule.js +76 -0
  143. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/index.js +39 -0
  144. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/iterateModulesInChunk.js +50 -0
  145. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/optionsHandler.js +68 -0
  146. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/pathCreator.js +23 -0
  147. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/readI18nValues.js +29 -0
  148. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateFileName.js +43 -0
  149. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/templateHashHelpers.js +77 -0
  150. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/classesAndObject.test.js +56 -0
  151. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/conditionalOperation.test.js +154 -0
  152. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/function.test.js +89 -0
  153. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/function2.test.js +71 -0
  154. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/loop.test.js +112 -0
  155. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/minifyBooleanValues.test.js +43 -0
  156. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/minimizeVariableNames.test.js +45 -0
  157. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/promise.test.js +53 -0
  158. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/removeCommentsAndEmptySpace.test.js +13 -0
  159. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/removeUnusedStrings.test.js +14 -0
  160. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/terser/__test__/variableDeclaration.test.js +30 -0
  161. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/collectI18nKeys.js +66 -0
  162. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/getChunkModules.js +13 -0
  163. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/hashUtils.js +19 -0
  164. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/index.js +31 -0
  165. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/utils/propertiesUtils.js +129 -0
  166. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +56 -0
  167. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/__test__/addFilesNamesToManifestJson.test.js +51 -0
  168. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/__test__/createInitialEntries.test.js +95 -0
  169. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/__test__/removeHashFromFileName.test.js +91 -0
  170. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/addFilesNamesToManifestJson.js +24 -0
  171. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createInitialEntries.js +17 -0
  172. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/createManifestJson.js +35 -0
  173. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/findInitialFileNames.js +18 -0
  174. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +46 -0
  175. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/removeHashFromFileName.js +18 -0
  176. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RTLSplitPlugin.js +1 -0
  177. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +192 -0
  178. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +62 -0
  179. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtlCssPlugin.js +84 -0
  180. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/RtrSplit.md +34 -0
  181. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RtlSplitPlugin/replaceCssDirTemplate.js +27 -0
  182. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/RuntimeResourceCleanup/index.js +73 -0
  183. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/classHandling.js +20 -0
  184. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/index.js +78 -0
  185. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/selectorWeightPrefixAdder.js +51 -0
  186. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/SelectorWeightPlugin/windowsModification.js +16 -0
  187. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +110 -0
  188. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +68 -0
  189. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/addHashToFilePath.js +22 -0
  190. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/TPHashMappingPlugin/index.js +55 -0
  191. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/__test__/uglifyCss1.test.js +74 -0
  192. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/__test__/uglifycss.test.js +64 -0
  193. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/__test__/utilities.js +28 -0
  194. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/UglifyCSSPlugin/index.js.js +49 -0
  195. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/ErrorHandler.js +62 -0
  196. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/VariableConversionCollector/index.js +362 -0
  197. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/custom_attribute_plugin/index.js +80 -0
  198. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/emitAsset.js +14 -0
  199. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +57 -0
  200. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/getInitialI18nAssetsArrayStr.js +87 -0
  201. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/classesAndObject.test.js +56 -0
  202. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/conditionalOperation.test.js +154 -0
  203. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/function.test.js +89 -0
  204. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/function2.test.js +71 -0
  205. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/loop.test.js +112 -0
  206. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/minifyBooleanValues.test.js +43 -0
  207. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/minimizeVariableNames.test.js +45 -0
  208. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/promise.test.js +53 -0
  209. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/removeCommentsAndEmptySpace.test.js +13 -0
  210. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/removeUnusedStrings.test.js +14 -0
  211. package/packages/client_build_tool/lib/shared/bundler/webpack/custom_plugins/terser/__test__/variableDeclaration.test.js +30 -0
  212. package/packages/client_build_tool/lib/shared/bundler/webpack/defaultVendorPatternList.js +13 -0
  213. package/packages/client_build_tool/lib/shared/bundler/webpack/devtoolConfig.js +13 -0
  214. package/packages/client_build_tool/lib/shared/bundler/webpack/entryConfig.js +28 -0
  215. package/packages/client_build_tool/lib/shared/bundler/webpack/externals.js +17 -0
  216. package/packages/client_build_tool/lib/shared/bundler/webpack/getCSSLoaders.js +29 -0
  217. package/packages/client_build_tool/lib/shared/bundler/webpack/getFilenameFromModule.js +24 -0
  218. package/packages/client_build_tool/lib/shared/bundler/webpack/jsLoaders.js +17 -0
  219. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/assetLoaders.js +12 -0
  220. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/babelLoaderConfig.js +18 -0
  221. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/checkIsPatternsMatchFilename.js +56 -0
  222. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configHtmlTemplateLoader.js +18 -0
  223. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configPostCssLoader.js +37 -0
  224. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configWebWorkerLoader.js +21 -0
  225. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/configsAssetsLoaders.js +86 -0
  226. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/cssClassNameGenerate.js +60 -0
  227. package/packages/client_build_tool/lib/shared/bundler/webpack/loaderConfigs/getCssLoaderOptions.js +21 -0
  228. package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/miniCssFallBackLoader.js +7 -0
  229. package/packages/client_build_tool/lib/shared/bundler/webpack/loaders/workerLoader.js +133 -0
  230. package/packages/client_build_tool/lib/shared/bundler/webpack/optimizationConfig.js +43 -0
  231. package/packages/client_build_tool/lib/shared/bundler/webpack/outputConfig.js +38 -0
  232. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configBundleAnalyzer.js +40 -0
  233. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configBundleIntegrityReport.js +36 -0
  234. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCSSMinifierPlugin.js +24 -0
  235. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCdnChangePlugin.js +27 -0
  236. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCopyPublicFolders.js +63 -0
  237. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configCustomAttributesPlugin.js +20 -0
  238. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEFCTemplatePlugin.js +46 -0
  239. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configEnvVariables.js +51 -0
  240. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configHtmlWebpackPlugin.js +56 -0
  241. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configI18nSplitPlugin.js +41 -0
  242. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configIgnorePlugin.js +16 -0
  243. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configManifestJsonPlugin.js +32 -0
  244. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configMiniCSSExtractPlugin.js +23 -0
  245. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configProgressPlugin.js +24 -0
  246. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +21 -0
  247. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRtlCssPlugin.js +27 -0
  248. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configRuntimeResourceCleanup.js +31 -0
  249. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configSelectorWeightPlugin.js +28 -0
  250. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configServiceWorkerPlugin.js +40 -0
  251. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configSourceMapPlugin.js +20 -0
  252. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configTPHashMappingPlugin.js +32 -0
  253. package/packages/client_build_tool/lib/shared/bundler/webpack/pluginConfigs/configVariableConversionPlugin.js +25 -0
  254. package/packages/client_build_tool/lib/shared/bundler/webpack/plugins.js +56 -0
  255. package/packages/client_build_tool/lib/shared/bundler/webpack/resolvers.js +82 -0
  256. package/packages/client_build_tool/lib/shared/bundler/webpack/splitChunksConfig.js +116 -0
  257. package/packages/client_build_tool/lib/shared/bundler/webpack/statsConfig.js +30 -0
  258. package/packages/client_build_tool/lib/shared/bundler/webpack/tsLoaders.js +17 -0
  259. package/packages/client_build_tool/lib/shared/bundler/webpack/utils/__test__/getArrayWithDefaultWithCustomEqual.test.js +54 -0
  260. package/packages/client_build_tool/lib/shared/bundler/webpack/utils/__test__/updateArrayWithDefault.test.js +47 -0
  261. package/packages/client_build_tool/lib/shared/bundler/webpack/utils/index.js +26 -0
  262. package/packages/client_build_tool/lib/shared/bundler/webpack/utils/object-manipulation.js +87 -0
  263. package/packages/client_build_tool/lib/shared/bundler/webpack/utils/updateArrayWithDefault.js +34 -0
  264. package/packages/client_build_tool/lib/shared/bundler/webpack/webpackBuild.js +27 -0
  265. package/packages/client_build_tool/lib/shared/bundler/webpack/webpackConfig.js +58 -0
  266. package/packages/client_build_tool/lib/shared/commands-utils/doBasicRequirementCheck.js +17 -0
  267. package/packages/client_build_tool/lib/shared/commands-utils/getCliPath.js +39 -0
  268. package/packages/client_build_tool/lib/shared/commands-utils/index.js +29 -0
  269. package/packages/client_build_tool/lib/shared/commands-utils/log.js +13 -0
  270. package/packages/client_build_tool/lib/shared/commands-utils/readArgsFormCommandLine.js +11 -0
  271. package/packages/client_build_tool/lib/shared/commands-utils/readOptionFormCommandLine.js +11 -0
  272. package/packages/client_build_tool/lib/shared/commands-utils/spawnSyncIO.js +38 -0
  273. package/packages/client_build_tool/lib/shared/constants.js +48 -0
  274. package/packages/client_build_tool/lib/shared/fileUtils/copyFile.js +38 -0
  275. package/packages/client_build_tool/lib/shared/fileUtils/directoryIterator.js +21 -0
  276. package/packages/client_build_tool/lib/shared/fileUtils/watchRun.js +112 -0
  277. package/packages/client_build_tool/lib/shared/postcss/__test__/ignoreTestCases.test.js +80 -0
  278. package/packages/client_build_tool/lib/shared/postcss/__test__/postcss-rtl-all-cases.test.js +119 -0
  279. package/packages/client_build_tool/lib/shared/postcss/__test__/postcssRtl.spec.js +34 -0
  280. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/EmptyPlugin.js +21 -0
  281. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/constants.js +10 -0
  282. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/handleIgnores.js +66 -0
  283. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/index.js +136 -0
  284. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/insertBefore.js +32 -0
  285. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/isPreviouslyProcessed.js +20 -0
  286. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/replaceUtils.js +20 -0
  287. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/separateHoveredSelectorAndNormalSelector.js +24 -0
  288. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/specialCases.js +43 -0
  289. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/HoverActivePlugin/typeCheckUtils.js +52 -0
  290. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/RTLSplitPlugin.js +139 -0
  291. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/SelectorReplace.js +90 -0
  292. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/ValueReplacer.js +57 -0
  293. package/packages/client_build_tool/lib/shared/postcss/custom_postcss_plugins/VariableModificationPlugin/index.js +343 -0
  294. package/packages/client_build_tool/lib/shared/postcss/filterPluginsAllowedForSpecficFile.js +55 -0
  295. package/packages/client_build_tool/lib/shared/postcss/getAllowedPostCssPlugins.js +30 -0
  296. package/packages/client_build_tool/lib/shared/postcss/getSpecificPostCssPlugin.js +58 -0
  297. package/packages/client_build_tool/lib/shared/postcss/runPostCssForCssFile.js +37 -0
  298. package/packages/client_build_tool/lib/shared/pre_process/runPreProcess.js +58 -0
  299. package/packages/client_build_tool/lib/shared/server/configWebpackDevMiddleware.js +41 -0
  300. package/packages/client_build_tool/lib/shared/server/corsHandling.js +30 -0
  301. package/packages/client_build_tool/lib/shared/server/getIp.js +30 -0
  302. package/packages/client_build_tool/lib/shared/server/getServerURL.js +29 -0
  303. package/packages/client_build_tool/lib/shared/server/httpsOptions.js +46 -0
  304. package/packages/client_build_tool/lib/shared/server/initExpressApp.js +19 -0
  305. package/packages/client_build_tool/lib/shared/server/initialHTMLHandling.js +99 -0
  306. package/packages/client_build_tool/lib/shared/server/mockApiHandler.js +60 -0
  307. package/packages/client_build_tool/lib/shared/server/mockServer.js +41 -0
  308. package/packages/client_build_tool/lib/shared/server/serveContextFiles.js +27 -0
  309. package/packages/client_build_tool/lib/shared/server/serverBywebpackDevMiddleware.js +35 -0
  310. package/packages/client_build_tool/lib/shared/server/startHttpServer.js +26 -0
  311. package/packages/client_build_tool/lib/shared/server/startHttpsServer.js +38 -0
  312. package/packages/client_build_tool/lib/shared/server/unwanted/addHttp2Server.js +41 -0
  313. package/packages/client_build_tool/lib/shared/server/unwanted/configWebpackDevMiddleware.js +44 -0
  314. package/packages/client_build_tool/lib/shared/server/unwanted/mockApiSupport.js +19 -0
  315. package/packages/client_build_tool/lib/shared/server/unwanted/websocketMockSetup.js +48 -0
  316. package/packages/client_build_tool/lib/shared/server/urlConcat.js +32 -0
  317. package/packages/client_build_tool/lib/shared/utils/requireLocalOrGlobal.js +81 -0
  318. package/packages/client_build_tool/lib/shared/utils/utils.js +1 -0
  319. package/packages/client_build_tool/lib/shared/utils/versionPrint.js +20 -0
  320. package/packages/client_build_tool/node_modules/history/CHANGES.md +395 -0
  321. package/packages/client_build_tool/node_modules/history/DOMUtils.js +3 -0
  322. package/packages/client_build_tool/node_modules/history/ExecutionEnvironment.js +3 -0
  323. package/packages/client_build_tool/node_modules/history/LICENSE +21 -0
  324. package/packages/client_build_tool/node_modules/history/LocationUtils.js +3 -0
  325. package/packages/client_build_tool/node_modules/history/PathUtils.js +3 -0
  326. package/packages/client_build_tool/node_modules/history/README.md +282 -0
  327. package/packages/client_build_tool/node_modules/history/cjs/history.js +933 -0
  328. package/packages/client_build_tool/node_modules/history/cjs/history.min.js +1 -0
  329. package/packages/client_build_tool/node_modules/history/createBrowserHistory.js +3 -0
  330. package/packages/client_build_tool/node_modules/history/createHashHistory.js +3 -0
  331. package/packages/client_build_tool/node_modules/history/createMemoryHistory.js +3 -0
  332. package/packages/client_build_tool/node_modules/history/createTransitionManager.js +3 -0
  333. package/packages/client_build_tool/node_modules/history/es/DOMUtils.js +7 -0
  334. package/packages/client_build_tool/node_modules/history/es/ExecutionEnvironment.js +7 -0
  335. package/packages/client_build_tool/node_modules/history/es/LocationUtils.js +7 -0
  336. package/packages/client_build_tool/node_modules/history/es/PathUtils.js +7 -0
  337. package/packages/client_build_tool/node_modules/history/es/createBrowserHistory.js +7 -0
  338. package/packages/client_build_tool/node_modules/history/es/createHashHistory.js +7 -0
  339. package/packages/client_build_tool/node_modules/history/es/createMemoryHistory.js +7 -0
  340. package/packages/client_build_tool/node_modules/history/es/createTransitionManager.js +7 -0
  341. package/packages/client_build_tool/node_modules/history/es/warnAboutDeprecatedESMImport.js +35 -0
  342. package/packages/client_build_tool/node_modules/history/esm/history.js +904 -0
  343. package/packages/client_build_tool/node_modules/history/index.js +7 -0
  344. package/packages/client_build_tool/node_modules/history/package.json +120 -0
  345. package/packages/client_build_tool/node_modules/history/umd/history.js +1059 -0
  346. package/packages/client_build_tool/node_modules/history/umd/history.min.js +1 -0
  347. package/packages/client_build_tool/node_modules/history/warnAboutDeprecatedCJSRequire.js +35 -0
  348. package/templates/docs/highlight.js/lib/common.d.ts +3 -0
  349. package/templates/docs/highlight.js/lib/common.js +42 -0
  350. package/templates/docs/highlight.js/lib/core.d.ts +3 -0
  351. package/templates/docs/highlight.js/lib/core.js +2600 -0
  352. package/templates/docs/highlight.js/lib/index.js +198 -0
  353. package/templates/docs/highlight.js/lib/languages/1c.js +537 -0
  354. package/templates/docs/highlight.js/lib/languages/1c.js.js +10 -0
  355. package/templates/docs/highlight.js/lib/languages/abnf.js +82 -0
  356. package/templates/docs/highlight.js/lib/languages/abnf.js.js +10 -0
  357. package/templates/docs/highlight.js/lib/languages/accesslog.js +92 -0
  358. package/templates/docs/highlight.js/lib/languages/accesslog.js.js +10 -0
  359. package/templates/docs/highlight.js/lib/languages/actionscript.js +153 -0
  360. package/templates/docs/highlight.js/lib/languages/actionscript.js.js +10 -0
  361. package/templates/docs/highlight.js/lib/languages/ada.js +265 -0
  362. package/templates/docs/highlight.js/lib/languages/ada.js.js +10 -0
  363. package/templates/docs/highlight.js/lib/languages/angelscript.js +178 -0
  364. package/templates/docs/highlight.js/lib/languages/angelscript.js.js +10 -0
  365. package/templates/docs/highlight.js/lib/languages/apache.js +101 -0
  366. package/templates/docs/highlight.js/lib/languages/apache.js.js +10 -0
  367. package/templates/docs/highlight.js/lib/languages/applescript.js +149 -0
  368. package/templates/docs/highlight.js/lib/languages/applescript.js.js +10 -0
  369. package/templates/docs/highlight.js/lib/languages/arcade.js +361 -0
  370. package/templates/docs/highlight.js/lib/languages/arcade.js.js +10 -0
  371. package/templates/docs/highlight.js/lib/languages/arduino.js +969 -0
  372. package/templates/docs/highlight.js/lib/languages/arduino.js.js +10 -0
  373. package/templates/docs/highlight.js/lib/languages/armasm.js +120 -0
  374. package/templates/docs/highlight.js/lib/languages/armasm.js.js +10 -0
  375. package/templates/docs/highlight.js/lib/languages/asciidoc.js +261 -0
  376. package/templates/docs/highlight.js/lib/languages/asciidoc.js.js +10 -0
  377. package/templates/docs/highlight.js/lib/languages/aspectj.js +230 -0
  378. package/templates/docs/highlight.js/lib/languages/aspectj.js.js +10 -0
  379. package/templates/docs/highlight.js/lib/languages/autohotkey.js +75 -0
  380. package/templates/docs/highlight.js/lib/languages/autohotkey.js.js +10 -0
  381. package/templates/docs/highlight.js/lib/languages/autoit.js +178 -0
  382. package/templates/docs/highlight.js/lib/languages/autoit.js.js +10 -0
  383. package/templates/docs/highlight.js/lib/languages/avrasm.js +78 -0
  384. package/templates/docs/highlight.js/lib/languages/avrasm.js.js +10 -0
  385. package/templates/docs/highlight.js/lib/languages/awk.js +67 -0
  386. package/templates/docs/highlight.js/lib/languages/awk.js.js +10 -0
  387. package/templates/docs/highlight.js/lib/languages/axapta.js +188 -0
  388. package/templates/docs/highlight.js/lib/languages/axapta.js.js +10 -0
  389. package/templates/docs/highlight.js/lib/languages/bash.js +389 -0
  390. package/templates/docs/highlight.js/lib/languages/bash.js.js +10 -0
  391. package/templates/docs/highlight.js/lib/languages/basic.js +229 -0
  392. package/templates/docs/highlight.js/lib/languages/basic.js.js +10 -0
  393. package/templates/docs/highlight.js/lib/languages/bnf.js +38 -0
  394. package/templates/docs/highlight.js/lib/languages/bnf.js.js +10 -0
  395. package/templates/docs/highlight.js/lib/languages/brainfuck.js +54 -0
  396. package/templates/docs/highlight.js/lib/languages/brainfuck.js.js +10 -0
  397. package/templates/docs/highlight.js/lib/languages/c.js +318 -0
  398. package/templates/docs/highlight.js/lib/languages/c.js.js +10 -0
  399. package/templates/docs/highlight.js/lib/languages/cal.js +159 -0
  400. package/templates/docs/highlight.js/lib/languages/cal.js.js +10 -0
  401. package/templates/docs/highlight.js/lib/languages/capnproto.js +99 -0
  402. package/templates/docs/highlight.js/lib/languages/capnproto.js.js +10 -0
  403. package/templates/docs/highlight.js/lib/languages/ceylon.js +139 -0
  404. package/templates/docs/highlight.js/lib/languages/ceylon.js.js +10 -0
  405. package/templates/docs/highlight.js/lib/languages/clean.js +67 -0
  406. package/templates/docs/highlight.js/lib/languages/clean.js.js +10 -0
  407. package/templates/docs/highlight.js/lib/languages/clojure-repl.js +27 -0
  408. package/templates/docs/highlight.js/lib/languages/clojure-repl.js.js +10 -0
  409. package/templates/docs/highlight.js/lib/languages/clojure.js +184 -0
  410. package/templates/docs/highlight.js/lib/languages/clojure.js.js +10 -0
  411. package/templates/docs/highlight.js/lib/languages/cmake.js +63 -0
  412. package/templates/docs/highlight.js/lib/languages/cmake.js.js +10 -0
  413. package/templates/docs/highlight.js/lib/languages/coffeescript.js +365 -0
  414. package/templates/docs/highlight.js/lib/languages/coffeescript.js.js +10 -0
  415. package/templates/docs/highlight.js/lib/languages/coq.js +445 -0
  416. package/templates/docs/highlight.js/lib/languages/coq.js.js +10 -0
  417. package/templates/docs/highlight.js/lib/languages/cos.js +140 -0
  418. package/templates/docs/highlight.js/lib/languages/cos.js.js +10 -0
  419. package/templates/docs/highlight.js/lib/languages/cpp.js +568 -0
  420. package/templates/docs/highlight.js/lib/languages/cpp.js.js +10 -0
  421. package/templates/docs/highlight.js/lib/languages/crmsh.js +100 -0
  422. package/templates/docs/highlight.js/lib/languages/crmsh.js.js +10 -0
  423. package/templates/docs/highlight.js/lib/languages/crystal.js +311 -0
  424. package/templates/docs/highlight.js/lib/languages/crystal.js.js +10 -0
  425. package/templates/docs/highlight.js/lib/languages/csharp.js +400 -0
  426. package/templates/docs/highlight.js/lib/languages/csharp.js.js +10 -0
  427. package/templates/docs/highlight.js/lib/languages/csp.js +57 -0
  428. package/templates/docs/highlight.js/lib/languages/csp.js.js +10 -0
  429. package/templates/docs/highlight.js/lib/languages/css.js +737 -0
  430. package/templates/docs/highlight.js/lib/languages/css.js.js +10 -0
  431. package/templates/docs/highlight.js/lib/languages/d.js +271 -0
  432. package/templates/docs/highlight.js/lib/languages/d.js.js +10 -0
  433. package/templates/docs/highlight.js/lib/languages/dart.js +262 -0
  434. package/templates/docs/highlight.js/lib/languages/dart.js.js +10 -0
  435. package/templates/docs/highlight.js/lib/languages/delphi.js +230 -0
  436. package/templates/docs/highlight.js/lib/languages/delphi.js.js +10 -0
  437. package/templates/docs/highlight.js/lib/languages/diff.js +62 -0
  438. package/templates/docs/highlight.js/lib/languages/diff.js.js +10 -0
  439. package/templates/docs/highlight.js/lib/languages/django.js +75 -0
  440. package/templates/docs/highlight.js/lib/languages/django.js.js +10 -0
  441. package/templates/docs/highlight.js/lib/languages/dns.js +78 -0
  442. package/templates/docs/highlight.js/lib/languages/dns.js.js +10 -0
  443. package/templates/docs/highlight.js/lib/languages/dockerfile.js +44 -0
  444. package/templates/docs/highlight.js/lib/languages/dockerfile.js.js +10 -0
  445. package/templates/docs/highlight.js/lib/languages/dos.js +166 -0
  446. package/templates/docs/highlight.js/lib/languages/dos.js.js +10 -0
  447. package/templates/docs/highlight.js/lib/languages/dsconfig.js +66 -0
  448. package/templates/docs/highlight.js/lib/languages/dsconfig.js.js +10 -0
  449. package/templates/docs/highlight.js/lib/languages/dts.js +157 -0
  450. package/templates/docs/highlight.js/lib/languages/dts.js.js +10 -0
  451. package/templates/docs/highlight.js/lib/languages/dust.js +47 -0
  452. package/templates/docs/highlight.js/lib/languages/dust.js.js +10 -0
  453. package/templates/docs/highlight.js/lib/languages/ebnf.js +53 -0
  454. package/templates/docs/highlight.js/lib/languages/ebnf.js.js +10 -0
  455. package/templates/docs/highlight.js/lib/languages/elixir.js +279 -0
  456. package/templates/docs/highlight.js/lib/languages/elixir.js.js +10 -0
  457. package/templates/docs/highlight.js/lib/languages/elm.js +143 -0
  458. package/templates/docs/highlight.js/lib/languages/elm.js.js +10 -0
  459. package/templates/docs/highlight.js/lib/languages/erb.js +29 -0
  460. package/templates/docs/highlight.js/lib/languages/erb.js.js +10 -0
  461. package/templates/docs/highlight.js/lib/languages/erlang-repl.js +54 -0
  462. package/templates/docs/highlight.js/lib/languages/erlang-repl.js.js +10 -0
  463. package/templates/docs/highlight.js/lib/languages/erlang.js +191 -0
  464. package/templates/docs/highlight.js/lib/languages/erlang.js.js +10 -0
  465. package/templates/docs/highlight.js/lib/languages/excel.js +544 -0
  466. package/templates/docs/highlight.js/lib/languages/excel.js.js +10 -0
  467. package/templates/docs/highlight.js/lib/languages/fix.js +39 -0
  468. package/templates/docs/highlight.js/lib/languages/fix.js.js +10 -0
  469. package/templates/docs/highlight.js/lib/languages/flix.js +79 -0
  470. package/templates/docs/highlight.js/lib/languages/flix.js.js +10 -0
  471. package/templates/docs/highlight.js/lib/languages/fortran.js +573 -0
  472. package/templates/docs/highlight.js/lib/languages/fortran.js.js +10 -0
  473. package/templates/docs/highlight.js/lib/languages/fsharp.js +626 -0
  474. package/templates/docs/highlight.js/lib/languages/fsharp.js.js +10 -0
  475. package/templates/docs/highlight.js/lib/languages/gams.js +181 -0
  476. package/templates/docs/highlight.js/lib/languages/gams.js.js +10 -0
  477. package/templates/docs/highlight.js/lib/languages/gauss.js +306 -0
  478. package/templates/docs/highlight.js/lib/languages/gauss.js.js +10 -0
  479. package/templates/docs/highlight.js/lib/languages/gcode.js +80 -0
  480. package/templates/docs/highlight.js/lib/languages/gcode.js.js +10 -0
  481. package/templates/docs/highlight.js/lib/languages/gherkin.js +49 -0
  482. package/templates/docs/highlight.js/lib/languages/gherkin.js.js +10 -0
  483. package/templates/docs/highlight.js/lib/languages/glsl.js +128 -0
  484. package/templates/docs/highlight.js/lib/languages/glsl.js.js +10 -0
  485. package/templates/docs/highlight.js/lib/languages/gml.js +2816 -0
  486. package/templates/docs/highlight.js/lib/languages/gml.js.js +10 -0
  487. package/templates/docs/highlight.js/lib/languages/go.js +141 -0
  488. package/templates/docs/highlight.js/lib/languages/go.js.js +10 -0
  489. package/templates/docs/highlight.js/lib/languages/golo.js +80 -0
  490. package/templates/docs/highlight.js/lib/languages/golo.js.js +10 -0
  491. package/templates/docs/highlight.js/lib/languages/gradle.js +189 -0
  492. package/templates/docs/highlight.js/lib/languages/gradle.js.js +10 -0
  493. package/templates/docs/highlight.js/lib/languages/graphql.js +78 -0
  494. package/templates/docs/highlight.js/lib/languages/graphql.js.js +10 -0
  495. package/templates/docs/highlight.js/lib/languages/groovy.js +188 -0
  496. package/templates/docs/highlight.js/lib/languages/groovy.js.js +10 -0
  497. package/templates/docs/highlight.js/lib/languages/haml.js +113 -0
  498. package/templates/docs/highlight.js/lib/languages/haml.js.js +10 -0
  499. package/templates/docs/highlight.js/lib/languages/handlebars.js +258 -0
  500. package/templates/docs/highlight.js/lib/languages/handlebars.js.js +10 -0
  501. package/templates/docs/highlight.js/lib/languages/haskell.js +203 -0
  502. package/templates/docs/highlight.js/lib/languages/haskell.js.js +10 -0
  503. package/templates/docs/highlight.js/lib/languages/haxe.js +153 -0
  504. package/templates/docs/highlight.js/lib/languages/haxe.js.js +10 -0
  505. package/templates/docs/highlight.js/lib/languages/hsp.js +59 -0
  506. package/templates/docs/highlight.js/lib/languages/hsp.js.js +10 -0
  507. package/templates/docs/highlight.js/lib/languages/http.js +97 -0
  508. package/templates/docs/highlight.js/lib/languages/http.js.js +10 -0
  509. package/templates/docs/highlight.js/lib/languages/hy.js +137 -0
  510. package/templates/docs/highlight.js/lib/languages/hy.js.js +10 -0
  511. package/templates/docs/highlight.js/lib/languages/inform7.js +69 -0
  512. package/templates/docs/highlight.js/lib/languages/inform7.js.js +10 -0
  513. package/templates/docs/highlight.js/lib/languages/ini.js +121 -0
  514. package/templates/docs/highlight.js/lib/languages/ini.js.js +10 -0
  515. package/templates/docs/highlight.js/lib/languages/irpf90.js +107 -0
  516. package/templates/docs/highlight.js/lib/languages/irpf90.js.js +10 -0
  517. package/templates/docs/highlight.js/lib/languages/isbl.js +3205 -0
  518. package/templates/docs/highlight.js/lib/languages/isbl.js.js +10 -0
  519. package/templates/docs/highlight.js/lib/languages/java.js +288 -0
  520. package/templates/docs/highlight.js/lib/languages/java.js.js +10 -0
  521. package/templates/docs/highlight.js/lib/languages/javascript.js +765 -0
  522. package/templates/docs/highlight.js/lib/languages/javascript.js.js +10 -0
  523. package/templates/docs/highlight.js/lib/languages/jboss-cli.js +63 -0
  524. package/templates/docs/highlight.js/lib/languages/jboss-cli.js.js +10 -0
  525. package/templates/docs/highlight.js/lib/languages/json.js +53 -0
  526. package/templates/docs/highlight.js/lib/languages/json.js.js +10 -0
  527. package/templates/docs/highlight.js/lib/languages/julia-repl.js +50 -0
  528. package/templates/docs/highlight.js/lib/languages/julia-repl.js.js +10 -0
  529. package/templates/docs/highlight.js/lib/languages/julia.js +441 -0
  530. package/templates/docs/highlight.js/lib/languages/julia.js.js +10 -0
  531. package/templates/docs/highlight.js/lib/languages/kotlin.js +285 -0
  532. package/templates/docs/highlight.js/lib/languages/kotlin.js.js +10 -0
  533. package/templates/docs/highlight.js/lib/languages/lasso.js +170 -0
  534. package/templates/docs/highlight.js/lib/languages/lasso.js.js +10 -0
  535. package/templates/docs/highlight.js/lib/languages/latex.js +278 -0
  536. package/templates/docs/highlight.js/lib/languages/latex.js.js +10 -0
  537. package/templates/docs/highlight.js/lib/languages/ldif.js +31 -0
  538. package/templates/docs/highlight.js/lib/languages/ldif.js.js +10 -0
  539. package/templates/docs/highlight.js/lib/languages/leaf.js +49 -0
  540. package/templates/docs/highlight.js/lib/languages/leaf.js.js +10 -0
  541. package/templates/docs/highlight.js/lib/languages/less.js +838 -0
  542. package/templates/docs/highlight.js/lib/languages/less.js.js +10 -0
  543. package/templates/docs/highlight.js/lib/languages/lisp.js +139 -0
  544. package/templates/docs/highlight.js/lib/languages/lisp.js.js +10 -0
  545. package/templates/docs/highlight.js/lib/languages/livecodeserver.js +173 -0
  546. package/templates/docs/highlight.js/lib/languages/livecodeserver.js.js +10 -0
  547. package/templates/docs/highlight.js/lib/languages/livescript.js +377 -0
  548. package/templates/docs/highlight.js/lib/languages/livescript.js.js +10 -0
  549. package/templates/docs/highlight.js/lib/languages/llvm.js +132 -0
  550. package/templates/docs/highlight.js/lib/languages/llvm.js.js +10 -0
  551. package/templates/docs/highlight.js/lib/languages/lsl.js +76 -0
  552. package/templates/docs/highlight.js/lib/languages/lsl.js.js +10 -0
  553. package/templates/docs/highlight.js/lib/languages/lua.js +80 -0
  554. package/templates/docs/highlight.js/lib/languages/lua.js.js +10 -0
  555. package/templates/docs/highlight.js/lib/languages/makefile.js +86 -0
  556. package/templates/docs/highlight.js/lib/languages/makefile.js.js +10 -0
  557. package/templates/docs/highlight.js/lib/languages/markdown.js +241 -0
  558. package/templates/docs/highlight.js/lib/languages/markdown.js.js +10 -0
  559. package/templates/docs/highlight.js/lib/languages/mathematica.js +7358 -0
  560. package/templates/docs/highlight.js/lib/languages/mathematica.js.js +10 -0
  561. package/templates/docs/highlight.js/lib/languages/matlab.js +107 -0
  562. package/templates/docs/highlight.js/lib/languages/matlab.js.js +10 -0
  563. package/templates/docs/highlight.js/lib/languages/maxima.js +414 -0
  564. package/templates/docs/highlight.js/lib/languages/maxima.js.js +10 -0
  565. package/templates/docs/highlight.js/lib/languages/mel.js +235 -0
  566. package/templates/docs/highlight.js/lib/languages/mel.js.js +10 -0
  567. package/templates/docs/highlight.js/lib/languages/mercury.js +107 -0
  568. package/templates/docs/highlight.js/lib/languages/mercury.js.js +10 -0
  569. package/templates/docs/highlight.js/lib/languages/mipsasm.js +104 -0
  570. package/templates/docs/highlight.js/lib/languages/mipsasm.js.js +10 -0
  571. package/templates/docs/highlight.js/lib/languages/mizar.js +27 -0
  572. package/templates/docs/highlight.js/lib/languages/mizar.js.js +10 -0
  573. package/templates/docs/highlight.js/lib/languages/mojolicious.js +36 -0
  574. package/templates/docs/highlight.js/lib/languages/mojolicious.js.js +10 -0
  575. package/templates/docs/highlight.js/lib/languages/monkey.js +183 -0
  576. package/templates/docs/highlight.js/lib/languages/monkey.js.js +10 -0
  577. package/templates/docs/highlight.js/lib/languages/moonscript.js +141 -0
  578. package/templates/docs/highlight.js/lib/languages/moonscript.js.js +10 -0
  579. package/templates/docs/highlight.js/lib/languages/n1ql.js +364 -0
  580. package/templates/docs/highlight.js/lib/languages/n1ql.js.js +10 -0
  581. package/templates/docs/highlight.js/lib/languages/nestedtext.js +83 -0
  582. package/templates/docs/highlight.js/lib/languages/nestedtext.js.js +10 -0
  583. package/templates/docs/highlight.js/lib/languages/nginx.js +153 -0
  584. package/templates/docs/highlight.js/lib/languages/nginx.js.js +10 -0
  585. package/templates/docs/highlight.js/lib/languages/nim.js +185 -0
  586. package/templates/docs/highlight.js/lib/languages/nim.js.js +10 -0
  587. package/templates/docs/highlight.js/lib/languages/nix.js +94 -0
  588. package/templates/docs/highlight.js/lib/languages/nix.js.js +10 -0
  589. package/templates/docs/highlight.js/lib/languages/node-repl.js +33 -0
  590. package/templates/docs/highlight.js/lib/languages/node-repl.js.js +10 -0
  591. package/templates/docs/highlight.js/lib/languages/nsis.js +554 -0
  592. package/templates/docs/highlight.js/lib/languages/nsis.js.js +10 -0
  593. package/templates/docs/highlight.js/lib/languages/objectivec.js +253 -0
  594. package/templates/docs/highlight.js/lib/languages/objectivec.js.js +10 -0
  595. package/templates/docs/highlight.js/lib/languages/ocaml.js +83 -0
  596. package/templates/docs/highlight.js/lib/languages/ocaml.js.js +10 -0
  597. package/templates/docs/highlight.js/lib/languages/openscad.js +77 -0
  598. package/templates/docs/highlight.js/lib/languages/openscad.js.js +10 -0
  599. package/templates/docs/highlight.js/lib/languages/oxygene.js +86 -0
  600. package/templates/docs/highlight.js/lib/languages/oxygene.js.js +10 -0
  601. package/templates/docs/highlight.js/lib/languages/parser3.js +55 -0
  602. package/templates/docs/highlight.js/lib/languages/parser3.js.js +10 -0
  603. package/templates/docs/highlight.js/lib/languages/perl.js +471 -0
  604. package/templates/docs/highlight.js/lib/languages/perl.js.js +10 -0
  605. package/templates/docs/highlight.js/lib/languages/pf.js +60 -0
  606. package/templates/docs/highlight.js/lib/languages/pf.js.js +10 -0
  607. package/templates/docs/highlight.js/lib/languages/pgsql.js +524 -0
  608. package/templates/docs/highlight.js/lib/languages/pgsql.js.js +10 -0
  609. package/templates/docs/highlight.js/lib/languages/php-template.js +54 -0
  610. package/templates/docs/highlight.js/lib/languages/php-template.js.js +10 -0
  611. package/templates/docs/highlight.js/lib/languages/php.js +613 -0
  612. package/templates/docs/highlight.js/lib/languages/php.js.js +10 -0
  613. package/templates/docs/highlight.js/lib/languages/plaintext.js +19 -0
  614. package/templates/docs/highlight.js/lib/languages/plaintext.js.js +10 -0
  615. package/templates/docs/highlight.js/lib/languages/pony.js +89 -0
  616. package/templates/docs/highlight.js/lib/languages/pony.js.js +10 -0
  617. package/templates/docs/highlight.js/lib/languages/powershell.js +316 -0
  618. package/templates/docs/highlight.js/lib/languages/powershell.js.js +10 -0
  619. package/templates/docs/highlight.js/lib/languages/processing.js +434 -0
  620. package/templates/docs/highlight.js/lib/languages/processing.js.js +10 -0
  621. package/templates/docs/highlight.js/lib/languages/profile.js +43 -0
  622. package/templates/docs/highlight.js/lib/languages/profile.js.js +10 -0
  623. package/templates/docs/highlight.js/lib/languages/prolog.js +96 -0
  624. package/templates/docs/highlight.js/lib/languages/prolog.js.js +10 -0
  625. package/templates/docs/highlight.js/lib/languages/properties.js +68 -0
  626. package/templates/docs/highlight.js/lib/languages/properties.js.js +10 -0
  627. package/templates/docs/highlight.js/lib/languages/protobuf.js +79 -0
  628. package/templates/docs/highlight.js/lib/languages/protobuf.js.js +10 -0
  629. package/templates/docs/highlight.js/lib/languages/puppet.js +146 -0
  630. package/templates/docs/highlight.js/lib/languages/puppet.js.js +10 -0
  631. package/templates/docs/highlight.js/lib/languages/purebasic.js +99 -0
  632. package/templates/docs/highlight.js/lib/languages/purebasic.js.js +10 -0
  633. package/templates/docs/highlight.js/lib/languages/python-repl.js +32 -0
  634. package/templates/docs/highlight.js/lib/languages/python-repl.js.js +10 -0
  635. package/templates/docs/highlight.js/lib/languages/python.js +434 -0
  636. package/templates/docs/highlight.js/lib/languages/python.js.js +10 -0
  637. package/templates/docs/highlight.js/lib/languages/q.js +37 -0
  638. package/templates/docs/highlight.js/lib/languages/q.js.js +10 -0
  639. package/templates/docs/highlight.js/lib/languages/qml.js +189 -0
  640. package/templates/docs/highlight.js/lib/languages/qml.js.js +10 -0
  641. package/templates/docs/highlight.js/lib/languages/r.js +257 -0
  642. package/templates/docs/highlight.js/lib/languages/r.js.js +10 -0
  643. package/templates/docs/highlight.js/lib/languages/reasonml.js +308 -0
  644. package/templates/docs/highlight.js/lib/languages/reasonml.js.js +10 -0
  645. package/templates/docs/highlight.js/lib/languages/rib.js +37 -0
  646. package/templates/docs/highlight.js/lib/languages/rib.js.js +10 -0
  647. package/templates/docs/highlight.js/lib/languages/roboconf.js +82 -0
  648. package/templates/docs/highlight.js/lib/languages/roboconf.js.js +10 -0
  649. package/templates/docs/highlight.js/lib/languages/routeros.js +163 -0
  650. package/templates/docs/highlight.js/lib/languages/routeros.js.js +10 -0
  651. package/templates/docs/highlight.js/lib/languages/rsl.js +149 -0
  652. package/templates/docs/highlight.js/lib/languages/rsl.js.js +10 -0
  653. package/templates/docs/highlight.js/lib/languages/ruby.js +448 -0
  654. package/templates/docs/highlight.js/lib/languages/ruby.js.js +10 -0
  655. package/templates/docs/highlight.js/lib/languages/ruleslanguage.js +76 -0
  656. package/templates/docs/highlight.js/lib/languages/ruleslanguage.js.js +10 -0
  657. package/templates/docs/highlight.js/lib/languages/rust.js +304 -0
  658. package/templates/docs/highlight.js/lib/languages/rust.js.js +10 -0
  659. package/templates/docs/highlight.js/lib/languages/sas.js +556 -0
  660. package/templates/docs/highlight.js/lib/languages/sas.js.js +10 -0
  661. package/templates/docs/highlight.js/lib/languages/scala.js +177 -0
  662. package/templates/docs/highlight.js/lib/languages/scala.js.js +10 -0
  663. package/templates/docs/highlight.js/lib/languages/scheme.js +196 -0
  664. package/templates/docs/highlight.js/lib/languages/scheme.js.js +10 -0
  665. package/templates/docs/highlight.js/lib/languages/scilab.js +73 -0
  666. package/templates/docs/highlight.js/lib/languages/scilab.js.js +10 -0
  667. package/templates/docs/highlight.js/lib/languages/scss.js +727 -0
  668. package/templates/docs/highlight.js/lib/languages/scss.js.js +10 -0
  669. package/templates/docs/highlight.js/lib/languages/shell.js +33 -0
  670. package/templates/docs/highlight.js/lib/languages/shell.js.js +10 -0
  671. package/templates/docs/highlight.js/lib/languages/smali.js +125 -0
  672. package/templates/docs/highlight.js/lib/languages/smali.js.js +10 -0
  673. package/templates/docs/highlight.js/lib/languages/smalltalk.js +68 -0
  674. package/templates/docs/highlight.js/lib/languages/smalltalk.js.js +10 -0
  675. package/templates/docs/highlight.js/lib/languages/sml.js +75 -0
  676. package/templates/docs/highlight.js/lib/languages/sml.js.js +10 -0
  677. package/templates/docs/highlight.js/lib/languages/sqf.js +2662 -0
  678. package/templates/docs/highlight.js/lib/languages/sqf.js.js +10 -0
  679. package/templates/docs/highlight.js/lib/languages/sql.js +682 -0
  680. package/templates/docs/highlight.js/lib/languages/sql.js.js +10 -0
  681. package/templates/docs/highlight.js/lib/languages/stan.js +493 -0
  682. package/templates/docs/highlight.js/lib/languages/stan.js.js +10 -0
  683. package/templates/docs/highlight.js/lib/languages/stata.js +53 -0
  684. package/templates/docs/highlight.js/lib/languages/stata.js.js +10 -0
  685. package/templates/docs/highlight.js/lib/languages/step21.js +66 -0
  686. package/templates/docs/highlight.js/lib/languages/step21.js.js +10 -0
  687. package/templates/docs/highlight.js/lib/languages/stylus.js +787 -0
  688. package/templates/docs/highlight.js/lib/languages/stylus.js.js +10 -0
  689. package/templates/docs/highlight.js/lib/languages/subunit.js +43 -0
  690. package/templates/docs/highlight.js/lib/languages/subunit.js.js +10 -0
  691. package/templates/docs/highlight.js/lib/languages/swift.js +860 -0
  692. package/templates/docs/highlight.js/lib/languages/swift.js.js +10 -0
  693. package/templates/docs/highlight.js/lib/languages/taggerscript.js +58 -0
  694. package/templates/docs/highlight.js/lib/languages/taggerscript.js.js +10 -0
  695. package/templates/docs/highlight.js/lib/languages/tap.js +47 -0
  696. package/templates/docs/highlight.js/lib/languages/tap.js.js +10 -0
  697. package/templates/docs/highlight.js/lib/languages/tcl.js +190 -0
  698. package/templates/docs/highlight.js/lib/languages/tcl.js.js +10 -0
  699. package/templates/docs/highlight.js/lib/languages/thrift.js +77 -0
  700. package/templates/docs/highlight.js/lib/languages/thrift.js.js +10 -0
  701. package/templates/docs/highlight.js/lib/languages/tp.js +171 -0
  702. package/templates/docs/highlight.js/lib/languages/tp.js.js +10 -0
  703. package/templates/docs/highlight.js/lib/languages/twig.js +260 -0
  704. package/templates/docs/highlight.js/lib/languages/twig.js.js +10 -0
  705. package/templates/docs/highlight.js/lib/languages/typescript.js +878 -0
  706. package/templates/docs/highlight.js/lib/languages/typescript.js.js +10 -0
  707. package/templates/docs/highlight.js/lib/languages/vala.js +60 -0
  708. package/templates/docs/highlight.js/lib/languages/vala.js.js +10 -0
  709. package/templates/docs/highlight.js/lib/languages/vbnet.js +157 -0
  710. package/templates/docs/highlight.js/lib/languages/vbnet.js.js +10 -0
  711. package/templates/docs/highlight.js/lib/languages/vbscript-html.js +24 -0
  712. package/templates/docs/highlight.js/lib/languages/vbscript-html.js.js +10 -0
  713. package/templates/docs/highlight.js/lib/languages/vbscript.js +220 -0
  714. package/templates/docs/highlight.js/lib/languages/vbscript.js.js +10 -0
  715. package/templates/docs/highlight.js/lib/languages/verilog.js +549 -0
  716. package/templates/docs/highlight.js/lib/languages/verilog.js.js +10 -0
  717. package/templates/docs/highlight.js/lib/languages/vhdl.js +215 -0
  718. package/templates/docs/highlight.js/lib/languages/vhdl.js.js +10 -0
  719. package/templates/docs/highlight.js/lib/languages/vim.js +129 -0
  720. package/templates/docs/highlight.js/lib/languages/vim.js.js +10 -0
  721. package/templates/docs/highlight.js/lib/languages/wasm.js +139 -0
  722. package/templates/docs/highlight.js/lib/languages/wasm.js.js +10 -0
  723. package/templates/docs/highlight.js/lib/languages/wren.js +302 -0
  724. package/templates/docs/highlight.js/lib/languages/wren.js.js +10 -0
  725. package/templates/docs/highlight.js/lib/languages/x86asm.js +153 -0
  726. package/templates/docs/highlight.js/lib/languages/x86asm.js.js +10 -0
  727. package/templates/docs/highlight.js/lib/languages/xl.js +205 -0
  728. package/templates/docs/highlight.js/lib/languages/xl.js.js +10 -0
  729. package/templates/docs/highlight.js/lib/languages/xml.js +241 -0
  730. package/templates/docs/highlight.js/lib/languages/xml.js.js +10 -0
  731. package/templates/docs/highlight.js/lib/languages/xquery.js +359 -0
  732. package/templates/docs/highlight.js/lib/languages/xquery.js.js +10 -0
  733. package/templates/docs/highlight.js/lib/languages/yaml.js +194 -0
  734. package/templates/docs/highlight.js/lib/languages/yaml.js.js +10 -0
  735. package/templates/docs/highlight.js/lib/languages/zephir.js +128 -0
  736. package/templates/docs/highlight.js/lib/languages/zephir.js.js +10 -0
@@ -0,0 +1,2600 @@
1
+ /* eslint-disable no-multi-assign */
2
+
3
+ function deepFreeze(obj) {
4
+ if (obj instanceof Map) {
5
+ obj.clear =
6
+ obj.delete =
7
+ obj.set =
8
+ function () {
9
+ throw new Error('map is read-only');
10
+ };
11
+ } else if (obj instanceof Set) {
12
+ obj.add =
13
+ obj.clear =
14
+ obj.delete =
15
+ function () {
16
+ throw new Error('set is read-only');
17
+ };
18
+ }
19
+
20
+ // Freeze self
21
+ Object.freeze(obj);
22
+
23
+ Object.getOwnPropertyNames(obj).forEach((name) => {
24
+ const prop = obj[name];
25
+ const type = typeof prop;
26
+
27
+ // Freeze prop if it is an object or function and also not already frozen
28
+ if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {
29
+ deepFreeze(prop);
30
+ }
31
+ });
32
+
33
+ return obj;
34
+ }
35
+
36
+ /** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */
37
+ /** @typedef {import('highlight.js').CompiledMode} CompiledMode */
38
+ /** @implements CallbackResponse */
39
+
40
+ class Response {
41
+ /**
42
+ * @param {CompiledMode} mode
43
+ */
44
+ constructor(mode) {
45
+ // eslint-disable-next-line no-undefined
46
+ if (mode.data === undefined) mode.data = {};
47
+
48
+ this.data = mode.data;
49
+ this.isMatchIgnored = false;
50
+ }
51
+
52
+ ignoreMatch() {
53
+ this.isMatchIgnored = true;
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @param {string} value
59
+ * @returns {string}
60
+ */
61
+ function escapeHTML(value) {
62
+ return value
63
+ .replace(/&/g, '&')
64
+ .replace(/</g, '&lt;')
65
+ .replace(/>/g, '&gt;')
66
+ .replace(/"/g, '&quot;')
67
+ .replace(/'/g, '&#x27;');
68
+ }
69
+
70
+ /**
71
+ * performs a shallow merge of multiple objects into one
72
+ *
73
+ * @template T
74
+ * @param {T} original
75
+ * @param {Record<string,any>[]} objects
76
+ * @returns {T} a single new object
77
+ */
78
+ function inherit$1(original, ...objects) {
79
+ /** @type Record<string,any> */
80
+ const result = Object.create(null);
81
+
82
+ for (const key in original) {
83
+ result[key] = original[key];
84
+ }
85
+ objects.forEach(function(obj) {
86
+ for (const key in obj) {
87
+ result[key] = obj[key];
88
+ }
89
+ });
90
+ return /** @type {T} */ (result);
91
+ }
92
+
93
+ /**
94
+ * @typedef {object} Renderer
95
+ * @property {(text: string) => void} addText
96
+ * @property {(node: Node) => void} openNode
97
+ * @property {(node: Node) => void} closeNode
98
+ * @property {() => string} value
99
+ */
100
+
101
+ /** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */
102
+ /** @typedef {{walk: (r: Renderer) => void}} Tree */
103
+ /** */
104
+
105
+ const SPAN_CLOSE = '</span>';
106
+
107
+ /**
108
+ * Determines if a node needs to be wrapped in <span>
109
+ *
110
+ * @param {Node} node */
111
+ const emitsWrappingTags = (node) => {
112
+ // rarely we can have a sublanguage where language is undefined
113
+ // TODO: track down why
114
+ return !!node.scope;
115
+ };
116
+
117
+ /**
118
+ *
119
+ * @param {string} name
120
+ * @param {{prefix:string}} options
121
+ */
122
+ const scopeToCSSClass = (name, { prefix }) => {
123
+ // sub-language
124
+ if (name.startsWith("language:")) {
125
+ return name.replace("language:", "language-");
126
+ }
127
+ // tiered scope: comment.line
128
+ if (name.includes(".")) {
129
+ const pieces = name.split(".");
130
+ return [
131
+ `${prefix}${pieces.shift()}`,
132
+ ...(pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`))
133
+ ].join(" ");
134
+ }
135
+ // simple scope
136
+ return `${prefix}${name}`;
137
+ };
138
+
139
+ /** @type {Renderer} */
140
+ class HTMLRenderer {
141
+ /**
142
+ * Creates a new HTMLRenderer
143
+ *
144
+ * @param {Tree} parseTree - the parse tree (must support `walk` API)
145
+ * @param {{classPrefix: string}} options
146
+ */
147
+ constructor(parseTree, options) {
148
+ this.buffer = "";
149
+ this.classPrefix = options.classPrefix;
150
+ parseTree.walk(this);
151
+ }
152
+
153
+ /**
154
+ * Adds texts to the output stream
155
+ *
156
+ * @param {string} text */
157
+ addText(text) {
158
+ this.buffer += escapeHTML(text);
159
+ }
160
+
161
+ /**
162
+ * Adds a node open to the output stream (if needed)
163
+ *
164
+ * @param {Node} node */
165
+ openNode(node) {
166
+ if (!emitsWrappingTags(node)) return;
167
+
168
+ const className = scopeToCSSClass(node.scope,
169
+ { prefix: this.classPrefix });
170
+ this.span(className);
171
+ }
172
+
173
+ /**
174
+ * Adds a node close to the output stream (if needed)
175
+ *
176
+ * @param {Node} node */
177
+ closeNode(node) {
178
+ if (!emitsWrappingTags(node)) return;
179
+
180
+ this.buffer += SPAN_CLOSE;
181
+ }
182
+
183
+ /**
184
+ * returns the accumulated buffer
185
+ */
186
+ value() {
187
+ return this.buffer;
188
+ }
189
+
190
+ // helpers
191
+
192
+ /**
193
+ * Builds a span element
194
+ *
195
+ * @param {string} className */
196
+ span(className) {
197
+ this.buffer += `<span class="${className}">`;
198
+ }
199
+ }
200
+
201
+ /** @typedef {{scope?: string, language?: string, sublanguage?: boolean, children: Node[]} | string} Node */
202
+ /** @typedef {{scope?: string, language?: string, sublanguage?: boolean, children: Node[]} } DataNode */
203
+ /** @typedef {import('highlight.js').Emitter} Emitter */
204
+ /** */
205
+
206
+ /** @returns {DataNode} */
207
+ const newNode = (opts = {}) => {
208
+ /** @type DataNode */
209
+ const result = { children: [] };
210
+ Object.assign(result, opts);
211
+ return result;
212
+ };
213
+
214
+ class TokenTree {
215
+ constructor() {
216
+ /** @type DataNode */
217
+ this.rootNode = newNode();
218
+ this.stack = [this.rootNode];
219
+ }
220
+
221
+ get top() {
222
+ return this.stack[this.stack.length - 1];
223
+ }
224
+
225
+ get root() { return this.rootNode; }
226
+
227
+ /** @param {Node} node */
228
+ add(node) {
229
+ this.top.children.push(node);
230
+ }
231
+
232
+ /** @param {string} scope */
233
+ openNode(scope) {
234
+ /** @type Node */
235
+ const node = newNode({ scope });
236
+ this.add(node);
237
+ this.stack.push(node);
238
+ }
239
+
240
+ closeNode() {
241
+ if (this.stack.length > 1) {
242
+ return this.stack.pop();
243
+ }
244
+ // eslint-disable-next-line no-undefined
245
+ return undefined;
246
+ }
247
+
248
+ closeAllNodes() {
249
+ while (this.closeNode());
250
+ }
251
+
252
+ toJSON() {
253
+ return JSON.stringify(this.rootNode, null, 4);
254
+ }
255
+
256
+ /**
257
+ * @typedef { import("./html_renderer").Renderer } Renderer
258
+ * @param {Renderer} builder
259
+ */
260
+ walk(builder) {
261
+ // this does not
262
+ return this.constructor._walk(builder, this.rootNode);
263
+ // this works
264
+ // return TokenTree._walk(builder, this.rootNode);
265
+ }
266
+
267
+ /**
268
+ * @param {Renderer} builder
269
+ * @param {Node} node
270
+ */
271
+ static _walk(builder, node) {
272
+ if (typeof node === "string") {
273
+ builder.addText(node);
274
+ } else if (node.children) {
275
+ builder.openNode(node);
276
+ node.children.forEach((child) => this._walk(builder, child));
277
+ builder.closeNode(node);
278
+ }
279
+ return builder;
280
+ }
281
+
282
+ /**
283
+ * @param {Node} node
284
+ */
285
+ static _collapse(node) {
286
+ if (typeof node === "string") return;
287
+ if (!node.children) return;
288
+
289
+ if (node.children.every(el => typeof el === "string")) {
290
+ // node.text = node.children.join("");
291
+ // delete node.children;
292
+ node.children = [node.children.join("")];
293
+ } else {
294
+ node.children.forEach((child) => {
295
+ TokenTree._collapse(child);
296
+ });
297
+ }
298
+ }
299
+ }
300
+
301
+ /**
302
+ Currently this is all private API, but this is the minimal API necessary
303
+ that an Emitter must implement to fully support the parser.
304
+
305
+ Minimal interface:
306
+
307
+ - addText(text)
308
+ - __addSublanguage(emitter, subLanguageName)
309
+ - startScope(scope)
310
+ - endScope()
311
+ - finalize()
312
+ - toHTML()
313
+
314
+ */
315
+
316
+ /**
317
+ * @implements {Emitter}
318
+ */
319
+ class TokenTreeEmitter extends TokenTree {
320
+ /**
321
+ * @param {*} options
322
+ */
323
+ constructor(options) {
324
+ super();
325
+ this.options = options;
326
+ }
327
+
328
+ /**
329
+ * @param {string} text
330
+ */
331
+ addText(text) {
332
+ if (text === "") { return; }
333
+
334
+ this.add(text);
335
+ }
336
+
337
+ /** @param {string} scope */
338
+ startScope(scope) {
339
+ this.openNode(scope);
340
+ }
341
+
342
+ endScope() {
343
+ this.closeNode();
344
+ }
345
+
346
+ /**
347
+ * @param {Emitter & {root: DataNode}} emitter
348
+ * @param {string} name
349
+ */
350
+ __addSublanguage(emitter, name) {
351
+ /** @type DataNode */
352
+ const node = emitter.root;
353
+ if (name) node.scope = `language:${name}`;
354
+
355
+ this.add(node);
356
+ }
357
+
358
+ toHTML() {
359
+ const renderer = new HTMLRenderer(this, this.options);
360
+ return renderer.value();
361
+ }
362
+
363
+ finalize() {
364
+ this.closeAllNodes();
365
+ return true;
366
+ }
367
+ }
368
+
369
+ /**
370
+ * @param {string} value
371
+ * @returns {RegExp}
372
+ * */
373
+
374
+ /**
375
+ * @param {RegExp | string } re
376
+ * @returns {string}
377
+ */
378
+ function source(re) {
379
+ if (!re) return null;
380
+ if (typeof re === "string") return re;
381
+
382
+ return re.source;
383
+ }
384
+
385
+ /**
386
+ * @param {RegExp | string } re
387
+ * @returns {string}
388
+ */
389
+ function lookahead(re) {
390
+ return concat('(?=', re, ')');
391
+ }
392
+
393
+ /**
394
+ * @param {RegExp | string } re
395
+ * @returns {string}
396
+ */
397
+ function anyNumberOfTimes(re) {
398
+ return concat('(?:', re, ')*');
399
+ }
400
+
401
+ /**
402
+ * @param {RegExp | string } re
403
+ * @returns {string}
404
+ */
405
+ function optional(re) {
406
+ return concat('(?:', re, ')?');
407
+ }
408
+
409
+ /**
410
+ * @param {...(RegExp | string) } args
411
+ * @returns {string}
412
+ */
413
+ function concat(...args) {
414
+ const joined = args.map((x) => source(x)).join("");
415
+ return joined;
416
+ }
417
+
418
+ /**
419
+ * @param { Array<string | RegExp | Object> } args
420
+ * @returns {object}
421
+ */
422
+ function stripOptionsFromArgs(args) {
423
+ const opts = args[args.length - 1];
424
+
425
+ if (typeof opts === 'object' && opts.constructor === Object) {
426
+ args.splice(args.length - 1, 1);
427
+ return opts;
428
+ } else {
429
+ return {};
430
+ }
431
+ }
432
+
433
+ /** @typedef { {capture?: boolean} } RegexEitherOptions */
434
+
435
+ /**
436
+ * Any of the passed expresssions may match
437
+ *
438
+ * Creates a huge this | this | that | that match
439
+ * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args
440
+ * @returns {string}
441
+ */
442
+ function either(...args) {
443
+ /** @type { object & {capture?: boolean} } */
444
+ const opts = stripOptionsFromArgs(args);
445
+ const joined = '('
446
+ + (opts.capture ? "" : "?:")
447
+ + args.map((x) => source(x)).join("|") + ")";
448
+ return joined;
449
+ }
450
+
451
+ /**
452
+ * @param {RegExp | string} re
453
+ * @returns {number}
454
+ */
455
+ function countMatchGroups(re) {
456
+ return (new RegExp(re.toString() + '|')).exec('').length - 1;
457
+ }
458
+
459
+ /**
460
+ * Does lexeme start with a regular expression match at the beginning
461
+ * @param {RegExp} re
462
+ * @param {string} lexeme
463
+ */
464
+ function startsWith(re, lexeme) {
465
+ const match = re && re.exec(lexeme);
466
+ return match && match.index === 0;
467
+ }
468
+
469
+ // BACKREF_RE matches an open parenthesis or backreference. To avoid
470
+ // an incorrect parse, it additionally matches the following:
471
+ // - [...] elements, where the meaning of parentheses and escapes change
472
+ // - other escape sequences, so we do not misparse escape sequences as
473
+ // interesting elements
474
+ // - non-matching or lookahead parentheses, which do not capture. These
475
+ // follow the '(' with a '?'.
476
+ const BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
477
+
478
+ // **INTERNAL** Not intended for outside usage
479
+ // join logically computes regexps.join(separator), but fixes the
480
+ // backreferences so they continue to match.
481
+ // it also places each individual regular expression into it's own
482
+ // match group, keeping track of the sequencing of those match groups
483
+ // is currently an exercise for the caller. :-)
484
+ /**
485
+ * @param {(string | RegExp)[]} regexps
486
+ * @param {{joinWith: string}} opts
487
+ * @returns {string}
488
+ */
489
+ function _rewriteBackreferences(regexps, { joinWith }) {
490
+ let numCaptures = 0;
491
+
492
+ return regexps.map((regex) => {
493
+ numCaptures += 1;
494
+ const offset = numCaptures;
495
+ let re = source(regex);
496
+ let out = '';
497
+
498
+ while (re.length > 0) {
499
+ const match = BACKREF_RE.exec(re);
500
+ if (!match) {
501
+ out += re;
502
+ break;
503
+ }
504
+ out += re.substring(0, match.index);
505
+ re = re.substring(match.index + match[0].length);
506
+ if (match[0][0] === '\\' && match[1]) {
507
+ // Adjust the backreference.
508
+ out += '\\' + String(Number(match[1]) + offset);
509
+ } else {
510
+ out += match[0];
511
+ if (match[0] === '(') {
512
+ numCaptures++;
513
+ }
514
+ }
515
+ }
516
+ return out;
517
+ }).map(re => `(${re})`).join(joinWith);
518
+ }
519
+
520
+ /** @typedef {import('highlight.js').Mode} Mode */
521
+ /** @typedef {import('highlight.js').ModeCallback} ModeCallback */
522
+
523
+ // Common regexps
524
+ const MATCH_NOTHING_RE = /\b\B/;
525
+ const IDENT_RE = '[a-zA-Z]\\w*';
526
+ const UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\w*';
527
+ const NUMBER_RE = '\\b\\d+(\\.\\d+)?';
528
+ const C_NUMBER_RE = '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float
529
+ const BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b...
530
+ const RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~';
531
+
532
+ /**
533
+ * @param { Partial<Mode> & {binary?: string | RegExp} } opts
534
+ */
535
+ const SHEBANG = (opts = {}) => {
536
+ const beginShebang = /^#![ ]*\//;
537
+ if (opts.binary) {
538
+ opts.begin = concat(
539
+ beginShebang,
540
+ /.*\b/,
541
+ opts.binary,
542
+ /\b.*/);
543
+ }
544
+ return inherit$1({
545
+ scope: 'meta',
546
+ begin: beginShebang,
547
+ end: /$/,
548
+ relevance: 0,
549
+ /** @type {ModeCallback} */
550
+ "on:begin": (m, resp) => {
551
+ if (m.index !== 0) resp.ignoreMatch();
552
+ }
553
+ }, opts);
554
+ };
555
+
556
+ // Common modes
557
+ const BACKSLASH_ESCAPE = {
558
+ begin: '\\\\[\\s\\S]', relevance: 0
559
+ };
560
+ const APOS_STRING_MODE = {
561
+ scope: 'string',
562
+ begin: '\'',
563
+ end: '\'',
564
+ illegal: '\\n',
565
+ contains: [BACKSLASH_ESCAPE]
566
+ };
567
+ const QUOTE_STRING_MODE = {
568
+ scope: 'string',
569
+ begin: '"',
570
+ end: '"',
571
+ illegal: '\\n',
572
+ contains: [BACKSLASH_ESCAPE]
573
+ };
574
+ const PHRASAL_WORDS_MODE = {
575
+ begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
576
+ };
577
+ /**
578
+ * Creates a comment mode
579
+ *
580
+ * @param {string | RegExp} begin
581
+ * @param {string | RegExp} end
582
+ * @param {Mode | {}} [modeOptions]
583
+ * @returns {Partial<Mode>}
584
+ */
585
+ const COMMENT = function(begin, end, modeOptions = {}) {
586
+ const mode = inherit$1(
587
+ {
588
+ scope: 'comment',
589
+ begin,
590
+ end,
591
+ contains: []
592
+ },
593
+ modeOptions
594
+ );
595
+ mode.contains.push({
596
+ scope: 'doctag',
597
+ // hack to avoid the space from being included. the space is necessary to
598
+ // match here to prevent the plain text rule below from gobbling up doctags
599
+ begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',
600
+ end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
601
+ excludeBegin: true,
602
+ relevance: 0
603
+ });
604
+ const ENGLISH_WORD = either(
605
+ // list of common 1 and 2 letter words in English
606
+ "I",
607
+ "a",
608
+ "is",
609
+ "so",
610
+ "us",
611
+ "to",
612
+ "at",
613
+ "if",
614
+ "in",
615
+ "it",
616
+ "on",
617
+ // note: this is not an exhaustive list of contractions, just popular ones
618
+ /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, // contractions - can't we'd they're let's, etc
619
+ /[A-Za-z]+[-][a-z]+/, // `no-way`, etc.
620
+ /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences
621
+ );
622
+ // looking like plain text, more likely to be a comment
623
+ mode.contains.push(
624
+ {
625
+ // TODO: how to include ", (, ) without breaking grammars that use these for
626
+ // comment delimiters?
627
+ // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
628
+ // ---
629
+
630
+ // this tries to find sequences of 3 english words in a row (without any
631
+ // "programming" type syntax) this gives us a strong signal that we've
632
+ // TRULY found a comment - vs perhaps scanning with the wrong language.
633
+ // It's possible to find something that LOOKS like the start of the
634
+ // comment - but then if there is no readable text - good chance it is a
635
+ // false match and not a comment.
636
+ //
637
+ // for a visual example please see:
638
+ // https://github.com/highlightjs/highlight.js/issues/2827
639
+
640
+ begin: concat(
641
+ /[ ]+/, // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
642
+ '(',
643
+ ENGLISH_WORD,
644
+ /[.]?[:]?([.][ ]|[ ])/,
645
+ '){3}') // look for 3 words in a row
646
+ }
647
+ );
648
+ return mode;
649
+ };
650
+ const C_LINE_COMMENT_MODE = COMMENT('//', '$');
651
+ const C_BLOCK_COMMENT_MODE = COMMENT('/\\*', '\\*/');
652
+ const HASH_COMMENT_MODE = COMMENT('#', '$');
653
+ const NUMBER_MODE = {
654
+ scope: 'number',
655
+ begin: NUMBER_RE,
656
+ relevance: 0
657
+ };
658
+ const C_NUMBER_MODE = {
659
+ scope: 'number',
660
+ begin: C_NUMBER_RE,
661
+ relevance: 0
662
+ };
663
+ const BINARY_NUMBER_MODE = {
664
+ scope: 'number',
665
+ begin: BINARY_NUMBER_RE,
666
+ relevance: 0
667
+ };
668
+ const REGEXP_MODE = {
669
+ // this outer rule makes sure we actually have a WHOLE regex and not simply
670
+ // an expression such as:
671
+ //
672
+ // 3 / something
673
+ //
674
+ // (which will then blow up when regex's `illegal` sees the newline)
675
+ begin: /(?=\/[^/\n]*\/)/,
676
+ contains: [{
677
+ scope: 'regexp',
678
+ begin: /\//,
679
+ end: /\/[gimuy]*/,
680
+ illegal: /\n/,
681
+ contains: [
682
+ BACKSLASH_ESCAPE,
683
+ {
684
+ begin: /\[/,
685
+ end: /\]/,
686
+ relevance: 0,
687
+ contains: [BACKSLASH_ESCAPE]
688
+ }
689
+ ]
690
+ }]
691
+ };
692
+ const TITLE_MODE = {
693
+ scope: 'title',
694
+ begin: IDENT_RE,
695
+ relevance: 0
696
+ };
697
+ const UNDERSCORE_TITLE_MODE = {
698
+ scope: 'title',
699
+ begin: UNDERSCORE_IDENT_RE,
700
+ relevance: 0
701
+ };
702
+ const METHOD_GUARD = {
703
+ // excludes method names from keyword processing
704
+ begin: '\\.\\s*' + UNDERSCORE_IDENT_RE,
705
+ relevance: 0
706
+ };
707
+
708
+ /**
709
+ * Adds end same as begin mechanics to a mode
710
+ *
711
+ * Your mode must include at least a single () match group as that first match
712
+ * group is what is used for comparison
713
+ * @param {Partial<Mode>} mode
714
+ */
715
+ const END_SAME_AS_BEGIN = function(mode) {
716
+ return Object.assign(mode,
717
+ {
718
+ /** @type {ModeCallback} */
719
+ 'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },
720
+ /** @type {ModeCallback} */
721
+ 'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }
722
+ });
723
+ };
724
+
725
+ var MODES = /*#__PURE__*/Object.freeze({
726
+ __proto__: null,
727
+ MATCH_NOTHING_RE: MATCH_NOTHING_RE,
728
+ IDENT_RE: IDENT_RE,
729
+ UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,
730
+ NUMBER_RE: NUMBER_RE,
731
+ C_NUMBER_RE: C_NUMBER_RE,
732
+ BINARY_NUMBER_RE: BINARY_NUMBER_RE,
733
+ RE_STARTERS_RE: RE_STARTERS_RE,
734
+ SHEBANG: SHEBANG,
735
+ BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,
736
+ APOS_STRING_MODE: APOS_STRING_MODE,
737
+ QUOTE_STRING_MODE: QUOTE_STRING_MODE,
738
+ PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,
739
+ COMMENT: COMMENT,
740
+ C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,
741
+ C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,
742
+ HASH_COMMENT_MODE: HASH_COMMENT_MODE,
743
+ NUMBER_MODE: NUMBER_MODE,
744
+ C_NUMBER_MODE: C_NUMBER_MODE,
745
+ BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,
746
+ REGEXP_MODE: REGEXP_MODE,
747
+ TITLE_MODE: TITLE_MODE,
748
+ UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE,
749
+ METHOD_GUARD: METHOD_GUARD,
750
+ END_SAME_AS_BEGIN: END_SAME_AS_BEGIN
751
+ });
752
+
753
+ /**
754
+ @typedef {import('highlight.js').CallbackResponse} CallbackResponse
755
+ @typedef {import('highlight.js').CompilerExt} CompilerExt
756
+ */
757
+
758
+ // Grammar extensions / plugins
759
+ // See: https://github.com/highlightjs/highlight.js/issues/2833
760
+
761
+ // Grammar extensions allow "syntactic sugar" to be added to the grammar modes
762
+ // without requiring any underlying changes to the compiler internals.
763
+
764
+ // `compileMatch` being the perfect small example of now allowing a grammar
765
+ // author to write `match` when they desire to match a single expression rather
766
+ // than being forced to use `begin`. The extension then just moves `match` into
767
+ // `begin` when it runs. Ie, no features have been added, but we've just made
768
+ // the experience of writing (and reading grammars) a little bit nicer.
769
+
770
+ // ------
771
+
772
+ // TODO: We need negative look-behind support to do this properly
773
+ /**
774
+ * Skip a match if it has a preceding dot
775
+ *
776
+ * This is used for `beginKeywords` to prevent matching expressions such as
777
+ * `bob.keyword.do()`. The mode compiler automatically wires this up as a
778
+ * special _internal_ 'on:begin' callback for modes with `beginKeywords`
779
+ * @param {RegExpMatchArray} match
780
+ * @param {CallbackResponse} response
781
+ */
782
+ function skipIfHasPrecedingDot(match, response) {
783
+ const before = match.input[match.index - 1];
784
+ if (before === ".") {
785
+ response.ignoreMatch();
786
+ }
787
+ }
788
+
789
+ /**
790
+ *
791
+ * @type {CompilerExt}
792
+ */
793
+ function scopeClassName(mode, _parent) {
794
+ // eslint-disable-next-line no-undefined
795
+ if (mode.className !== undefined) {
796
+ mode.scope = mode.className;
797
+ delete mode.className;
798
+ }
799
+ }
800
+
801
+ /**
802
+ * `beginKeywords` syntactic sugar
803
+ * @type {CompilerExt}
804
+ */
805
+ function beginKeywords(mode, parent) {
806
+ if (!parent) return;
807
+ if (!mode.beginKeywords) return;
808
+
809
+ // for languages with keywords that include non-word characters checking for
810
+ // a word boundary is not sufficient, so instead we check for a word boundary
811
+ // or whitespace - this does no harm in any case since our keyword engine
812
+ // doesn't allow spaces in keywords anyways and we still check for the boundary
813
+ // first
814
+ mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\.)(?=\\b|\\s)';
815
+ mode.__beforeBegin = skipIfHasPrecedingDot;
816
+ mode.keywords = mode.keywords || mode.beginKeywords;
817
+ delete mode.beginKeywords;
818
+
819
+ // prevents double relevance, the keywords themselves provide
820
+ // relevance, the mode doesn't need to double it
821
+ // eslint-disable-next-line no-undefined
822
+ if (mode.relevance === undefined) mode.relevance = 0;
823
+ }
824
+
825
+ /**
826
+ * Allow `illegal` to contain an array of illegal values
827
+ * @type {CompilerExt}
828
+ */
829
+ function compileIllegal(mode, _parent) {
830
+ if (!Array.isArray(mode.illegal)) return;
831
+
832
+ mode.illegal = either(...mode.illegal);
833
+ }
834
+
835
+ /**
836
+ * `match` to match a single expression for readability
837
+ * @type {CompilerExt}
838
+ */
839
+ function compileMatch(mode, _parent) {
840
+ if (!mode.match) return;
841
+ if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
842
+
843
+ mode.begin = mode.match;
844
+ delete mode.match;
845
+ }
846
+
847
+ /**
848
+ * provides the default 1 relevance to all modes
849
+ * @type {CompilerExt}
850
+ */
851
+ function compileRelevance(mode, _parent) {
852
+ // eslint-disable-next-line no-undefined
853
+ if (mode.relevance === undefined) mode.relevance = 1;
854
+ }
855
+
856
+ // allow beforeMatch to act as a "qualifier" for the match
857
+ // the full match begin must be [beforeMatch][begin]
858
+ const beforeMatchExt = (mode, parent) => {
859
+ if (!mode.beforeMatch) return;
860
+ // starts conflicts with endsParent which we need to make sure the child
861
+ // rule is not matched multiple times
862
+ if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
863
+
864
+ const originalMode = Object.assign({}, mode);
865
+ Object.keys(mode).forEach((key) => { delete mode[key]; });
866
+
867
+ mode.keywords = originalMode.keywords;
868
+ mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));
869
+ mode.starts = {
870
+ relevance: 0,
871
+ contains: [
872
+ Object.assign(originalMode, { endsParent: true })
873
+ ]
874
+ };
875
+ mode.relevance = 0;
876
+
877
+ delete originalMode.beforeMatch;
878
+ };
879
+
880
+ // keywords that should have no default relevance value
881
+ const COMMON_KEYWORDS = [
882
+ 'of',
883
+ 'and',
884
+ 'for',
885
+ 'in',
886
+ 'not',
887
+ 'or',
888
+ 'if',
889
+ 'then',
890
+ 'parent', // common variable name
891
+ 'list', // common variable name
892
+ 'value' // common variable name
893
+ ];
894
+
895
+ const DEFAULT_KEYWORD_SCOPE = "keyword";
896
+
897
+ /**
898
+ * Given raw keywords from a language definition, compile them.
899
+ *
900
+ * @param {string | Record<string,string|string[]> | Array<string>} rawKeywords
901
+ * @param {boolean} caseInsensitive
902
+ */
903
+ function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
904
+ /** @type {import("highlight.js/private").KeywordDict} */
905
+ const compiledKeywords = Object.create(null);
906
+
907
+ // input can be a string of keywords, an array of keywords, or a object with
908
+ // named keys representing scopeName (which can then point to a string or array)
909
+ if (typeof rawKeywords === 'string') {
910
+ compileList(scopeName, rawKeywords.split(" "));
911
+ } else if (Array.isArray(rawKeywords)) {
912
+ compileList(scopeName, rawKeywords);
913
+ } else {
914
+ Object.keys(rawKeywords).forEach(function(scopeName) {
915
+ // collapse all our objects back into the parent object
916
+ Object.assign(
917
+ compiledKeywords,
918
+ compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName)
919
+ );
920
+ });
921
+ }
922
+ return compiledKeywords;
923
+
924
+ // ---
925
+
926
+ /**
927
+ * Compiles an individual list of keywords
928
+ *
929
+ * Ex: "for if when while|5"
930
+ *
931
+ * @param {string} scopeName
932
+ * @param {Array<string>} keywordList
933
+ */
934
+ function compileList(scopeName, keywordList) {
935
+ if (caseInsensitive) {
936
+ keywordList = keywordList.map(x => x.toLowerCase());
937
+ }
938
+ keywordList.forEach(function(keyword) {
939
+ const pair = keyword.split('|');
940
+ compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];
941
+ });
942
+ }
943
+ }
944
+
945
+ /**
946
+ * Returns the proper score for a given keyword
947
+ *
948
+ * Also takes into account comment keywords, which will be scored 0 UNLESS
949
+ * another score has been manually assigned.
950
+ * @param {string} keyword
951
+ * @param {string} [providedScore]
952
+ */
953
+ function scoreForKeyword(keyword, providedScore) {
954
+ // manual scores always win over common keywords
955
+ // so you can force a score of 1 if you really insist
956
+ if (providedScore) {
957
+ return Number(providedScore);
958
+ }
959
+
960
+ return commonKeyword(keyword) ? 0 : 1;
961
+ }
962
+
963
+ /**
964
+ * Determines if a given keyword is common or not
965
+ *
966
+ * @param {string} keyword */
967
+ function commonKeyword(keyword) {
968
+ return COMMON_KEYWORDS.includes(keyword.toLowerCase());
969
+ }
970
+
971
+ /*
972
+
973
+ For the reasoning behind this please see:
974
+ https://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419
975
+
976
+ */
977
+
978
+ /**
979
+ * @type {Record<string, boolean>}
980
+ */
981
+ const seenDeprecations = {};
982
+
983
+ /**
984
+ * @param {string} message
985
+ */
986
+ const error = (message) => {
987
+ console.error(message);
988
+ };
989
+
990
+ /**
991
+ * @param {string} message
992
+ * @param {any} args
993
+ */
994
+ const warn = (message, ...args) => {
995
+ console.log(`WARN: ${message}`, ...args);
996
+ };
997
+
998
+ /**
999
+ * @param {string} version
1000
+ * @param {string} message
1001
+ */
1002
+ const deprecated = (version, message) => {
1003
+ if (seenDeprecations[`${version}/${message}`]) return;
1004
+
1005
+ console.log(`Deprecated as of ${version}. ${message}`);
1006
+ seenDeprecations[`${version}/${message}`] = true;
1007
+ };
1008
+
1009
+ /* eslint-disable no-throw-literal */
1010
+
1011
+ /**
1012
+ @typedef {import('highlight.js').CompiledMode} CompiledMode
1013
+ */
1014
+
1015
+ const MultiClassError = new Error();
1016
+
1017
+ /**
1018
+ * Renumbers labeled scope names to account for additional inner match
1019
+ * groups that otherwise would break everything.
1020
+ *
1021
+ * Lets say we 3 match scopes:
1022
+ *
1023
+ * { 1 => ..., 2 => ..., 3 => ... }
1024
+ *
1025
+ * So what we need is a clean match like this:
1026
+ *
1027
+ * (a)(b)(c) => [ "a", "b", "c" ]
1028
+ *
1029
+ * But this falls apart with inner match groups:
1030
+ *
1031
+ * (a)(((b)))(c) => ["a", "b", "b", "b", "c" ]
1032
+ *
1033
+ * Our scopes are now "out of alignment" and we're repeating `b` 3 times.
1034
+ * What needs to happen is the numbers are remapped:
1035
+ *
1036
+ * { 1 => ..., 2 => ..., 5 => ... }
1037
+ *
1038
+ * We also need to know that the ONLY groups that should be output
1039
+ * are 1, 2, and 5. This function handles this behavior.
1040
+ *
1041
+ * @param {CompiledMode} mode
1042
+ * @param {Array<RegExp | string>} regexes
1043
+ * @param {{key: "beginScope"|"endScope"}} opts
1044
+ */
1045
+ function remapScopeNames(mode, regexes, { key }) {
1046
+ let offset = 0;
1047
+ const scopeNames = mode[key];
1048
+ /** @type Record<number,boolean> */
1049
+ const emit = {};
1050
+ /** @type Record<number,string> */
1051
+ const positions = {};
1052
+
1053
+ for (let i = 1; i <= regexes.length; i++) {
1054
+ positions[i + offset] = scopeNames[i];
1055
+ emit[i + offset] = true;
1056
+ offset += countMatchGroups(regexes[i - 1]);
1057
+ }
1058
+ // we use _emit to keep track of which match groups are "top-level" to avoid double
1059
+ // output from inside match groups
1060
+ mode[key] = positions;
1061
+ mode[key]._emit = emit;
1062
+ mode[key]._multi = true;
1063
+ }
1064
+
1065
+ /**
1066
+ * @param {CompiledMode} mode
1067
+ */
1068
+ function beginMultiClass(mode) {
1069
+ if (!Array.isArray(mode.begin)) return;
1070
+
1071
+ if (mode.skip || mode.excludeBegin || mode.returnBegin) {
1072
+ error("skip, excludeBegin, returnBegin not compatible with beginScope: {}");
1073
+ throw MultiClassError;
1074
+ }
1075
+
1076
+ if (typeof mode.beginScope !== "object" || mode.beginScope === null) {
1077
+ error("beginScope must be object");
1078
+ throw MultiClassError;
1079
+ }
1080
+
1081
+ remapScopeNames(mode, mode.begin, { key: "beginScope" });
1082
+ mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" });
1083
+ }
1084
+
1085
+ /**
1086
+ * @param {CompiledMode} mode
1087
+ */
1088
+ function endMultiClass(mode) {
1089
+ if (!Array.isArray(mode.end)) return;
1090
+
1091
+ if (mode.skip || mode.excludeEnd || mode.returnEnd) {
1092
+ error("skip, excludeEnd, returnEnd not compatible with endScope: {}");
1093
+ throw MultiClassError;
1094
+ }
1095
+
1096
+ if (typeof mode.endScope !== "object" || mode.endScope === null) {
1097
+ error("endScope must be object");
1098
+ throw MultiClassError;
1099
+ }
1100
+
1101
+ remapScopeNames(mode, mode.end, { key: "endScope" });
1102
+ mode.end = _rewriteBackreferences(mode.end, { joinWith: "" });
1103
+ }
1104
+
1105
+ /**
1106
+ * this exists only to allow `scope: {}` to be used beside `match:`
1107
+ * Otherwise `beginScope` would necessary and that would look weird
1108
+
1109
+ {
1110
+ match: [ /def/, /\w+/ ]
1111
+ scope: { 1: "keyword" , 2: "title" }
1112
+ }
1113
+
1114
+ * @param {CompiledMode} mode
1115
+ */
1116
+ function scopeSugar(mode) {
1117
+ if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) {
1118
+ mode.beginScope = mode.scope;
1119
+ delete mode.scope;
1120
+ }
1121
+ }
1122
+
1123
+ /**
1124
+ * @param {CompiledMode} mode
1125
+ */
1126
+ function MultiClass(mode) {
1127
+ scopeSugar(mode);
1128
+
1129
+ if (typeof mode.beginScope === "string") {
1130
+ mode.beginScope = { _wrap: mode.beginScope };
1131
+ }
1132
+ if (typeof mode.endScope === "string") {
1133
+ mode.endScope = { _wrap: mode.endScope };
1134
+ }
1135
+
1136
+ beginMultiClass(mode);
1137
+ endMultiClass(mode);
1138
+ }
1139
+
1140
+ /**
1141
+ @typedef {import('highlight.js').Mode} Mode
1142
+ @typedef {import('highlight.js').CompiledMode} CompiledMode
1143
+ @typedef {import('highlight.js').Language} Language
1144
+ @typedef {import('highlight.js').HLJSPlugin} HLJSPlugin
1145
+ @typedef {import('highlight.js').CompiledLanguage} CompiledLanguage
1146
+ */
1147
+
1148
+ // compilation
1149
+
1150
+ /**
1151
+ * Compiles a language definition result
1152
+ *
1153
+ * Given the raw result of a language definition (Language), compiles this so
1154
+ * that it is ready for highlighting code.
1155
+ * @param {Language} language
1156
+ * @returns {CompiledLanguage}
1157
+ */
1158
+ function compileLanguage(language) {
1159
+ /**
1160
+ * Builds a regex with the case sensitivity of the current language
1161
+ *
1162
+ * @param {RegExp | string} value
1163
+ * @param {boolean} [global]
1164
+ */
1165
+ function langRe(value, global) {
1166
+ return new RegExp(
1167
+ source(value),
1168
+ 'm'
1169
+ + (language.case_insensitive ? 'i' : '')
1170
+ + (language.unicodeRegex ? 'u' : '')
1171
+ + (global ? 'g' : '')
1172
+ );
1173
+ }
1174
+
1175
+ /**
1176
+ Stores multiple regular expressions and allows you to quickly search for
1177
+ them all in a string simultaneously - returning the first match. It does
1178
+ this by creating a huge (a|b|c) regex - each individual item wrapped with ()
1179
+ and joined by `|` - using match groups to track position. When a match is
1180
+ found checking which position in the array has content allows us to figure
1181
+ out which of the original regexes / match groups triggered the match.
1182
+
1183
+ The match object itself (the result of `Regex.exec`) is returned but also
1184
+ enhanced by merging in any meta-data that was registered with the regex.
1185
+ This is how we keep track of which mode matched, and what type of rule
1186
+ (`illegal`, `begin`, end, etc).
1187
+ */
1188
+ class MultiRegex {
1189
+ constructor() {
1190
+ this.matchIndexes = {};
1191
+ // @ts-ignore
1192
+ this.regexes = [];
1193
+ this.matchAt = 1;
1194
+ this.position = 0;
1195
+ }
1196
+
1197
+ // @ts-ignore
1198
+ addRule(re, opts) {
1199
+ opts.position = this.position++;
1200
+ // @ts-ignore
1201
+ this.matchIndexes[this.matchAt] = opts;
1202
+ this.regexes.push([opts, re]);
1203
+ this.matchAt += countMatchGroups(re) + 1;
1204
+ }
1205
+
1206
+ compile() {
1207
+ if (this.regexes.length === 0) {
1208
+ // avoids the need to check length every time exec is called
1209
+ // @ts-ignore
1210
+ this.exec = () => null;
1211
+ }
1212
+ const terminators = this.regexes.map(el => el[1]);
1213
+ this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: '|' }), true);
1214
+ this.lastIndex = 0;
1215
+ }
1216
+
1217
+ /** @param {string} s */
1218
+ exec(s) {
1219
+ this.matcherRe.lastIndex = this.lastIndex;
1220
+ const match = this.matcherRe.exec(s);
1221
+ if (!match) { return null; }
1222
+
1223
+ // eslint-disable-next-line no-undefined
1224
+ const i = match.findIndex((el, i) => i > 0 && el !== undefined);
1225
+ // @ts-ignore
1226
+ const matchData = this.matchIndexes[i];
1227
+ // trim off any earlier non-relevant match groups (ie, the other regex
1228
+ // match groups that make up the multi-matcher)
1229
+ match.splice(0, i);
1230
+
1231
+ return Object.assign(match, matchData);
1232
+ }
1233
+ }
1234
+
1235
+ /*
1236
+ Created to solve the key deficiently with MultiRegex - there is no way to
1237
+ test for multiple matches at a single location. Why would we need to do
1238
+ that? In the future a more dynamic engine will allow certain matches to be
1239
+ ignored. An example: if we matched say the 3rd regex in a large group but
1240
+ decided to ignore it - we'd need to started testing again at the 4th
1241
+ regex... but MultiRegex itself gives us no real way to do that.
1242
+
1243
+ So what this class creates MultiRegexs on the fly for whatever search
1244
+ position they are needed.
1245
+
1246
+ NOTE: These additional MultiRegex objects are created dynamically. For most
1247
+ grammars most of the time we will never actually need anything more than the
1248
+ first MultiRegex - so this shouldn't have too much overhead.
1249
+
1250
+ Say this is our search group, and we match regex3, but wish to ignore it.
1251
+
1252
+ regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0
1253
+
1254
+ What we need is a new MultiRegex that only includes the remaining
1255
+ possibilities:
1256
+
1257
+ regex4 | regex5 ' ie, startAt = 3
1258
+
1259
+ This class wraps all that complexity up in a simple API... `startAt` decides
1260
+ where in the array of expressions to start doing the matching. It
1261
+ auto-increments, so if a match is found at position 2, then startAt will be
1262
+ set to 3. If the end is reached startAt will return to 0.
1263
+
1264
+ MOST of the time the parser will be setting startAt manually to 0.
1265
+ */
1266
+ class ResumableMultiRegex {
1267
+ constructor() {
1268
+ // @ts-ignore
1269
+ this.rules = [];
1270
+ // @ts-ignore
1271
+ this.multiRegexes = [];
1272
+ this.count = 0;
1273
+
1274
+ this.lastIndex = 0;
1275
+ this.regexIndex = 0;
1276
+ }
1277
+
1278
+ // @ts-ignore
1279
+ getMatcher(index) {
1280
+ if (this.multiRegexes[index]) return this.multiRegexes[index];
1281
+
1282
+ const matcher = new MultiRegex();
1283
+ this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));
1284
+ matcher.compile();
1285
+ this.multiRegexes[index] = matcher;
1286
+ return matcher;
1287
+ }
1288
+
1289
+ resumingScanAtSamePosition() {
1290
+ return this.regexIndex !== 0;
1291
+ }
1292
+
1293
+ considerAll() {
1294
+ this.regexIndex = 0;
1295
+ }
1296
+
1297
+ // @ts-ignore
1298
+ addRule(re, opts) {
1299
+ this.rules.push([re, opts]);
1300
+ if (opts.type === "begin") this.count++;
1301
+ }
1302
+
1303
+ /** @param {string} s */
1304
+ exec(s) {
1305
+ const m = this.getMatcher(this.regexIndex);
1306
+ m.lastIndex = this.lastIndex;
1307
+ let result = m.exec(s);
1308
+
1309
+ // The following is because we have no easy way to say "resume scanning at the
1310
+ // existing position but also skip the current rule ONLY". What happens is
1311
+ // all prior rules are also skipped which can result in matching the wrong
1312
+ // thing. Example of matching "booger":
1313
+
1314
+ // our matcher is [string, "booger", number]
1315
+ //
1316
+ // ....booger....
1317
+
1318
+ // if "booger" is ignored then we'd really need a regex to scan from the
1319
+ // SAME position for only: [string, number] but ignoring "booger" (if it
1320
+ // was the first match), a simple resume would scan ahead who knows how
1321
+ // far looking only for "number", ignoring potential string matches (or
1322
+ // future "booger" matches that might be valid.)
1323
+
1324
+ // So what we do: We execute two matchers, one resuming at the same
1325
+ // position, but the second full matcher starting at the position after:
1326
+
1327
+ // /--- resume first regex match here (for [number])
1328
+ // |/---- full match here for [string, "booger", number]
1329
+ // vv
1330
+ // ....booger....
1331
+
1332
+ // Which ever results in a match first is then used. So this 3-4 step
1333
+ // process essentially allows us to say "match at this position, excluding
1334
+ // a prior rule that was ignored".
1335
+ //
1336
+ // 1. Match "booger" first, ignore. Also proves that [string] does non match.
1337
+ // 2. Resume matching for [number]
1338
+ // 3. Match at index + 1 for [string, "booger", number]
1339
+ // 4. If #2 and #3 result in matches, which came first?
1340
+ if (this.resumingScanAtSamePosition()) {
1341
+ if (result && result.index === this.lastIndex) ; else { // use the second matcher result
1342
+ const m2 = this.getMatcher(0);
1343
+ m2.lastIndex = this.lastIndex + 1;
1344
+ result = m2.exec(s);
1345
+ }
1346
+ }
1347
+
1348
+ if (result) {
1349
+ this.regexIndex += result.position + 1;
1350
+ if (this.regexIndex === this.count) {
1351
+ // wrap-around to considering all matches again
1352
+ this.considerAll();
1353
+ }
1354
+ }
1355
+
1356
+ return result;
1357
+ }
1358
+ }
1359
+
1360
+ /**
1361
+ * Given a mode, builds a huge ResumableMultiRegex that can be used to walk
1362
+ * the content and find matches.
1363
+ *
1364
+ * @param {CompiledMode} mode
1365
+ * @returns {ResumableMultiRegex}
1366
+ */
1367
+ function buildModeRegex(mode) {
1368
+ const mm = new ResumableMultiRegex();
1369
+
1370
+ mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: "begin" }));
1371
+
1372
+ if (mode.terminatorEnd) {
1373
+ mm.addRule(mode.terminatorEnd, { type: "end" });
1374
+ }
1375
+ if (mode.illegal) {
1376
+ mm.addRule(mode.illegal, { type: "illegal" });
1377
+ }
1378
+
1379
+ return mm;
1380
+ }
1381
+
1382
+ /** skip vs abort vs ignore
1383
+ *
1384
+ * @skip - The mode is still entered and exited normally (and contains rules apply),
1385
+ * but all content is held and added to the parent buffer rather than being
1386
+ * output when the mode ends. Mostly used with `sublanguage` to build up
1387
+ * a single large buffer than can be parsed by sublanguage.
1388
+ *
1389
+ * - The mode begin ands ends normally.
1390
+ * - Content matched is added to the parent mode buffer.
1391
+ * - The parser cursor is moved forward normally.
1392
+ *
1393
+ * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it
1394
+ * never matched) but DOES NOT continue to match subsequent `contains`
1395
+ * modes. Abort is bad/suboptimal because it can result in modes
1396
+ * farther down not getting applied because an earlier rule eats the
1397
+ * content but then aborts.
1398
+ *
1399
+ * - The mode does not begin.
1400
+ * - Content matched by `begin` is added to the mode buffer.
1401
+ * - The parser cursor is moved forward accordingly.
1402
+ *
1403
+ * @ignore - Ignores the mode (as if it never matched) and continues to match any
1404
+ * subsequent `contains` modes. Ignore isn't technically possible with
1405
+ * the current parser implementation.
1406
+ *
1407
+ * - The mode does not begin.
1408
+ * - Content matched by `begin` is ignored.
1409
+ * - The parser cursor is not moved forward.
1410
+ */
1411
+
1412
+ /**
1413
+ * Compiles an individual mode
1414
+ *
1415
+ * This can raise an error if the mode contains certain detectable known logic
1416
+ * issues.
1417
+ * @param {Mode} mode
1418
+ * @param {CompiledMode | null} [parent]
1419
+ * @returns {CompiledMode | never}
1420
+ */
1421
+ function compileMode(mode, parent) {
1422
+ const cmode = /** @type CompiledMode */ (mode);
1423
+ if (mode.isCompiled) return cmode;
1424
+
1425
+ [
1426
+ scopeClassName,
1427
+ // do this early so compiler extensions generally don't have to worry about
1428
+ // the distinction between match/begin
1429
+ compileMatch,
1430
+ MultiClass,
1431
+ beforeMatchExt
1432
+ ].forEach(ext => ext(mode, parent));
1433
+
1434
+ language.compilerExtensions.forEach(ext => ext(mode, parent));
1435
+
1436
+ // __beforeBegin is considered private API, internal use only
1437
+ mode.__beforeBegin = null;
1438
+
1439
+ [
1440
+ beginKeywords,
1441
+ // do this later so compiler extensions that come earlier have access to the
1442
+ // raw array if they wanted to perhaps manipulate it, etc.
1443
+ compileIllegal,
1444
+ // default to 1 relevance if not specified
1445
+ compileRelevance
1446
+ ].forEach(ext => ext(mode, parent));
1447
+
1448
+ mode.isCompiled = true;
1449
+
1450
+ let keywordPattern = null;
1451
+ if (typeof mode.keywords === "object" && mode.keywords.$pattern) {
1452
+ // we need a copy because keywords might be compiled multiple times
1453
+ // so we can't go deleting $pattern from the original on the first
1454
+ // pass
1455
+ mode.keywords = Object.assign({}, mode.keywords);
1456
+ keywordPattern = mode.keywords.$pattern;
1457
+ delete mode.keywords.$pattern;
1458
+ }
1459
+ keywordPattern = keywordPattern || /\w+/;
1460
+
1461
+ if (mode.keywords) {
1462
+ mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
1463
+ }
1464
+
1465
+ cmode.keywordPatternRe = langRe(keywordPattern, true);
1466
+
1467
+ if (parent) {
1468
+ if (!mode.begin) mode.begin = /\B|\b/;
1469
+ cmode.beginRe = langRe(cmode.begin);
1470
+ if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
1471
+ if (mode.end) cmode.endRe = langRe(cmode.end);
1472
+ cmode.terminatorEnd = source(cmode.end) || '';
1473
+ if (mode.endsWithParent && parent.terminatorEnd) {
1474
+ cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;
1475
+ }
1476
+ }
1477
+ if (mode.illegal) cmode.illegalRe = langRe(/** @type {RegExp | string} */ (mode.illegal));
1478
+ if (!mode.contains) mode.contains = [];
1479
+
1480
+ mode.contains = [].concat(...mode.contains.map(function(c) {
1481
+ return expandOrCloneMode(c === 'self' ? mode : c);
1482
+ }));
1483
+ mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });
1484
+
1485
+ if (mode.starts) {
1486
+ compileMode(mode.starts, parent);
1487
+ }
1488
+
1489
+ cmode.matcher = buildModeRegex(cmode);
1490
+ return cmode;
1491
+ }
1492
+
1493
+ if (!language.compilerExtensions) language.compilerExtensions = [];
1494
+
1495
+ // self is not valid at the top-level
1496
+ if (language.contains && language.contains.includes('self')) {
1497
+ throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
1498
+ }
1499
+
1500
+ // we need a null object, which inherit will guarantee
1501
+ language.classNameAliases = inherit$1(language.classNameAliases || {});
1502
+
1503
+ return compileMode(/** @type Mode */ (language));
1504
+ }
1505
+
1506
+ /**
1507
+ * Determines if a mode has a dependency on it's parent or not
1508
+ *
1509
+ * If a mode does have a parent dependency then often we need to clone it if
1510
+ * it's used in multiple places so that each copy points to the correct parent,
1511
+ * where-as modes without a parent can often safely be re-used at the bottom of
1512
+ * a mode chain.
1513
+ *
1514
+ * @param {Mode | null} mode
1515
+ * @returns {boolean} - is there a dependency on the parent?
1516
+ * */
1517
+ function dependencyOnParent(mode) {
1518
+ if (!mode) return false;
1519
+
1520
+ return mode.endsWithParent || dependencyOnParent(mode.starts);
1521
+ }
1522
+
1523
+ /**
1524
+ * Expands a mode or clones it if necessary
1525
+ *
1526
+ * This is necessary for modes with parental dependenceis (see notes on
1527
+ * `dependencyOnParent`) and for nodes that have `variants` - which must then be
1528
+ * exploded into their own individual modes at compile time.
1529
+ *
1530
+ * @param {Mode} mode
1531
+ * @returns {Mode | Mode[]}
1532
+ * */
1533
+ function expandOrCloneMode(mode) {
1534
+ if (mode.variants && !mode.cachedVariants) {
1535
+ mode.cachedVariants = mode.variants.map(function(variant) {
1536
+ return inherit$1(mode, { variants: null }, variant);
1537
+ });
1538
+ }
1539
+
1540
+ // EXPAND
1541
+ // if we have variants then essentially "replace" the mode with the variants
1542
+ // this happens in compileMode, where this function is called from
1543
+ if (mode.cachedVariants) {
1544
+ return mode.cachedVariants;
1545
+ }
1546
+
1547
+ // CLONE
1548
+ // if we have dependencies on parents then we need a unique
1549
+ // instance of ourselves, so we can be reused with many
1550
+ // different parents without issue
1551
+ if (dependencyOnParent(mode)) {
1552
+ return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });
1553
+ }
1554
+
1555
+ if (Object.isFrozen(mode)) {
1556
+ return inherit$1(mode);
1557
+ }
1558
+
1559
+ // no special dependency issues, just return ourselves
1560
+ return mode;
1561
+ }
1562
+
1563
+ var version = "11.8.0";
1564
+
1565
+ class HTMLInjectionError extends Error {
1566
+ constructor(reason, html) {
1567
+ super(reason);
1568
+ this.name = "HTMLInjectionError";
1569
+ this.html = html;
1570
+ }
1571
+ }
1572
+
1573
+ /*
1574
+ Syntax highlighting with language autodetection.
1575
+ https://highlightjs.org/
1576
+ */
1577
+
1578
+
1579
+ /**
1580
+ @typedef {import('highlight.js').Mode} Mode
1581
+ @typedef {import('highlight.js').CompiledMode} CompiledMode
1582
+ @typedef {import('highlight.js').CompiledScope} CompiledScope
1583
+ @typedef {import('highlight.js').Language} Language
1584
+ @typedef {import('highlight.js').HLJSApi} HLJSApi
1585
+ @typedef {import('highlight.js').HLJSPlugin} HLJSPlugin
1586
+ @typedef {import('highlight.js').PluginEvent} PluginEvent
1587
+ @typedef {import('highlight.js').HLJSOptions} HLJSOptions
1588
+ @typedef {import('highlight.js').LanguageFn} LanguageFn
1589
+ @typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement
1590
+ @typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext
1591
+ @typedef {import('highlight.js/private').MatchType} MatchType
1592
+ @typedef {import('highlight.js/private').KeywordData} KeywordData
1593
+ @typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch
1594
+ @typedef {import('highlight.js/private').AnnotatedError} AnnotatedError
1595
+ @typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult
1596
+ @typedef {import('highlight.js').HighlightOptions} HighlightOptions
1597
+ @typedef {import('highlight.js').HighlightResult} HighlightResult
1598
+ */
1599
+
1600
+
1601
+ const escape = escapeHTML;
1602
+ const inherit = inherit$1;
1603
+ const NO_MATCH = Symbol("nomatch");
1604
+ const MAX_KEYWORD_HITS = 7;
1605
+
1606
+ /**
1607
+ * @param {any} hljs - object that is extended (legacy)
1608
+ * @returns {HLJSApi}
1609
+ */
1610
+ const HLJS = function(hljs) {
1611
+ // Global internal variables used within the highlight.js library.
1612
+ /** @type {Record<string, Language>} */
1613
+ const languages = Object.create(null);
1614
+ /** @type {Record<string, string>} */
1615
+ const aliases = Object.create(null);
1616
+ /** @type {HLJSPlugin[]} */
1617
+ const plugins = [];
1618
+
1619
+ // safe/production mode - swallows more errors, tries to keep running
1620
+ // even if a single syntax or parse hits a fatal error
1621
+ let SAFE_MODE = true;
1622
+ const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
1623
+ /** @type {Language} */
1624
+ const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };
1625
+
1626
+ // Global options used when within external APIs. This is modified when
1627
+ // calling the `hljs.configure` function.
1628
+ /** @type HLJSOptions */
1629
+ let options = {
1630
+ ignoreUnescapedHTML: false,
1631
+ throwUnescapedHTML: false,
1632
+ noHighlightRe: /^(no-?highlight)$/i,
1633
+ languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
1634
+ classPrefix: 'hljs-',
1635
+ cssSelector: 'pre code',
1636
+ languages: null,
1637
+ // beta configuration options, subject to change, welcome to discuss
1638
+ // https://github.com/highlightjs/highlight.js/issues/1086
1639
+ __emitter: TokenTreeEmitter
1640
+ };
1641
+
1642
+ /* Utility functions */
1643
+
1644
+ /**
1645
+ * Tests a language name to see if highlighting should be skipped
1646
+ * @param {string} languageName
1647
+ */
1648
+ function shouldNotHighlight(languageName) {
1649
+ return options.noHighlightRe.test(languageName);
1650
+ }
1651
+
1652
+ /**
1653
+ * @param {HighlightedHTMLElement} block - the HTML element to determine language for
1654
+ */
1655
+ function blockLanguage(block) {
1656
+ let classes = block.className + ' ';
1657
+
1658
+ classes += block.parentNode ? block.parentNode.className : '';
1659
+
1660
+ // language-* takes precedence over non-prefixed class names.
1661
+ const match = options.languageDetectRe.exec(classes);
1662
+ if (match) {
1663
+ const language = getLanguage(match[1]);
1664
+ if (!language) {
1665
+ warn(LANGUAGE_NOT_FOUND.replace("{}", match[1]));
1666
+ warn("Falling back to no-highlight mode for this block.", block);
1667
+ }
1668
+ return language ? match[1] : 'no-highlight';
1669
+ }
1670
+
1671
+ return classes
1672
+ .split(/\s+/)
1673
+ .find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
1674
+ }
1675
+
1676
+ /**
1677
+ * Core highlighting function.
1678
+ *
1679
+ * OLD API
1680
+ * highlight(lang, code, ignoreIllegals, continuation)
1681
+ *
1682
+ * NEW API
1683
+ * highlight(code, {lang, ignoreIllegals})
1684
+ *
1685
+ * @param {string} codeOrLanguageName - the language to use for highlighting
1686
+ * @param {string | HighlightOptions} optionsOrCode - the code to highlight
1687
+ * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail
1688
+ *
1689
+ * @returns {HighlightResult} Result - an object that represents the result
1690
+ * @property {string} language - the language name
1691
+ * @property {number} relevance - the relevance score
1692
+ * @property {string} value - the highlighted HTML code
1693
+ * @property {string} code - the original raw code
1694
+ * @property {CompiledMode} top - top of the current mode stack
1695
+ * @property {boolean} illegal - indicates whether any illegal matches were found
1696
+ */
1697
+ function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
1698
+ let code = "";
1699
+ let languageName = "";
1700
+ if (typeof optionsOrCode === "object") {
1701
+ code = codeOrLanguageName;
1702
+ ignoreIllegals = optionsOrCode.ignoreIllegals;
1703
+ languageName = optionsOrCode.language;
1704
+ } else {
1705
+ // old API
1706
+ deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
1707
+ deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
1708
+ languageName = codeOrLanguageName;
1709
+ code = optionsOrCode;
1710
+ }
1711
+
1712
+ // https://github.com/highlightjs/highlight.js/issues/3149
1713
+ // eslint-disable-next-line no-undefined
1714
+ if (ignoreIllegals === undefined) { ignoreIllegals = true; }
1715
+
1716
+ /** @type {BeforeHighlightContext} */
1717
+ const context = {
1718
+ code,
1719
+ language: languageName
1720
+ };
1721
+ // the plugin can change the desired language or the code to be highlighted
1722
+ // just be changing the object it was passed
1723
+ fire("before:highlight", context);
1724
+
1725
+ // a before plugin can usurp the result completely by providing it's own
1726
+ // in which case we don't even need to call highlight
1727
+ const result = context.result
1728
+ ? context.result
1729
+ : _highlight(context.language, context.code, ignoreIllegals);
1730
+
1731
+ result.code = context.code;
1732
+ // the plugin can change anything in result to suite it
1733
+ fire("after:highlight", result);
1734
+
1735
+ return result;
1736
+ }
1737
+
1738
+ /**
1739
+ * private highlight that's used internally and does not fire callbacks
1740
+ *
1741
+ * @param {string} languageName - the language to use for highlighting
1742
+ * @param {string} codeToHighlight - the code to highlight
1743
+ * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail
1744
+ * @param {CompiledMode?} [continuation] - current continuation mode, if any
1745
+ * @returns {HighlightResult} - result of the highlight operation
1746
+ */
1747
+ function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
1748
+ const keywordHits = Object.create(null);
1749
+
1750
+ /**
1751
+ * Return keyword data if a match is a keyword
1752
+ * @param {CompiledMode} mode - current mode
1753
+ * @param {string} matchText - the textual match
1754
+ * @returns {KeywordData | false}
1755
+ */
1756
+ function keywordData(mode, matchText) {
1757
+ return mode.keywords[matchText];
1758
+ }
1759
+
1760
+ function processKeywords() {
1761
+ if (!top.keywords) {
1762
+ emitter.addText(modeBuffer);
1763
+ return;
1764
+ }
1765
+
1766
+ let lastIndex = 0;
1767
+ top.keywordPatternRe.lastIndex = 0;
1768
+ let match = top.keywordPatternRe.exec(modeBuffer);
1769
+ let buf = "";
1770
+
1771
+ while (match) {
1772
+ buf += modeBuffer.substring(lastIndex, match.index);
1773
+ const word = language.case_insensitive ? match[0].toLowerCase() : match[0];
1774
+ const data = keywordData(top, word);
1775
+ if (data) {
1776
+ const [kind, keywordRelevance] = data;
1777
+ emitter.addText(buf);
1778
+ buf = "";
1779
+
1780
+ keywordHits[word] = (keywordHits[word] || 0) + 1;
1781
+ if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;
1782
+ if (kind.startsWith("_")) {
1783
+ // _ implied for relevance only, do not highlight
1784
+ // by applying a class name
1785
+ buf += match[0];
1786
+ } else {
1787
+ const cssClass = language.classNameAliases[kind] || kind;
1788
+ emitKeyword(match[0], cssClass);
1789
+ }
1790
+ } else {
1791
+ buf += match[0];
1792
+ }
1793
+ lastIndex = top.keywordPatternRe.lastIndex;
1794
+ match = top.keywordPatternRe.exec(modeBuffer);
1795
+ }
1796
+ buf += modeBuffer.substring(lastIndex);
1797
+ emitter.addText(buf);
1798
+ }
1799
+
1800
+ function processSubLanguage() {
1801
+ if (modeBuffer === "") return;
1802
+ /** @type HighlightResult */
1803
+ let result = null;
1804
+
1805
+ if (typeof top.subLanguage === 'string') {
1806
+ if (!languages[top.subLanguage]) {
1807
+ emitter.addText(modeBuffer);
1808
+ return;
1809
+ }
1810
+ result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);
1811
+ continuations[top.subLanguage] = /** @type {CompiledMode} */ (result._top);
1812
+ } else {
1813
+ result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
1814
+ }
1815
+
1816
+ // Counting embedded language score towards the host language may be disabled
1817
+ // with zeroing the containing mode relevance. Use case in point is Markdown that
1818
+ // allows XML everywhere and makes every XML snippet to have a much larger Markdown
1819
+ // score.
1820
+ if (top.relevance > 0) {
1821
+ relevance += result.relevance;
1822
+ }
1823
+ emitter.__addSublanguage(result._emitter, result.language);
1824
+ }
1825
+
1826
+ function processBuffer() {
1827
+ if (top.subLanguage != null) {
1828
+ processSubLanguage();
1829
+ } else {
1830
+ processKeywords();
1831
+ }
1832
+ modeBuffer = '';
1833
+ }
1834
+
1835
+ /**
1836
+ * @param {string} text
1837
+ * @param {string} scope
1838
+ */
1839
+ function emitKeyword(keyword, scope) {
1840
+ if (keyword === "") return;
1841
+
1842
+ emitter.startScope(scope);
1843
+ emitter.addText(keyword);
1844
+ emitter.endScope();
1845
+ }
1846
+
1847
+ /**
1848
+ * @param {CompiledScope} scope
1849
+ * @param {RegExpMatchArray} match
1850
+ */
1851
+ function emitMultiClass(scope, match) {
1852
+ let i = 1;
1853
+ const max = match.length - 1;
1854
+ while (i <= max) {
1855
+ if (!scope._emit[i]) { i++; continue; }
1856
+ const klass = language.classNameAliases[scope[i]] || scope[i];
1857
+ const text = match[i];
1858
+ if (klass) {
1859
+ emitKeyword(text, klass);
1860
+ } else {
1861
+ modeBuffer = text;
1862
+ processKeywords();
1863
+ modeBuffer = "";
1864
+ }
1865
+ i++;
1866
+ }
1867
+ }
1868
+
1869
+ /**
1870
+ * @param {CompiledMode} mode - new mode to start
1871
+ * @param {RegExpMatchArray} match
1872
+ */
1873
+ function startNewMode(mode, match) {
1874
+ if (mode.scope && typeof mode.scope === "string") {
1875
+ emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);
1876
+ }
1877
+ if (mode.beginScope) {
1878
+ // beginScope just wraps the begin match itself in a scope
1879
+ if (mode.beginScope._wrap) {
1880
+ emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);
1881
+ modeBuffer = "";
1882
+ } else if (mode.beginScope._multi) {
1883
+ // at this point modeBuffer should just be the match
1884
+ emitMultiClass(mode.beginScope, match);
1885
+ modeBuffer = "";
1886
+ }
1887
+ }
1888
+
1889
+ top = Object.create(mode, { parent: { value: top } });
1890
+ return top;
1891
+ }
1892
+
1893
+ /**
1894
+ * @param {CompiledMode } mode - the mode to potentially end
1895
+ * @param {RegExpMatchArray} match - the latest match
1896
+ * @param {string} matchPlusRemainder - match plus remainder of content
1897
+ * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode
1898
+ */
1899
+ function endOfMode(mode, match, matchPlusRemainder) {
1900
+ let matched = startsWith(mode.endRe, matchPlusRemainder);
1901
+
1902
+ if (matched) {
1903
+ if (mode["on:end"]) {
1904
+ const resp = new Response(mode);
1905
+ mode["on:end"](match, resp);
1906
+ if (resp.isMatchIgnored) matched = false;
1907
+ }
1908
+
1909
+ if (matched) {
1910
+ while (mode.endsParent && mode.parent) {
1911
+ mode = mode.parent;
1912
+ }
1913
+ return mode;
1914
+ }
1915
+ }
1916
+ // even if on:end fires an `ignore` it's still possible
1917
+ // that we might trigger the end node because of a parent mode
1918
+ if (mode.endsWithParent) {
1919
+ return endOfMode(mode.parent, match, matchPlusRemainder);
1920
+ }
1921
+ }
1922
+
1923
+ /**
1924
+ * Handle matching but then ignoring a sequence of text
1925
+ *
1926
+ * @param {string} lexeme - string containing full match text
1927
+ */
1928
+ function doIgnore(lexeme) {
1929
+ if (top.matcher.regexIndex === 0) {
1930
+ // no more regexes to potentially match here, so we move the cursor forward one
1931
+ // space
1932
+ modeBuffer += lexeme[0];
1933
+ return 1;
1934
+ } else {
1935
+ // no need to move the cursor, we still have additional regexes to try and
1936
+ // match at this very spot
1937
+ resumeScanAtSamePosition = true;
1938
+ return 0;
1939
+ }
1940
+ }
1941
+
1942
+ /**
1943
+ * Handle the start of a new potential mode match
1944
+ *
1945
+ * @param {EnhancedMatch} match - the current match
1946
+ * @returns {number} how far to advance the parse cursor
1947
+ */
1948
+ function doBeginMatch(match) {
1949
+ const lexeme = match[0];
1950
+ const newMode = match.rule;
1951
+
1952
+ const resp = new Response(newMode);
1953
+ // first internal before callbacks, then the public ones
1954
+ const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]];
1955
+ for (const cb of beforeCallbacks) {
1956
+ if (!cb) continue;
1957
+ cb(match, resp);
1958
+ if (resp.isMatchIgnored) return doIgnore(lexeme);
1959
+ }
1960
+
1961
+ if (newMode.skip) {
1962
+ modeBuffer += lexeme;
1963
+ } else {
1964
+ if (newMode.excludeBegin) {
1965
+ modeBuffer += lexeme;
1966
+ }
1967
+ processBuffer();
1968
+ if (!newMode.returnBegin && !newMode.excludeBegin) {
1969
+ modeBuffer = lexeme;
1970
+ }
1971
+ }
1972
+ startNewMode(newMode, match);
1973
+ return newMode.returnBegin ? 0 : lexeme.length;
1974
+ }
1975
+
1976
+ /**
1977
+ * Handle the potential end of mode
1978
+ *
1979
+ * @param {RegExpMatchArray} match - the current match
1980
+ */
1981
+ function doEndMatch(match) {
1982
+ const lexeme = match[0];
1983
+ const matchPlusRemainder = codeToHighlight.substring(match.index);
1984
+
1985
+ const endMode = endOfMode(top, match, matchPlusRemainder);
1986
+ if (!endMode) { return NO_MATCH; }
1987
+
1988
+ const origin = top;
1989
+ if (top.endScope && top.endScope._wrap) {
1990
+ processBuffer();
1991
+ emitKeyword(lexeme, top.endScope._wrap);
1992
+ } else if (top.endScope && top.endScope._multi) {
1993
+ processBuffer();
1994
+ emitMultiClass(top.endScope, match);
1995
+ } else if (origin.skip) {
1996
+ modeBuffer += lexeme;
1997
+ } else {
1998
+ if (!(origin.returnEnd || origin.excludeEnd)) {
1999
+ modeBuffer += lexeme;
2000
+ }
2001
+ processBuffer();
2002
+ if (origin.excludeEnd) {
2003
+ modeBuffer = lexeme;
2004
+ }
2005
+ }
2006
+ do {
2007
+ if (top.scope) {
2008
+ emitter.closeNode();
2009
+ }
2010
+ if (!top.skip && !top.subLanguage) {
2011
+ relevance += top.relevance;
2012
+ }
2013
+ top = top.parent;
2014
+ } while (top !== endMode.parent);
2015
+ if (endMode.starts) {
2016
+ startNewMode(endMode.starts, match);
2017
+ }
2018
+ return origin.returnEnd ? 0 : lexeme.length;
2019
+ }
2020
+
2021
+ function processContinuations() {
2022
+ const list = [];
2023
+ for (let current = top; current !== language; current = current.parent) {
2024
+ if (current.scope) {
2025
+ list.unshift(current.scope);
2026
+ }
2027
+ }
2028
+ list.forEach(item => emitter.openNode(item));
2029
+ }
2030
+
2031
+ /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */
2032
+ let lastMatch = {};
2033
+
2034
+ /**
2035
+ * Process an individual match
2036
+ *
2037
+ * @param {string} textBeforeMatch - text preceding the match (since the last match)
2038
+ * @param {EnhancedMatch} [match] - the match itself
2039
+ */
2040
+ function processLexeme(textBeforeMatch, match) {
2041
+ const lexeme = match && match[0];
2042
+
2043
+ // add non-matched text to the current mode buffer
2044
+ modeBuffer += textBeforeMatch;
2045
+
2046
+ if (lexeme == null) {
2047
+ processBuffer();
2048
+ return 0;
2049
+ }
2050
+
2051
+ // we've found a 0 width match and we're stuck, so we need to advance
2052
+ // this happens when we have badly behaved rules that have optional matchers to the degree that
2053
+ // sometimes they can end up matching nothing at all
2054
+ // Ref: https://github.com/highlightjs/highlight.js/issues/2140
2055
+ if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") {
2056
+ // spit the "skipped" character that our regex choked on back into the output sequence
2057
+ modeBuffer += codeToHighlight.slice(match.index, match.index + 1);
2058
+ if (!SAFE_MODE) {
2059
+ /** @type {AnnotatedError} */
2060
+ const err = new Error(`0 width match regex (${languageName})`);
2061
+ err.languageName = languageName;
2062
+ err.badRule = lastMatch.rule;
2063
+ throw err;
2064
+ }
2065
+ return 1;
2066
+ }
2067
+ lastMatch = match;
2068
+
2069
+ if (match.type === "begin") {
2070
+ return doBeginMatch(match);
2071
+ } else if (match.type === "illegal" && !ignoreIllegals) {
2072
+ // illegal match, we do not continue processing
2073
+ /** @type {AnnotatedError} */
2074
+ const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.scope || '<unnamed>') + '"');
2075
+ err.mode = top;
2076
+ throw err;
2077
+ } else if (match.type === "end") {
2078
+ const processed = doEndMatch(match);
2079
+ if (processed !== NO_MATCH) {
2080
+ return processed;
2081
+ }
2082
+ }
2083
+
2084
+ // edge case for when illegal matches $ (end of line) which is technically
2085
+ // a 0 width match but not a begin/end match so it's not caught by the
2086
+ // first handler (when ignoreIllegals is true)
2087
+ if (match.type === "illegal" && lexeme === "") {
2088
+ // advance so we aren't stuck in an infinite loop
2089
+ return 1;
2090
+ }
2091
+
2092
+ // infinite loops are BAD, this is a last ditch catch all. if we have a
2093
+ // decent number of iterations yet our index (cursor position in our
2094
+ // parsing) still 3x behind our index then something is very wrong
2095
+ // so we bail
2096
+ if (iterations > 100000 && iterations > match.index * 3) {
2097
+ const err = new Error('potential infinite loop, way more iterations than matches');
2098
+ throw err;
2099
+ }
2100
+
2101
+ /*
2102
+ Why might be find ourselves here? An potential end match that was
2103
+ triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.
2104
+ (this could be because a callback requests the match be ignored, etc)
2105
+
2106
+ This causes no real harm other than stopping a few times too many.
2107
+ */
2108
+
2109
+ modeBuffer += lexeme;
2110
+ return lexeme.length;
2111
+ }
2112
+
2113
+ const language = getLanguage(languageName);
2114
+ if (!language) {
2115
+ error(LANGUAGE_NOT_FOUND.replace("{}", languageName));
2116
+ throw new Error('Unknown language: "' + languageName + '"');
2117
+ }
2118
+
2119
+ const md = compileLanguage(language);
2120
+ let result = '';
2121
+ /** @type {CompiledMode} */
2122
+ let top = continuation || md;
2123
+ /** @type Record<string,CompiledMode> */
2124
+ const continuations = {}; // keep continuations for sub-languages
2125
+ const emitter = new options.__emitter(options);
2126
+ processContinuations();
2127
+ let modeBuffer = '';
2128
+ let relevance = 0;
2129
+ let index = 0;
2130
+ let iterations = 0;
2131
+ let resumeScanAtSamePosition = false;
2132
+
2133
+ try {
2134
+ if (!language.__emitTokens) {
2135
+ top.matcher.considerAll();
2136
+
2137
+ for (;;) {
2138
+ iterations++;
2139
+ if (resumeScanAtSamePosition) {
2140
+ // only regexes not matched previously will now be
2141
+ // considered for a potential match
2142
+ resumeScanAtSamePosition = false;
2143
+ } else {
2144
+ top.matcher.considerAll();
2145
+ }
2146
+ top.matcher.lastIndex = index;
2147
+
2148
+ const match = top.matcher.exec(codeToHighlight);
2149
+ // console.log("match", match[0], match.rule && match.rule.begin)
2150
+
2151
+ if (!match) break;
2152
+
2153
+ const beforeMatch = codeToHighlight.substring(index, match.index);
2154
+ const processedCount = processLexeme(beforeMatch, match);
2155
+ index = match.index + processedCount;
2156
+ }
2157
+ processLexeme(codeToHighlight.substring(index));
2158
+ } else {
2159
+ language.__emitTokens(codeToHighlight, emitter);
2160
+ }
2161
+
2162
+ emitter.finalize();
2163
+ result = emitter.toHTML();
2164
+
2165
+ return {
2166
+ language: languageName,
2167
+ value: result,
2168
+ relevance,
2169
+ illegal: false,
2170
+ _emitter: emitter,
2171
+ _top: top
2172
+ };
2173
+ } catch (err) {
2174
+ if (err.message && err.message.includes('Illegal')) {
2175
+ return {
2176
+ language: languageName,
2177
+ value: escape(codeToHighlight),
2178
+ illegal: true,
2179
+ relevance: 0,
2180
+ _illegalBy: {
2181
+ message: err.message,
2182
+ index,
2183
+ context: codeToHighlight.slice(index - 100, index + 100),
2184
+ mode: err.mode,
2185
+ resultSoFar: result
2186
+ },
2187
+ _emitter: emitter
2188
+ };
2189
+ } else if (SAFE_MODE) {
2190
+ return {
2191
+ language: languageName,
2192
+ value: escape(codeToHighlight),
2193
+ illegal: false,
2194
+ relevance: 0,
2195
+ errorRaised: err,
2196
+ _emitter: emitter,
2197
+ _top: top
2198
+ };
2199
+ } else {
2200
+ throw err;
2201
+ }
2202
+ }
2203
+ }
2204
+
2205
+ /**
2206
+ * returns a valid highlight result, without actually doing any actual work,
2207
+ * auto highlight starts with this and it's possible for small snippets that
2208
+ * auto-detection may not find a better match
2209
+ * @param {string} code
2210
+ * @returns {HighlightResult}
2211
+ */
2212
+ function justTextHighlightResult(code) {
2213
+ const result = {
2214
+ value: escape(code),
2215
+ illegal: false,
2216
+ relevance: 0,
2217
+ _top: PLAINTEXT_LANGUAGE,
2218
+ _emitter: new options.__emitter(options)
2219
+ };
2220
+ result._emitter.addText(code);
2221
+ return result;
2222
+ }
2223
+
2224
+ /**
2225
+ Highlighting with language detection. Accepts a string with the code to
2226
+ highlight. Returns an object with the following properties:
2227
+
2228
+ - language (detected language)
2229
+ - relevance (int)
2230
+ - value (an HTML string with highlighting markup)
2231
+ - secondBest (object with the same structure for second-best heuristically
2232
+ detected language, may be absent)
2233
+
2234
+ @param {string} code
2235
+ @param {Array<string>} [languageSubset]
2236
+ @returns {AutoHighlightResult}
2237
+ */
2238
+ function highlightAuto(code, languageSubset) {
2239
+ languageSubset = languageSubset || options.languages || Object.keys(languages);
2240
+ const plaintext = justTextHighlightResult(code);
2241
+
2242
+ const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name =>
2243
+ _highlight(name, code, false)
2244
+ );
2245
+ results.unshift(plaintext); // plaintext is always an option
2246
+
2247
+ const sorted = results.sort((a, b) => {
2248
+ // sort base on relevance
2249
+ if (a.relevance !== b.relevance) return b.relevance - a.relevance;
2250
+
2251
+ // always award the tie to the base language
2252
+ // ie if C++ and Arduino are tied, it's more likely to be C++
2253
+ if (a.language && b.language) {
2254
+ if (getLanguage(a.language).supersetOf === b.language) {
2255
+ return 1;
2256
+ } else if (getLanguage(b.language).supersetOf === a.language) {
2257
+ return -1;
2258
+ }
2259
+ }
2260
+
2261
+ // otherwise say they are equal, which has the effect of sorting on
2262
+ // relevance while preserving the original ordering - which is how ties
2263
+ // have historically been settled, ie the language that comes first always
2264
+ // wins in the case of a tie
2265
+ return 0;
2266
+ });
2267
+
2268
+ const [best, secondBest] = sorted;
2269
+
2270
+ /** @type {AutoHighlightResult} */
2271
+ const result = best;
2272
+ result.secondBest = secondBest;
2273
+
2274
+ return result;
2275
+ }
2276
+
2277
+ /**
2278
+ * Builds new class name for block given the language name
2279
+ *
2280
+ * @param {HTMLElement} element
2281
+ * @param {string} [currentLang]
2282
+ * @param {string} [resultLang]
2283
+ */
2284
+ function updateClassName(element, currentLang, resultLang) {
2285
+ const language = (currentLang && aliases[currentLang]) || resultLang;
2286
+
2287
+ element.classList.add("hljs");
2288
+ element.classList.add(`language-${language}`);
2289
+ }
2290
+
2291
+ /**
2292
+ * Applies highlighting to a DOM node containing code.
2293
+ *
2294
+ * @param {HighlightedHTMLElement} element - the HTML element to highlight
2295
+ */
2296
+ function highlightElement(element) {
2297
+ /** @type HTMLElement */
2298
+ let node = null;
2299
+ const language = blockLanguage(element);
2300
+
2301
+ if (shouldNotHighlight(language)) return;
2302
+
2303
+ fire("before:highlightElement",
2304
+ { el: element, language });
2305
+
2306
+ // we should be all text, no child nodes (unescaped HTML) - this is possibly
2307
+ // an HTML injection attack - it's likely too late if this is already in
2308
+ // production (the code has likely already done its damage by the time
2309
+ // we're seeing it)... but we yell loudly about this so that hopefully it's
2310
+ // more likely to be caught in development before making it to production
2311
+ if (element.children.length > 0) {
2312
+ if (!options.ignoreUnescapedHTML) {
2313
+ console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");
2314
+ console.warn("https://github.com/highlightjs/highlight.js/wiki/security");
2315
+ console.warn("The element with unescaped HTML:");
2316
+ console.warn(element);
2317
+ }
2318
+ if (options.throwUnescapedHTML) {
2319
+ const err = new HTMLInjectionError(
2320
+ "One of your code blocks includes unescaped HTML.",
2321
+ element.innerHTML
2322
+ );
2323
+ throw err;
2324
+ }
2325
+ }
2326
+
2327
+ node = element;
2328
+ const text = node.textContent;
2329
+ const result = language ? highlight(text, { language, ignoreIllegals: true }) : highlightAuto(text);
2330
+
2331
+ element.innerHTML = result.value;
2332
+ updateClassName(element, language, result.language);
2333
+ element.result = {
2334
+ language: result.language,
2335
+ // TODO: remove with version 11.0
2336
+ re: result.relevance,
2337
+ relevance: result.relevance
2338
+ };
2339
+ if (result.secondBest) {
2340
+ element.secondBest = {
2341
+ language: result.secondBest.language,
2342
+ relevance: result.secondBest.relevance
2343
+ };
2344
+ }
2345
+
2346
+ fire("after:highlightElement", { el: element, result, text });
2347
+ }
2348
+
2349
+ /**
2350
+ * Updates highlight.js global options with the passed options
2351
+ *
2352
+ * @param {Partial<HLJSOptions>} userOptions
2353
+ */
2354
+ function configure(userOptions) {
2355
+ options = inherit(options, userOptions);
2356
+ }
2357
+
2358
+ // TODO: remove v12, deprecated
2359
+ const initHighlighting = () => {
2360
+ highlightAll();
2361
+ deprecated("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
2362
+ };
2363
+
2364
+ // TODO: remove v12, deprecated
2365
+ function initHighlightingOnLoad() {
2366
+ highlightAll();
2367
+ deprecated("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
2368
+ }
2369
+
2370
+ let wantsHighlight = false;
2371
+
2372
+ /**
2373
+ * auto-highlights all pre>code elements on the page
2374
+ */
2375
+ function highlightAll() {
2376
+ // if we are called too early in the loading process
2377
+ if (document.readyState === "loading") {
2378
+ wantsHighlight = true;
2379
+ return;
2380
+ }
2381
+
2382
+ const blocks = document.querySelectorAll(options.cssSelector);
2383
+ blocks.forEach(highlightElement);
2384
+ }
2385
+
2386
+ function boot() {
2387
+ // if a highlight was requested before DOM was loaded, do now
2388
+ if (wantsHighlight) highlightAll();
2389
+ }
2390
+
2391
+ // make sure we are in the browser environment
2392
+ if (typeof window !== 'undefined' && window.addEventListener) {
2393
+ window.addEventListener('DOMContentLoaded', boot, false);
2394
+ }
2395
+
2396
+ /**
2397
+ * Register a language grammar module
2398
+ *
2399
+ * @param {string} languageName
2400
+ * @param {LanguageFn} languageDefinition
2401
+ */
2402
+ function registerLanguage(languageName, languageDefinition) {
2403
+ let lang = null;
2404
+ try {
2405
+ lang = languageDefinition(hljs);
2406
+ } catch (error$1) {
2407
+ error("Language definition for '{}' could not be registered.".replace("{}", languageName));
2408
+ // hard or soft error
2409
+ if (!SAFE_MODE) { throw error$1; } else { error(error$1); }
2410
+ // languages that have serious errors are replaced with essentially a
2411
+ // "plaintext" stand-in so that the code blocks will still get normal
2412
+ // css classes applied to them - and one bad language won't break the
2413
+ // entire highlighter
2414
+ lang = PLAINTEXT_LANGUAGE;
2415
+ }
2416
+ // give it a temporary name if it doesn't have one in the meta-data
2417
+ if (!lang.name) lang.name = languageName;
2418
+ languages[languageName] = lang;
2419
+ lang.rawDefinition = languageDefinition.bind(null, hljs);
2420
+
2421
+ if (lang.aliases) {
2422
+ registerAliases(lang.aliases, { languageName });
2423
+ }
2424
+ }
2425
+
2426
+ /**
2427
+ * Remove a language grammar module
2428
+ *
2429
+ * @param {string} languageName
2430
+ */
2431
+ function unregisterLanguage(languageName) {
2432
+ delete languages[languageName];
2433
+ for (const alias of Object.keys(aliases)) {
2434
+ if (aliases[alias] === languageName) {
2435
+ delete aliases[alias];
2436
+ }
2437
+ }
2438
+ }
2439
+
2440
+ /**
2441
+ * @returns {string[]} List of language internal names
2442
+ */
2443
+ function listLanguages() {
2444
+ return Object.keys(languages);
2445
+ }
2446
+
2447
+ /**
2448
+ * @param {string} name - name of the language to retrieve
2449
+ * @returns {Language | undefined}
2450
+ */
2451
+ function getLanguage(name) {
2452
+ name = (name || '').toLowerCase();
2453
+ return languages[name] || languages[aliases[name]];
2454
+ }
2455
+
2456
+ /**
2457
+ *
2458
+ * @param {string|string[]} aliasList - single alias or list of aliases
2459
+ * @param {{languageName: string}} opts
2460
+ */
2461
+ function registerAliases(aliasList, { languageName }) {
2462
+ if (typeof aliasList === 'string') {
2463
+ aliasList = [aliasList];
2464
+ }
2465
+ aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; });
2466
+ }
2467
+
2468
+ /**
2469
+ * Determines if a given language has auto-detection enabled
2470
+ * @param {string} name - name of the language
2471
+ */
2472
+ function autoDetection(name) {
2473
+ const lang = getLanguage(name);
2474
+ return lang && !lang.disableAutodetect;
2475
+ }
2476
+
2477
+ /**
2478
+ * Upgrades the old highlightBlock plugins to the new
2479
+ * highlightElement API
2480
+ * @param {HLJSPlugin} plugin
2481
+ */
2482
+ function upgradePluginAPI(plugin) {
2483
+ // TODO: remove with v12
2484
+ if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) {
2485
+ plugin["before:highlightElement"] = (data) => {
2486
+ plugin["before:highlightBlock"](
2487
+ Object.assign({ block: data.el }, data)
2488
+ );
2489
+ };
2490
+ }
2491
+ if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) {
2492
+ plugin["after:highlightElement"] = (data) => {
2493
+ plugin["after:highlightBlock"](
2494
+ Object.assign({ block: data.el }, data)
2495
+ );
2496
+ };
2497
+ }
2498
+ }
2499
+
2500
+ /**
2501
+ * @param {HLJSPlugin} plugin
2502
+ */
2503
+ function addPlugin(plugin) {
2504
+ upgradePluginAPI(plugin);
2505
+ plugins.push(plugin);
2506
+ }
2507
+
2508
+ /**
2509
+ * @param {HLJSPlugin} plugin
2510
+ */
2511
+ function removePlugin(plugin) {
2512
+ const index = plugins.indexOf(plugin);
2513
+ if (index !== -1) {
2514
+ plugins.splice(index, 1);
2515
+ }
2516
+ }
2517
+
2518
+ /**
2519
+ *
2520
+ * @param {PluginEvent} event
2521
+ * @param {any} args
2522
+ */
2523
+ function fire(event, args) {
2524
+ const cb = event;
2525
+ plugins.forEach(function(plugin) {
2526
+ if (plugin[cb]) {
2527
+ plugin[cb](args);
2528
+ }
2529
+ });
2530
+ }
2531
+
2532
+ /**
2533
+ * DEPRECATED
2534
+ * @param {HighlightedHTMLElement} el
2535
+ */
2536
+ function deprecateHighlightBlock(el) {
2537
+ deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0");
2538
+ deprecated("10.7.0", "Please use highlightElement now.");
2539
+
2540
+ return highlightElement(el);
2541
+ }
2542
+
2543
+ /* Interface definition */
2544
+ Object.assign(hljs, {
2545
+ highlight,
2546
+ highlightAuto,
2547
+ highlightAll,
2548
+ highlightElement,
2549
+ // TODO: Remove with v12 API
2550
+ highlightBlock: deprecateHighlightBlock,
2551
+ configure,
2552
+ initHighlighting,
2553
+ initHighlightingOnLoad,
2554
+ registerLanguage,
2555
+ unregisterLanguage,
2556
+ listLanguages,
2557
+ getLanguage,
2558
+ registerAliases,
2559
+ autoDetection,
2560
+ inherit,
2561
+ addPlugin,
2562
+ removePlugin
2563
+ });
2564
+
2565
+ hljs.debugMode = function() { SAFE_MODE = false; };
2566
+ hljs.safeMode = function() { SAFE_MODE = true; };
2567
+ hljs.versionString = version;
2568
+
2569
+ hljs.regex = {
2570
+ concat: concat,
2571
+ lookahead: lookahead,
2572
+ either: either,
2573
+ optional: optional,
2574
+ anyNumberOfTimes: anyNumberOfTimes
2575
+ };
2576
+
2577
+ for (const key in MODES) {
2578
+ // @ts-ignore
2579
+ if (typeof MODES[key] === "object") {
2580
+ // @ts-ignore
2581
+ deepFreeze(MODES[key]);
2582
+ }
2583
+ }
2584
+
2585
+ // merge all the modes/regexes into our main object
2586
+ Object.assign(hljs, MODES);
2587
+
2588
+ return hljs;
2589
+ };
2590
+
2591
+ // Other names for the variable may break build script
2592
+ const highlight = HLJS({});
2593
+
2594
+ // returns a new instance of the highlighter to be used for extensions
2595
+ // check https://github.com/wooorm/lowlight/issues/47
2596
+ highlight.newInstance = () => HLJS({});
2597
+
2598
+ module.exports = highlight;
2599
+ highlight.HighlightJS = highlight;
2600
+ highlight.default = highlight;