@oracle/oraclejet-audit 10.0.0 → 11.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (702) hide show
  1. package/jaf-amd.js +12 -4
  2. package/jaf.js +6 -1
  3. package/jafapi.js +6 -1
  4. package/lib/AST.js +6 -1
  5. package/lib/AST_Ts.js +6 -1
  6. package/lib/AstJson.js +6 -1
  7. package/lib/AstNodeTypes.js +6 -1
  8. package/lib/Comments.js +6 -1
  9. package/lib/ComponentSvcs.js +5 -0
  10. package/lib/Components.js +6 -1
  11. package/lib/Config.js +6 -1
  12. package/lib/ConfigLib.js +6 -1
  13. package/lib/CssLib.js +5 -0
  14. package/lib/CssUtils.js +5 -0
  15. package/lib/DomUtils.js +6 -1
  16. package/lib/FileIndex.js +5 -0
  17. package/lib/FileSet.js +5 -0
  18. package/lib/FsUtils.js +6 -1
  19. package/lib/Histo.js +6 -0
  20. package/lib/HtmlTree.js +6 -1
  21. package/lib/HtmlUtils.js +5 -0
  22. package/lib/Issue.js +5 -0
  23. package/lib/JafEvents.js +5 -0
  24. package/lib/JafLib.js +6 -1
  25. package/lib/Json.js +6 -0
  26. package/lib/JsonLoader.js +6 -1
  27. package/lib/MetaLib.js +6 -1
  28. package/lib/NetUtils.js +5 -0
  29. package/lib/NodeTypes.js +5 -0
  30. package/lib/Parser.js +6 -1
  31. package/lib/RegTypes.js +5 -0
  32. package/lib/Registry.js +5 -0
  33. package/lib/Reporter.js +5 -0
  34. package/lib/RuleContext.js +5 -0
  35. package/lib/RulePack.js +5 -0
  36. package/lib/RuleSet.js +6 -1
  37. package/lib/Rules.js +6 -1
  38. package/lib/Scope.js +6 -1
  39. package/lib/SemVer.js +5 -0
  40. package/lib/Server.js +5 -0
  41. package/lib/SevLib.js +5 -0
  42. package/lib/Severity.js +6 -1
  43. package/lib/Stats.js +6 -0
  44. package/lib/Ts.js +6 -1
  45. package/lib/Utils.js +6 -1
  46. package/lib/Watch.js +5 -0
  47. package/lib/Writer.js +5 -0
  48. package/lib/ZipUtils.js +5 -0
  49. package/lib/api.js +6 -0
  50. package/lib/cliStats.js +6 -0
  51. package/lib/clone.js +5 -0
  52. package/lib/cmdline.js +6 -1
  53. package/lib/colors.js +5 -0
  54. package/lib/exportRules.js +6 -0
  55. package/lib/extends.js +6 -0
  56. package/lib/filetypes.js +6 -0
  57. package/lib/groups.js +6 -0
  58. package/lib/help.js +6 -1
  59. package/lib/imanual.js +6 -0
  60. package/lib/jetver.js +6 -1
  61. package/lib/macros.js +6 -0
  62. package/lib/metaLoader.js +5 -0
  63. package/lib/metahist.js +5 -0
  64. package/lib/msgidLoader.js +6 -1
  65. package/lib/ns.js +6 -1
  66. package/lib/nslist.js +6 -1
  67. package/lib/outFormat.js +6 -0
  68. package/lib/outfile.js +5 -0
  69. package/lib/ruleLoader.js +5 -0
  70. package/lib/scaffold.js +6 -1
  71. package/lib/scaffoldRule.js +6 -1
  72. package/lib/schema.js +5 -0
  73. package/lib/scopewalker.js +6 -0
  74. package/lib/spinner.js +5 -0
  75. package/lib/spinnernoop.js +5 -0
  76. package/lib/tabs.js +5 -0
  77. package/lib/xmanual.js +6 -0
  78. package/libext/expparser.js +6 -1
  79. package/meta/10.1.0/jetauditmeta.js +9 -0
  80. package/meta/11.0.0/jetauditmeta.js +9 -0
  81. package/meta/11.1.0/jetauditmeta.js +9 -0
  82. package/meta/metaverlist.json +1 -1
  83. package/package.json +2 -3
  84. package/rulepacks/csp/csp-html-script-unsafe-inline.js +5 -0
  85. package/rulepacks/csp/csp-html-style-unsafe-inline.js +5 -0
  86. package/rulepacks/csp/csp-html-unsafe-expr.js +5 -0
  87. package/rulepacks/csp/csp-js-script-unsafe-eval.js +6 -1
  88. package/rulepacks/csp/csp-js-style-unsafe-inline.js +5 -0
  89. package/rulepacks/csp/csp-ts-script-unsafe-eval.js +6 -0
  90. package/rulepacks/csp/csp-ts-style-unsafe-inline.js +6 -0
  91. package/rulepacks/csp/msgid.json +6 -1
  92. package/rulepacks/csp/rules.json +6 -1
  93. package/rulepacks/jetwc/jetwc-absolute-jetversion.js +6 -1
  94. package/rulepacks/jetwc/jetwc-aria-redefinition.js +6 -1
  95. package/rulepacks/jetwc/jetwc-bootstrap.js +6 -1
  96. package/rulepacks/jetwc/jetwc-compjson-bp-ar.js +6 -1
  97. package/rulepacks/jetwc/jetwc-compjson-bp-obj.js +6 -1
  98. package/rulepacks/jetwc/jetwc-component-dependencies.js +6 -1
  99. package/rulepacks/jetwc/jetwc-component-displayname.js +6 -1
  100. package/rulepacks/jetwc/jetwc-component-foldername.js +6 -1
  101. package/rulepacks/jetwc/jetwc-component-location.js +6 -1
  102. package/rulepacks/jetwc/jetwc-component-type.js +6 -1
  103. package/rulepacks/jetwc/jetwc-data-property-prefix.js +6 -1
  104. package/rulepacks/jetwc/jetwc-deprecated-lifecycle.js +6 -1
  105. package/rulepacks/jetwc/jetwc-disabled-property.js +6 -1
  106. package/rulepacks/jetwc/jetwc-displayname.js +6 -1
  107. package/rulepacks/jetwc/jetwc-dynamic-slot-context.js +6 -1
  108. package/rulepacks/jetwc/jetwc-dynamic-slots-naming.js +6 -1
  109. package/rulepacks/jetwc/jetwc-event-displayname.js +6 -1
  110. package/rulepacks/jetwc/jetwc-events.js +6 -1
  111. package/rulepacks/jetwc/jetwc-jet-version.js +6 -1
  112. package/rulepacks/jetwc/jetwc-loader-file.js +6 -1
  113. package/rulepacks/jetwc/jetwc-method-displayname.js +6 -1
  114. package/rulepacks/jetwc/jetwc-methods.js +6 -1
  115. package/rulepacks/jetwc/jetwc-namespace.js +6 -1
  116. package/rulepacks/jetwc/jetwc-nested-defaults.js +6 -1
  117. package/rulepacks/jetwc/jetwc-nls-languages.js +6 -1
  118. package/rulepacks/jetwc/jetwc-nls-root.js +6 -1
  119. package/rulepacks/jetwc/jetwc-oj-register.js +6 -1
  120. package/rulepacks/jetwc/jetwc-ojcss.js +6 -1
  121. package/rulepacks/jetwc/jetwc-pack-children.js +6 -1
  122. package/rulepacks/jetwc/jetwc-packable-components.js +6 -1
  123. package/rulepacks/jetwc/jetwc-prerelease-dependencies.js +6 -1
  124. package/rulepacks/jetwc/jetwc-prerelease-pattern.js +6 -1
  125. package/rulepacks/jetwc/jetwc-prerelease-version.js +6 -1
  126. package/rulepacks/jetwc/jetwc-property-changed.js +6 -1
  127. package/rulepacks/jetwc/jetwc-property-displayname.js +6 -1
  128. package/rulepacks/jetwc/jetwc-property-nesting.js +6 -1
  129. package/rulepacks/jetwc/jetwc-public-modules.js +6 -1
  130. package/rulepacks/jetwc/jetwc-register-css.js +6 -1
  131. package/rulepacks/jetwc/jetwc-register-with-promises.js +6 -1
  132. package/rulepacks/jetwc/jetwc-require-paths.js +6 -1
  133. package/rulepacks/jetwc/jetwc-required-subproperty.js +6 -0
  134. package/rulepacks/jetwc/jetwc-reserved-property.js +6 -1
  135. package/rulepacks/jetwc/jetwc-schema.js +6 -1
  136. package/rulepacks/jetwc/jetwc-semantic-version.js +6 -1
  137. package/rulepacks/jetwc/jetwc-slot-displayname.js +6 -1
  138. package/rulepacks/jetwc/jetwc-slots.js +6 -1
  139. package/rulepacks/jetwc/jetwc-standard-files.js +6 -1
  140. package/rulepacks/jetwc/jetwc-subproperty-writeback.js +6 -0
  141. package/rulepacks/jetwc/jetwc-template-slots.js +6 -1
  142. package/rulepacks/jetwc/jetwc-unused-events.js +6 -1
  143. package/rulepacks/jetwc/jetwc-unused-slots.js +6 -1
  144. package/rulepacks/jetwc/jetwc-vb-category.js +6 -1
  145. package/rulepacks/jetwc/jetwc-vb-icon.js +6 -1
  146. package/rulepacks/jetwc/jetwc-version-openrange.js +6 -1
  147. package/rulepacks/jetwc/jetwc-writeback-required.js +6 -1
  148. package/rulepacks/jetwc/msgid.json +6 -0
  149. package/rulepacks/jetwc/rules.json +6 -1
  150. package/rulepacks/jetwc-lib/component-audit-utils.js +6 -1
  151. package/rulepacks/jetwco/jetwco-bootstrap.js +6 -1
  152. package/rulepacks/jetwco/jetwco-compjson-ns-reg.js +6 -1
  153. package/rulepacks/jetwco/jetwco-component-api-baseline-changes.js +6 -0
  154. package/rulepacks/jetwco/jetwco-component-api-changes.js +6 -1
  155. package/rulepacks/jetwco/jetwco-component-cdn.js +6 -1
  156. package/rulepacks/jetwco/jetwco-exchange-version-check.js +6 -1
  157. package/rulepacks/jetwco/jetwco-license-info.js +6 -1
  158. package/rulepacks/jetwco/jetwco-prerelease-cdn.js +6 -1
  159. package/rulepacks/jetwco/jetwco-thirdparty-ba.js +6 -1
  160. package/rulepacks/jetwco/msgid.json +6 -0
  161. package/rulepacks/jetwco/rules.json +6 -1
  162. package/rulepacks/spoc/msgid.json +5 -0
  163. package/rulepacks/spoc/rules.json +5 -0
  164. package/rulepacks/spoc/spoc-dom-manip-inv-tag.js +5 -0
  165. package/rulepacks/spoc/spoc-dom-manip-tag-pos.js +5 -0
  166. package/rulepacks/spoc/spoc-dom-manip.js +5 -0
  167. package/rules/jaf/jaf-css-diagnose.js +5 -0
  168. package/rules/jaf/jaf-html-diagnose.js +5 -0
  169. package/rules/jaf/jaf-init-schema.js +5 -0
  170. package/rules/jaf/jaf-js-diagnose.js +5 -0
  171. package/rules/jaf/jaf-ts-diagnose.js +6 -0
  172. package/rules/jaf/msgid.json +6 -1
  173. package/rules/jaf/rules.json +6 -1
  174. package/rules/jet/helpers/acc-aria-label.js +6 -1
  175. package/rules/jet/helpers/bp-checkPropType.js +5 -0
  176. package/rules/jet/helpers/cssHelper.js +6 -1
  177. package/rules/jet/helpers/extractStylesFromClass.js +6 -1
  178. package/rules/jet/helpers/has-slot-name.js +6 -1
  179. package/rules/jet/helpers/has-slot.js +5 -0
  180. package/rules/jet/helpers/json-prop-pos.js +5 -0
  181. package/rules/jet/helpers/json-propname-pos.js +5 -0
  182. package/rules/jet/helpers/style-selector.js +6 -1
  183. package/rules/jet/helpers/valid-attr.js +5 -0
  184. package/rules/jet/helpers/vartrack.js +5 -0
  185. package/rules/jet/jet-css-ojselector.js +5 -0
  186. package/rules/jet/msgid.json +6 -1
  187. package/rules/jet/oj-acc-aria-labelledby.js +5 -0
  188. package/rules/jet/oj-acc-aria-prop.js +5 -0
  189. package/rules/jet/oj-acc-avatar-aria-role.js +5 -0
  190. package/rules/jet/oj-acc-combobox-aria-label.js +6 -1
  191. package/rules/jet/oj-acc-film-strip-aria-label.js +5 -0
  192. package/rules/jet/oj-acc-input-aria-label.js +6 -1
  193. package/rules/jet/oj-acc-select-aria-label.js +6 -1
  194. package/rules/jet/oj-cca-compjson-bp-ar.js +5 -0
  195. package/rules/jet/oj-cca-compjson-bp-dsplyname.js +5 -0
  196. package/rules/jet/oj-cca-compjson-bp-jetver.js +5 -0
  197. package/rules/jet/oj-cca-compjson-bp-obj.js +5 -0
  198. package/rules/jet/oj-cca-compjson-ns-reg.js +5 -0
  199. package/rules/jet/oj-css-bp-border-color.js +5 -0
  200. package/rules/jet/oj-css-bp-dir-flow.js +6 -1
  201. package/rules/jet/oj-css-bp-float.js +5 -0
  202. package/rules/jet/oj-css-bp-textalign.js +5 -0
  203. package/rules/jet/oj-css-style-abs-units.js +5 -0
  204. package/rules/jet/oj-css-style-bp-color.js +6 -1
  205. package/rules/jet/oj-css-style-bp-display.js +6 -1
  206. package/rules/jet/oj-css-style-bp-font-family.js +6 -1
  207. package/rules/jet/oj-css-style-bp-font.js +5 -0
  208. package/rules/jet/oj-css-style-deprecated.js +6 -1
  209. package/rules/jet/oj-css-style-override.js +6 -1
  210. package/rules/jet/oj-css-var-override.js +5 -0
  211. package/rules/jet/oj-form-maxcols.js +6 -0
  212. package/rules/jet/oj-html-5-attr-obs.js +5 -0
  213. package/rules/jet/oj-html-5-tag-obs.js +5 -0
  214. package/rules/jet/oj-html-attr-$unique.js +5 -0
  215. package/rules/jet/oj-html-attr-2def.js +5 -0
  216. package/rules/jet/oj-html-attr-json.js +6 -1
  217. package/rules/jet/oj-html-attr-prefix-expr.js +6 -1
  218. package/rules/jet/oj-html-attr-prefix-ro.js +5 -0
  219. package/rules/jet/oj-html-attr-req.js +5 -0
  220. package/rules/jet/oj-html-bindforeach-data.js +5 -0
  221. package/rules/jet/oj-html-bindif-test.js +5 -0
  222. package/rules/jet/oj-html-binding-attr.js +5 -0
  223. package/rules/jet/oj-html-cca-count.js +5 -0
  224. package/rules/jet/oj-html-cca-tagname.js +6 -1
  225. package/rules/jet/oj-html-cdn.js +5 -0
  226. package/rules/jet/oj-html-combo-converter.js +5 -0
  227. package/rules/jet/oj-html-cspexpr.js +6 -1
  228. package/rules/jet/oj-html-databind-all.js +5 -0
  229. package/rules/jet/oj-html-dlg-title.js +5 -0
  230. package/rules/jet/oj-html-file-pick-accept.js +6 -0
  231. package/rules/jet/oj-html-form-bindif.js +6 -1
  232. package/rules/jet/oj-html-form-layout-maxcols.js +6 -0
  233. package/rules/jet/oj-html-form-noflex.js +5 -0
  234. package/rules/jet/oj-html-input-isodate.js +6 -0
  235. package/rules/jet/oj-html-invalid-doctype.js +6 -1
  236. package/rules/jet/oj-html-jq-databind.js +6 -1
  237. package/rules/jet/oj-html-ko-comment.js +5 -0
  238. package/rules/jet/oj-html-ko-databind.js +5 -0
  239. package/rules/jet/oj-html-label-for-prefix.js +5 -0
  240. package/rules/jet/oj-html-missing-doctype.js +6 -1
  241. package/rules/jet/oj-html-oj-lib.js +5 -0
  242. package/rules/jet/oj-html-ojattr-520.js +6 -1
  243. package/rules/jet/oj-html-ojattr-deprecated.js +6 -1
  244. package/rules/jet/oj-html-ojattr-enum-deprecated.js +6 -1
  245. package/rules/jet/oj-html-ojattr-evt-syntax.js +5 -0
  246. package/rules/jet/oj-html-ojattr-value.js +6 -1
  247. package/rules/jet/oj-html-ojattr.js +6 -1
  248. package/rules/jet/oj-html-ojevent.js +6 -1
  249. package/rules/jet/oj-html-ojslot.js +5 -0
  250. package/rules/jet/oj-html-ojstyle.js +5 -0
  251. package/rules/jet/oj-html-ojtag-datacmd.js +6 -1
  252. package/rules/jet/oj-html-ojtag-datactx.js +5 -0
  253. package/rules/jet/oj-html-ojtag-deprecated.js +6 -1
  254. package/rules/jet/oj-html-ojtag-globattr-noprefix.js +5 -0
  255. package/rules/jet/oj-html-ojtag-id.js +5 -0
  256. package/rules/jet/oj-html-ojtag-nonglobattr-prefix.js +5 -0
  257. package/rules/jet/oj-html-ojtag-ns.js +5 -0
  258. package/rules/jet/oj-html-picker-attrs.js +6 -0
  259. package/rules/jet/oj-html-redwood-cssnovars.js +6 -0
  260. package/rules/jet/oj-html-redwood-cssvars.js +6 -0
  261. package/rules/jet/oj-html-self-close.js +5 -0
  262. package/rules/jet/oj-html-slot-item-minmax.js +6 -0
  263. package/rules/jet/oj-html-slot-name.js +6 -1
  264. package/rules/jet/oj-html-slot-pref-content.js +6 -0
  265. package/rules/jet/oj-html-style-abs-units.js +5 -0
  266. package/rules/jet/oj-html-style-bp-color.js +5 -0
  267. package/rules/jet/oj-html-style-bp-display.js +6 -1
  268. package/rules/jet/oj-html-style-bp-font-family.js +5 -0
  269. package/rules/jet/oj-html-style-bp-font.js +5 -0
  270. package/rules/jet/oj-html-style-deprecated.js +5 -0
  271. package/rules/jet/oj-html-style.js +6 -1
  272. package/rules/jet/oj-html-stylesel.js +6 -1
  273. package/rules/jet/oj-html-tag-attr-noprefix.js +5 -0
  274. package/rules/jet/oj-html-template-index.js +6 -0
  275. package/rules/jet/oj-html-unsup-theme.js +6 -1
  276. package/rules/jet/oj-html-wctag-$props.js +6 -1
  277. package/rules/jet/oj-html-wctag-arialabelledby.js +5 -0
  278. package/rules/jet/oj-html-wctag-for.js +5 -0
  279. package/rules/jet/oj-html-wctag-id.js +5 -0
  280. package/rules/jet/oj-html-wctag-packprivate.js +6 -0
  281. package/rules/jet/oj-js-comp-attr-deprecated.js +5 -0
  282. package/rules/jet/oj-js-comp-meth-deprecated.js +5 -0
  283. package/rules/jet/oj-js-no-ext-final.js +5 -0
  284. package/rules/jet/oj-js-noconsole.js +5 -0
  285. package/rules/jet/oj-js-ojcomp-deprecated.js +6 -1
  286. package/rules/jet/oj-js-ojcomp-exist.js +5 -0
  287. package/rules/jet/oj-js-ojcomp-new.js +5 -0
  288. package/rules/jet/oj-js-poly-promise.js +6 -1
  289. package/rules/jet/oj-js-var-undef.js +5 -0
  290. package/rules/jet/oj-json-syntax.js +6 -1
  291. package/rules/jet/oj-ts-comp-attr-deprecated.js +5 -0
  292. package/rules/jet/oj-ts-comp-meth-deprecated.js +5 -0
  293. package/rules/jet/oj-ts-no-ext-final.js +6 -0
  294. package/rules/jet/oj-ts-noconsole.js +6 -1
  295. package/rules/jet/oj-ts-ojcomp-deprecated.js +6 -1
  296. package/rules/jet/oj-ts-ojcomp-exist.js +6 -1
  297. package/rules/jet/oj-ts-ojcomp-new.js +6 -1
  298. package/rules/jet/oj-ts-poly-promise.js +6 -1
  299. package/rules/jet/rules.json +6 -1
  300. package/schema/component-schema.json +122 -2
  301. package/src/JafCore.js +6 -1
  302. package/types/index.d.ts +144 -35
  303. package/lib/manual.js +0 -1
  304. package/lib/stats.js +0 -1
  305. package/rules/exch/helpers/json-prop-pos.js +0 -1
  306. package/rules/exch/msgid.json +0 -1
  307. package/rules/exch/oj-cca-comp-zip-content-composite.js +0 -1
  308. package/rules/exch/oj-cca-comp-zip-content-pack.js +0 -1
  309. package/rules/exch/oj-cca-comp-zip-expand.js +0 -1
  310. package/rules/exch/oj-cca-compjson-evnames.js +0 -1
  311. package/rules/exch/oj-cca-compjson-file.js +0 -1
  312. package/rules/exch/oj-cca-compjson-prefix.js +0 -1
  313. package/rules/exch/oj-cca-compjson-prop-compdeps.js +0 -1
  314. package/rules/exch/oj-cca-compjson-prop-deps.js +0 -1
  315. package/rules/exch/oj-cca-compjson-prop-jetver.js +0 -1
  316. package/rules/exch/oj-cca-compjson-prop-obs.js +0 -1
  317. package/rules/exch/oj-cca-compjson-prop-type.js +0 -1
  318. package/rules/exch/oj-cca-compjson-prop-types.js +0 -1
  319. package/rules/exch/oj-cca-compjson-prop-undef.js +0 -1
  320. package/rules/exch/oj-cca-compjson-prop-version.js +0 -1
  321. package/rules/exch/oj-cca-compjson-schema.js +0 -1
  322. package/rules/exch/oj-cca-zip-compjson.js +0 -1
  323. package/rules/exch/rules.json +0 -1
  324. package/rules/jet/oj-css-bp-bgcolor.js +0 -1
  325. package/tests/components/attr-req-test/component.json +0 -1
  326. package/tests/components/demo-analog-clock/component.json +0 -1
  327. package/tests/components/demo-analog-clock/demo-analog-clock-viewModel.js +0 -1
  328. package/tests/components/demo-analog-clock/extension/demo/js/viewModels/demo.js +0 -1
  329. package/tests/components/demo-analog-clock/loader.js +0 -1
  330. package/tests/components/demo-card/component.json +0 -1
  331. package/tests/components/demo-chart-orientation-control/component.json +0 -1
  332. package/tests/components/demo-chart-stack-control/component.json +0 -1
  333. package/tests/components/made-up/component.json +0 -1
  334. package/tests/components/oj-made-up/component.json +0 -1
  335. package/tests/components/sp-activity-item/component.json +0 -1
  336. package/tests/config/config_base.json +0 -1
  337. package/tests/golden/10.0.0/golden_base.json +0 -1
  338. package/tests/golden/8.1.0/golden_base.json +0 -1
  339. package/tests/golden/9.0.0/golden_base.json +0 -1
  340. package/tests/rulepacks/hooks/hook-rpext.js +0 -1
  341. package/tests/rulepacks/hooks/hook-start-close-rulepack.js +0 -1
  342. package/tests/rulepacks/hooks/rule-rpext.js +0 -1
  343. package/tests/rulepacks/hooks/rules.json +0 -1
  344. package/tests/rulepacks/tags/proc_directive.js +0 -1
  345. package/tests/rulepacks/tags/rules.json +0 -1
  346. package/tests/rulepacks/tags/tag-count-setup.js +0 -1
  347. package/tests/rulepacks/tags/tag-count.js +0 -1
  348. package/tests/rules/bugs/JET-4770_PASS_1.html +0 -9
  349. package/tests/rules/comments/com_FAIL_1.js +0 -57
  350. package/tests/rules/comments/com_FAIL_2.js +0 -96
  351. package/tests/rules/comments/com_PASS_1.js +0 -42
  352. package/tests/rules/comments/com_PASS_2.js +0 -63
  353. package/tests/rules/comments/com_PASS_3.js +0 -40
  354. package/tests/rules/comments/com_PASS_4.js +0 -36
  355. package/tests/rules/comments/com_PASS_5.js +0 -19
  356. package/tests/rules/csp/html-script-unsafe-inline/FAIL_1.html +0 -11
  357. package/tests/rules/csp/html-script-unsafe-inline/FAIL_2.html +0 -8
  358. package/tests/rules/csp/html-script-unsafe-inline/PASS_1.html +0 -8
  359. package/tests/rules/csp/html-script-unsafe-inline/PASS_2.html +0 -8
  360. package/tests/rules/csp/html-script-unsafe-inline/PASS_3.html +0 -8
  361. package/tests/rules/csp/html-style-unsafe-inline/FAIL_1.html +0 -11
  362. package/tests/rules/csp/html-style-unsafe-inline/PASS_1.html +0 -11
  363. package/tests/rules/csp/html-unsafe-expr/FAIL_1.html +0 -14
  364. package/tests/rules/csp/html-unsafe-expr/PASS_1.html +0 -23
  365. package/tests/rules/csp/js-script-unsafe-eval/FAIL_1.js +0 -17
  366. package/tests/rules/csp/js-script-unsafe-eval/FAIL_2.js +0 -40
  367. package/tests/rules/csp/js-script-unsafe-eval/FAIL_3.js +0 -22
  368. package/tests/rules/csp/js-script-unsafe-eval/PASS_1.js +0 -20
  369. package/tests/rules/csp/js-script-unsafe-eval/PASS_2.js +0 -44
  370. package/tests/rules/csp/js-script-unsafe-eval/PASS_3.js +0 -16
  371. package/tests/rules/csp/js-style-unsafe-inline/FAIL_1.js +0 -25
  372. package/tests/rules/csp/js-style-unsafe-inline/PASS.js +0 -22
  373. package/tests/rules/demo/noself_FAIL_1.js +0 -101
  374. package/tests/rules/import/import_FAIL_1.js +0 -11
  375. package/tests/rules/import/import_PASS_1.js +0 -10
  376. package/tests/rules/jet-composites/demo-buttonset-enum/component.json +0 -57
  377. package/tests/rules/jet-composites/demo-buttonset-enum/loader.js +0 -19
  378. package/tests/rules/jet-composites/demo-buttonset-enum/view.html +0 -48
  379. package/tests/rules/jet-composites/demo-card/component.json +0 -28
  380. package/tests/rules/jet-composites/demo-card/loader.js +0 -16
  381. package/tests/rules/jet-composites/demo-card/view.html +0 -30
  382. package/tests/rules/jet-composites/demo-card/viewModel.js +0 -46
  383. package/tests/rules/jet-composites/demo-card/view_PASS_1.html +0 -21
  384. package/tests/rules/jet-composites/demo-contact-form/component.json +0 -23
  385. package/tests/rules/jet-composites/demo-contact-form/loader.js +0 -16
  386. package/tests/rules/jet-composites/demo-contact-form/view.html +0 -9
  387. package/tests/rules/jet-composites/demo-grocery-list/component.json +0 -18
  388. package/tests/rules/jet-composites/demo-grocery-list/loader.js +0 -19
  389. package/tests/rules/jet-composites/demo-grocery-list/view.html +0 -22
  390. package/tests/rules/jet-composites/demo-grocery-list/viewModel.js +0 -48
  391. package/tests/rules/jet-composites/dummy-component-1/component.json +0 -82
  392. package/tests/rules/jet-composites/dummy-component-2/component.json +0 -72
  393. package/tests/rules/jet-composites/foo-my-cca/component.json +0 -14
  394. package/tests/rules/jet-composites/foo-unsup-theme/component.json +0 -29
  395. package/tests/rules/jet-composites/header/component.json +0 -12
  396. package/tests/rules/jet-composites/oj-cgbu-omc/attribute-selection/component.json +0 -154
  397. package/tests/rules/jet-composites/oj-cgbu-omc/component.json +0 -11
  398. package/tests/rules/jet-composites/oj-cgbu-omc/reference/component.json +0 -185
  399. package/tests/rules/jet-composites/oj-cgbu-omc/wctag_props_FAIL_1.html +0 -34
  400. package/tests/rules/jet-composites/oj-enum-depr/component.json +0 -69
  401. package/tests/rules/jet-composites/oj-html-wctag-id/id_FAIL_1.html +0 -10
  402. package/tests/rules/jet-composites/oj-html-wctag-id/id_PASS_1.html +0 -6
  403. package/tests/rules/misc/oj.js +0 -12
  404. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_FAIL_1.html +0 -23
  405. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_FAIL_2.html +0 -22
  406. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_1.html +0 -23
  407. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_2.html +0 -22
  408. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_3.html +0 -22
  409. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_4.html +0 -22
  410. package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_5.html +0 -22
  411. package/tests/rules/oj-acc-aria-prop/aria_prop_FAIL_1.html +0 -22
  412. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_FAIL_1.html +0 -20
  413. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_1.html +0 -23
  414. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_2.html +0 -24
  415. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_3.html +0 -21
  416. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_4.html +0 -22
  417. package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_5.html +0 -22
  418. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_FAIL_1.html +0 -20
  419. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_FAIL_2.html +0 -21
  420. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_PASS_1.html +0 -20
  421. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_FAIL_1.html +0 -21
  422. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_FAIL_2.html +0 -22
  423. package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_PASS_1.html +0 -22
  424. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_FAIL_1.html +0 -18
  425. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_FAIL_2.html +0 -18
  426. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_1.html +0 -18
  427. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_2.html +0 -19
  428. package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_3.html +0 -22
  429. package/tests/rules/oj-acc-input-aria-label/oj_input_date_FAIL_1.html +0 -21
  430. package/tests/rules/oj-acc-input-aria-label/oj_input_date_FAIL_2.html +0 -22
  431. package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_1.html +0 -16
  432. package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_2.html +0 -17
  433. package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_3.html +0 -26
  434. package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_FAIL_1.html +0 -19
  435. package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_FAIL_2.html +0 -20
  436. package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_PASS_1.html +0 -19
  437. package/tests/rules/oj-acc-input-aria-label/oj_input_number_FAIL_1.html +0 -17
  438. package/tests/rules/oj-acc-input-aria-label/oj_input_number_FAIL_2.html +0 -18
  439. package/tests/rules/oj-acc-input-aria-label/oj_input_number_PASS_1.html +0 -17
  440. package/tests/rules/oj-acc-input-aria-label/oj_input_password_FAIL_1.html +0 -17
  441. package/tests/rules/oj-acc-input-aria-label/oj_input_password_FAIL_2.html +0 -17
  442. package/tests/rules/oj-acc-input-aria-label/oj_input_password_PASS_1.html +0 -17
  443. package/tests/rules/oj-acc-input-aria-label/oj_input_text_3_PASS_1.html +0 -20
  444. package/tests/rules/oj-acc-input-aria-label/oj_input_text_FAIL_1.html +0 -20
  445. package/tests/rules/oj-acc-input-aria-label/oj_input_text_FAIL_2.html +0 -21
  446. package/tests/rules/oj-acc-input-aria-label/oj_input_text_PASS_2.html +0 -62
  447. package/tests/rules/oj-acc-input-aria-label/oj_input_text_nolabel_PASS_2.html +0 -17
  448. package/tests/rules/oj-acc-input-aria-label/oj_input_time_FAIL_1.html +0 -19
  449. package/tests/rules/oj-acc-input-aria-label/oj_input_time_FAIL_2.html +0 -20
  450. package/tests/rules/oj-acc-input-aria-label/oj_input_time_PASS_1.html +0 -19
  451. package/tests/rules/oj-acc-select-aria-label/aria_selectmany_FAIL_1.html +0 -19
  452. package/tests/rules/oj-acc-select-aria-label/aria_selectmany_FAIL_2.html +0 -20
  453. package/tests/rules/oj-acc-select-aria-label/aria_selectmany_PASS_1.html +0 -19
  454. package/tests/rules/oj-acc-select-aria-label/aria_selectone_FAIL_1.html +0 -20
  455. package/tests/rules/oj-acc-select-aria-label/aria_selectone_FAIL_2.html +0 -21
  456. package/tests/rules/oj-cca-comp-zip/zip_FAIL_1.zip +0 -1
  457. package/tests/rules/oj-cca-comp-zip/zip_FAIL_2.zip +0 -0
  458. package/tests/rules/oj-cca-comp-zip/zip_FAIL_3.zip +0 -0
  459. package/tests/rules/oj-cca-comp-zip/zip_FAIL_4.zip +0 -0
  460. package/tests/rules/oj-cca-comp-zip/zip_FAIL_5.zip +0 -0
  461. package/tests/rules/oj-cca-comp-zip/zip_FAIL_6.zip +0 -0
  462. package/tests/rules/oj-cca-comp-zip/zip_FAIL_7.zip +0 -0
  463. package/tests/rules/oj-cca-comp-zip/zip_FAIL_8.zip +0 -0
  464. package/tests/rules/oj-cca-comp-zip/zip_PASS_1.zip +0 -0
  465. package/tests/rules/oj-cca-ns-reg/oj-cca-ns-FAIL_1/component.json +0 -19
  466. package/tests/rules/oj-cca-ns-reg/oj-cca-ns-PASS_1/component.json +0 -19
  467. package/tests/rules/oj-cgbu-omc_tests/html_ojevent_FAIL_1.html +0 -15
  468. package/tests/rules/oj-cgbu-omc_tests/html_ojevent_PASS_1.html +0 -17
  469. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_1/component.json +0 -16
  470. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_10/component.json +0 -103
  471. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_11/component.json +0 -24
  472. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_12/component.json +0 -17
  473. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_13/component.json +0 -17
  474. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_14/component.json +0 -40
  475. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_15/component.json +0 -24
  476. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_16/component.json +0 -44
  477. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_17/component.json +0 -8
  478. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_18/component.json +0 -8
  479. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_19/component.json +0 -8
  480. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_2/component.json +0 -15
  481. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_20/component.json +0 -18
  482. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_21/component.json +0 -16
  483. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_22/component.json +0 -19
  484. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_3/component.json +0 -15
  485. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_4/component.json +0 -16
  486. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_5/component.json +0 -16
  487. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_6/component.json +0 -18
  488. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_7/component.json +0 -15
  489. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_8/component.json +0 -15
  490. package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_9/component.json +0 -52
  491. package/tests/rules/oj-compjson-syntax/ojcomp-PASS_1/component.json +0 -17
  492. package/tests/rules/oj-compjson-syntax/ojcomp-PASS_2/component.json +0 -88
  493. package/tests/rules/oj-compjson-syntax/ojcomp-PASS_3/component.json +0 -19
  494. package/tests/rules/oj-css-bp-dir-flow/dirflow_FAIL_1.html +0 -22
  495. package/tests/rules/oj-css-bp-dir-flow/dirflow_FAIL_2.html +0 -22
  496. package/tests/rules/oj-css-diagnose/css_FAIL_1.html +0 -14
  497. package/tests/rules/oj-css-diagnose/css_PASS_1.html +0 -14
  498. package/tests/rules/oj-css-var-override/varovr_FAIL_1.html +0 -8
  499. package/tests/rules/oj-html-5-attr-depr/attrdepr_FAIL_1.html +0 -16
  500. package/tests/rules/oj-html-5-attr-depr/attrdepr_PASS_1.html +0 -16
  501. package/tests/rules/oj-html-5-tag-depr/tagdepr_FAIL_1.html +0 -9
  502. package/tests/rules/oj-html-attr/attr_FAIL_1.html +0 -27
  503. package/tests/rules/oj-html-attr-$unique/attr_$unique1_FAIL_1.html +0 -19
  504. package/tests/rules/oj-html-attr-$unique/attr_$unique_FAIL_2.html +0 -25
  505. package/tests/rules/oj-html-attr-2def/attr2def_FAIL_1.html +0 -10
  506. package/tests/rules/oj-html-attr-2def/attr2def_PASS_1.html +0 -10
  507. package/tests/rules/oj-html-attr-json/attr-json_FAIL_1.html +0 -20
  508. package/tests/rules/oj-html-attr-json/attr-json_FAIL_2.html +0 -20
  509. package/tests/rules/oj-html-attr-json/attr-json_FAIL_3.html +0 -20
  510. package/tests/rules/oj-html-attr-json/attr-json_PASS_1.html +0 -20
  511. package/tests/rules/oj-html-attr-json/attr-json_PASS_2.html +0 -20
  512. package/tests/rules/oj-html-attr-json/attr-json_PASS_3.html +0 -8
  513. package/tests/rules/oj-html-attr-prefix-expr/attrprefixexpr_FAIL_1.html +0 -10
  514. package/tests/rules/oj-html-attr-prefix-expr/attrprefixexpr_PASS_1.html +0 -10
  515. package/tests/rules/oj-html-attr-prefix-ro/attrprefixro_FAIL_1.html +0 -10
  516. package/tests/rules/oj-html-attr-prefix-ro/attrprefixro_PASS_1.html +0 -10
  517. package/tests/rules/oj-html-attr-req/attrreq_FAIL_1.html +0 -17
  518. package/tests/rules/oj-html-attr-req/attrreq_FAIL_2.html +0 -13
  519. package/tests/rules/oj-html-attr-req/attrreq_FAIL_3.html +0 -8
  520. package/tests/rules/oj-html-attr-req/attrreq_FAIL_4.html +0 -13
  521. package/tests/rules/oj-html-attr-req/attrreq_FAIL_5.html +0 -17
  522. package/tests/rules/oj-html-attr-req/attrreq_PASS_1.html +0 -24
  523. package/tests/rules/oj-html-attr-req/attrreq_PASS_2.html +0 -24
  524. package/tests/rules/oj-html-attr-req/attrreq_PASS_3.html +0 -10
  525. package/tests/rules/oj-html-attr-req/attrreq_PASS_4.html +0 -11
  526. package/tests/rules/oj-html-bindforeach-data/bindforeach_data_FAIL_1.html +0 -19
  527. package/tests/rules/oj-html-bindforeach-data/bindforeach_data_PASS_1.html +0 -10
  528. package/tests/rules/oj-html-bindif-test/bindif_test_FAIL_1.html +0 -22
  529. package/tests/rules/oj-html-bindif-test/bindif_test_PASS_1.html +0 -11
  530. package/tests/rules/oj-html-binding-attr/binding-foreach_FAIL_2.html +0 -28
  531. package/tests/rules/oj-html-binding-attr/binding-if_FAIL_1.html +0 -23
  532. package/tests/rules/oj-html-binding-attr/binding-if_PASS_1.html +0 -23
  533. package/tests/rules/oj-html-cca-count/cca-count_FAIL_1.html +0 -119
  534. package/tests/rules/oj-html-cca-tagname/ccatag_FAIL_1.html +0 -7
  535. package/tests/rules/oj-html-cca-tagname/ccatag_PASS_1.html +0 -7
  536. package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_1.html +0 -8
  537. package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_2.html +0 -8
  538. package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_3.html +0 -8
  539. package/tests/rules/oj-html-cca-tagname/tag_ns_PASS_1.html +0 -10
  540. package/tests/rules/oj-html-cdn/html_cdn_FAIL_1.html +0 -18
  541. package/tests/rules/oj-html-cspexpr/cspexpr_FAIL_1.html +0 -14
  542. package/tests/rules/oj-html-cspexpr/cspexpr_FAIL_2.html +0 -10
  543. package/tests/rules/oj-html-cspexpr/cspexpr_PASS_1.html +0 -23
  544. package/tests/rules/oj-html-cspexpr/cspexpr_PASS_2.html +0 -10
  545. package/tests/rules/oj-html-cspexpr/cspexpr_PASS_3.html +0 -13
  546. package/tests/rules/oj-html-dlg-title/dlgtitle_FAIL_1.html +0 -12
  547. package/tests/rules/oj-html-dlg-title/dlgtitle_PASS_1.html +0 -12
  548. package/tests/rules/oj-html-form-noflex/noflex_FAIL_1.html +0 -10
  549. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_1.html +0 -20
  550. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_2.html +0 -13
  551. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_3.html +0 -16
  552. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_4.html +0 -13
  553. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_1.html +0 -6
  554. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_2.html +0 -7
  555. package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_3.html +0 -7
  556. package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_1.html +0 -37
  557. package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_2.html +0 -34
  558. package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_3.html +0 -27
  559. package/tests/rules/oj-html-jq-databind/jq-databind_PASS_1.html +0 -30
  560. package/tests/rules/oj-html-ko-comment/ko-comment_FAIL_1.html +0 -47
  561. package/tests/rules/oj-html-ko-comment/ko-comment_FAIL_2.html +0 -36
  562. package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_1.html +0 -24
  563. package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_2.html +0 -36
  564. package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_3.html +0 -29
  565. package/tests/rules/oj-html-label-for-prefix/for_FAIL_1.html +0 -8
  566. package/tests/rules/oj-html-label-for-prefix/for_PASS_1.html +0 -8
  567. package/tests/rules/oj-html-missing-doctype/doctype_missing_FAIL_1.html +0 -12
  568. package/tests/rules/oj-html-missing-doctype/doctype_missing_FAIL_2.html +0 -11
  569. package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_1.html +0 -14
  570. package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_2.html +0 -5
  571. package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_3.html +0 -12
  572. package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_5.html +0 -6
  573. package/tests/rules/oj-html-nonvoid-close/close_FAIL_1.html +0 -28
  574. package/tests/rules/oj-html-nonvoid-close/close_FAIL_2.html +0 -14
  575. package/tests/rules/oj-html-nonvoid-close/close_FAIL_3.html +0 -13
  576. package/tests/rules/oj-html-nonvoid-close/close_FAIL_5.html +0 -28
  577. package/tests/rules/oj-html-nonvoid-close/close_FAIL_6.html +0 -28
  578. package/tests/rules/oj-html-nonvoid-close/close_PASS_1.html +0 -7
  579. package/tests/rules/oj-html-oj-lib/oj_lib_FAIL_1.html +0 -15
  580. package/tests/rules/oj-html-ojattr/ojattr_PASS_1.html +0 -8
  581. package/tests/rules/oj-html-ojattr/ojattr_PASS_2.html +0 -10
  582. package/tests/rules/oj-html-ojattr/ojattr_PASS_3.html +0 -7
  583. package/tests/rules/oj-html-ojattr/ojattr_PASS_4.html +0 -7
  584. package/tests/rules/oj-html-ojattr-deprecated/ojattr-dep_FAIL1.html +0 -156
  585. package/tests/rules/oj-html-ojattr-enum-deprecated/enum_FAIL_1.html +0 -19
  586. package/tests/rules/oj-html-ojattr-enum-deprecated/enum_FAIL_2.html +0 -20
  587. package/tests/rules/oj-html-ojattr-enum-deprecated/enum_PASS_1.html +0 -25
  588. package/tests/rules/oj-html-ojattr-evt-syntax/evt-attr-syntax_FAIL_1.html +0 -6
  589. package/tests/rules/oj-html-ojattr-evt-syntax/evt-attr-syntax_PASS_1.html +0 -6
  590. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_1.html +0 -26
  591. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_2.html +0 -26
  592. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_3.html +0 -8
  593. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_4.html +0 -8
  594. package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_5.html +0 -8
  595. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_1.html +0 -26
  596. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_2.html +0 -8
  597. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_3.html +0 -7
  598. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_6.html +0 -7
  599. package/tests/rules/oj-html-ojattr-value/attr-value_PASS_7.html +0 -10
  600. package/tests/rules/oj-html-ojattr-value/attr_value_PASS_4.html +0 -7
  601. package/tests/rules/oj-html-ojattr-value/attr_value_PASS_5.html +0 -9
  602. package/tests/rules/oj-html-ojslot/ojslot_FAIL_1.html +0 -11
  603. package/tests/rules/oj-html-ojslot/ojslot_PASS_1.html +0 -12
  604. package/tests/rules/oj-html-ojstyle/style_FAIL_1.html +0 -103
  605. package/tests/rules/oj-html-ojstyle/style_PASS_2.html +0 -7
  606. package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_1.html +0 -10
  607. package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_2.html +0 -18
  608. package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_3.html +0 -10
  609. package/tests/rules/oj-html-ojtag-datacmd/datacmd_PASS_1.html +0 -28
  610. package/tests/rules/oj-html-ojtag-datacmd/datacmd_PASS_2.html +0 -15
  611. package/tests/rules/oj-html-ojtag-datactx/datactx_FAIL_1.html +0 -14
  612. package/tests/rules/oj-html-ojtag-datactx/datactx_PASS_1.html +0 -14
  613. package/tests/rules/oj-html-ojtag-globattr-noprefix/globattr-noprefix_FAIL_1.html +0 -36
  614. package/tests/rules/oj-html-ojtag-nonglobattr-prefix/nonglobattr-prefix_FAIL_1.html +0 -26
  615. package/tests/rules/oj-html-slot-name/slot_name.FAIL_1.html +0 -24
  616. package/tests/rules/oj-html-slot-name/slot_name.FAIL_2.html +0 -46
  617. package/tests/rules/oj-html-slot-name/slot_name.FAIL_3.html +0 -10
  618. package/tests/rules/oj-html-slot-name/slot_name.PASS_1.html +0 -24
  619. package/tests/rules/oj-html-slot-name/slot_name.PASS_2.html +0 -39
  620. package/tests/rules/oj-html-slot-name/slot_name.PASS_3.html +0 -10
  621. package/tests/rules/oj-html-slot-name/slot_name_PASS_4.html +0 -16
  622. package/tests/rules/oj-html-slot-name/slot_name_PASS_5.html +0 -11
  623. package/tests/rules/oj-html-slot-name/slot_name_PASS_6.html +0 -14
  624. package/tests/rules/oj-html-slot-name/slot_name_PASS_7.html +0 -10
  625. package/tests/rules/oj-html-style/style_FAIL_1.html +0 -7
  626. package/tests/rules/oj-html-style/style_PASS_1.html +0 -12
  627. package/tests/rules/oj-html-style/style_PASS_2.html +0 -7
  628. package/tests/rules/oj-html-style-bp-color/color-FAIL_1.html +0 -17
  629. package/tests/rules/oj-html-style-bp-color/color-FAIL_2.html +0 -15
  630. package/tests/rules/oj-html-style-bp-color/color-FAIL_3.html +0 -7
  631. package/tests/rules/oj-html-style-bp-color/color-PASS_1.html +0 -7
  632. package/tests/rules/oj-html-style-bp-font-family/fam_FAIL_1.html +0 -23
  633. package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_FAIL_1.html +0 -15
  634. package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_FAIL_2.html +0 -9
  635. package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_PASS_1.html +0 -9
  636. package/tests/rules/oj-html-unsup-theme/unsup_FAIL_1.html +0 -8
  637. package/tests/rules/oj-html-wctag-for/for_FAIL_1.html +0 -8
  638. package/tests/rules/oj-html-wctag-for/for_PASS_1.html +0 -8
  639. package/tests/rules/oj-js-comp-attr-deprecated/attr-del_FAIL_1.js +0 -20
  640. package/tests/rules/oj-js-comp-attr-deprecated/attr-dep_FAIL_1.js +0 -20
  641. package/tests/rules/oj-js-comp-meth-deprecated/meth-del_FAIL_1.js +0 -20
  642. package/tests/rules/oj-js-comp-meth-deprecated/meth-dep_FAIL_1.js +0 -20
  643. package/tests/rules/oj-js-define-promise/def-prom_FAIL_1.js +0 -16
  644. package/tests/rules/oj-js-define-promise/def-prom_FAIL_2.js +0 -16
  645. package/tests/rules/oj-js-diagnose/es6_PASS_1.js +0 -24
  646. package/tests/rules/oj-js-diagnose/js_FAIL_1.js +0 -12
  647. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_1.js +0 -30
  648. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_2.js +0 -23
  649. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_3.js +0 -22
  650. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_4.js +0 -20
  651. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_5.js +0 -24
  652. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_6.js +0 -30
  653. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_7.js +0 -15
  654. package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_8.js +0 -16
  655. package/tests/rules/oj-js-no-ext-final/noextfinal_PASS_1.js +0 -17
  656. package/tests/rules/oj-js-no-ext-final/noextfinal_PASS_2.js +0 -17
  657. package/tests/rules/oj-js-noconsole/nocons_FAIL_1.js +0 -11
  658. package/tests/rules/oj-js-ojcomp-deprecated/jscomp_FAIL_1.js +0 -27
  659. package/tests/rules/oj-json-syntax/json_FAIL_1.json +0 -8
  660. package/tests/rules/oj-json-syntax/json_FAIL_2.json +0 -12
  661. package/tests/rules/oj-json-syntax/json_PASS_1.json +0 -25
  662. package/tests/rules/oj-json-syntax/json_PASS_2.json +0 -12
  663. package/tests/rules/oj-json-syntax/json_PASS_3.json +0 -14
  664. package/tests/rules/ojcompjson/attrreq_FAIL_1/component.json +0 -69
  665. package/tests/rules/pack-compjson/audit-pack/component-1/component-1-view.html +0 -6
  666. package/tests/rules/pack-compjson/audit-pack/component-1/component-1-viewModel.js +0 -56
  667. package/tests/rules/pack-compjson/audit-pack/component-1/component.json +0 -13
  668. package/tests/rules/pack-compjson/audit-pack/component-1/loader.js +0 -20
  669. package/tests/rules/pack-compjson/audit-pack/component-1/resources/nls/component-1-strings.js +0 -18
  670. package/tests/rules/pack-compjson/audit-pack/component-2/component-2-view.html +0 -5
  671. package/tests/rules/pack-compjson/audit-pack/component-2/component-2-viewModel.js +0 -56
  672. package/tests/rules/pack-compjson/audit-pack/component-2/component.json +0 -13
  673. package/tests/rules/pack-compjson/audit-pack/component-2/loader.js +0 -20
  674. package/tests/rules/pack-compjson/audit-pack/component-2/resources/nls/component-1-strings.js +0 -18
  675. package/tests/rules/pack-compjson/audit-pack/component.json +0 -12
  676. package/tests/rules/pack-compjson/audit-singleton-1/audit-singleton-1-view.html +0 -5
  677. package/tests/rules/pack-compjson/audit-singleton-1/audit-singleton-1-viewModel.js +0 -56
  678. package/tests/rules/pack-compjson/audit-singleton-1/component.json +0 -20
  679. package/tests/rules/pack-compjson/audit-singleton-1/loader.js +0 -20
  680. package/tests/rules/pack-compjson/audit-singleton-1/resources/nls/audit-singleton-1-strings.js +0 -18
  681. package/tests/rules/pack-compjson/audit-singleton-2/audit-singleton-2-view.html +0 -8
  682. package/tests/rules/pack-compjson/audit-singleton-2/audit-singleton-2-viewModel.js +0 -56
  683. package/tests/rules/pack-compjson/audit-singleton-2/component.json +0 -15
  684. package/tests/rules/pack-compjson/audit-singleton-2/loader.js +0 -20
  685. package/tests/rules/pack-compjson/audit-singleton-2/resources/nls/audit-singleton-2-strings.js +0 -18
  686. package/tests/rules/parse-html/proc_instr.html +0 -9
  687. package/tests/rules/spoc-dom-manip/dom-manip_FAIL_1.js +0 -113
  688. package/tests/rules/spoc-dom-manip/dom-manip_FAIL_2.js +0 -151
  689. package/tests/rules/spoc-dom-manip/dom-manip_PASS_1.js +0 -149
  690. package/tests/rules/spoc-dom-manip/dom-manip_PASS_2.js +0 -147
  691. package/tests/rules/spoc-dom-manip/dom-manip_PASS_3.js +0 -147
  692. package/tests/rules/spoc-dom-manip/dom-manip_PASS_4.js +0 -20
  693. package/tests/rules/spoc-dom-manip/dom-manip_PASS_5.js +0 -246
  694. package/tests/rules/tab-tests/tab-test_FAIL_1.html +0 -37
  695. package/tests/rules/tab-tests/tab-test_FAIL_2.html +0 -8
  696. package/tests/rules/webcomptests/jet-composites/oj-html-wctag-$props/prop_PASS_1.html +0 -8
  697. package/tests/rules/webcomptests/jet-composites/oj-html-wctag-$props/prop_PASS_2.html +0 -8
  698. package/tests/rules/webcomptests/jet-composites/oj-html-wctag-for/for_FAIL_1.html +0 -8
  699. package/tests/rules/webcomptests/jet-composites/oj-html-wctag-for/for_PASS_1.html +0 -8
  700. package/tests/src/JetTest.js +0 -1
  701. package/tests/src/server.js +0 -1
  702. package/tests/test.js +0 -1
package/lib/extends.js ADDED
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const TSCONFIG="tsconfig.json";const MERGEABLE_BY_DEFAULT={components:true,componentUrls:true,exclude:true,files:true,groups:true,message:true,nameSpaces:true,options:true,ruleMods:true,ruleNames:true,rulePacks:true,tokens:true};const MERGEABLE_BY_OPTION={};const EXOPT_IGNORE="ignore";const EXOPT_MERGE="merge";const MSG={OBJ:"Config '%s' is not an object - %p",ARRAY:"Config '%s' is not an array - %p",STR_OR_AR_STR:"Config '%s' is not a string or an array of strings - %p",AR_OBJ:"Config '%s' is not an array of objects - %p",AR_STR:"Config '%s' is not an array of strings - %p",AR_STR_OBJ:"Config '%s' is not an array of strings or objects - %p",EXT_OPT:"Config 'extendOptions.%s' cannot be 'merge' - %p",EXT_OPT_VAL:"Config 'extendOptions.%s' not 'ignore' or 'merge' - %p",UNKNOWN:"Unknown config prop - '%s' - %p"};const REPL_PROP="%s";const REPL_PATH="%p";class Extends{constructor(configLib,configInst,cfg,path,nd,msgCtx,utils){this._path=path;this._cfg=cfg;this._fp=cfg.base;this._nd=nd;this._msgCtx=msgCtx;this._utils=utils;this._cwd=nd.process.cwd();this._cfgLib=configLib;this._cfgInst=configInst;this._stack=[];this._extendOpts=null;this._error=msgCtx.error;this._info=msgCtx.info;this._mergeHandlers={components:this._mergePropComponents.bind(this),componentUrls:this._mergePropCompUrls.bind(this),exclude:this._mergePropExclude.bind(this),files:this._mergePropFiles.bind(this),groups:this._mergePropGroups.bind(this),messages:this._mergePropMessages,nameSpaces:this._mergePropNameSpaces.bind(this),options:this._mergePropOptions.bind(this),ruleMods:this._mergePropRuleMods,ruleNames:this._mergePropRuleNames.bind(this),rulePacks:this._mergePropRulePacks,tokens:this._mergePropTokens.bind(this)}}extend(){var debug;if(debug=this._cfg.options&&(this._cfg.options.verbose||this._cfg.options.debug)){this._msgCtx.info("[Info]: Merging configurations...","I",true)}if(!this._createStack()){return null}if(debug){this._dumpStack()}if(!this._isError){this._checkMergePropTypes()}if(this._isError){return null}if(!this._stack.length){return this._cfg}return this._mergeStack()}_createStack(cfg,fp){var json,fp,first,o;if(first=!cfg){cfg=this._cfg;fp=this._path?this._path:this._fp}else{fp=cfg.extends}if(!fp){return true}if(first){json=cfg}else{fp=this._getAbsolutePath(fp);if(!this._nd.fsUtils.fileExists(fp)){this._error(`Configuration file not found : ${fp}`);return false}if(this._isCircular(fp)){this._error(`Circular configuration 'extends' detected : ${fp}`);return false}try{json=this._nd.fs.readFileSync(fp,"utf8");json=this._nd.decomment(json);json=this._preprocessRawJson(json,fp);if(!json){return false}o=this._utils.parseJson(json,false);if(o.msg){this._error(`Config 'extends' error : ${o.msg} : ${fp}`);return false}else{json=o.obj}}catch(e){this._error(`Error reading 'extends' config : ${fp}`);return false}}this._stack.push({path:fp,cfg:json});if(json.extends){if(!this._createStack(json,json.extends)){return false}}return true}_preprocessRawJson(txt,fp){var json=this._cfgInst.processIncludes(txt,fp);if(this._cfgInst.isOk()){json=this._cfgInst.processTokens(json);if(this._cfgInst.isOk()){}}return this._cfgInst.isOk()?json:null}_mergeStack(){if(!this._fixupPaths()){return null}for(let i=this._stack.length-1;i>0;i--){if(!this._mergePair(this._stack[i-1],this._stack[i])){return null}}if(this._isMergeProp("files")){if(this._stack[0].cfg.hasOwnProperty("files")){this._stack[0].cfg.files=_removeDupes(this._stack[0].cfg.files)}}if(this._isMergeProp("exclude")){if(this._stack[0].cfg.hasOwnProperty("exclude")){this._stack[0].cfg.exclude=_removeDupes(this._stack[0].cfg.exclude)}}return this._stack[0].cfg}_mergePair(parSE,chSE){var props,parent,child,merger,ret=true;parent=parSE.cfg;child=chSE.cfg;this._extendOpts=parSE.cfg.extendOptions||{};props=Object.keys(child);props.forEach(prop=>{if(prop.startsWith("_")||prop==="base"||prop==="extends"||prop==="tokens"||this._extendOpts[prop]===EXOPT_IGNORE){return}if(!parent.hasOwnProperty(prop)){parent[prop]=child[prop];return}if(!this._isMergeProp(prop)){return}if(merger=this._mergeHandlers[prop]){if(!merger(parSE,chSE)){ret=false}}});if(!ret){return ret}this._msgCtx.info(`[Info]: Inherited config '${chSE.path}'`,"I",true);return true}_checkMergePropTypes(){var cfg,se,prop,prop2,val;for(let i=0;i<this._stack.length;i++){se=this._stack[i];cfg=se.cfg;if(!this._cfgLib.checkPropNames(cfg,se.path)){this._isError=true}if(cfg.extendOptions){if(this._utils.isObject(cfg.extendOptions)){this._extendOpts=cfg.extendOptions;for(prop in this._extendOpts){val=this._extendOpts[prop];if(val===EXOPT_MERGE&&!MERGEABLE_BY_OPTION[prop]){this._emitErrorMsg(MSG.EXT_OPT,prop,se.path);return}else if(val!==EXOPT_MERGE&&val!==EXOPT_IGNORE){this._emitErrorMsg(MSG.EXT_OPT_VAL,prop,se.path);return}}}else{this._emitErrorMsg(MSG.OBJ,"extendOptions",se.path);return}}else{this._extendOpts={}}for(prop in cfg){if(!this._isMergeProp(prop)){continue}val=cfg[prop];if(prop==="components"||prop==="componentUrls"){if(typeof val!=="string"&&!Array.isArray(val)||!this._utils.isArrayContentsType(val,"string")){this._emitErrorMsg(MSG.STR_OR_AR_STR,prop,se.path)}}else if(prop==="files"){if(!Array.isArray(val)){this._emitErrorMsg(prop,prop,se.path)}if(!this._utils.isArrayContentsType(val,["string","object"])){this._emitErrorMsg(MSG.AR_STR_OBJ,prop,se.path)}}else if(prop==="exclude"){if(!Array.isArray(val)||!this._utils.isArrayContentsType(val,"string")){this._emitErrorMsg(MSG.STR_OR_AR_STR,prop,se.path)}}else if(prop==="groups"){if(!Array.isArray(val)){this._emitErrorMsg(MSG.STR,prop,se.path)}}else if(prop==="messages"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}if(se.messages.reject){if(!Array.isArray(se.messages.reject)){this._emitErrorMsg(MSG.OBJ,"messages.reject",se.path)}}if(se.messages.accept){if(!Array.isArray(se.messages.accept)){this._emitErrorMsg(MSG.OBJ,"messages.accept",se.path)}}}else if(prop==="nameSpaces"){if(!Array.isArray(val)){this._emitErrorMsg(MSG.AR_STR,prop,se.path)}}else if(prop==="options"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}}else if(prop==="ruleMods"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path);continue}for(prop2 in val){if(prop2==="enable"||prop2==="disable"){if(!Array.isArray(val[prop2])){this._emitErrorMsg(MSG.AR_OBJ,prop2==="enable"?"ruleMods.enable":"ruleMods.disable",se.path)}}else{if(!this._utils.isObject(val[prop2])){this._emitErrorMsg(MSG.AR_OBJ,prop+"."+prop2,se.path)}}}}else if(prop==="ruleNames"){if(!Array.isArray(val)||!this._utils.isArrayContentsType(val,"string")){this._emitErrorMsg(MSG.AR_STR,prop,se.path)}}else if(prop==="rulePacks"){if(!Array.isArray(val)||!this._utils.isArrayContentsType(val,"object")){this._emitErrorMsg(MSG.AR_OBJ,prop,se.path)}}else if(prop==="sevMap"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}if(val.sevMsg&&!this._utils.isObject(val.sevMsg)){this._emitErrorMsg(MSG.OBJ,prop+".sevMsg",se.path)}if(val.sevSet&&!this._utils.isObject(val.sevSet)){this._emitErrorMsg(MSG.OBJ,prop+".sevSet",se.path)}}else if(prop==="tokens"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}}else{this._error(`JAF ERROR: unhandled 'extends' property '${prop}' - ${se.path}`);this._isError=true}}}}_fixupPaths(){var se,ret=true;for(let i=this._stack.length-1;i>=0;i--){se=this._stack[i];if(!(this._cleanBase(se)&&this._fixupConfig(se))){ret=false;break}}return ret}_cleanBase(se){var src,ft;var nd=this._nd;src=se.cfg.base;if(src==="$jafcwd"){src=this._cwd}else{if(!src){src=this._nd.path.dirname(se.path)}src=nd.path.normalize(src);if(!nd.path.isAbsolute(src)){src=nd.path.join(nd.path.dirname(se.path),src)}ft=nd.fsUtils.getFileType(src);if(ft!=="d"){this._msgCtx.error(`Config file 'base' is not a directory - '${src}' in ${se.path}`);return false}}se.cfg.base=src;this._info(`[Info]: Using config base '${src}' in ${se.path}`,"I");return true}_fixupConfig(se){var nd,cfg,src,dir,ft,i;nd=this._nd;cfg=se.cfg;if(cfg.files){if(!this._cfgLib.validateFileList(cfg.files)){this._bErrors=true;return}if(src=se.cfg.files){for(i=0;i<src.length;i++){if(!src[i].startsWith("http")){src[i]=nd.path.normalize(src[i]);src[i]=nd.path.resolve(cfg.base,src[i])}}}}if(cfg.exclude){if(!this._cfgLib.validateFileList(cfg.exclude)){this._bErrors=true;return}if(src=cfg.exclude){for(i=0;i<src.length;i++){src[i]=nd.path.normalize(src[i]);src[i]=nd.path.resolve(cfg.base,src[i])}}}src=cfg.components;if(src){for(i=0;i<src.length;i++){dir=nd.path.normalize(src[i]);dir=nd.path.resolve(cfg.base,dir);cfg.components[i]=dir}}src=cfg.outPath;if(src&&src!=="$noout"){src=nd.path.normalize(src);src=nd.path.resolve(cfg.base,src);cfg.outPath=src}src=cfg.rulePacks;if(src){for(i=0;i<src.length;i++){dir=src[i].path;dir=nd.path.normalize(dir);src[i].path=nd.path.resolve(cfg.base,dir);if(src[i].path.endsWith(".zip")){continue}ft=nd.fsUtils.getFileType(src[i].path);if(ft!=="d"){this._error("'rulePacks (entry "+(i+1)+"): path' is not a directory - \""+src[i].path+"\"");this._bErrors=true}}}src=cfg.tsconfig;if(src&&typeof src==="string"){dir=nd.path.normalize(src);dir=nd.path.resolve(cfg.base,dir);if(dir.endsWith(TSCONFIG)){dir=nd.path.dirname(dir)}src=this._loadTsConfig(nd.path.join(dir,TSCONFIG));if(src){cfg.tsconfig=dir;this._tsconfig=src}else{this._bErrors=true}}if(this._bErrors){this._error(`Errors found in inherited config '${se.path}'`)}return!this._bErrors}_getAbsolutePath(fp){if(this._nd.path.isAbsolute(fp)){return fp}let p=this._nd.path.join(this._cfg.base,fp);if(!this._nd.path.isAbsolute(p)){p=this._nd.path.join(this._dir,p)}return p}_isCircular(fp){var ret;for(let i=0;i<this._stack.length;i++){if(this._stack[i].path===fp){ret=true;break}}return ret}_isMergeProp(p){return MERGEABLE_BY_DEFAULT[p]||this._extendOpts[p]===EXOPT_MERGE}_mergePropFiles(parSE,chSE){return this._mergePropFilesExclude(parSE,chSE,"files")}_mergePropExclude(parSE,chSE){return this._mergePropFilesExclude(parSE,chSE,"exclude")}_mergePropFilesExclude(parSE,chSE,prop){var parent,child,ch,i;var parent=parSE.cfg[prop];var child=chSE.cfg[prop];for(i=0;i<child.length;i++){ch=child[i];if(!parent.includes(ch)){parent.push(ch)}}return true}_mergePropOptions(parSE,chSE){return this._mergeObjects(parSE,chSE,"options")}_mergePropGroups(parSE,chSE){return this._mergeArrays(parSE,chSE,"groups")}_mergePropTokens(parSE,chSE){return this._mergeObjects(parSE,chSE,"tokens")}_mergePropNameSpaces(parSE,chSE){return this._mergeArrays(parSE,chSE,"nameSpaces")}_mergePropRuleMods(parSE,chSE){var parent,child,pname,parPack,rule,rval,prval,i;var parent=parSE.cfg.ruleMods;var child=chSE.cfg.ruleMods;for(pname in child){rval=child[pname];if(!parent[pname]){parent[pname]=rval;continue}if(pname==="enable"||pname==="disable"){prval=parent[pname];for(i=0;i<rval.length;i++){if(!prval.includes(rval[i])){prval.push(rval[i])}}continue}parPack=parent[pname];for(rule in rval){if(!parPack[rule]){parPack[rule]=rval[rule]}}}return true}_mergePropRuleNames(parSE,chSE){return this._mergeArrays(parSE,chSE,"ruleNames")}_mergePropRulePacks(parSE,chSE){var parent=parSE.cfg.rulePacks;var child=chSE.cfg.rulePacks;for(let i=0;i<child.length;i++){let ch=child[i];let b=false;for(let j=0;j<parent.length;j++){let par=parent[j];if(ch.path===par.path){b=true;break}}if(!b){parent.push(ch)}}return true}_mergePropMessages(parSE,chSE){var parent=parSE.cfg.messages;var child=chSE.cfg.messages;var parReject=parent.reject;var chReject=child.reject;if(!parReject&&chReject){parent.reject=chReject}else if(parReject&&chReject){parent.reject=_removeDupes(parReject.concat(chReject))}var parAccept=parent.accept;var chAccept=child.accept;if(!parAccept&&chAccept){parent.accept=chAccept}else if(parAccept&&chAccept){parent.accept=_removeDupes(parAccept.concat(chAccept))}return true}_mergePropComponents(parSE,chSE){return this._mergeArrays(parSE,chSE,"components")}_mergePropCompUrls(parSE,chSE){return this._mergeArrays(parSE,chSE,"componentUrls")}_mergeObjects(parSE,chSE,prop){var parent,child;parent=parSE.cfg[prop];child=chSE.cfg[prop];for(let prop in child){if(!parent.hasOwnProperty[prop]){parent[prop]=child[prop]}}return true}_mergeArrays(parSE,chSE,prop){var parent,child,isPS,isCS,isPA,isCA,val;parent=parSE.cfg[prop];child=chSE.cfg[prop];isPS=typeof parent==="string";isCS=typeof child==="string";if(isPS&&isCS&&parent===child){return}isPA=Array.isArray(parent);isCA=Array.isArray(child);parent=isPA?parent:[parent];child=isCA?child:[child];for(let i=0;i<child.length;i++){val=child[i];if(!parent.includes(val)){parent.push(val)}}return true}_emitErrorMsg(s,prop,path){var s=s||MSG.UNKNOWN;if(prop){s=s.replace(REPL_PROP,prop)}this._error(s.replace(REPL_PATH,path));this._isError=true}_parseError(msg){this._parseError=msg}_dumpStack(){this._msgCtx.info("[Info]: Config 'extends' stack","I",true);for(let i=0;i<this._stack.length;i++){this._msgCtx.info(`[Info]: ${this._stack[i].path}`,"I",true)}}}function _removeDupes(ar){return Array.isArray(ar)?ar.filter((val,x)=>ar.indexOf(val)===x):ar};module.exports=Extends;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const _FILETYPES={html:true,css:true,js:true,ts:true,tsx:true,json:true,zip:true};const _OBJ_FILETYPES={html:true,css:true,js:true,ts:true,tsx:true,json:true};const _ZIP_FILETYPES={html:true,css:true,js:true,ts:true,tsx:true,json:true};module.exports.HTML="html";module.exports.CSS="css";module.exports.JS="js";module.exports.TS="ts";module.exports.TSX="tsx";module.exports.JSON="json";module.exports.ZIP="zip";module.exports.isFileTypeSupported=ft=>{return _FILETYPES[ft]};module.exports.isFileTypeSupportedInObj=ft=>{return _OBJ_FILETYPES[ft]};module.exports.isFileTypeSupportedInZip=ft=>{return _ZIP_FILETYPES[ft]};module.exports.isFileTypeTsOrTsx=ft=>{return ft==="ts"||ft==="tsx"};
package/lib/groups.js ADDED
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const _GROUPS={all:true,'jet-html':true,'jet-css':true,'jet-js':true,'jet-ts':true,'jet-tsx':true,'jet-json':true,'jet-aria':true,'jet-deprecated':true,'jet-deleted':true,'jet-override':true,'jet-cca':true,'jet-spoc':true,'jet-csp':true,'jet-demo':true,'jet-bp':true,html5:true};module.exports.isGroup=g=>{return _GROUPS[g]};
package/lib/help.js CHANGED
@@ -1 +1,6 @@
1
- const FLAGS=["\n Command line: [flags] [ files/directory space separated list]\n"," Flags: --config or -c : followed by filepath to configuration file."," If omitted, current directory is used."," --base or -b : followed by filepath used to resolve relative paths"," If omitted, current directory is used."," --jetver or -jv : sets the JET version - must be followed by a version number x[.y[.z]]"," --format or -t : followed by output format 'prose' | 'json' | 'line'"," --outPath or -o : followed by output file path"," --noout or -no : do not write to output file path"," --rules or -r : display rule information"," --rulessonar or -rs : display rule information - sonar format"," --rulesjson or -rj : display rule information - json format"," --severity or -s : report on this rule severity only"," --groups or -g : followed by group(s)"," --followlinks or -fl : follow stylesheet/script links"," --nofollowlinks or -nfl : do not follow stylesheet/script links"," --extra or -e : verbose - show extra details"," --retcode or -rc : followed by 'auto' | 'errors' | number, to override return code"," --msgid or -id : show audit message id's in the ouput if format 'prose'"," --dryrun or -dr : dry run - show setup without actually auditing"," --nocolor or -nc : do not colorize output"," --reg or -reg : display rule listener types (debug)"," --debug or -d : debug mode"," --help or -h : show this help"," --help or -h : followed by messageID | rulename : show description"," --version or -v : show the ojaf version"," --jetlist or -jl : show the supported JET versions"," --nslist or -nsl : show the supported Namespaces"," --metahist or -mh : show the renamed/deleted JET component history\n"," --init or -i : scaffold a JAF config file"," --initrule or -ir : followed by rulename (no file extension) - scaffold a rule file\n","\n1) Command line args override corresponding properties in the configuration file.","2) The command flags are case independent."];module.exports=function(fnShowVersion,msgContext){var console=msgContext.console;fnShowVersion();FLAGS.forEach(s=>console(s))};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const FLAGS=["\n Command line: [flags] [ files/directory space separated list]\n"," Flags: --config or -c : followed by filepath to configuration file."," If omitted, current directory is used."," --base or -b : followed by filepath used to resolve relative paths"," If omitted, current directory is used."," --jetver or -jv : sets the JET version - must be followed by a version number x[.y[.z]]"," --format or -t : followed by output format 'prose' | 'json' | 'line'"," --outPath or -o : followed by output file path"," --noout or -no : do not write to output file path"," --rules or -r : display rule information"," --rulessonar or -rs : display rule information - sonar format"," --rulesjson or -rj : display rule information - json format"," --severity or -s : report on this rule severity only"," --groups or -g : followed by group(s)"," --groups= or -g= : followed by group(s)"," --followlinks or -fl : follow stylesheet/script links"," --nofollowlinks or -nfl : do not follow stylesheet/script links"," --extra or -e : verbose - show extra details"," --retcode or -rc : followed by 'auto' | 'errors' | number, to override return code"," --retcode= or -rc= : followed by 'auto' | 'errors' | number, to override return code"," --msgid or -id : show audit message id's in the ouput if format 'prose'"," --dryrun or -dr : dry run - show setup and files that would have be audited (no audit performed)"," --dac or -dac : display active config and teminate (no audit performed)"," --nocolor or -nc : do not colorize output"," --reg or -reg : display rule listener types (debug)"," --debug or -d : debug mode"," --help or -h : show this help"," --help or -h : followed by messageID | rulename : show description"," --version or -v : show the ojaf version"," --jetlist or -jl : show the supported JET versions"," --nslist or -nsl : show the supported Namespaces"," --metahist or -mh : show the renamed/deleted JET component history\n"," --init or -i : scaffold a JAF config file"," --initrule or -ir : followed by rulename (no file extension) - scaffold a rule file\n","\n1) Command line args override corresponding properties in the configuration file.","2) The command flags are case independent."];module.exports=function(fnShowVersion,msgContext){var console=msgContext.console;fnShowVersion();FLAGS.forEach(s=>console(s))};
package/lib/imanual.js ADDED
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const PREFIX=["jet","jaf","csp","jetwc","jetwco"];const RP_PREFIX=["csp","jetwc","jetwco"];const RULES_JSON="rules.json";const MSGID_JSON="msgid.json";const JS=".js";const RE_WS=/^\s*$/;const RE_MARKUP=/<[^>]*>/g;const RE_MARKUP2=/\s{2,}/g;const EMPTY="";const LINELEN=100;var _nd;var _error;var _path;var _rDir;var _rpDir;var _isMsgId;var _prefix;var _msgNum;var _arg;var _sev;var _multiIDs=[];var _isColor;function showMsgHelp(nd,arg,isColor,msgCtx){var rc=_init(nd,arg,isColor,msgCtx);if(rc>0){return _process()}else{return rc===0}};function _process(){var meta;_rDir=_path.join(__dirname,"../rules");_rpDir=_path.join(__dirname,"../rulepacks");if(!(meta=_loadRuleMetadata())){return true}return _isMsgId?_processMsgId(meta):_processRuleName(meta)};function _processMsgId(meta){var mjson=meta.mjson;var rname,r,x;for(r in mjson){if(_msgNum===mjson[r]){rname=r;break}}if(!rname){_error(`No rule found for message ID ${_prefix}-${_msgNum}.`);return true}x=rname.indexOf("_");if(x>=0){rname=rname.substring(0,x)}return _displayIt(rname,_prefix,meta)};function _processRuleName(meta){var rname,rjson,r;rname=_arg.toLowerCase();rjson=meta.rjson.rules;for(r in rjson){if(r===rname){return _displayIt(rname,_prefix,meta)}}_error(`Rule ${rname} is not a core rule`);return!rname.startsWith("oj-")};function _displayIt(rname,prefix,meta){var rule,r,mjson,rjson,prefix;mjson=meta.mjson;for(r in mjson){if(r.startsWith(rname)){_multiIDs.push(mjson[r])}}rjson=meta.rjson;for(r in rjson.rules){if(r===rname){_sev=rjson.rules[r].severity;break}}_sev=_sev||"unknown";if(rule=_loadRule(rname,meta)){let o={descrip:rule.getDescription(),rule:rname,prefix:prefix,sev:_sev,idList:_multiIDs};display(o,_isColor?_nd.colors:null);return true}return false};function _loadRule(rname,meta){var rule,ruleJS,fp;try{fp=_nd.path.join(meta.rdir,rname+JS);ruleJS=_nd.ruleLoader(fp);if(ruleJS.prototype||!ruleJS.getName){try{rule=new ruleJS}catch(e){_error(`Failed to instantiate rule ${rname}`)}}else{rule=ruleJS}return rule}catch(e){_error(`Failed to load rule ${rname}`)}};function _loadRuleMetadata(){var meta,fp;fp=RP_PREFIX.includes(_prefix)?_nd.path.join(_rpDir,_prefix):_nd.path.join(_rDir,_prefix);meta=_loadRulesJson(fp);return meta}function _loadRulesJson(dir){var rjson,mjson,fp;fp=_nd.path.join(dir,RULES_JSON);if(_nd.fsUtils.fileExists(fp)){rjson=_nd.jsonLoader.load(fp,_nd,m=>{_error(m)},true,_nd.utils)}else{_error(`Internal error: rule manifest for ${_prefix} not found`);return false}fp=_nd.path.join(dir,MSGID_JSON);if(_nd.fsUtils.fileExists(fp)){mjson=_nd.jsonLoader.load(fp,_nd,m=>{_error(m)},true,_nd.utils)}else{if(!RP_PREFIX.includes(_prefix)){_error(`Internal error: rule message ID manifest for ${_prefix} not found`);return false}}if(rjson){return{rjson:rjson,mjson:mjson,rdir:dir}}};function _init(nd,arg,isColor,msgCtx){var x;_nd=nd;_isColor=isColor;_error=msgCtx.error;_path=nd.path;_arg=arg;arg=arg.toLowerCase();x=arg.indexOf("-");if(x<0){if(!isNaN(parseInt(arg))){arg="jet-"+arg;x=3}else{_error("Expected a message ID or rulename to follow --help");return 0}}_prefix=arg.substring(0,x);_msgNum=arg.substring(x+1);x=parseInt(_msgNum);_isMsgId=!isNaN(x);if(_isMsgId){if(_msgNum.length<4){_msgNum="0".repeat(4-_msgNum.length)+_msgNum}}else{_msgNum=null;if(arg.startsWith("oj-")){_prefix="jet"}}if(PREFIX.includes(_prefix)){return 1}return-1};function display(o,color){var start,end,line,s,s1,s2,s3,c,x;var multiSev=o.idList.length>1;function nop(s){return s};color=color?color:{BRIGHTGREEN:nop,BRIGHTYELLOW:nop,CYAN:nop};s=color.BRIGHTGREEN("Rule: ");s1=color.BRIGHTGREEN("Severity: ");s2=color.BRIGHTGREEN("Message ID");s3=color.BRIGHTYELLOW("\xB9");line="\n"+s+color.BRIGHTYELLOW(o.rule)+" "+s1+color.BRIGHTYELLOW(o.sev)+(multiSev?s3:EMPTY)+" "+s2+(multiSev?"'s":EMPTY)+": "+o.prefix+"-"+o.idList.join(", ");console.log(line);s=_removeMarkup(o.descrip);s=_removeColorMarkup(s);start=0;end=LINELEN;while(end<s.length){x=_NL(s,start,end);if(x>=0){line=s.substring(start,x).trim();console.log(color.CYAN(line));start=x+1;end=start+LINELEN;continue}c=s.charAt(end);if(RE_WS.test(c)){line=s.substring(start,end).trim();console.log(color.CYAN(line));start=end;end+=LINELEN;continue}else{end--}}if(start<end){line=s.substring(start,end).trim();console.log(color.CYAN(line))}if(multiSev){s="\n"+s3+color.BRIGHTYELLOW(" Possibility of more than 1 severity since there are "+o.idList.length+" message ID's");console.log(s)}console.log("")};function _removeMarkup(s){s=s.replace(/<oj-/g,"@@1").replace(/<\/oj-/g,"@@2").replace(/<br>/g,"@@3").replace(/<p>/g,"@@3@@3").replace(/<b>/g,"@@4").replace(/<em>/g,"@@4").replace(/<i>/g,"@@5").replace(/<\/b>/g,"@@6").replace(/<\/em>/g,"@@6").replace(/<\/i>/g,"@@6").replace(/<div/g,"@@7").replace(/<\/div>/g,"@@8").replace(RE_MARKUP,EMPTY).replace(RE_MARKUP2," ").trimRight().replace(/@@1/g,"<oj-").replace(/@@2/g,"</oj-").replace(/@@3/g,"\n").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g,EMPTY).replace(/@@7/g,"<div").replace(/@@8/g,"</div>");if(!_isColor){s=s.replace(/@@4/g,EMPTY).replace(/@@5/g,EMPTY).replace(/@@6/g,EMPTY)}return s.trim();;};function _removeColorMarkup(s){if(_isColor){s=s.replace(/@@4/g,EMPTY).replace(/@@5/g,EMPTY).replace(/@@6/g,EMPTY)}return s.trim()};function _NL(s,start,end){while(start<end){if(s.charAt(start)==="\n"){return start}start++}return-1};module.exports.showMsgHelp=showMsgHelp;module.exports.display=display;
package/lib/jetver.js CHANGED
@@ -1 +1,6 @@
1
- const verList=require("../meta/metaverlist.json");var verData;var defVer;var nd;function init(nodeDeps,defaultVer){nd=nodeDeps;defVer=defaultVer;if(!verData){let o=verList.metaList,o2={},v,s;for(s in o){v=o[s];o2[v.version]={date:v.date,time:v.time}}verData={metaList:o2}}};function showList(colorMode){let keys,ver,a,built,list=verData.metaList,indent=" \u2022 ";keys=Object.keys(list).sort(function(a,b){var va=a.split(".");var vb=b.split(".");va.forEach(function(v,i,a){a[i]=parseInt(v)});vb.forEach(function(v,i,a){a[i]=parseInt(v)});if(va[0]>vb[0]){return 1}if(va[0]<vb[0]){return-1}if(va[1]>vb[1]){return 1}if(va[1]<vb[1]){return-1}if(va[2]>vb[2]){return 1}if(va[2]<vb[2]){return-1}return 0}).reverse();console.log("\n"+" JET versions supported:");keys.forEach(function(verName){ver=list[verName];a=verName.split(".");a.forEach(function(s,x){a[x]=parseInt(s)});if(a[0]<10){verName=" "+verName}built=" ("+ver.date+" "+ver.time+")";console.log(indent+(colorMode?nd.colors.CYAN(verName):verName)+built)})};function validate(v){var a;var i;if(v===null){return _getMVError(v,1)}if(typeof v!=="string"){return _getMVError(v,2)}a=v.split(".");for(i=0;i<a.length;i++){if(a[i]===""||parseInt(a[i])===NaN){return _getMVError(v,3)}}return null};function getBestVersion(v,a){return _findVer(v,a)}function _findVer(v,a){var keys=Object.keys(verData.metaList);var suspects=[];var s,i,ret;if(!Array.isArray(a)){a=v.split(".")}if(a.length===3&&a[2]==="0"){a.length=2}if(a.length===2){s=a[0]+"."+a[1]+".";for(i=0;i<keys.length;i++){if(keys[i].startsWith(s)){suspects.push(keys[i])}}}else if(a.length===1){s=a[0]+".";for(i=0;i<keys.length;i++){if(keys[i].startsWith(s)){suspects.push(keys[i])}}}if(suspects.length===1){return suspects[0]}if(!suspects.length){return null}ret="0.0.0";for(i=0;i<suspects.length;i++){if(suspects[i]>ret){ret=suspects[i]}}return ret};function getVersions(){return verData.metaList};function getDefault(){return defVer};function _getMVError(v,errno){var s;switch(errno){case 1:s="missing version arg after --jetver";break;case 2:s="--jetver '"+v+"' : invalid - expected major.minor.patch";break;case 3:s="--jetver '"+v+"' : invalid version specification";break;default:s="unknown error";}return s};module.exports.init=init;module.exports.validate=validate;module.exports.getVersions=getVersions;module.exports.getBestVersion=getBestVersion;module.exports.getDefault=getDefault;module.exports.showList=showList;
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const verList=require("../meta/metaverlist.json");const SUP="\xB9";var verData;var defVer;var nd;function init(nodeDeps,defaultVer){nd=nodeDeps;defVer=defaultVer;if(!verData){let o=verList.metaList,o2={},v,s;for(s in o){v=o[s];o2[v.version]={date:v.date,time:v.time}}verData={metaList:o2}}};function showList(colorMode){let keys,ver,a,built,isDefVer,list=verData.metaList,indent=" \u2022 ";let sup=colorMode?nd.colors.BRIGHTYELLOW(SUP):SUP;keys=Object.keys(list).sort(function(a,b){var va=a.split(".");var vb=b.split(".");va.forEach(function(v,i,a){a[i]=parseInt(v)});vb.forEach(function(v,i,a){a[i]=parseInt(v)});if(va[0]>vb[0]){return 1}if(va[0]<vb[0]){return-1}if(va[1]>vb[1]){return 1}if(va[1]<vb[1]){return-1}if(va[2]>vb[2]){return 1}if(va[2]<vb[2]){return-1}return 0}).reverse();console.log("\n"+" JET versions supported:");keys.forEach(function(verName){ver=list[verName];a=verName.split(".");a.forEach(function(s,x){a[x]=parseInt(s)});if(a[0]<10){verName=" "+verName}built=" ("+ver.date+" "+ver.time+")";if(isDefVer=verName===defVer){let def=" Default";built+=(colorMode?nd.colors.BRIGHTYELLOW(def):def)+sup}if(colorMode){verName=isDefVer?nd.colors.BRIGHTYELLOW(verName):nd.colors.CYAN(verName)}console.log(indent+verName+built)});let footnote="Default config 'jetver' value if not specified.";footnote=colorMode?nd.colors.BRIGHTYELLOW(footnote):footnote;console.log(`\n${sup} ${footnote}`)};function validate(v){var a;var i;if(v===null){return _getMVError(v,1)}if(typeof v!=="string"){return _getMVError(v,2)}a=v.split(".");for(i=0;i<a.length;i++){if(a[i]===""||parseInt(a[i])===NaN){return _getMVError(v,3)}}return null};function getBestVersion(v,a){return _findVer(v,a)}function _findVer(v,a){var keys=Object.keys(verData.metaList);var suspects=[];var s,i,ret;if(!Array.isArray(a)){a=v.split(".")}if(a.length===3&&a[2]==="0"){a.length=2}if(a.length===2){s=a[0]+"."+a[1]+".";for(i=0;i<keys.length;i++){if(keys[i].startsWith(s)){suspects.push(keys[i])}}}else if(a.length===1){s=a[0]+".";for(i=0;i<keys.length;i++){if(keys[i].startsWith(s)){suspects.push(keys[i])}}}if(suspects.length===1){return suspects[0]}if(!suspects.length){return null}ret="0.0.0";for(i=0;i<suspects.length;i++){if(suspects[i]>ret){ret=suspects[i]}}return ret};function getVersions(){return verData.metaList};function getDefault(){return defVer};function _getMVError(v,errno){var s;switch(errno){case 1:s="missing version arg after --jetver";break;case 2:s="--jetver '"+v+"' : invalid - expected major.minor.patch";break;case 3:s="--jetver '"+v+"' : invalid version specification";break;default:s="unknown error";}return s};module.exports.init=init;module.exports.validate=validate;module.exports.getVersions=getVersions;module.exports.getBestVersion=getBestVersion;module.exports.getDefault=getDefault;module.exports.showList=showList;
package/lib/macros.js ADDED
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const MACROS={cwd:"$jafcwd",date:"$jafdate",time:"$jaftime",ver:"$jafver",config:"$jafconfig",jetver:"$jetver"};module.exports=MACROS;
package/lib/metaLoader.js CHANGED
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  function loadMeta(metaFile,nodeDeps){const fs=require("fs");var obj=null;try{if(nodeDeps.fsUtils.fileExists(metaFile)){var js=fs.readFileSync(metaFile,"utf8");js=js.replace("define","obj=");eval(js);obj=obj()}}catch(e){console.log(e)}return obj};module.exports.loadMeta=loadMeta;
package/lib/metahist.js CHANGED
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const fs=require("fs");const path=require("path");const META_DIR=path.join(__dirname,"../meta");const META_FILE="jetauditmeta.js";function show(nd){var meta,delHist,renHist;meta=_getMetaData(nd);if(!meta){return}delHist=meta.delMeta;renHist=meta.renMeta;_showTagDeletes(delHist);_showRenames(renHist);_showDeletes(delHist)};function _showTagDeletes(delHist){var tags,tag;tags=delHist.tags;if(!tags){return}var line="-".repeat(36);console.log("\n"+line);console.log(" Deleted Web Components ");console.log(line+"\n");for(tag in tags){console.log(tag)}};function _showRenames(o){var line="-".repeat(35);console.log("\n"+line);console.log(" Renamed Classes ");console.log(line+"\n");var len=_longest(o);for(let n in o){console.log(`${_ljust(n,len)} -> ${o[n].to} (${o[n].since})`)}console.log("\n")};function _showDeletes(o){var clazzes,clazz,ce,line,len;if(o.classes){line="-".repeat(36);console.log("\n"+line);console.log(" Deleted Classes ");console.log(line+"\n");len=_longest(o.classes);clazzes=o.classes;for(clazz in clazzes){console.log(`${_ljust(clazz,len)} (${clazzes[clazz]})`)}}line="-".repeat(45);console.log("\n"+line);console.log(" Deleted Methods & Members ");console.log(line);len=_longest(o);for(clazz in o){let meths,mems,meth,mem;if(clazz==="classes"||clazz==="tags"){continue}ce=o[clazz];console.log("\n"+clazz);if(ce.methods){meths=ce.methods;len=_longest(meths)+2;for(meth in meths){console.log(` ${_ljust(meth+"()",len)} (${meths[meth]})`)}}if(ce.members){mems=ce.members;len=_longest(mems);for(mem in mems){console.log(` ${_ljust(mem,len)} (${mems[mem]})`)}}}console.log("\n")};function _ljust(s,n){var len=n-s.length>=0?n-s.length:0;return s+" ".repeat(len)}function _longest(o){var len=0;for(let n in o){if(n!=="classes"&&n!=="tags"){len=n.length>len?n.length:len}}return len};function _getMetaData(nd){var jetVers,metaVer,metaFile,meta;jetVers=_getVersionList(nd);if(!jetVers||!jetVers.length){return}metaVer=jetVers[jetVers.length-1];metaFile=path.join(META_DIR,metaVer,META_FILE);try{meta=nd.metaLoader.loadMeta(metaFile,nd)}catch(e){meta=null;this._error("Metadata '"+metaFile+"' not found!")}return meta};function _getVersionList(nd){var verList=[];var files,inFile,ftype,i;try{files=fs.readdirSync(META_DIR);for(i=0;i<files.length;i++){inFile=files[i];ftype=nd.fsUtils.getFileTypeSync(path.join(META_DIR,inFile));if(ftype==="d"){verList.push(inFile)}else if(ftype instanceof Error){throw ftype}}}catch(e){console.log(e.message)}if(verList&&verList.length){verList.sort(function(a,b){var va=a.split(".");var vb=b.split(".");va.forEach(function(v,i,a){a[i]=parseInt(v)});vb.forEach(function(v,i,a){a[i]=parseInt(v)});if(va[0]>vb[0]){return 1}if(va[0]<vb[0]){return-1}if(va[1]>vb[1]){return 1}if(va[1]<vb[1]){return-1}if(va[2]>vb[2]){return 1}if(va[2]<vb[2]){return-1}return 0})}return verList};module.exports.show=show;
@@ -1 +1,6 @@
1
- module.exports=function(filepath){return require(filepath)};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ module.exports=function(fp,nd,appCtx){var json,obj;if(nd.fsUtils.fileExists(fp)){json=nd.fs.readFileSync(fp,'utf8');obj=appCtx.utils.parseJson(json,true);if(obj.msg){appCtx.error(`Internal error: rule message ID manifest syntax error : ${obj.msg} line ${obj.line} col ${obj.col} - ${fp}`);return null}return obj.obj}appCtx.error(`Internal error: rule message ID manifest not found - '${fp}'`);return null};
package/lib/ns.js CHANGED
@@ -1 +1,6 @@
1
- const _ns=["oj-adp","oj-approvals","oj-bi","oj-bi-sac","oj-cgbu","oj-communities","oj-cp","oj-cso","oj-cx","oj-cx-ap","oj-cx-cg","oj-cx-fsvc","oj-cx-hd","oj-cx-iss","oj-cx-km","oj-cx-kmagent","oj-cx-marketing","oj-cx-mc","oj-cxi","oj-cxm","oj-dbt","oj-dcs","oj-doceng","oj-ee","oj-em","oj-epm","oj-fa","oj-faw","oj-fa-fin","oj-fnd","oj-fom","oj-fsgbu","oj-fsgbu-demo","oj-fwk","oj-gbu","oj-gcs","oj-hcm","oj-hed","oj-hsgbu","oj-hsp","oj-hsp-common","oj-hsp-cruise","oj-hsp-hdp","oj-hsp-ohip","oj-hsp-opera","oj-i18n","oj-idaas","oj-ips","oj-j4s","oj-jv","oj-lux","oj-lx","oj-mca","oj-mcps","oj-oa","oj-oac","oj-oal","oj-oal-ni","oj-oax","oj-ob","oj-oc","oj-oce","oj-oda","oj-oda-chat","oj-odcs","oj-odps","oj-ofsc","oj-ohi","oj-oit","oj-ol","oj-omc","oj-omnichannel","oj-opa","oj-opaas","oj-pa","oj-psc","oj-psm","oj-ref","oj-rgbu","oj-rgbu-jraf","oj-scs","oj-sp","oj-spatial","oj-spectra","oj-svc","oj-ux","oj-vb","oj-vb-sample","oj-vbdt","oj","oj-cc","oj-dynamic","oj-ext","oj-sample","oj-sample-internal","ns","demo","my"];const _setNS=new Set(_ns);module.exports={has:function(k){return _setNS.has(k)},getKeys:function(){return[..._setNS]}};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const _ns=["oj-acx","oj-acx-assets","oj-adp","oj-approvals","oj-av","oj-bi","oj-bi-sac","oj-cegbu","oj-cgbu","oj-cgm","oj-communities","oj-core","oj-cp","oj-cso","oj-cx","oj-cx-ap","oj-cx-cg","oj-cx-dcs","oj-cx-fsvc","oj-cx-hd","oj-cx-iss","oj-cx-km","oj-cx-km-agent","oj-cx-marketing","oj-cx-ma","oj-cx-mc","oj-cx-ol","oj-cx-svc","oj-cxi","oj-cxm","oj-dbt","oj-dcs","oj-doceng","oj-ee","oj-em","oj-epm","oj-fa","oj-faw","oj-fa-fin","oj-fnd","oj-fom","oj-fsgbu","oj-fsgbu-demo","oj-fwk","oj-gbu","oj-gbu-comp","oj-gcs","oj-hcm","oj-hed","oj-hsgbu","oj-hsp","oj-hsp-common","oj-hsp-cruise","oj-hsp-hdp","oj-hsp-ohip","oj-hsp-opera","oj-ia","oj-i18n","oj-idaas","oj-ips","oj-j4s","oj-jv","oj-lux","oj-lx","oj-mca","oj-mcps","oj-oa","oj-oac","oj-oal","oj-oal-ni","oj-oal-ux","oj-oax","oj-ob","oj-oc","oj-oce","oj-oda","oj-oda-chat","oj-odcs","oj-odcs-oit","oj-odps","oj-ofsc","oj-ohi","oj-oic","oj-oit","oj-ofs","oj-ol","oj-omc","oj-omnichannel","oj-opa","oj-opaas","oj-pa","oj-psc","oj-prmt","oj-psm","oj-ref","oj-rgbu","oj-rgbu-jraf","oj-scs","oj-sp","oj-spatial","oj-spectra","oj-svc","oj-ux","oj-vb","oj-vb-sample","oj-vbdt","oj","oj-cc","oj-dynamic","oj-ext","oj-sample","oj-sample-internal","ns","ns-ui","demo","my"];const _setNS=new Set(_ns);module.exports={has:function(k){return _setNS.has(k)},getKeys:function(){return[..._setNS]}};
package/lib/nslist.js CHANGED
@@ -1 +1,6 @@
1
- const NS=require("./ns").getKeys();const OJ="oj-";function show(){var oj,noj,m,i;oj=[];noj=[];for(i=0;i<NS.length;i++){if(NS[i].startsWith(OJ)){oj.push(NS[i])}else{noj.push(NS[i])}}oj=oj.sort();var col1l,col2l;var col1l=Math.floor(oj.length/3)+(oj.length%3?1:0);if(!(oj.length%3)){col2l=col1l}else{if(oj.length-col1l){col2l=Math.floor((oj.length-col1l)/2)+(oj.length%2?1:0)}else{col2l=0}}col2l+=col1l;var col1w=0,col2w=0;for(i=0;i<col1l;i++){if(oj[i].length>col1w){col1w=oj[i].length}}for(i=col1l;i<col2l;i++){if(oj[i].length>col2w){col2w=oj[i].length}}col1w+=3;col2w+=3;m="\nJET Registered Namespaces";console.log(`\n${m}\n${"-".repeat(m.length)}`);for(i=0;i<col1l;i++){let col1=oj[i];let col2=i+col1l<col2l?oj[i+col1l]:"";let col3=i+col2l<oj.length?oj[i+col2l]:"";console.log(`${_left(col1,col1w)}${_left(col2,col2w)}${col3}`)}noj.sort();m="\nMiscellaneous Registered Namespaces";console.log(`\n${m}\n${"-".repeat(m.length)}`);for(i=0;i<noj.length;i++){console.log(noj[i])}};function _left(s,len){var l=len-s.length;if(l<0){l=0}return s+" ".repeat(l)};module.exports.showNamespaces=show;
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const NS=require("./ns").getKeys();const OJ="oj-";function show(){var oj,noj,m,i;oj=[];noj=[];for(i=0;i<NS.length;i++){if(NS[i].startsWith(OJ)){oj.push(NS[i])}else{noj.push(NS[i])}}oj=oj.sort();var col1l,col2l;var col1l=Math.floor(oj.length/3)+(oj.length%3?1:0);if(!(oj.length%3)){col2l=col1l}else{if(oj.length-col1l){col2l=Math.floor((oj.length-col1l)/2)+(oj.length%2?1:0)}else{col2l=0}}col2l+=col1l;var col1w=0,col2w=0;for(i=0;i<col1l;i++){if(oj[i].length>col1w){col1w=oj[i].length}}for(i=col1l;i<col2l;i++){if(oj[i].length>col2w){col2w=oj[i].length}}col1w+=3;col2w+=3;m="\nJET Registered Namespaces";console.log(`\n${m}\n${"-".repeat(m.length)}`);for(i=0;i<col1l;i++){let col1=oj[i];let col2=i+col1l<col2l?oj[i+col1l]:"";let col3=i+col2l<oj.length?oj[i+col2l]:"";console.log(`${_left(col1,col1w)}${_left(col2,col2w)}${col3}`)}noj.sort();m="\nMiscellaneous Non-OJ Registered Namespaces";console.log(`\n${m}\n${"-".repeat(m.length)}`);for(i=0;i<noj.length;i++){console.log(noj[i])}};function _left(s,len){var l=len-s.length;if(l<0){l=0}return s+" ".repeat(l)};module.exports.showNamespaces=show;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const OUTFMT={JSON:"json",PROSE:"prose",LINE:"line"};module.exports=OUTFMT;
package/lib/outfile.js CHANGED
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  function writeFileSyncJson(nodeDeps,filepath,obj,options){var indent=options&&options.indent?options.indent:3;nodeDeps.fs.writeFileSync(filepath,JSON.stringify(obj,null,indent))};function writeFileSyncText(nodeDeps,filepath,text){nodeDeps.fs.writeFileSync(filepath,text)};module.exports={writeFileSyncJson:writeFileSyncJson,writeFileSyncText:writeFileSyncText};
package/lib/ruleLoader.js CHANGED
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  module.exports=function(rulePath){return require(rulePath)};
package/lib/scaffold.js CHANGED
@@ -1 +1,6 @@
1
- const DEFAULT_ECMAVER=11;const DEFAULT_THEME="Alta";const OJET_CONFIG="oraclejetconfig.json";const OJAF_CONFIG="oraclejafconfig.json";const OJAF_DEFAULT_CONFIG="jafconfig.json";const DEPENDENCIES_VER_PROP="@oracle/oraclejet";const EXCH_COMPS_FOLDER="jet_components";const COMPOSITES_FOLDER="jet-composites";const EXTENSION_FOLDER="extension";const RESOURCES_FOLDER="resources";const COMP_JSON="component.json";const PACKAGE_JSON="package.json";const SUFFIX_HTML="/**/*.html";const SUFFIX_JS="/**/*.js";const SUFFIX_CSS="/**/*.css";const SUFFIX_JSON="*.json";const SUFFIX_ALL="/**/*.*";const OJET_COMMENT="OJET Based Configuration";const NON_OJET_COMMENT="Default Configuration";const SLASHIFY=/\\\\|\\/g;var ojetCommon;var ojetComposites;var cwd,appCtx,nd,ojet,ojConfig,jafConfig,initDone;function init(cwdir,nodeDeps,appContext){if(!initDone){cwd=_fwdSlashify(cwdir);nd=nodeDeps;appCtx=appContext;ojet=isOJET();initDone=true}return ojet}function isOJET(){return initDone?!!ojConfig:nd.fsUtils.fileExists(nd.path.join(cwd,OJET_CONFIG))};function handleOjetConfig(isScaffold){var ojetPath,ojafPath,doUpdate=false,temp,hash,defaultExists,error=false;ojetPath=nd.path.join(cwd,OJET_CONFIG);ojConfig=nd.jsonLoader.load(ojetPath,nd,function(errMsg){appCtx.error(_extractMsg(errMsg));error=true},false,appCtx.utils);if(isScaffold){if(error){appCtx.error("Cannot continue with --init");return"error"}else if(ojConfig){appCtx.msg("Scaffolding JAF configuration in "+_getFolderName()+" ...")}else{appCtx.error("OJET CLI config not found - cannot continue with --init");return"error"}}ojafPath=nd.path.join(cwd,OJAF_CONFIG);jafConfig=_readJAFConfig(ojafPath);if(jafConfig==="error"){return"error"}if(isScaffold){defaultExists=_defaultConfigExists();if(jafConfig||defaultExists){appCtx.error("Pre-existing configuration found - '"+(defaultExists?OJAF_DEFAULT_CONFIG:OJAF_CONFIG)+"'");return"error"}}if(!isScaffold&&!ojConfig&&jafConfig){appCtx.warn("JAF Configuration '"+OJAF_CONFIG+"' found, but OJET configuration '"+OJET_CONFIG+"' no longer exists.\n")}ojetCommon="./"+ojConfig.paths.source.common;ojetComposites=ojetCommon+"/"+ojConfig.paths.source.javascript+"/"+COMPOSITES_FOLDER;hash=_ojetFileChange(ojetPath,jafConfig);if(jafConfig){if(hash){if(jafConfig.ojet&&jafConfig.ojet.update){if(appCtx.verboseMode||appCtx.debugMode){appCtx.info(OJET_CONFIG+" change detected - updating "+OJAF_CONFIG)}jafConfig.files=_getFileSet();jafConfig.exclude=_getExcludes();jafConfig.components=_getComposites();temp=_getJetVer();if(jafConfig.jetVer!==temp){jafConfig.jetVer=temp}temp=_getTheme();if(jafConfig.theme!==temp){jafConfig.theme=temp}if(!jafConfig.ojet){jafConfig.ojet={}}jafConfig.ojet.md5=hash;if(typeof jafConfig.ojet.update!=="boolean"){jafConfig.ojet.update=true}doUpdate=true}}}else if(isScaffold){jafConfig={base:"$jafcwd",files:_getFileSet(),exclude:_getExcludes(),components:_getComposites(),builtinJetRules:true,builtinExchRules:true,jetVer:_getJetVer(),ecmaVer:DEFAULT_ECMAVER,theme:_getTheme(),format:"prose",severity:"all",groups:["all"],options:{verbose:false,color:true},title:["+---------------------------------------------------------------------+","| OJET Application Audit |","+---------------------------------------------------------------------+","JAF $jafver - Jet $jetver : ($jafdate, $jaftime)\n"],ojet:{update:true,md5:hash}};doUpdate=true}if(doUpdate&&!_writeJAFConfig(OJAF_CONFIG,true)){appCtx.error("Failed to "+(isScaffold?"scaffold":"persist")+" OJAF config '"+nd.path.join(cwd,OJAF_CONFIG)+"'");return"error"}if(isScaffold){scaffoldSuccessful(OJAF_CONFIG)}if(appCtx.debugMode){appCtx.debug("JAFConfig :\n"+JSON.stringify(jafConfig,null,3))}return jafConfig};function getOjetConfig(){return ojConfig}function _getFileSet(){var source,files;files=[];source=ojConfig.paths.source;files.push("./"+source.common+SUFFIX_HTML);files.push("./"+source.common+SUFFIX_JS);files.push("./"+source.web+SUFFIX_HTML);files.push("./"+source.web+SUFFIX_JS);files.push("./"+source.hybrid+SUFFIX_HTML);files.push("./"+source.hybrid+SUFFIX_JS);files.push("./"+source.common+"/"+source.styles+SUFFIX_CSS);files.push("./"+nd.path.join(ojetComposites,"**"+"/",COMP_JSON));return _fwdSlashify(files)};function createNonOjetConfig(){var oj;oj=_ojetJafConfigExists();if(oj||_defaultConfigExists()){appCtx.error("Default configuration '"+(oj?OJAF_CONFIG:OJAF_DEFAULT_CONFIG)+"' exists - terminating --init");return"'error"}jafConfig=_createDefault();setFileProps(jafConfig);if(!_writeJAFConfig(OJAF_DEFAULT_CONFIG,false)){appCtx.error("Failed to scaffold OJAF config '"+OJAF_DEFAULT_CONFIG+"'");return"error"}scaffoldSuccessful(OJAF_DEFAULT_CONFIG)};function _getExcludes(){var files=[],source;files.push("./"+nd.path.join(EXCH_COMPS_FOLDER,SUFFIX_ALL));files.push("./"+nd.path.join(ojetComposites,"**"+"/"+EXTENSION_FOLDER,SUFFIX_ALL));files.push("./"+nd.path.join(ojetComposites,"**"+"/"+RESOURCES_FOLDER,SUFFIX_ALL));source=ojConfig.paths.source.common;if(source.tests){files.push("./"+source.tests+SUFFIX_HTML);files.push("./"+source.tests+SUFFIX_JS)}source=ojConfig.paths.source.common;files.push("./"+nd.path.join(source,"**"+"/"+"*-min.js"));files.push("./"+nd.path.join(source,"**"+"/"+"*-min.css"));return _fwdSlashify(files)};function _getComposites(){var a=[],dir;dir=nd.path.join(cwd,ojetComposites);if(nd.fsUtils.fileExists(dir,true)){a.push(ojetComposites)}if(ojConfig.components){var c=_getExchComponents();if(c&&c.length){a.push.apply(a,c)}}return _fwdSlashify(a)};function _getJetVer(){var i,ojetPackage,ver,error;ojetPackage=nd.jsonLoader.load(nd.path.join(cwd,PACKAGE_JSON),nd,function(errMsg){appCtx.error(_extractMsg(errMsg));appCtx.warn("Defaulting to "+appCtx.defaultJetVer);error=true});if(!error&&ojetPackage&&ojetPackage.dependencies){ver=ojetPackage.dependencies[DEPENDENCIES_VER_PROP]}else{ver=appCtx.defaultJetVer}if(ver){for(i=0;i<ver.length;i++){if(!isNaN(ver.charAt(i))){ver=ver.substring(i);break}}ver=ver.replace(".tgz","");i=ver.lastIndexOf(".");ver=ver.substring(0,i)}return ver};function _getExchComponents(){var dirComps,comps,compName,o,a,ret=[],dir,rel;comps=ojConfig.components;if(!comps){return null}dirComps=nd.path.join(cwd,EXCH_COMPS_FOLDER);if(!nd.fsUtils.fileExists(dirComps,true)){return null}if(!(dirComps&&comps)){return null}for(compName in comps){dir=nd.path.join(cwd,EXCH_COMPS_FOLDER,compName);rel="./"+nd.path.join(EXCH_COMPS_FOLDER,compName);o=_readComponentJson(dir);if(o){if(o.type==="pack"){a=_expandPack(rel,o,comps[compName]);if(a.length){ret.push.apply(ret,a)}}else if(o.type==="composite"||!o.type){ret.push(rel)}}}return ret};function _getTheme(){var dt=ojConfig.defaultTheme;if(dt){dt=dt.charAt(0).toUpperCase()+dt.substring(1)}else{dt=DEFAULT_THEME}return dt};function _readComponentJson(dir){var compJson=nd.jsonLoader.load(nd.path.join(dir,COMP_JSON),nd,function(errMsg){appCtx.error(_extractMsg(errMsg))});return compJson};function _expandPack(dir,json,compObj){var comps,compName,a=[];comps=compObj.components;if(comps){for(compName in comps){a.push(dir+"/"+compName)}}return _fwdSlashify(a)};function _getFolderName(){return nd.path.basename(cwd)};function _readJAFConfig(path){var error;var json=nd.jsonLoader.load(path,nd,function(errMsg){appCtx.error(_extractMsg(errMsg));error=true},true);return error?"error":json};function _writeJAFConfig(name,isOjet){var data,ret=false;try{data="// JAF Generated "+(isOjet?OJET_COMMENT:NON_OJET_COMMENT)+"\n"+JSON.stringify(jafConfig,null,3);nd.fs.writeFileSync(nd.path.join(cwd,name),data);ret=true}catch(e){appCtx.error(e)}return ret};function _ojetFileChange(ojPath,jafConfig){var md5=require("md5");var ojetMd5,ojafMd5;ojetMd5=md5(_readFile(ojPath));ojafMd5=jafConfig&&jafConfig.ojet&&jafConfig.ojet.md5;return ojetMd5!==ojafMd5?ojetMd5:null};function _readFile(inFile){var data;try{data=nd.fs.readFileSync(inFile,"utf8")}catch(e){}return data};function _extractMsg(msg){var i=msg.indexOf(":");if(i>=0){msg=msg.substring(i+1)}return msg};function _fwdSlashify(path){if(Array.isArray(path)){for(var i=0;i<path.length;i++){path[i]=path[i].replace(SLASHIFY,"/")}return path}else{return path.replace(SLASHIFY,"/")}};function _createDefault(){return{"base":"$jafcwd","files":[],"exclude":[],"components":[],"builtinJetRules":true,"builtinExchRules":true,"jetVer":appCtx.defaultJetVer,"ecmaVer":DEFAULT_ECMAVER,"theme":DEFAULT_THEME,"groups":["all"],"format":"prose","options":{"verbose":false,"color":true},"title":["+---------------------------------------------------------------------+","| OJET Application Audit |","+---------------------------------------------------------------------+","JAF $jafver - Jet $jetver : ($jafdate, $jaftime)\n"]}};function setFileProps(obj){var path,folder;folder="src";path=_getPathTo(folder);if(path){obj.files.push(path+"/**/*.html");obj.files.push(path+"/**/*.js");obj.files.push(path+"/**/*.css");obj.exclude.push(path+"/**/*-min.js");obj.exclude.push(path+"/**/*-min.css")}folder="jet-composites";path=_getPathTo(folder);if(path){obj.components=[path];obj.exclude.push(path+"/**/extension/**/*.*");obj.exclude.push(path+"/**/resources/**/*.*")}};function _getPathTo(folder){var path=nd.fsUtils.findFile(cwd,folder,function(dir,file){return file!=="node_modules"&&!dir.includes("node_modules")});if(path){path=nd.path.join(path,folder);path=_fwdSlashify(path);path="."+path.replace(cwd,"")}else{path=null}return path};function _defaultConfigExists(){var file=nd.path.join(cwd,OJAF_DEFAULT_CONFIG);return nd.fsUtils.fileExists(file)};function _ojetJafConfigExists(){var file=nd.path.join(cwd,OJAF_CONFIG);return nd.fsUtils.fileExists(file)};function scaffoldSuccessful(configName){appCtx.msg(" __ ___");appCtx.msg(" __ / /___ _/ _/ Configuration generation successful");appCtx.msg(" / // // _ `/ _/ created: '@@'".replace("@@",configName));appCtx.msg(" \\___/ \\_,_/_/\n")};module.exports={init,isOJET,handleOjetConfig,createNonOjetConfig,getOjetConfig};
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const DEFAULT_ECMAVER=11;const DEFAULT_THEME="Alta";const OJET_CONFIG="oraclejetconfig.json";const OJAF_CONFIG="oraclejafconfig.json";const OJAF_DEFAULT_CONFIG="jafconfig.json";const DEPENDENCIES_VER_PROP="@oracle/oraclejet";const EXCH_COMPS_FOLDER="jet_components";const COMPOSITES_FOLDER="jet-composites";const EXTENSION_FOLDER="extension";const RESOURCES_FOLDER="resources";const COMP_JSON="component.json";const PACKAGE_JSON="package.json";const TSCONFIG="tsconfig.json";const SUFFIX_HTML="/**/*.html";const SUFFIX_JS="/**/*.js";const SUFFIX_TS="/**/*.ts";const SUFFIX_CSS="/**/*.css";const SUFFIX_ALL="/**/*.*";const OJET_COMMENT="OJET Based Configuration";const NON_OJET_COMMENT="Default Configuration";const SLASHIFY=/\\\\|\\/g;var ojetCommon;var ojetComposites;var cwd,appCtx,nd,ojet,ojConfig,jafConfig,initDone;var md5;function init(cwdir,nodeDeps,appContext){if(!initDone){cwd=_fwdSlashify(cwdir);nd=nodeDeps;appCtx=appContext;ojet=isOJET();initDone=true}return ojet}function isOJET(){return initDone?!!ojConfig:nd.fsUtils.fileExists(nd.path.join(cwd,OJET_CONFIG))};function handleOjetConfig(isScaffold){var ojetPath,ojafPath,doUpdate=false,temp,hash,tsHash,tsc,defaultExists,error=false;ojetPath=nd.path.join(cwd,OJET_CONFIG);ojConfig=nd.jsonLoader.load(ojetPath,nd,function(errMsg){appCtx.error(errMsg);error=true},false,appCtx.utils);if(isScaffold){if(error){appCtx.error("Cannot continue with --init");return"error"}else if(ojConfig){appCtx.msg("Scaffolding JAF configuration in "+_getFolderName()+" ...")}else{appCtx.error("OJET CLI config not found - cannot continue with --init");return"error"}}ojafPath=nd.path.join(cwd,OJAF_CONFIG);if(nd.fsUtils.fileExists(ojafPath)){jafConfig=_readJAFConfig(ojafPath);if(jafConfig==="error"){return"error"}}if(isScaffold){defaultExists=_defaultConfigExists();if(jafConfig||defaultExists){appCtx.error("Pre-existing configuration found - '"+(defaultExists?OJAF_DEFAULT_CONFIG:OJAF_CONFIG)+"'");return"error"}}if(!isScaffold&&!ojConfig&&jafConfig){appCtx.warn("JAF Configuration '"+OJAF_CONFIG+"' found, but OJET configuration '"+OJET_CONFIG+"' no longer exists.\n")}if(ojConfig.paths){if(ojConfig.paths.source&&ojConfig.paths.source.common){ojetCommon="./"+ojConfig.paths.source.common;ojetComposites=ojetCommon+"/"+ojConfig.paths.source.javascript+"/"+COMPOSITES_FOLDER}}hash=_ojetFileChange(ojetPath,jafConfig);if(jafConfig){tsHash=_tsConfigChange(cwd,jafConfig)}if(jafConfig){if(hash||tsHash){if(jafConfig.ojet&&jafConfig.ojet.update){if(appCtx.verboseMode||appCtx.debugMode){appCtx.info(OJET_CONFIG+" change detected - updating "+OJAF_CONFIG)}jafConfig.files=_getFileSet();jafConfig.exclude=_getExcludes();jafConfig.components=_getComposites();tsc=_getTsConfig();if(tsc){jafConfig.tsconfig=tsc}else if(jafConfig.tsconfig){delete jafConfig.tsconfig}temp=_getJetVer();if(jafConfig.jetVer!==temp){jafConfig.jetVer=temp}temp=_getTheme();if(jafConfig.theme!==temp){jafConfig.theme=temp}if(!jafConfig.ojet){jafConfig.ojet={}}if(hash){jafConfig.ojet.md5=hash}if(typeof jafConfig.ojet.update!=="boolean"){jafConfig.ojet.update=true}if(typeof tsHash==="string"){jafConfig.ojet.tsmd5=tsHash}else if(tsHash&&jafConfig.ojet.tsmd5){delete jafConfig.ojet.tsmd5}doUpdate=true;_backupJAFConfig(ojafPath)}else{const changeMsg=" changes detected, but oraclejafconfig updates are disabled";if(hash){appCtx.warn(OJET_CONFIG+changeMsg)}if(tsHash){appCtx.warn(TSCONFIG+changeMsg)}}}}else if(isScaffold){jafConfig={base:"$jafcwd",files:_getFileSet(),exclude:_getExcludes(),components:_getComposites(),builtinJetRules:true,jetVer:_getJetVer(),ecmaVer:DEFAULT_ECMAVER,theme:_getTheme(),format:"prose",severity:"all",groups:["all"],options:{verbose:false,color:true},title:["+---------------------------------------------------------------------+","| OJET Application Audit |","+---------------------------------------------------------------------+","JAF $jafver - Jet $jetver : ($jafdate, $jaftime)\n"],ojet:{update:true,md5:hash}};tsc=_getTsConfig();if(tsc){jafConfig.tsconfig=tsc}if(tsHash){jafConfig.ojet.tsmd5=tsHash}doUpdate=true}if(doUpdate&&!_writeJAFConfig(OJAF_CONFIG,true)){appCtx.error("Failed to "+(isScaffold?"scaffold":"update")+" OJAF config '"+nd.path.join(cwd,OJAF_CONFIG)+"'");return"error"}if(isScaffold){scaffoldSuccessful(OJAF_CONFIG)}if(appCtx.debugMode){appCtx.debug("JAFConfig :\n"+JSON.stringify(jafConfig,null,3))}return jafConfig};function getOjetConfig(){return ojConfig}function _getFileSet(){var source,files;files=[];if(ojConfig&&ojConfig.paths){source=ojConfig.paths.source;if(source){files.push("./"+source.common+SUFFIX_HTML);if(source.javascript){files.push("./"+source.common+SUFFIX_JS)}if(source.typescript){files.push("./"+source.common+SUFFIX_TS)}files.push("./"+source.web+SUFFIX_HTML);if(source.javascript){files.push("./"+source.web+SUFFIX_JS)}if(source.typescript){files.push("./"+source.web+SUFFIX_TS)}files.push("./"+source.hybrid+SUFFIX_HTML);if(source.javascript){files.push("./"+source.hybrid+SUFFIX_JS)}if(source.typescript){files.push("./"+source.hybrid+SUFFIX_TS)}files.push("./"+source.common+"/"+source.styles+SUFFIX_CSS)}}files.push("./"+nd.path.join(ojetComposites,"**"+"/",COMP_JSON));return _fwdSlashify(files)};function createNonOjetConfig(){var oj;oj=_ojetJafConfigExists();if(oj||_defaultConfigExists()){appCtx.error("Default configuration '"+(oj?OJAF_CONFIG:OJAF_DEFAULT_CONFIG)+"' exists - terminating --init");return"'error"}jafConfig=_createDefault();setFileProps(jafConfig);if(!_writeJAFConfig(OJAF_DEFAULT_CONFIG,false)){appCtx.error("Failed to scaffold OJAF config '"+OJAF_DEFAULT_CONFIG+"'");return"error"}scaffoldSuccessful(OJAF_DEFAULT_CONFIG)};function _getExcludes(){var files=[],source;files.push("./"+nd.path.join(EXCH_COMPS_FOLDER,SUFFIX_ALL));if(ojetComposites){files.push("./"+nd.path.join(ojetComposites,"**"+"/"+EXTENSION_FOLDER,SUFFIX_ALL));files.push("./"+nd.path.join(ojetComposites,"**"+"/"+RESOURCES_FOLDER,SUFFIX_ALL))}if(ojConfig.paths&&ojConfig.paths.source){source=ojConfig.paths.source.common;if(source.tests){files.push("./"+source.tests+SUFFIX_HTML);files.push("./"+source.tests+SUFFIX_JS)}source=ojConfig.paths.source.common;files.push("./"+nd.path.join(source,"**"+"/"+"*-min.js"));files.push("./"+nd.path.join(source,"**"+"/"+"*-min.css"));files.push("./**/node_modules/**/*.*")}return _fwdSlashify(files)};function _getComposites(){var a=[],dir;if(ojetComposites){dir=nd.path.join(cwd,ojetComposites);if(nd.fsUtils.fileExists(dir,true)){a.push(ojetComposites)}}if(ojConfig.components){var c=_getExchComponents();if(c&&c.length){a.push.apply(a,c)}}return _fwdSlashify(a)};function _getTsConfig(){return _tsConfigExists()?".":null};function _getJetVer(){var i,ojetPackage,ver,error;ojetPackage=nd.jsonLoader.load(nd.path.join(cwd,PACKAGE_JSON),nd,function(errMsg){appCtx.error(errMsg);appCtx.warn("Defaulting to "+appCtx.defaultJetVer);error=true});if(!error&&ojetPackage&&ojetPackage.dependencies){ver=ojetPackage.dependencies[DEPENDENCIES_VER_PROP]}else{ver=appCtx.defaultJetVer}if(ver){for(i=0;i<ver.length;i++){if(!isNaN(ver.charAt(i))){ver=ver.substring(i);break}}ver=ver.replace(".tgz","");i=ver.lastIndexOf(".");ver=ver.substring(0,i)}return ver};function _getExchComponents(){var dirComps,comps,compName,o,a,ret=[],dir,rel;comps=ojConfig.components;if(!comps){return null}dirComps=nd.path.join(cwd,EXCH_COMPS_FOLDER);if(!nd.fsUtils.fileExists(dirComps,true)){return null}if(!(dirComps&&comps)){return null}for(compName in comps){dir=nd.path.join(cwd,EXCH_COMPS_FOLDER,compName);rel="./"+nd.path.join(EXCH_COMPS_FOLDER,compName);o=_readComponentJson(dir);if(o){if(o.type==="pack"){a=_expandPack(rel,o,comps[compName]);if(a.length){ret.push.apply(ret,a)}}else if(o.type==="composite"||!o.type){ret.push(rel)}}}return ret};function _getTheme(){var dt=ojConfig.defaultTheme;if(dt){dt=dt.charAt(0).toUpperCase()+dt.substring(1)}else{dt=DEFAULT_THEME}return dt};function _readComponentJson(dir){var compJson=nd.jsonLoader.load(nd.path.join(dir,COMP_JSON),nd,function(errMsg){appCtx.error(errMsg)});return compJson};function _expandPack(dir,json,compObj){var comps,compName,a=[];comps=compObj.components;if(comps){for(compName in comps){a.push(dir+"/"+compName)}}return _fwdSlashify(a)};function _getFolderName(){return nd.path.basename(cwd)};function _readJAFConfig(path){var error;var json=nd.jsonLoader.load(path,nd,function(errMsg){appCtx.error(errMsg);error=true},true);return error?"error":json};function _writeJAFConfig(name,isOjet){var data,ret=false;try{data="// JAF Generated "+(isOjet?OJET_COMMENT:NON_OJET_COMMENT)+"\n"+JSON.stringify(jafConfig,null,3);nd.fs.writeFileSync(nd.path.join(cwd,name),data);ret=true}catch(e){appCtx.error(e)}return ret};function _backupJAFConfig(fp){var data,ret=false;try{data=_readFile(fp);if(data){nd.fs.writeFileSync(fp+".bak",data);ret=true}}catch(e){appCtx.error(e)}return ret};function _ojetFileChange(ojPath,jafConfig){if(!md5){md5=require("md5")}var ojetMd5,ojafMd5;ojetMd5=md5(_readFile(ojPath));ojafMd5=jafConfig&&jafConfig.ojet&&jafConfig.ojet.md5;return ojetMd5!==ojafMd5?ojetMd5:false};function _tsConfigChange(ojPath,jafConfig){var p,h,ret=false;p=nd.path.join(ojPath,TSCONFIG);if(nd.fsUtils.fileExists(p)){if(!md5){md5=require("md5")}h=md5(_readFile(p))}if(h){if(jafConfig.ojet.tsmd5){ret=h!==jafConfig.ojet.tsmd5?h:false}else{ret=h}}else if(jafConfig&&jafConfig.ojet.tsmd5){ret=true}return ret};function _readFile(fp){var data;try{data=nd.fs.readFileSync(fp,"utf8")}catch(e){}return data};function _fwdSlashify(path){if(Array.isArray(path)){for(var i=0;i<path.length;i++){path[i]=path[i].replace(SLASHIFY,"/")}return path}else if(path){return path.replace(SLASHIFY,"/")}};function _createDefault(){var o={"base":"$jafcwd","files":[],"exclude":[],"components":[],"builtinJetRules":true,"jetVer":appCtx.defaultJetVer,"ecmaVer":DEFAULT_ECMAVER,"theme":DEFAULT_THEME,"groups":["all"],"format":"prose","options":{"verbose":false,"color":true},"title":["+---------------------------------------------------------------------+","| OJET Application Audit |","+---------------------------------------------------------------------+","JAF $jafver - Jet $jetver : ($jafdate, $jaftime)\n"]};if(_tsConfigExists()){o.tsconfig=cwd}return o};function setFileProps(obj){var path,folder;folder="src";path=_getPathTo(folder);if(path){obj.files.push(path+"/**/*.html");obj.files.push(path+"/**/*.js");obj.files.push(path+"/**/*.css");obj.exclude.push(path+"/**/*-min.js");obj.exclude.push(path+"/**/*-min.css")}folder="jet-composites";path=_getPathTo(folder);if(path){obj.components=[path];obj.exclude.push(path+"/**/extension/**/*.*");obj.exclude.push(path+"/**/resources/**/*.*")}};function _getPathTo(folder){var path=nd.fsUtils.findFile(cwd,folder,function(dir,file){return file!=="node_modules"&&!dir.includes("node_modules")});if(path){path=nd.path.join(path,folder);path=_fwdSlashify(path);path="."+path.replace(cwd,"")}else{path=null}return path};function _defaultConfigExists(){var file=nd.path.join(cwd,OJAF_DEFAULT_CONFIG);return nd.fsUtils.fileExists(file)};function _ojetJafConfigExists(){var file=nd.path.join(cwd,OJAF_CONFIG);return nd.fsUtils.fileExists(file)};function _tsConfigExists(){var file=nd.path.join(cwd,TSCONFIG);return nd.fsUtils.fileExists(file)};function scaffoldSuccessful(configName){appCtx.msg(" __ ___");appCtx.msg(" __ / /___ _/ _/ Configuration generation successful");appCtx.msg(" / // // _ `/ _/ created: '@@'".replace("@@",configName));appCtx.msg(" \\___/ \\_,_/_/\n")};module.exports={init,isOJET,handleOjetConfig,createNonOjetConfig,getOjetConfig};
@@ -1 +1,6 @@
1
- const RULE=["/*--------------------------------------------------------------------------------*/","/* JAF Rule: '%r' */","/* Purpose : */","/*--------------------------------------------------------------------------------*/","","","const RULENAME = \"%s\";","const DESCRIPTION = \"long description - can include markup\";","const SHORT_DESCRIPTION = \"short description\";","","class Rule {"," getName() {"," return RULENAME ;"," }",""," getDescription() {"," return DESCRIPTION;"," }",""," getShortDescription() {"," return SHORT_DESCRIPTION;"," }",""," register(regCtx) {"," // register listeners"," // return { xxx : this._onXXX; }"," }",""," _onXXX(ruleCtx) {"," // implement rule listener"," }","","}","","","","module.exports = Rule;"];const LOGO=[" __ ___"," __ / /___ _/ _/ Rule '"+"%r"+"'"," / // // _ `/ _/ Created successfully"," \\___/ \\_,_/_/\n"];const JS=".js";const PC_R="%r";const PC_S="%s";function genRule(dir,ruleName,nodeDeps){var np=nodeDeps.path;var fsUtils=nodeDeps.fsUtils;var ext=np.extname(ruleName);var rule,fp,text;if(ext===""){rule=ruleName}else if(ext.toLowerCase()!==JS){console.log("[error]: invalid rule file extension '"+ext+"'. Do not specify a file extension!");return true}else{rule=ruleName.substring(0,ruleName.length-3)}ruleName=rule+JS;fp=np.join(dir,ruleName);try{if(fsUtils.fileExists(fp)){console.log("[Warning]: Rule '"+ruleName+"' already exists. ojaf will not overwrite it!");return true}text=_updateText(text,rule);nodeDeps.fs.writeFileSync(fp,text);_logo(rule);return true}catch(e){console.log("[Error]: "+e)}return false};function _updateText(text,rule){var i;text=RULE.join("\n").replace(PC_S,rule);i=text.indexOf(PC_R);text=text.replace(PC_R," ");return _insertText(text,i,rule)};function _insertText(text,i,rule){return text.substring(0,i)+rule+"'"+text.substring(i+1+rule.length)};function _logo(rule){console.log(LOGO.join("\n").replace("%r",rule))}module.exports.genRule=genRule;
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const RULE=["/*--------------------------------------------------------------------------------*/","/* JAF Rule: '%r' */","/* Purpose : */","/*--------------------------------------------------------------------------------*/","","","const RULENAME = \"%s\";","const DESCRIPTION = \"long description - can include markup\";","const SHORT_DESCRIPTION = \"short description\";","","class Rule {"," getName() {"," return RULENAME;"," }",""," getDescription() {"," return DESCRIPTION;"," }",""," getShortDescription() {"," return SHORT_DESCRIPTION;"," }",""," register( /*regCtx*/ ) {"," // register listeners"," // return { xxx : this._onXXX }"," }",""," _onXXX(ruleCtx) {"," // implement rule listener"," }","","}","","","","module.exports = Rule;"];const LOGO=[" __ ___"," __ / /___ _/ _/ Rule '"+"%r"+"'"," / // // _ `/ _/ Created successfully"," \\___/ \\_,_/_/\n"];const JS=".js";const PC_R="%r";const PC_S="%s";function genRule(dir,ruleName,nodeDeps){var np=nodeDeps.path;var fsUtils=nodeDeps.fsUtils;var ext=np.extname(ruleName);var rule,fp,text;if(ext===""){rule=ruleName}else if(ext.toLowerCase()!==JS){console.log("[error]: invalid rule file extension '"+ext+"'. Do not specify a file extension!");return true}else{rule=ruleName.substring(0,ruleName.length-3)}ruleName=rule+JS;fp=np.join(dir,ruleName);try{if(fsUtils.fileExists(fp)){console.log("[Warning]: Rule '"+ruleName+"' already exists. ojaf will not overwrite it!");return true}text=_updateText(text,rule);nodeDeps.fs.writeFileSync(fp,text);_logo(rule);return true}catch(e){console.log("[Error]: "+e)}return false};function _updateText(text,rule){var i;text=RULE.join("\n").replace(PC_S,rule);i=text.indexOf(PC_R);text=text.replace(PC_R," ");return _insertText(text,i,rule)};function _insertText(text,i,rule){return text.substring(0,i)+rule+"'"+text.substring(i+1+rule.length)};function _logo(rule){console.log(LOGO.join("\n").replace("%r",rule))}module.exports.genRule=genRule;
package/lib/schema.js CHANGED
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  var _validate;const EMPTY_INDEX="['']";function validateComponentJson(obj){var errors,error,s,i,ret=null;if(!_validate){var schema=require("../schema/component-schema.json");var Ajv=require("ajv");var _ajv=new Ajv({allErrors:true});_validate=_ajv.compile(schema)}if(!_validate(obj)){ret=[];errors=_validate.errors;for(i=0;i<errors.length;i++){error=errors[i];s=_cleanAjvMessages(error);if(!s.includes("(if)")){ret.push({msg:s,error:error})}}}return ret};function _cleanAjvMessages(error){var keyword,i;var prop,subProp,propType,propId,param,dataPath,msg,ret;keyword=error.keyword;switch(keyword){case"required":ret=error.message;break;case"enum":prop=error.dataPath;if(prop.charAt(0)==="."){prop=prop.substr(1)};ret="bad property '"+prop+"' value : "+error.message+" ["+error.params.allowedValues+"]";break;case"additionalProperties":if(error.params){ret=error.params["additionalProperty"];dataPath=error.dataPath||"";if(dataPath){if(dataPath.charAt(0)==="."){dataPath=dataPath.substring(1)}if(dataPath.endsWith(EMPTY_INDEX)){dataPath=dataPath.substring(0,dataPath.indexOf(EMPTY_INDEX))}dataPath=" in "+dataPath}ret=`unexpected additional property '${ret}'${dataPath}`}else{prop=error.dataPath;i=prop.indexOf("[");propType=prop.substring(0,i);prop=prop.substring(i);prop=_smartRemoveSquareBrackets(prop);i=prop.indexOf(".");propId=prop.substring(0,i);propId=propId.replace(/[\'\"]/g,"");param=prop.substring(i);i=param.indexOf("'");if(i>=0){param=param.substring(0,i)+"."+param.substring(i+1);param=param.replace(/[\'\"]/g,"")}propType=_getSchemaPropType(propType);ret=propType+" "+propId+" has unexpected additional sub-property '"+param+"'"}break;case"type":msg=error.dataPath;if(msg.charAt(0)==="."){msg=msg.substring(1)}ret=msg+" - "+error.message;break;case"not":msg=error.message;msg=msg.replace("should NOT be ","is not ");propType=error.dataPath.startsWith(".prop")?"property":error.dataPath.startsWith(".events")?"events":error.dataPath.startsWith(".name")?"name":"";prop=error.propertyName?error.propertyName:null;if(!propType){ret=(prop?" property '"+prop+"'":"")+" - "+msg}else{ret="property '"+propType+"'"+(prop?" '"+prop+"' ":" ")+"- "+msg}break;case"propertyNames":ret=error.message;break;case"pattern":prop=error.dataPath;if(prop.charAt(0)==="."){prop=prop.substring(1)}return"property '"+prop+"' failed a schema format pattern match";break;case"format":prop=error.dataPath;if(prop.charAt(0)==="."){prop=prop.substring(1)}return"property '"+prop+"' format - "+error.message;break;case"anyOf":prop=error.dataPath;return"property "+(prop.charAt(0)==="."?prop.substring(1):prop)+" - "+error.message;break;default:ret="unknown error ("+error.keyword+")";}return ret};function _getSchemaPropType(propType){if(propType.startsWith(".prop")){propType="property"}else if(propType.startsWith(".even")){propType="event"}else if(propType.startsWith(".meth")){propType="method"}else{propType="UNNKNOWN"}return propType};function _smartRemoveSquareBrackets(prop){var i,x=0,s;while(true){i=prop.indexOf("[",x);if(i>=0){s=prop.substring(i+1,i+2).trim();if(!/\d/.test(s)){prop=prop.replace("[","");prop=prop.replace("]","");x=i;continue}}break}return prop};module.exports.validateComponentJson=validateComponentJson;
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ (function clone(exports){'use strict';var Syntax,VisitorOption,VisitorKeys,BREAK,SKIP,REMOVE;function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==='object'&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}Syntax={AssignmentExpression:'AssignmentExpression',AssignmentPattern:'AssignmentPattern',ArrayExpression:'ArrayExpression',ArrayPattern:'ArrayPattern',ArrowFunctionExpression:'ArrowFunctionExpression',AwaitExpression:'AwaitExpression',BlockStatement:'BlockStatement',BinaryExpression:'BinaryExpression',BreakStatement:'BreakStatement',CallExpression:'CallExpression',CatchClause:'CatchClause',ChainExpression:'ChainExpression',ClassBody:'ClassBody',ClassDeclaration:'ClassDeclaration',ClassExpression:'ClassExpression',ComprehensionBlock:'ComprehensionBlock',ComprehensionExpression:'ComprehensionExpression',ConditionalExpression:'ConditionalExpression',ContinueStatement:'ContinueStatement',DebuggerStatement:'DebuggerStatement',DirectiveStatement:'DirectiveStatement',DoWhileStatement:'DoWhileStatement',EmptyStatement:'EmptyStatement',ExportAllDeclaration:'ExportAllDeclaration',ExportDefaultDeclaration:'ExportDefaultDeclaration',ExportNamedDeclaration:'ExportNamedDeclaration',ExportSpecifier:'ExportSpecifier',ExpressionStatement:'ExpressionStatement',ForStatement:'ForStatement',ForInStatement:'ForInStatement',ForOfStatement:'ForOfStatement',FunctionDeclaration:'FunctionDeclaration',FunctionExpression:'FunctionExpression',GeneratorExpression:'GeneratorExpression',Identifier:'Identifier',IfStatement:'IfStatement',ImportExpression:'ImportExpression',ImportDeclaration:'ImportDeclaration',ImportDefaultSpecifier:'ImportDefaultSpecifier',ImportNamespaceSpecifier:'ImportNamespaceSpecifier',ImportSpecifier:'ImportSpecifier',Literal:'Literal',LabeledStatement:'LabeledStatement',LogicalExpression:'LogicalExpression',MemberExpression:'MemberExpression',MetaProperty:'MetaProperty',MethodDefinition:'MethodDefinition',ModuleSpecifier:'ModuleSpecifier',NewExpression:'NewExpression',ObjectExpression:'ObjectExpression',ObjectPattern:'ObjectPattern',Program:'Program',Property:'Property',RestElement:'RestElement',ReturnStatement:'ReturnStatement',SequenceExpression:'SequenceExpression',SpreadElement:'SpreadElement',Super:'Super',SwitchStatement:'SwitchStatement',SwitchCase:'SwitchCase',TaggedTemplateExpression:'TaggedTemplateExpression',TemplateElement:'TemplateElement',TemplateLiteral:'TemplateLiteral',ThisExpression:'ThisExpression',ThrowStatement:'ThrowStatement',TryStatement:'TryStatement',UnaryExpression:'UnaryExpression',UpdateExpression:'UpdateExpression',VariableDeclaration:'VariableDeclaration',VariableDeclarator:'VariableDeclarator',WhileStatement:'WhileStatement',WithStatement:'WithStatement',YieldExpression:'YieldExpression',ClassProperty:'ClassProperty',TSAsExpression:'TSAsExpression',TSImportEqualsDeclaration:'TSImportEqualsDeclaration',TSTypeAliasDeclaration:'TSTypeAliasDeclaration',TSInterfaceDeclaration:'TSInterfaceDeclaration',JSXElement:'JsxElement',JSXOpeningElement:'JSXOpeningElement'};VisitorKeys={AssignmentExpression:['left','right'],AssignmentPattern:['left','right'],ArrayExpression:['elements'],ArrayPattern:['elements'],ArrowFunctionExpression:['params','body'],AwaitExpression:['argument'],BlockStatement:['body'],BinaryExpression:['left','right'],BreakStatement:['label'],CallExpression:['callee','arguments'],CatchClause:['param','body'],ChainExpression:['expression'],ClassBody:['body'],ClassDeclaration:['id','superClass','body'],ClassExpression:['id','superClass','body'],ComprehensionBlock:['left','right'],ComprehensionExpression:['blocks','filter','body'],ConditionalExpression:['test','consequent','alternate'],ContinueStatement:['label'],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:['body','test'],EmptyStatement:[],ExportAllDeclaration:['source'],ExportDefaultDeclaration:['declaration'],ExportNamedDeclaration:['declaration','specifiers','source'],ExportSpecifier:['exported','local'],ExpressionStatement:['expression'],ForStatement:['init','test','update','body'],ForInStatement:['left','right','body'],ForOfStatement:['left','right','body'],FunctionDeclaration:['id','params','body'],FunctionExpression:['id','params','body'],GeneratorExpression:['blocks','filter','body'],Identifier:[],IfStatement:['test','consequent','alternate'],ImportExpression:['source'],ImportDeclaration:['specifiers','source'],ImportDefaultSpecifier:['local'],ImportNamespaceSpecifier:['local'],ImportSpecifier:['imported','local'],Literal:[],LabeledStatement:['label','body'],LogicalExpression:['left','right'],MemberExpression:['object','property'],MetaProperty:['meta','property'],MethodDefinition:['key','value'],ModuleSpecifier:[],NewExpression:['callee','arguments'],ObjectExpression:['properties'],ObjectPattern:['properties'],Program:['body'],Property:['key','value'],RestElement:['argument'],ReturnStatement:['argument'],SequenceExpression:['expressions'],SpreadElement:['argument'],Super:[],SwitchStatement:['discriminant','cases'],SwitchCase:['test','consequent'],TaggedTemplateExpression:['tag','quasi'],TemplateElement:[],TemplateLiteral:['quasis','expressions'],ThisExpression:[],ThrowStatement:['argument'],TryStatement:['block','handler','finalizer'],UnaryExpression:['argument'],UpdateExpression:['argument'],VariableDeclaration:['declarations'],VariableDeclarator:['id','init'],WhileStatement:['test','body'],WithStatement:['object','body'],YieldExpression:['argument'],ClassProperty:[],TSAsExpression:[],TSImportEqualsDeclaration:[],TSTypeAliasDeclaration:[],TSInterfaceDeclaration:[],JSXElement:[],JSXOpeningElement:[]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(Array.isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.type=function(){var node=this.current();return node.type||this.__current.wrap};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype['break']=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=null;if(visitor.fallback==='iteration'){this.__fallback=Object.keys}else if(typeof visitor.fallback==='function'){this.__fallback=visitor.fallback}this.__keys=VisitorKeys;if(visitor.keys){this.__keys=Object.assign(Object.create(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==='object'&&typeof node.type==='string'}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&'properties'===key}function candidateExistsInLeaveList(leavelist,candidate){for(var i=leavelist.length-1;i>=0;--i){if(leavelist[i].node===candidate){return true}}return false}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=node.type||element.wrap;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=this.__fallback(node)}else{throw new Error('Unknown node type '+nodeType+'.')}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(Array.isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(candidateExistsInLeaveList(leavelist,candidate[current2])){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],'Property',null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){if(candidateExistsInLeaveList(leavelist,candidate)){continue}worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;function removeElem(element){var i,key,nextElem,parent;if(element.ref.remove()){key=element.ref.key;parent=element.ref.parent;i=worklist.length;while(i--){nextElem=worklist[i];if(nextElem.ref&&nextElem.ref.parent===parent){if(nextElem.ref.key<key){break}--nextElem.ref.key}}}}this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,'root'));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem(element)}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem(element);element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=node.type||element.wrap;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=this.__fallback(node)}else{throw new Error('Unknown node type '+nodeType+'.')}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(Array.isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],'Property',new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error('attachComments needs range information')}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller;exports.cloneEnvironment=function(){return clone({})};return exports})(exports);
package/lib/spinner.js CHANGED
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const Colors=require("./colors");const wcwidth=require("wcwidth");const CR="\r";const NL="\n";var Spinner=function(opts){this._options={text:"",textColor:"yellow",spincolor:"white",frame:[124,47,45,92],interval:100,hideCursor:true,gap:" ",stream:process.stderr};opts=this._mergeOpts(this._options,opts);this._textColor=opts.textColor;this._hideTheCursor=opts.hideCursor!==false;this._interval=opts.interval||100;this._stream=opts.stream;this._frame=opts.frame;this._gap=opts.gap;for(var i=0;i<opts.frame.length;i++){opts.frame[i]=String.fromCharCode(opts.frame[i])}this._frameIndex=0;this._canDo=!process.stdout.isTTY&&process.stderr.isTTY;this._lineCount=0;this._linesToClear=0;this._count=0};Spinner.prototype.start=function(text){if(!this._canDo){return}this.setText(text);if(this._hideTheCursor){this._hideCursor()}};Spinner.prototype.stop=function(text){if(!this._canDo){return}var opts;clearInterval(this._timer);this._timer=null;opts=this._options;this.setText(text);this._frameIndex=0;this.clear();if(this._hideTheCursor){this._showCursor()}};Spinner.prototype.setText=function(text){if(!this._canDo){return}text=typeof text==="string"?this._getNextFrameChar()+this._gap+text:"";text=this._setTextColor(text);const columns=this._stream.columns||80;this._lineCount=_stripAnsi("--"+text).split("\n").reduce((count,line)=>{return count+Math.max(1,Math.ceil(wcwidth(line)/columns))},0);_tslice(this)};Spinner.prototype._startTimer=function(){var opts=this._options;opts.stream.write(this._getNextFrameChar()+opts.gap+opts.text);this._timer=setInterval(_tslice,opts.interval,this)};function _tslice(self){self.clear();self._stream.write(self._text);self._linesToClear=self._lineCount};Spinner.prototype._getNextFrameChar=function(){var opts=this._options;this._frameIndex++;this._frameIndex=this._frameIndex%this._frame.length;return this._frame[this._frameIndex]};Spinner.prototype._hideCursor=function(){this._stream.write("\x1B[?25h");this._stream.write("\x1B[?25l")};Spinner.prototype._showCursor=function(){this._stream.write("\x1B[?25h")};Spinner.prototype._mergeOpts=function(optsTo,optsFrom){var prop;if(optsFrom){for(prop in optsFrom){if(optsFrom.hasOwnProperty(prop)){optsTo[prop]=optsFrom[prop]}}}return optsTo};Spinner.prototype.clear=function(){for(let i=0;i<this._linesToClear;i++){if(i>0){this._stream.moveCursor(0,-1)}this._stream.clearLine();this._stream.cursorTo(0)}this._linesToClear=0};Spinner.prototype._setTextColor=function(text){if(this._textColor==="yellow"){this._text=Colors.YELLOW(text)}return this._text};function _stripAnsi(text){return typeof text==="string"?text.replace(_ansiRegex(),""):text};function _ansiRegex(){const pattern=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");return new RegExp(pattern,"g")};module.exports=Spinner;
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  function SpinnerNoOp(){};SpinnerNoOp.prototype.start=_noop;SpinnerNoOp.prototype.stop=_noop;SpinnerNoOp.prototype.setText=_noop;SpinnerNoOp.prototype.clear=_noop;function _noop(){};module.exports=SpinnerNoOp;
package/lib/tabs.js CHANGED
@@ -1 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
1
6
  const FILE_TYPES=["html","js","css","json","all"];const defaultTabs={"all":{spaces:4}};function Tabs(){this._tabs={}};Tabs.prototype.validate=function(t,msgContext){var fileType,entry,count=0;if(!t){this._tabs=defaultTabs;return true}if(typeof t!=="object"){msgContext.error("invalid \"tabs\" property - object expected");this._tabs=defaultTabs;return false}for(fileType in t){if(!_isFileType(fileType)){msgContext.error("invalid 'tabs' property - unknown file type \""+fileType+"\"");this._tabs=defaultTabs;return false}entry=t[fileType];if(entry.spaces&&typeof entry.spaces!=="number"||entry.stops&&!_isTabStops(entry.stops)){msgContext.error("invalid 'tabs' property for file type \""+fileType+"\"");this._tabs=defaultTabs;return false}this._tabs[fileType]=entry;count++}if(count===0){this._tabs=defaultTabs}else if(!this._tabs.all){this._tabs.all=defaultTabs.all}return true};Tabs.prototype.getTabCol=function(col,fileType){var entry,len,stops,i;if(fileType&&_isFileType(fileType)){entry=this._tabs[fileType]}if(!entry){entry=this._tabs.all;if(!entry){entry=defaultTabs.all}}if(!entry.stops){return col+entry.spaces}else{len=len-1;stops=entry.stops;if(stops.length===0){return _computeTabStop(col,0,entry.spaces?entry.spaces:defaultTabs.spaces)}if(col>=stops[len]){return _computeTabStop(col,stops[len],entry.spaces?entry.spaces:defaultTabs.spaces)}if(col<stops[0]){return stops[0]}for(i=0;i<len;i++){if(col>=stops[i]&&col<stops[i+1]){return stops[i+1]}}}};function _computeTabStop(col,lastStop,inc){var span=col-lastStop;return col+span/inc*inc+span%inc};function _isArrayNumeric(a){var i,ret=-1;for(i=0;i<a.length;i++){if(typeof a[i]!=="number"){ret=i;break}}return ret};function _isTabStops(ts){return Array.isArray(ts)&&_isArrayNumeric(ts)}function _isFileType(fileType){return FILE_TYPES.includes(fileType.toLowerCase())};module.exports=Tabs;
package/lib/xmanual.js ADDED
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const imanual=require("./imanual");function checkMsgHelp(rules,manCheckL,manCheckS,color,msgCtx){var check,temp,isShort,o,x,ret=false;check=manCheckL||manCheckS;if(check){temp=check.toLowerCase();x=temp.indexOf("-");check=x>=0?temp.substring(0,x):"";check=check.toUpperCase()+temp.substring(x);isShort=!!manCheckS;if(rules.getRSIByRuleName(temp)>=0){o=rules.getRuleDescriptionEx(null,temp,isShort)}else{o=rules.getRuleDescriptionEx(check,null,isShort)}if(o&&o.descrip){imanual.display(o,color)}else{msgCtx.error(`Unable to locate '${temp}' via the configuration file.`)}ret=true}return ret};module.exports.checkMsgHelp=checkMsgHelp;
@@ -1 +1,6 @@
1
- const ExpParser=function(){this.parse=function(expr){var length=expr.length;var context={index:0,expr:expr};var nodes=[];while(context.index<length){var ch_i=expr.charCodeAt(context.index);if(ch_i===SEMCOL_CODE||ch_i===COMMA_CODE){context.index++}else{var node=_gobbleExpression(context);if(node){nodes.push(node)}else if(context.index<length){_throwError('Unexpected "'+expr.charAt(context.index)+'"',context.index)}}}if(nodes.length===1){return nodes[0]}return{type:0,body:nodes}};function _gobbleSpaces(context){var expr=context.expr;var ch=expr.charCodeAt(context.index);while(ch===32||ch===9||ch===10||ch===13){ch=expr.charCodeAt(++context.index)}}function _gobbleExpression(context){var expr=context.expr;var test=_gobbleBinaryExpression(context),consequent,alternate;_gobbleSpaces(context);if(expr.charCodeAt(context.index)===QUMARK_CODE){context.index++;consequent=_gobbleExpression(context);if(!consequent){_throwError('Expected expression',context.index)}_gobbleSpaces(context);if(expr.charCodeAt(context.index)===COLON_CODE){context.index++;alternate=_gobbleExpression(context);if(!alternate){_throwError('Expected expression',context.index)}return{type:8,test:test,consequent:consequent,alternate:alternate}}_throwError('Expected :',context.index)}else{return test}}function _gobbleBinaryOp(context){var expr=context.expr;_gobbleSpaces(context);var to_check=expr.substr(context.index,_max_binop_len),tc_len=to_check.length;while(tc_len>0){if(_binary_ops[to_check]&&(!_isIdentifierStart(expr.charCodeAt(context.index))||context.index+to_check.length<expr.length&&!_isIdentifierPart(expr.charCodeAt(context.index+to_check.length)))){context.index+=tc_len;return to_check}to_check=to_check.substr(0,--tc_len)}return false}function _gobbleBinaryExpression(context){var node,biop,prec,stack,biop_info,left,right,i,cur_biop;left=_gobbleToken(context);biop=_gobbleBinaryOp(context);if(!biop){return left}biop_info={value:biop,prec:_binaryPrecedence(biop)};right=_gobbleToken(context);if(!right){_throwError('Expected expression after '+biop,context.index)}stack=[left,biop_info,right];while(biop=_gobbleBinaryOp(context)){prec=_binaryPrecedence(biop);if(prec===0){break}biop_info={value:biop,prec:prec};cur_biop=biop;while(stack.length>2&&prec<=stack[stack.length-2].prec){right=stack.pop();biop=stack.pop().value;left=stack.pop();node=_createBinaryExpression(biop,left,right,context);stack.push(node)}node=_gobbleToken(context);if(!node){_throwError('Expected expression after '+cur_biop,context.index)}stack.push(biop_info,node)}i=stack.length-1;node=stack[i];while(i>1){node=_createBinaryExpression(stack[i-1].value,stack[i-2],node,context);i-=2}return node}function _gobbleToken(context){var expr=context.expr;var ch,to_check,tc_len;_gobbleSpaces(context);ch=expr.charCodeAt(context.index);if(_isDecimalDigit(ch)||ch===PERIOD_CODE){return _gobbleNumericLiteral(context)}else if(ch===SQUOTE_CODE||ch===DQUOTE_CODE||ch===OBRACK_CODE){return _gobbleVariable(context)}else if(ch===OBRACE_CODE){return _gobbleObjectLiteral(context)}to_check=expr.substr(context.index,_max_unop_len);tc_len=to_check.length;while(tc_len>0){if(to_check in _unary_ops&&(!_isIdentifierStart(expr.charCodeAt(context.index))||context.index+to_check.length<expr.length&&!_isIdentifierPart(expr.charCodeAt(context.index+to_check.length)))){context.index+=tc_len;return{type:5,operator:to_check,argument:_gobbleToken(context),prefix:true}}to_check=to_check.substr(0,--tc_len)}var start=context.index;var funcEnd=context.index+8;if(expr.substring(start,funcEnd)==='function'&&!_isIdentifierPart(expr.charCodeAt(funcEnd))){context.index=funcEnd;return _gobbleFunction(context)}if(_isIdentifierStart(ch)||ch===OPAREN_CODE){return _gobbleVariable(context)}return false}function _gobbleNumericLiteral(context){var expr=context.expr;var number='',ch,chCode;while(_isDecimalDigit(expr.charCodeAt(context.index))){number+=expr.charAt(context.index++)}if(expr.charCodeAt(context.index)===PERIOD_CODE){number+=expr.charAt(context.index++);while(_isDecimalDigit(expr.charCodeAt(context.index))){number+=expr.charAt(context.index++)}}ch=expr.charAt(context.index);if(ch==='e'||ch==='E'){number+=expr.charAt(context.index++);ch=expr.charAt(context.index);if(ch==='+'||ch==='-'){number+=expr.charAt(context.index++)}while(_isDecimalDigit(expr.charCodeAt(context.index))){number+=expr.charAt(context.index++)}if(!_isDecimalDigit(expr.charCodeAt(context.index-1))){_throwError('Expected exponent ('+number+expr.charAt(context.index)+')',context.index)}}chCode=expr.charCodeAt(context.index);if(_isIdentifierStart(chCode)){_throwError('Variable names cannot start with a number ('+number+expr.charAt(context.index)+')',context.index)}else if(chCode===PERIOD_CODE){_throwError('Unexpected period',context.index)}return{type:3,value:parseFloat(number),raw:number}}function _gobbleStringLiteral(context){var expr=context.expr;var str='',quote=expr.charAt(context.index++),closed=false,ch;var length=expr.length;while(context.index<length){ch=expr.charAt(context.index++);if(ch===quote){closed=true;break}else if(ch==='\\'){ch=expr.charAt(context.index++);switch(ch){case'n':str+='\n';break;case'r':str+='\r';break;case't':str+='\t';break;case'b':str+='\b';break;case'f':str+='\f';break;case'v':str+='\x0B';break;default:str+=ch;}}else{str+=ch}}if(!closed){_throwError('Unclosed quote after "'+str+'"',context.index)}return{type:3,value:str,raw:quote+str+quote}}function _gobbleIdentifier(context){var expr=context.expr;var ch=expr.charCodeAt(context.index),start=context.index,identifier;if(_isIdentifierStart(ch)){context.index++}else{_throwError('Unexpected '+expr.charAt(context.index),context.index)}var length=expr.length;while(context.index<length){ch=expr.charCodeAt(context.index);if(_isIdentifierPart(ch)){context.index++}else{break}}identifier=expr.slice(start,context.index);if(identifier==='new'){_gobbleSpaces(context);var constructorNode=_gobbleVariable(context,4);if(constructorNode.type!==4){_throwError('Expression of type: '+constructorNode.type+' not supported for constructor expression')}return{type:12,callee:constructorNode.callee,arguments:constructorNode.arguments}}if(_literals.has(identifier)){return{type:3,value:_literals.get(identifier),raw:identifier}}return{type:1,name:identifier}}function _gobbleArguments(context,termination,identifiersOnly){var expr=context.expr;var length=expr.length;var ch_i,args=[],node,closed=false;var separator_count=0;while(context.index<length){_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i===termination){closed=true;context.index++;if(termination===CPAREN_CODE&&separator_count&&separator_count>=args.length){_throwError('Unexpected token '+String.fromCharCode(termination),context.index)}break}else if(ch_i===COMMA_CODE){context.index++;separator_count++;if(separator_count!==args.length){if(termination===CPAREN_CODE){_throwError('Unexpected token ,',context.index)}else if(termination===CBRACK_CODE){for(var arg=args.length;arg<separator_count;arg++){args.push(null)}}}}else{if(identifiersOnly){node=_gobbleIdentifier(context)}else{node=_gobbleExpression(context)}if(!node||args.length>separator_count){_throwError('Expected comma',context.index)}args.push(node)}}if(!closed){_throwError('Expected '+String.fromCharCode(termination),context.index)}return args}function _gobbleVariable(context,stopAtType){var expr=context.expr;var ch_i,node;ch_i=expr.charCodeAt(context.index);if(ch_i===OPAREN_CODE){node=_gobbleGroup(context)}else if(ch_i===SQUOTE_CODE||ch_i===DQUOTE_CODE){node=_gobbleStringLiteral(context)}else if(ch_i===OBRACK_CODE){node=_gobbleArray(context)}else{node=_gobbleIdentifier(context)}_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);while(ch_i===PERIOD_CODE||ch_i===OBRACK_CODE||ch_i===OPAREN_CODE||_isOptionalChaining(context)){context.index++;if(ch_i===PERIOD_CODE){_gobbleSpaces(context);node={type:2,computed:false,object:node,property:_gobbleIdentifier(context)}}else if(ch_i===QUMARK_CODE){context.index++;_gobbleSpaces(context);node={type:2,computed:false,conditional:true,object:node,property:_gobbleIdentifier(context)}}else if(ch_i===OBRACK_CODE){node={type:2,computed:true,object:node,property:_gobbleExpression(context)};_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i!==CBRACK_CODE){_throwError('Unclosed [',context.index)}context.index++}else if(ch_i===OPAREN_CODE){node={type:4,arguments:_gobbleArguments(context,CPAREN_CODE),callee:node}}if(stopAtType===node.type){return node}_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index)}return node}function _gobbleGroup(context){context.index++;var node=_gobbleExpression(context);_gobbleSpaces(context);if(context.expr.charCodeAt(context.index)===CPAREN_CODE){context.index++;return node}_throwError('Unclosed (',context.index)}function _gobbleArray(context){context.index++;return{type:9,elements:_gobbleArguments(context,CBRACK_CODE)}}function _gobbleFunction(context){var expr=context.expr;_gobbleSpaces(context);var ch_i=expr.charCodeAt(context.index);if(ch_i!==OPAREN_CODE){_throwError('Expected (,',context.index)}context.index++;var args=_gobbleArguments(context,CPAREN_CODE,true);_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i!==OBRACE_CODE){_throwError('Expected {,',context.index)}context.index++;_gobbleSpaces(context);var startDef=context.index;var hasReturn;var start=context.index;if(expr.substring(start,start+6)==='return'){hasReturn=true;context.index+=6}_gobbleSpaces(context);var body=_gobbleExpression(context);_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i===SEMCOL_CODE){context.index++;_gobbleSpaces(context)}ch_i=expr.charCodeAt(context.index);if(ch_i!==CBRACE_CODE){_throwError('Expected },',context.index)}context.index++;return{type:11,arguments:args,body:body,expr:expr.substring(startDef,context.index-1),return:hasReturn}}function _gobbleObjectLiteral(context){var expr=context.expr;context.index++;var props=[];var closed;var separator_count=0;var length=expr.length;while(context.index<length&&!closed){_gobbleSpaces(context);var ch_i=expr.charCodeAt(context.index);if(ch_i===CBRACE_CODE){closed=true;context.index++}else if(ch_i===COMMA_CODE){context.index++;separator_count++;if(separator_count!==props.length){_throwError('Unexpected token ,',context.index)}}else{var key;if(ch_i===SQUOTE_CODE||ch_i===DQUOTE_CODE){key=_gobbleStringLiteral(context).value}else{key=_gobbleIdentifier(context).name}_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i!==COLON_CODE){_throwError('Expected \':\'. Found '+String.fromCharCode(ch_i),context.index)}context.index++;var writer=context.writer;if(key==='_ko_property_writers'){context.writer=1}try{props.push({key:key,value:_gobbleExpression(context)})}finally{context.writer=writer}}}if(!closed){_throwError('Expected '+String.fromCharCode(CBRACE_CODE),context.index)}return{type:10,properties:props}}var PERIOD_CODE=46,COMMA_CODE=44,SQUOTE_CODE=39,DQUOTE_CODE=34,OPAREN_CODE=40,CPAREN_CODE=41,OBRACK_CODE=91,CBRACK_CODE=93,QUMARK_CODE=63,SEMCOL_CODE=59,COLON_CODE=58,OBRACE_CODE=123,CBRACE_CODE=125;function _getMaxKeyLen(obj){return Object.keys(obj).reduce(function(curr,key){return Math.max(curr,key.length)},0)}var t=true,_unary_ops={'-':t,'!':t,'~':t,'+':t},_binary_ops={'=':1,'||':2,'&&':3,'|':4,'^':5,'&':6,'==':7,'!=':7,'===':7,'!==':7,'<':8,'>':8,'<=':8,'>=':8,'<<':9,'>>':9,'>>>':9,'+':10,'-':10,'*':11,'/':11,'%':11},_max_unop_len=_getMaxKeyLen(_unary_ops),_max_binop_len=_getMaxKeyLen(_binary_ops);var _literals=new Map;_literals.set('true',true);_literals.set('false',false);_literals.set('null',null);_literals.set('undefined',undefined);function _binaryPrecedence(op_val){return _binary_ops[op_val]||0}function _createBinaryExpression(operator,left,right,context){if(operator==='='&&!context.writer){_throwError('Unexpected operator \'=\'',context.index)}var type=operator==='||'||operator==='&&'?7:6;return{type:type,operator:operator,left:left,right:right}}function _isOptionalChaining(context){var expr=context.expr;if(expr.charCodeAt(context.index)===QUMARK_CODE&&expr.charCodeAt(context.index+1)===PERIOD_CODE&&!_isDecimalDigit(expr.charCodeAt(context.index+2))){return true}return false}function _isDecimalDigit(ch){return ch>=48&&ch<=57}function _isIdentifierStart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=128&&!_binary_ops[String.fromCharCode(ch)]}function _isIdentifierPart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch>=128&&!_binary_ops[String.fromCharCode(ch)]}function _throwError(message,index){var error=new Error(message+' at character '+index);error.index=index;error.description=message;throw error}};module.exports=ExpParser;
1
+ /*
2
+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates.
3
+ * Licensed under The Universal Permissive License (UPL), Version 1.0
4
+ * as shown at https://oss.oracle.com/licenses/upl/
5
+ */
6
+ const ExpParser=function(){this.parse=function(expr){var length=expr.length;var context={index:0,expr:expr};var nodes=[];while(context.index<length){var ch_i=expr.charCodeAt(context.index);if(ch_i===SEMCOL_CODE||ch_i===COMMA_CODE){context.index++}else{var node=_gobbleExpression(context);if(node){nodes.push(node)}else if(context.index<length){_throwError('Unexpected "'+expr.charAt(context.index)+'"',context.index)}}}if(nodes.length===1){return nodes[0]}return{type:0,body:nodes}};function _gobbleSpaces(context){var expr=context.expr;var ch=expr.charCodeAt(context.index);while(ch===32||ch===9||ch===10||ch===13){ch=expr.charCodeAt(++context.index)}}function _gobbleExpression(context){var expr=context.expr;var test=_gobbleBinaryExpression(context),consequent,alternate;_gobbleSpaces(context);if(expr.charCodeAt(context.index)===QUMARK_CODE){context.index++;consequent=_gobbleExpression(context);if(!consequent){_throwError('Expected expression',context.index)}_gobbleSpaces(context);if(expr.charCodeAt(context.index)===COLON_CODE){context.index++;alternate=_gobbleExpression(context);if(!alternate){_throwError('Expected expression',context.index)}return{type:8,test:test,consequent:consequent,alternate:alternate}}_throwError('Expected :',context.index)}else{return test}}function _gobbleBinaryOp(context){var expr=context.expr;_gobbleSpaces(context);var to_check=expr.substr(context.index,_max_binop_len),tc_len=to_check.length;while(tc_len>0){if(_binary_ops[to_check]&&(!_isIdentifierStart(expr.charCodeAt(context.index))||context.index+to_check.length<expr.length&&!_isIdentifierPart(expr.charCodeAt(context.index+to_check.length)))){context.index+=tc_len;return to_check}to_check=to_check.substr(0,--tc_len)}return false}function _gobbleBinaryExpression(context){var node,biop,prec,stack,biop_info,left,right,i,cur_biop;left=_gobbleToken(context);biop=_gobbleBinaryOp(context);if(!biop){return left}biop_info={value:biop,prec:_binaryPrecedence(biop)};right=_gobbleToken(context);if(!right){_throwError('Expected expression after '+biop,context.index)}stack=[left,biop_info,right];while(biop=_gobbleBinaryOp(context)){prec=_binaryPrecedence(biop);if(prec===0){break}biop_info={value:biop,prec:prec};cur_biop=biop;while(stack.length>2&&prec<=stack[stack.length-2].prec){right=stack.pop();biop=stack.pop().value;left=stack.pop();node=_createBinaryExpression(biop,left,right,context);stack.push(node)}node=_gobbleToken(context);if(!node){_throwError('Expected expression after '+cur_biop,context.index)}stack.push(biop_info,node)}i=stack.length-1;node=stack[i];while(i>1){node=_createBinaryExpression(stack[i-1].value,stack[i-2],node,context);i-=2}return node}function _gobbleToken(context){var expr=context.expr;var ch,to_check,tc_len;_gobbleSpaces(context);ch=expr.charCodeAt(context.index);if(_isDecimalDigit(ch)||ch===PERIOD_CODE){return _gobbleNumericLiteral(context)}else if(ch===SQUOTE_CODE||ch===DQUOTE_CODE||ch===OBRACK_CODE){return _gobbleVariable(context)}else if(ch===OBRACE_CODE){return _gobbleObjectLiteral(context)}to_check=expr.substr(context.index,_max_unop_len);tc_len=to_check.length;while(tc_len>0){if(to_check in _unary_ops&&(!_isIdentifierStart(expr.charCodeAt(context.index))||context.index+to_check.length<expr.length&&!_isIdentifierPart(expr.charCodeAt(context.index+to_check.length)))){context.index+=tc_len;return{type:5,operator:to_check,argument:_gobbleToken(context),prefix:true}}to_check=to_check.substr(0,--tc_len)}var start=context.index;var funcEnd=context.index+8;if(expr.substring(start,funcEnd)==='function'&&!_isIdentifierPart(expr.charCodeAt(funcEnd))){context.index=funcEnd;return _gobbleFunction(context)}if(_isIdentifierStart(ch)||ch===OPAREN_CODE){return _gobbleVariable(context)}return false}function _gobbleNumericLiteral(context){var expr=context.expr;var number='',ch,chCode;while(_isDecimalDigit(expr.charCodeAt(context.index))){number+=expr.charAt(context.index++)}if(expr.charCodeAt(context.index)===PERIOD_CODE){number+=expr.charAt(context.index++);while(_isDecimalDigit(expr.charCodeAt(context.index))){number+=expr.charAt(context.index++)}}ch=expr.charAt(context.index);if(ch==='e'||ch==='E'){number+=expr.charAt(context.index++);ch=expr.charAt(context.index);if(ch==='+'||ch==='-'){number+=expr.charAt(context.index++)}while(_isDecimalDigit(expr.charCodeAt(context.index))){number+=expr.charAt(context.index++)}if(!_isDecimalDigit(expr.charCodeAt(context.index-1))){_throwError('Expected exponent ('+number+expr.charAt(context.index)+')',context.index)}}chCode=expr.charCodeAt(context.index);if(_isIdentifierStart(chCode)){_throwError('Variable names cannot start with a number ('+number+expr.charAt(context.index)+')',context.index)}else if(chCode===PERIOD_CODE){_throwError('Unexpected period',context.index)}return{type:3,value:parseFloat(number),raw:number}}function _gobbleStringLiteral(context){var expr=context.expr;var str='',quote=expr.charAt(context.index++),closed=false,ch;var length=expr.length;while(context.index<length){ch=expr.charAt(context.index++);if(ch===quote){closed=true;break}else if(ch==='\\'){ch=expr.charAt(context.index++);switch(ch){case'n':str+='\n';break;case'r':str+='\r';break;case't':str+='\t';break;case'b':str+='\b';break;case'f':str+='\f';break;case'v':str+='\x0B';break;default:str+=ch;}}else{str+=ch}}if(!closed){_throwError('Unclosed quote after "'+str+'"',context.index)}return{type:3,value:str,raw:quote+str+quote}}function _gobbleIdentifier(context,bMemberExpr){var expr=context.expr;var ch=expr.charCodeAt(context.index),start=context.index,identifier;if(_isIdentifierStart(ch)){context.index++}else{_throwError('Unexpected '+expr.charAt(context.index),context.index)}var length=expr.length;while(context.index<length){ch=expr.charCodeAt(context.index);if(_isIdentifierPart(ch)){context.index++}else{break}}identifier=expr.slice(start,context.index);if(identifier==='new'&&!bMemberExpr){_gobbleSpaces(context);var constructorNode=_gobbleVariable(context,4);if(constructorNode.type!==4){_throwError('Expression of type: '+constructorNode.type+' not supported for constructor expression')}return{type:12,callee:constructorNode.callee,arguments:constructorNode.arguments}}if(_literals.has(identifier)){return{type:3,value:_literals.get(identifier),raw:identifier}}return{type:1,name:identifier}}function _gobbleArguments(context,termination,identifiersOnly){var expr=context.expr;var length=expr.length;var ch_i,args=[],node,closed=false;var separator_count=0;while(context.index<length){_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i===termination){closed=true;context.index++;if(termination===CPAREN_CODE&&separator_count&&separator_count>=args.length){_throwError('Unexpected token '+String.fromCharCode(termination),context.index)}break}else if(ch_i===COMMA_CODE){context.index++;separator_count++;if(separator_count!==args.length){if(termination===CPAREN_CODE){_throwError('Unexpected token ,',context.index)}else if(termination===CBRACK_CODE){for(var arg=args.length;arg<separator_count;arg++){args.push(null)}}}}else{if(identifiersOnly){node=_gobbleIdentifier(context)}else{node=_gobbleExpression(context)}if(!node||args.length>separator_count){_throwError('Expected comma',context.index)}args.push(node)}}if(!closed){_throwError('Expected '+String.fromCharCode(termination),context.index)}return args}function _gobbleVariable(context,stopAtType){var expr=context.expr;var ch_i,node;ch_i=expr.charCodeAt(context.index);if(ch_i===OPAREN_CODE){node=_gobbleGroup(context)}else if(ch_i===SQUOTE_CODE||ch_i===DQUOTE_CODE){node=_gobbleStringLiteral(context)}else if(ch_i===OBRACK_CODE){node=_gobbleArray(context)}else{node=_gobbleIdentifier(context)}_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);while(ch_i===PERIOD_CODE||ch_i===OBRACK_CODE||ch_i===OPAREN_CODE||_isOptionalChaining(context)){context.index++;if(ch_i===PERIOD_CODE){_gobbleSpaces(context);node={type:2,computed:false,object:node,property:_gobbleIdentifier(context,true)}}else if(ch_i===QUMARK_CODE){context.index++;_gobbleSpaces(context);node={type:2,computed:false,conditional:true,object:node,property:_gobbleIdentifier(context,true)}}else if(ch_i===OBRACK_CODE){node={type:2,computed:true,object:node,property:_gobbleExpression(context)};_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i!==CBRACK_CODE){_throwError('Unclosed [',context.index)}context.index++}else if(ch_i===OPAREN_CODE){node={type:4,arguments:_gobbleArguments(context,CPAREN_CODE),callee:node}}if(stopAtType===node.type){return node}_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index)}return node}function _gobbleGroup(context){context.index++;var node=_gobbleExpression(context);_gobbleSpaces(context);if(context.expr.charCodeAt(context.index)===CPAREN_CODE){context.index++;return node}_throwError('Unclosed (',context.index)}function _gobbleArray(context){context.index++;return{type:9,elements:_gobbleArguments(context,CBRACK_CODE)}}function _gobbleFunction(context){var expr=context.expr;_gobbleSpaces(context);var ch_i=expr.charCodeAt(context.index);if(ch_i!==OPAREN_CODE){_throwError('Expected (,',context.index)}context.index++;var args=_gobbleArguments(context,CPAREN_CODE,true);_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i!==OBRACE_CODE){_throwError('Expected {,',context.index)}context.index++;_gobbleSpaces(context);var startDef=context.index;var hasReturn;var start=context.index;if(expr.substring(start,start+6)==='return'){hasReturn=true;context.index+=6}_gobbleSpaces(context);var body=_gobbleExpression(context);_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i===SEMCOL_CODE){context.index++;_gobbleSpaces(context)}ch_i=expr.charCodeAt(context.index);if(ch_i!==CBRACE_CODE){_throwError('Expected },',context.index)}context.index++;return{type:11,arguments:args,body:body,expr:expr.substring(startDef,context.index-1),return:hasReturn}}function _gobbleObjectLiteral(context){var expr=context.expr;context.index++;var props=[];var closed;var separator_count=0;var length=expr.length;while(context.index<length&&!closed){_gobbleSpaces(context);var ch_i=expr.charCodeAt(context.index);if(ch_i===CBRACE_CODE){closed=true;context.index++}else if(ch_i===COMMA_CODE){context.index++;separator_count++;if(separator_count!==props.length){_throwError('Unexpected token ,',context.index)}}else{var key;if(ch_i===SQUOTE_CODE||ch_i===DQUOTE_CODE){key=_gobbleStringLiteral(context).value}else{key=_gobbleIdentifier(context).name}_gobbleSpaces(context);ch_i=expr.charCodeAt(context.index);if(ch_i!==COLON_CODE){_throwError('Expected \':\'. Found '+String.fromCharCode(ch_i),context.index)}context.index++;var writer=context.writer;if(key==='_ko_property_writers'){context.writer=1}try{props.push({key:key,value:_gobbleExpression(context)})}finally{context.writer=writer}}}if(!closed){_throwError('Expected '+String.fromCharCode(CBRACE_CODE),context.index)}return{type:10,properties:props}}var PERIOD_CODE=46,COMMA_CODE=44,SQUOTE_CODE=39,DQUOTE_CODE=34,OPAREN_CODE=40,CPAREN_CODE=41,OBRACK_CODE=91,CBRACK_CODE=93,QUMARK_CODE=63,SEMCOL_CODE=59,COLON_CODE=58,OBRACE_CODE=123,CBRACE_CODE=125;function _getMaxKeyLen(obj){return Object.keys(obj).reduce(function(curr,key){return Math.max(curr,key.length)},0)}var t=true,_unary_ops={'-':t,'!':t,'~':t,'+':t},_binary_ops={'=':1,'||':2,'&&':3,'|':4,'^':5,'&':6,'==':7,'!=':7,'===':7,'!==':7,'<':8,'>':8,'<=':8,'>=':8,'<<':9,'>>':9,'>>>':9,'+':10,'-':10,'*':11,'/':11,'%':11},_max_unop_len=_getMaxKeyLen(_unary_ops),_max_binop_len=_getMaxKeyLen(_binary_ops);var _literals=new Map;_literals.set('true',true);_literals.set('false',false);_literals.set('null',null);_literals.set('undefined',undefined);function _binaryPrecedence(op_val){return _binary_ops[op_val]||0}function _createBinaryExpression(operator,left,right,context){if(operator==='='&&!context.writer){_throwError('Unexpected operator \'=\'',context.index)}var type=operator==='||'||operator==='&&'?7:6;return{type:type,operator:operator,left:left,right:right}}function _isOptionalChaining(context){var expr=context.expr;if(expr.charCodeAt(context.index)===QUMARK_CODE&&expr.charCodeAt(context.index+1)===PERIOD_CODE&&!_isDecimalDigit(expr.charCodeAt(context.index+2))){return true}return false}function _isDecimalDigit(ch){return ch>=48&&ch<=57}function _isIdentifierStart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=128&&!_binary_ops[String.fromCharCode(ch)]}function _isIdentifierPart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch>=128&&!_binary_ops[String.fromCharCode(ch)]}function _throwError(message,index){var error=new Error(message+' at character '+index);error.index=index;error.description=message;throw error}};module.exports=ExpParser;