@oracle/oraclejet-audit 10.1.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/jaf-amd.js +12 -4
- package/jaf.js +6 -1
- package/jafapi.js +6 -1
- package/lib/AST.js +6 -1
- package/lib/AST_Ts.js +6 -1
- package/lib/AstJson.js +6 -1
- package/lib/AstMd.js +6 -0
- package/lib/AstNodeTypes.js +6 -1
- package/lib/Comments.js +6 -1
- package/lib/ComponentSvcs.js +5 -0
- package/lib/Components.js +6 -1
- package/lib/Config.js +6 -1
- package/lib/ConfigLib.js +6 -1
- package/lib/CssLib.js +5 -0
- package/lib/CssUtils.js +5 -0
- package/lib/DomUtils.js +6 -1
- package/lib/FileIndex.js +5 -0
- package/lib/FileSet.js +5 -0
- package/lib/FsUtils.js +6 -1
- package/lib/Histo.js +6 -0
- package/lib/HtmlTree.js +6 -1
- package/lib/HtmlUtils.js +5 -0
- package/lib/Issue.js +6 -1
- package/lib/JafEvents.js +5 -0
- package/lib/JafLib.js +6 -1
- package/lib/Json.js +6 -0
- package/lib/JsonLoader.js +6 -1
- package/lib/Md.js +6 -0
- package/lib/MetaLib.js +6 -1
- package/lib/NetUtils.js +5 -0
- package/lib/NodeTypes.js +5 -0
- package/lib/Parser.js +6 -1
- package/lib/RegTypes.js +6 -1
- package/lib/Registry.js +6 -1
- package/lib/Reporter.js +6 -1
- package/lib/RuleContext.js +5 -0
- package/lib/RulePack.js +5 -0
- package/lib/RuleSet.js +6 -1
- package/lib/Rules.js +6 -1
- package/lib/Scope.js +6 -1
- package/lib/SemVer.js +5 -0
- package/lib/Server.js +5 -0
- package/lib/SevLib.js +5 -0
- package/lib/Severity.js +6 -1
- package/lib/Stats.js +6 -0
- package/lib/Ts.js +6 -1
- package/lib/Utils.js +6 -1
- package/lib/Watch.js +5 -0
- package/lib/Writer.js +5 -0
- package/lib/ZipUtils.js +5 -0
- package/lib/api.js +6 -0
- package/lib/builtinpacks.js +6 -0
- package/lib/cliStats.js +6 -0
- package/lib/clone.js +6 -1
- package/lib/cmdline.js +6 -1
- package/lib/colors.js +6 -1
- package/lib/defaults.js +6 -0
- package/lib/deflist.js +6 -0
- package/lib/dislist.js +6 -0
- package/lib/exportRules.js +6 -0
- package/lib/extends.js +6 -0
- package/lib/filetypes.js +6 -0
- package/lib/grouplist.js +6 -0
- package/lib/groups.js +6 -0
- package/lib/help.js +6 -1
- package/lib/jetver.js +6 -1
- package/lib/macros.js +6 -0
- package/lib/manual.js +6 -1
- package/lib/metaLoader.js +5 -0
- package/lib/metahist.js +5 -0
- package/lib/msgidLoader.js +6 -1
- package/lib/ns.js +6 -1
- package/lib/nslist.js +5 -0
- package/lib/outFormat.js +6 -0
- package/lib/outfile.js +5 -0
- package/lib/ruleLoader.js +5 -0
- package/lib/scaffold.js +6 -1
- package/lib/scaffoldRule.js +6 -1
- package/lib/schema.js +6 -1
- package/lib/scopewalker.js +6 -0
- package/lib/spinner.js +6 -1
- package/lib/spinnernoop.js +5 -0
- package/lib/tabs.js +5 -0
- package/libext/expparser.js +6 -1
- package/meta/11.0.0/jetauditmeta.js +9 -0
- package/meta/11.1.0/jetauditmeta.js +9 -0
- package/meta/12.0.0/jetauditmeta.js +9 -0
- package/meta/metaverlist.json +1 -1
- package/package.json +72 -69
- package/rulepacks/csp/csp-html-script-unsafe-inline.js +5 -0
- package/rulepacks/csp/csp-html-style-unsafe-inline.js +5 -0
- package/rulepacks/csp/csp-html-unsafe-expr.js +5 -0
- package/rulepacks/csp/csp-js-script-unsafe-eval.js +6 -1
- package/rulepacks/csp/csp-js-style-unsafe-inline.js +5 -0
- package/rulepacks/csp/csp-ts-script-unsafe-eval.js +6 -0
- package/rulepacks/csp/csp-ts-style-unsafe-inline.js +6 -0
- package/rulepacks/csp/msgid.json +6 -1
- package/rulepacks/csp/rules.json +6 -1
- package/rulepacks/jetwc/jetwc-absolute-jetversion.js +6 -1
- package/rulepacks/jetwc/jetwc-aria-redefinition.js +6 -1
- package/rulepacks/jetwc/jetwc-bootstrap.js +6 -1
- package/rulepacks/jetwc/jetwc-compjson-bp-ar.js +6 -1
- package/rulepacks/jetwc/jetwc-compjson-bp-obj.js +6 -1
- package/rulepacks/jetwc/jetwc-component-dependencies.js +6 -1
- package/rulepacks/jetwc/jetwc-component-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-component-foldername.js +6 -1
- package/rulepacks/jetwc/jetwc-component-location.js +6 -1
- package/rulepacks/jetwc/jetwc-component-type.js +6 -1
- package/rulepacks/jetwc/jetwc-css-oj-complete.js +6 -0
- package/rulepacks/jetwc/jetwc-data-property-prefix.js +6 -1
- package/rulepacks/jetwc/jetwc-deprecated-lifecycle.js +6 -1
- package/rulepacks/jetwc/jetwc-disabled-property.js +6 -1
- package/rulepacks/jetwc/jetwc-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-dynamic-slot-context.js +6 -1
- package/rulepacks/jetwc/jetwc-dynamic-slots-naming.js +6 -1
- package/rulepacks/jetwc/jetwc-event-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-events.js +6 -1
- package/rulepacks/jetwc/jetwc-jet-version.js +6 -1
- package/rulepacks/jetwc/jetwc-loader-file.js +6 -1
- package/rulepacks/jetwc/jetwc-markdown-link.js +6 -0
- package/rulepacks/jetwc/jetwc-method-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-methods.js +6 -1
- package/rulepacks/jetwc/jetwc-namespace.js +6 -1
- package/rulepacks/jetwc/jetwc-nested-defaults.js +6 -1
- package/rulepacks/jetwc/jetwc-nls-languages.js +6 -1
- package/rulepacks/jetwc/jetwc-nls-root.js +6 -1
- package/rulepacks/jetwc/jetwc-oj-register.js +6 -1
- package/rulepacks/jetwc/jetwc-ojcss.js +6 -1
- package/rulepacks/jetwc/jetwc-pack-children.js +6 -1
- package/rulepacks/jetwc/jetwc-packable-components.js +6 -1
- package/rulepacks/jetwc/jetwc-prerelease-dependencies.js +6 -1
- package/rulepacks/jetwc/jetwc-prerelease-pattern.js +6 -1
- package/rulepacks/jetwc/jetwc-prerelease-version.js +6 -1
- package/rulepacks/jetwc/jetwc-property-changed.js +6 -1
- package/rulepacks/jetwc/jetwc-property-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-property-nesting.js +6 -1
- package/rulepacks/jetwc/jetwc-public-modules.js +6 -1
- package/rulepacks/jetwc/jetwc-register-css.js +6 -1
- package/rulepacks/jetwc/jetwc-register-with-promises.js +6 -1
- package/rulepacks/jetwc/jetwc-require-paths.js +6 -1
- package/rulepacks/jetwc/jetwc-required-subproperty.js +6 -0
- package/rulepacks/jetwc/jetwc-reserved-property.js +6 -1
- package/rulepacks/jetwc/jetwc-schema.js +6 -1
- package/rulepacks/jetwc/jetwc-semantic-version.js +6 -1
- package/rulepacks/jetwc/jetwc-slot-displayname.js +6 -1
- package/rulepacks/jetwc/jetwc-slots.js +6 -1
- package/rulepacks/jetwc/jetwc-standard-files.js +6 -1
- package/rulepacks/jetwc/jetwc-subproperty-writeback.js +6 -0
- package/rulepacks/jetwc/jetwc-template-slots.js +6 -1
- package/rulepacks/jetwc/jetwc-unused-events.js +6 -1
- package/rulepacks/jetwc/jetwc-unused-slots.js +6 -1
- package/rulepacks/jetwc/jetwc-vb-category.js +6 -1
- package/rulepacks/jetwc/jetwc-vb-icon.js +6 -1
- package/rulepacks/jetwc/jetwc-vcomponent-jetversion.js +6 -0
- package/rulepacks/jetwc/jetwc-vcomponent-loader.js +6 -0
- package/rulepacks/jetwc/jetwc-vcomponent-version.js +6 -0
- package/rulepacks/jetwc/jetwc-version-openrange.js +6 -1
- package/rulepacks/jetwc/jetwc-writeback-required.js +6 -1
- package/rulepacks/jetwc/msgid.json +6 -0
- package/rulepacks/jetwc/rules.json +6 -1
- package/rulepacks/jetwc-lib/jetwcutils-auditComponentCacheManager.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-commonListenerImpls.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-componentAuditUtils.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-componentFinder.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-preCompiler.js +6 -0
- package/rulepacks/jetwc-lib/jetwcutils-tsxUtils.js +6 -0
- package/rulepacks/jetwco/jetwco-bootstrap.js +6 -1
- package/rulepacks/jetwco/jetwco-cacc-auditConstraints.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-dependencies.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-dynamicSlots.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-eventBubbles.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-eventCancelable.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-eventPayload.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-events.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-helpers.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-jetVer.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-methodParamTypes.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-methodParams.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-methodReturnType.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-methods.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-packBundle.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-packBundleContent.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-packContent.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-properties.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyDefault.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyEnumeration.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyReadOnly.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyRequired.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyType.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-propertyWriteback.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-publicModules.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-slotDataVariable.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-slotDataVariableType.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-slots.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-styleClasses.js +6 -0
- package/rulepacks/jetwco/jetwco-cacc-styleVariables.js +6 -0
- package/rulepacks/jetwco/jetwco-compjson-ns-reg.js +6 -1
- package/rulepacks/jetwco/jetwco-component-api-baseline-changes.js +6 -0
- package/rulepacks/jetwco/jetwco-component-api-changes.js +6 -1
- package/rulepacks/jetwco/jetwco-component-api-controlled-changes.js +6 -0
- package/rulepacks/jetwco/jetwco-component-cdn.js +6 -1
- package/rulepacks/jetwco/jetwco-description-standards.js +6 -0
- package/rulepacks/jetwco/jetwco-displayname-standards.js +6 -0
- package/rulepacks/jetwco/jetwco-exchange-version-check.js +6 -1
- package/rulepacks/jetwco/jetwco-license-info.js +6 -1
- package/rulepacks/jetwco/jetwco-prerelease-cdn.js +6 -1
- package/rulepacks/jetwco/jetwco-thirdparty-ba.js +6 -1
- package/rulepacks/jetwco/msgid.json +6 -0
- package/rulepacks/jetwco/rules.json +6 -1
- package/rulepacks/spoc/msgid.json +5 -0
- package/rulepacks/spoc/rules.json +5 -0
- package/rulepacks/spoc/spoc-dom-manip-inv-tag.js +5 -0
- package/rulepacks/spoc/spoc-dom-manip-tag-pos.js +5 -0
- package/rulepacks/spoc/spoc-dom-manip.js +5 -0
- package/{tests/rules/oj-js-diagnose/js_FAIL_1.js → rulepacks/wdt/msgid.json} +3 -9
- package/rulepacks/wdt/rules.json +6 -0
- package/rulepacks/wdt/wd-driver-sleep.js +6 -0
- package/rulepacks/wdt/wd-xpath.js +6 -0
- package/rules/jaf/jaf-css-diagnose.js +5 -0
- package/rules/jaf/jaf-html-diagnose.js +5 -0
- package/rules/jaf/jaf-init-schema.js +5 -0
- package/rules/jaf/jaf-js-diagnose.js +5 -0
- package/rules/jaf/jaf-ts-diagnose.js +6 -0
- package/rules/jaf/msgid.json +6 -1
- package/rules/jaf/rules.json +6 -1
- package/rules/jet/helpers/acc-aria-label.js +6 -1
- package/rules/jet/helpers/bp-checkPropType.js +5 -0
- package/rules/jet/helpers/cssHelper.js +6 -1
- package/rules/jet/helpers/extractStylesFromClass.js +6 -1
- package/rules/jet/helpers/has-slot-name.js +6 -1
- package/rules/jet/helpers/has-slot.js +5 -0
- package/rules/jet/helpers/json-prop-pos.js +5 -0
- package/rules/jet/helpers/json-propname-pos.js +5 -0
- package/rules/jet/helpers/style-selector.js +6 -1
- package/rules/jet/helpers/valid-attr.js +5 -0
- package/rules/jet/helpers/vartrack.js +5 -0
- package/rules/jet/jet-css-ojselector.js +5 -0
- package/rules/jet/msgid.json +6 -1
- package/rules/jet/oj-acc-aria-labelledby.js +5 -0
- package/rules/jet/oj-acc-aria-prop.js +6 -1
- package/rules/jet/oj-acc-avatar-aria-role.js +6 -1
- package/rules/jet/oj-acc-combobox-aria-label.js +6 -1
- package/rules/jet/oj-acc-film-strip-aria-label.js +6 -1
- package/rules/jet/oj-acc-input-aria-label.js +6 -1
- package/rules/jet/oj-acc-select-aria-label.js +6 -1
- package/rules/jet/oj-cca-compjson-bp-ar.js +5 -0
- package/rules/jet/oj-cca-compjson-bp-dsplyname.js +5 -0
- package/rules/jet/oj-cca-compjson-bp-jetver.js +5 -0
- package/rules/jet/oj-cca-compjson-bp-obj.js +5 -0
- package/rules/jet/oj-cca-compjson-ns-reg.js +5 -0
- package/rules/jet/oj-css-bp-border-color.js +5 -0
- package/rules/jet/oj-css-bp-dir-flow.js +6 -1
- package/rules/jet/oj-css-bp-float.js +5 -0
- package/rules/jet/oj-css-bp-textalign.js +5 -0
- package/rules/jet/oj-css-style-abs-units.js +6 -1
- package/rules/jet/oj-css-style-bp-color.js +5 -0
- package/rules/jet/oj-css-style-bp-display.js +6 -1
- package/rules/jet/oj-css-style-bp-font-family.js +6 -1
- package/rules/jet/oj-css-style-bp-font.js +5 -0
- package/rules/jet/oj-css-style-deprecated.js +6 -1
- package/rules/jet/oj-css-style-override.js +6 -1
- package/rules/jet/oj-css-var-override.js +5 -0
- package/rules/jet/oj-form-maxcols.js +6 -1
- package/rules/jet/oj-html-5-attr-obs.js +5 -0
- package/rules/jet/oj-html-5-tag-obs.js +5 -0
- package/rules/jet/oj-html-alta-deprecated.js +6 -0
- package/rules/jet/oj-html-attr-$unique.js +5 -0
- package/rules/jet/oj-html-attr-2def.js +5 -0
- package/rules/jet/oj-html-attr-json.js +6 -1
- package/rules/jet/oj-html-attr-prefix-expr.js +6 -1
- package/rules/jet/oj-html-attr-prefix-ro.js +5 -0
- package/rules/jet/oj-html-attr-req.js +5 -0
- package/rules/jet/oj-html-bindforeach-data.js +6 -1
- package/rules/jet/oj-html-bindif-test.js +6 -1
- package/rules/jet/oj-html-binding-attr.js +6 -1
- package/rules/jet/oj-html-cca-count.js +5 -0
- package/rules/jet/oj-html-cca-tagname.js +6 -1
- package/rules/jet/oj-html-cdn.js +5 -0
- package/rules/jet/oj-html-combo-converter.js +5 -0
- package/rules/jet/oj-html-cspexpr.js +6 -1
- package/rules/jet/oj-html-databind-all.js +5 -0
- package/rules/jet/oj-html-dlg-title.js +6 -1
- package/rules/jet/oj-html-file-pick-accept.js +6 -1
- package/rules/jet/oj-html-form-bindif.js +6 -1
- package/rules/jet/oj-html-form-layout-maxcols.js +6 -1
- package/rules/jet/oj-html-form-noflex.js +5 -0
- package/rules/jet/oj-html-input-isodate.js +6 -0
- package/rules/jet/oj-html-invalid-doctype.js +6 -1
- package/rules/jet/oj-html-jq-databind.js +6 -1
- package/rules/jet/oj-html-ko-comment.js +5 -0
- package/rules/jet/oj-html-ko-databind.js +6 -1
- package/rules/jet/oj-html-label-for-prefix.js +5 -0
- package/rules/jet/oj-html-missing-doctype.js +6 -1
- package/rules/jet/oj-html-msgs-cat-text.js +6 -0
- package/rules/jet/oj-html-no-style-tag.js +6 -0
- package/rules/jet/oj-html-notag-style.js +6 -0
- package/rules/jet/oj-html-oj-lib.js +5 -0
- package/rules/jet/oj-html-ojattr-520.js +6 -1
- package/rules/jet/oj-html-ojattr-deprecated.js +6 -1
- package/rules/jet/oj-html-ojattr-enum-deprecated.js +6 -1
- package/rules/jet/oj-html-ojattr-evt-syntax.js +6 -1
- package/rules/jet/oj-html-ojattr-value.js +6 -1
- package/rules/jet/oj-html-ojattr.js +6 -1
- package/rules/jet/oj-html-ojevent.js +6 -1
- package/rules/jet/oj-html-ojslot.js +6 -1
- package/rules/jet/oj-html-ojstyle.js +5 -0
- package/rules/jet/oj-html-ojtag-datacmd.js +6 -1
- package/rules/jet/oj-html-ojtag-datactx.js +5 -0
- package/rules/jet/oj-html-ojtag-deprecated.js +6 -1
- package/rules/jet/oj-html-ojtag-globattr-noprefix.js +6 -1
- package/rules/jet/oj-html-ojtag-id.js +5 -0
- package/rules/jet/oj-html-ojtag-nonglobattr-prefix.js +6 -1
- package/rules/jet/oj-html-ojtag-ns.js +5 -0
- package/rules/jet/oj-html-picker-attrs.js +6 -0
- package/rules/jet/oj-html-redwood-cssnovars.js +6 -0
- package/rules/jet/oj-html-redwood-cssvars.js +6 -0
- package/rules/jet/oj-html-self-close.js +5 -0
- package/rules/jet/oj-html-slot-item-minmax.js +6 -0
- package/rules/jet/oj-html-slot-name.js +6 -1
- package/rules/jet/oj-html-slot-pref-content.js +6 -0
- package/rules/jet/oj-html-style-abs-units.js +5 -0
- package/rules/jet/oj-html-style-bp-color.js +5 -0
- package/rules/jet/oj-html-style-bp-display.js +6 -1
- package/rules/jet/oj-html-style-bp-font-family.js +5 -0
- package/rules/jet/oj-html-style-bp-font.js +5 -0
- package/rules/jet/oj-html-style-deprecated.js +6 -1
- package/rules/jet/oj-html-style.js +6 -1
- package/rules/jet/oj-html-stylesel.js +6 -1
- package/rules/jet/oj-html-tag-attr-noprefix.js +6 -1
- package/rules/jet/oj-html-template-index.js +6 -1
- package/rules/jet/oj-html-unsup-theme.js +6 -1
- package/rules/jet/oj-html-wctag-$props.js +6 -1
- package/rules/jet/oj-html-wctag-arialabelledby.js +5 -0
- package/rules/jet/oj-html-wctag-for.js +5 -0
- package/rules/jet/oj-html-wctag-id.js +6 -1
- package/rules/jet/oj-html-wctag-nested.js +6 -0
- package/rules/jet/oj-html-wctag-packprivate.js +6 -0
- package/rules/jet/oj-js-comp-attr-deprecated.js +6 -1
- package/rules/jet/oj-js-comp-meth-deprecated.js +6 -1
- package/rules/jet/oj-js-no-ext-final.js +5 -0
- package/rules/jet/oj-js-noconsole.js +5 -0
- package/rules/jet/oj-js-ojcomp-deprecated.js +6 -1
- package/rules/jet/oj-js-ojcomp-exist.js +5 -0
- package/rules/jet/oj-js-ojcomp-new.js +5 -0
- package/rules/jet/oj-js-poly-promise.js +6 -1
- package/rules/jet/oj-js-var-undef.js +5 -0
- package/rules/jet/oj-json-syntax.js +5 -0
- package/rules/jet/oj-ts-comp-attr-deprecated.js +6 -1
- package/rules/jet/oj-ts-comp-meth-deprecated.js +6 -1
- package/rules/jet/oj-ts-no-ext-final.js +6 -0
- package/rules/jet/oj-ts-noconsole.js +6 -1
- package/rules/jet/oj-ts-ojcomp-deprecated.js +6 -1
- package/rules/jet/oj-ts-ojcomp-exist.js +6 -1
- package/rules/jet/oj-ts-ojcomp-new.js +6 -1
- package/rules/jet/oj-ts-poly-promise.js +6 -1
- package/rules/jet/rules.json +6 -1
- package/schema/component-schema.json +125 -2
- package/src/JafCore.js +6 -1
- package/types/index.d.ts +175 -37
- package/lib/stats.js +0 -1
- package/rulepacks/jetwc-lib/component-audit-utils.js +0 -1
- package/rules/exch/helpers/json-prop-pos.js +0 -1
- package/rules/exch/msgid.json +0 -1
- package/rules/exch/oj-cca-comp-zip-content-composite.js +0 -1
- package/rules/exch/oj-cca-comp-zip-content-pack.js +0 -1
- package/rules/exch/oj-cca-comp-zip-expand.js +0 -1
- package/rules/exch/oj-cca-compjson-evnames.js +0 -1
- package/rules/exch/oj-cca-compjson-file.js +0 -1
- package/rules/exch/oj-cca-compjson-prefix.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-compdeps.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-deps.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-jetver.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-obs.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-type.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-types.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-undef.js +0 -1
- package/rules/exch/oj-cca-compjson-prop-version.js +0 -1
- package/rules/exch/oj-cca-compjson-schema.js +0 -1
- package/rules/exch/oj-cca-zip-compjson.js +0 -1
- package/rules/exch/rules.json +0 -1
- package/rules/jet/oj-css-bp-bgcolor.js +0 -1
- package/tests/components/attr-req-test/component.json +0 -1
- package/tests/components/demo-analog-clock/component.json +0 -1
- package/tests/components/demo-analog-clock/demo-analog-clock-viewModel.js +0 -1
- package/tests/components/demo-analog-clock/extension/demo/js/viewModels/demo.js +0 -1
- package/tests/components/demo-analog-clock/loader.js +0 -1
- package/tests/components/demo-card/component.json +0 -1
- package/tests/components/demo-chart-orientation-control/component.json +0 -1
- package/tests/components/demo-chart-stack-control/component.json +0 -1
- package/tests/components/made-up/component.json +0 -1
- package/tests/components/oj-made-up/component.json +0 -1
- package/tests/components/sp-activity-item/component.json +0 -1
- package/tests/config/config_base.json +0 -1
- package/tests/golden/10.0.0/golden_base.json +0 -1
- package/tests/golden/8.1.0/golden_base.json +0 -1
- package/tests/golden/9.0.0/golden_base.json +0 -1
- package/tests/rulepacks/hooks/hook-rpext.js +0 -1
- package/tests/rulepacks/hooks/hook-start-close-rulepack.js +0 -1
- package/tests/rulepacks/hooks/rule-rpext.js +0 -1
- package/tests/rulepacks/hooks/rules.json +0 -1
- package/tests/rulepacks/tags/proc_directive.js +0 -1
- package/tests/rulepacks/tags/rules.json +0 -1
- package/tests/rulepacks/tags/tag-count-setup.js +0 -1
- package/tests/rulepacks/tags/tag-count.js +0 -1
- package/tests/rules/bugs/JET-4770_PASS_1.html +0 -9
- package/tests/rules/comments/com_FAIL_1.js +0 -57
- package/tests/rules/comments/com_FAIL_2.js +0 -96
- package/tests/rules/comments/com_PASS_1.js +0 -42
- package/tests/rules/comments/com_PASS_2.js +0 -63
- package/tests/rules/comments/com_PASS_3.js +0 -40
- package/tests/rules/comments/com_PASS_4.js +0 -36
- package/tests/rules/comments/com_PASS_5.js +0 -19
- package/tests/rules/csp/html-script-unsafe-inline/FAIL_1.html +0 -11
- package/tests/rules/csp/html-script-unsafe-inline/FAIL_2.html +0 -8
- package/tests/rules/csp/html-script-unsafe-inline/PASS_1.html +0 -8
- package/tests/rules/csp/html-script-unsafe-inline/PASS_2.html +0 -8
- package/tests/rules/csp/html-script-unsafe-inline/PASS_3.html +0 -8
- package/tests/rules/csp/html-style-unsafe-inline/FAIL_1.html +0 -11
- package/tests/rules/csp/html-style-unsafe-inline/PASS_1.html +0 -11
- package/tests/rules/csp/html-unsafe-expr/FAIL_1.html +0 -14
- package/tests/rules/csp/html-unsafe-expr/PASS_1.html +0 -23
- package/tests/rules/csp/js-script-unsafe-eval/FAIL_1.js +0 -17
- package/tests/rules/csp/js-script-unsafe-eval/FAIL_2.js +0 -40
- package/tests/rules/csp/js-script-unsafe-eval/FAIL_3.js +0 -22
- package/tests/rules/csp/js-script-unsafe-eval/PASS_1.js +0 -20
- package/tests/rules/csp/js-script-unsafe-eval/PASS_2.js +0 -44
- package/tests/rules/csp/js-script-unsafe-eval/PASS_3.js +0 -16
- package/tests/rules/csp/js-style-unsafe-inline/FAIL_1.js +0 -25
- package/tests/rules/csp/js-style-unsafe-inline/PASS.js +0 -22
- package/tests/rules/demo/noself_FAIL_1.js +0 -101
- package/tests/rules/import/import_FAIL_1.js +0 -11
- package/tests/rules/import/import_PASS_1.js +0 -10
- package/tests/rules/jet-composites/demo-buttonset-enum/component.json +0 -57
- package/tests/rules/jet-composites/demo-buttonset-enum/loader.js +0 -19
- package/tests/rules/jet-composites/demo-buttonset-enum/view.html +0 -48
- package/tests/rules/jet-composites/demo-card/component.json +0 -28
- package/tests/rules/jet-composites/demo-card/loader.js +0 -16
- package/tests/rules/jet-composites/demo-card/view.html +0 -30
- package/tests/rules/jet-composites/demo-card/viewModel.js +0 -46
- package/tests/rules/jet-composites/demo-card/view_PASS_1.html +0 -21
- package/tests/rules/jet-composites/demo-contact-form/component.json +0 -23
- package/tests/rules/jet-composites/demo-contact-form/loader.js +0 -16
- package/tests/rules/jet-composites/demo-contact-form/view.html +0 -9
- package/tests/rules/jet-composites/demo-grocery-list/component.json +0 -18
- package/tests/rules/jet-composites/demo-grocery-list/loader.js +0 -19
- package/tests/rules/jet-composites/demo-grocery-list/view.html +0 -22
- package/tests/rules/jet-composites/demo-grocery-list/viewModel.js +0 -48
- package/tests/rules/jet-composites/dummy-component-1/component.json +0 -82
- package/tests/rules/jet-composites/dummy-component-2/component.json +0 -72
- package/tests/rules/jet-composites/foo-my-cca/component.json +0 -14
- package/tests/rules/jet-composites/foo-unsup-theme/component.json +0 -29
- package/tests/rules/jet-composites/header/component.json +0 -12
- package/tests/rules/jet-composites/oj-cgbu-omc/attribute-selection/component.json +0 -154
- package/tests/rules/jet-composites/oj-cgbu-omc/component.json +0 -11
- package/tests/rules/jet-composites/oj-cgbu-omc/reference/component.json +0 -185
- package/tests/rules/jet-composites/oj-cgbu-omc/wctag_props_FAIL_1.html +0 -34
- package/tests/rules/jet-composites/oj-enum-depr/component.json +0 -69
- package/tests/rules/jet-composites/oj-html-wctag-id/id_FAIL_1.html +0 -10
- package/tests/rules/jet-composites/oj-html-wctag-id/id_PASS_1.html +0 -6
- package/tests/rules/misc/oj.js +0 -12
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_FAIL_1.html +0 -23
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_FAIL_2.html +0 -22
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_1.html +0 -23
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_2.html +0 -22
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_3.html +0 -22
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_4.html +0 -22
- package/tests/rules/oj-acc-aria-labelledby/aria_labelledby_PASS_5.html +0 -22
- package/tests/rules/oj-acc-aria-prop/aria_prop_FAIL_1.html +0 -22
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_FAIL_1.html +0 -20
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_1.html +0 -23
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_2.html +0 -24
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_3.html +0 -21
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_4.html +0 -22
- package/tests/rules/oj-acc-avatar-aria-role/aria_avatar_role_PASS_5.html +0 -22
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_FAIL_1.html +0 -20
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_FAIL_2.html +0 -21
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_many_PASS_1.html +0 -20
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_FAIL_1.html +0 -21
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_FAIL_2.html +0 -22
- package/tests/rules/oj-acc-combobox-aria-label/aria_combo_one_PASS_1.html +0 -22
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_FAIL_1.html +0 -18
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_FAIL_2.html +0 -18
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_1.html +0 -18
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_2.html +0 -19
- package/tests/rules/oj-acc-film-strip-aria-label/aria_filmstrip_PASS_3.html +0 -22
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_FAIL_1.html +0 -21
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_FAIL_2.html +0 -22
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_1.html +0 -16
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_2.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_PASS_3.html +0 -26
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_FAIL_1.html +0 -19
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_FAIL_2.html +0 -20
- package/tests/rules/oj-acc-input-aria-label/oj_input_date_time_PASS_1.html +0 -19
- package/tests/rules/oj-acc-input-aria-label/oj_input_number_FAIL_1.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_number_FAIL_2.html +0 -18
- package/tests/rules/oj-acc-input-aria-label/oj_input_number_PASS_1.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_password_FAIL_1.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_password_FAIL_2.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_password_PASS_1.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_3_PASS_1.html +0 -20
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_FAIL_1.html +0 -20
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_FAIL_2.html +0 -21
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_PASS_2.html +0 -62
- package/tests/rules/oj-acc-input-aria-label/oj_input_text_nolabel_PASS_2.html +0 -17
- package/tests/rules/oj-acc-input-aria-label/oj_input_time_FAIL_1.html +0 -19
- package/tests/rules/oj-acc-input-aria-label/oj_input_time_FAIL_2.html +0 -20
- package/tests/rules/oj-acc-input-aria-label/oj_input_time_PASS_1.html +0 -19
- package/tests/rules/oj-acc-select-aria-label/aria_selectmany_FAIL_1.html +0 -19
- package/tests/rules/oj-acc-select-aria-label/aria_selectmany_FAIL_2.html +0 -20
- package/tests/rules/oj-acc-select-aria-label/aria_selectmany_PASS_1.html +0 -19
- package/tests/rules/oj-acc-select-aria-label/aria_selectone_FAIL_1.html +0 -20
- package/tests/rules/oj-acc-select-aria-label/aria_selectone_FAIL_2.html +0 -21
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_1.zip +0 -1
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_2.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_3.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_4.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_5.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_6.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_7.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_FAIL_8.zip +0 -0
- package/tests/rules/oj-cca-comp-zip/zip_PASS_1.zip +0 -0
- package/tests/rules/oj-cca-ns-reg/oj-cca-ns-FAIL_1/component.json +0 -19
- package/tests/rules/oj-cca-ns-reg/oj-cca-ns-PASS_1/component.json +0 -19
- package/tests/rules/oj-cgbu-omc_tests/html_ojevent_FAIL_1.html +0 -15
- package/tests/rules/oj-cgbu-omc_tests/html_ojevent_PASS_1.html +0 -17
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_1/component.json +0 -16
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_10/component.json +0 -103
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_11/component.json +0 -24
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_12/component.json +0 -17
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_13/component.json +0 -17
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_14/component.json +0 -40
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_15/component.json +0 -24
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_16/component.json +0 -44
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_17/component.json +0 -8
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_18/component.json +0 -8
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_19/component.json +0 -8
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_2/component.json +0 -15
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_20/component.json +0 -18
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_21/component.json +0 -16
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_22/component.json +0 -19
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_3/component.json +0 -15
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_4/component.json +0 -16
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_5/component.json +0 -16
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_6/component.json +0 -18
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_7/component.json +0 -15
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_8/component.json +0 -15
- package/tests/rules/oj-compjson-syntax/ojcomp-FAIL_9/component.json +0 -52
- package/tests/rules/oj-compjson-syntax/ojcomp-PASS_1/component.json +0 -17
- package/tests/rules/oj-compjson-syntax/ojcomp-PASS_2/component.json +0 -88
- package/tests/rules/oj-compjson-syntax/ojcomp-PASS_3/component.json +0 -19
- package/tests/rules/oj-css-bp-dir-flow/dirflow_FAIL_1.html +0 -22
- package/tests/rules/oj-css-bp-dir-flow/dirflow_FAIL_2.html +0 -22
- package/tests/rules/oj-css-diagnose/css_FAIL_1.html +0 -14
- package/tests/rules/oj-css-diagnose/css_PASS_1.html +0 -14
- package/tests/rules/oj-css-var-override/varovr_FAIL_1.html +0 -8
- package/tests/rules/oj-html-5-attr-depr/attrdepr_FAIL_1.html +0 -16
- package/tests/rules/oj-html-5-attr-depr/attrdepr_PASS_1.html +0 -16
- package/tests/rules/oj-html-5-tag-depr/tagdepr_FAIL_1.html +0 -9
- package/tests/rules/oj-html-attr/attr_FAIL_1.html +0 -27
- package/tests/rules/oj-html-attr-$unique/attr_$unique1_FAIL_1.html +0 -19
- package/tests/rules/oj-html-attr-$unique/attr_$unique_FAIL_2.html +0 -25
- package/tests/rules/oj-html-attr-2def/attr2def_FAIL_1.html +0 -10
- package/tests/rules/oj-html-attr-2def/attr2def_PASS_1.html +0 -10
- package/tests/rules/oj-html-attr-json/attr-json_FAIL_1.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_FAIL_2.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_FAIL_3.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_PASS_1.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_PASS_2.html +0 -20
- package/tests/rules/oj-html-attr-json/attr-json_PASS_3.html +0 -8
- package/tests/rules/oj-html-attr-prefix-expr/attrprefixexpr_FAIL_1.html +0 -10
- package/tests/rules/oj-html-attr-prefix-expr/attrprefixexpr_PASS_1.html +0 -10
- package/tests/rules/oj-html-attr-prefix-ro/attrprefixro_FAIL_1.html +0 -10
- package/tests/rules/oj-html-attr-prefix-ro/attrprefixro_PASS_1.html +0 -10
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_1.html +0 -17
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_2.html +0 -13
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_3.html +0 -8
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_4.html +0 -13
- package/tests/rules/oj-html-attr-req/attrreq_FAIL_5.html +0 -17
- package/tests/rules/oj-html-attr-req/attrreq_PASS_1.html +0 -24
- package/tests/rules/oj-html-attr-req/attrreq_PASS_2.html +0 -24
- package/tests/rules/oj-html-attr-req/attrreq_PASS_3.html +0 -10
- package/tests/rules/oj-html-attr-req/attrreq_PASS_4.html +0 -11
- package/tests/rules/oj-html-bindforeach-data/bindforeach_data_FAIL_1.html +0 -19
- package/tests/rules/oj-html-bindforeach-data/bindforeach_data_PASS_1.html +0 -10
- package/tests/rules/oj-html-bindif-test/bindif_test_FAIL_1.html +0 -22
- package/tests/rules/oj-html-bindif-test/bindif_test_PASS_1.html +0 -11
- package/tests/rules/oj-html-binding-attr/binding-foreach_FAIL_2.html +0 -28
- package/tests/rules/oj-html-binding-attr/binding-if_FAIL_1.html +0 -23
- package/tests/rules/oj-html-binding-attr/binding-if_PASS_1.html +0 -23
- package/tests/rules/oj-html-cca-count/cca-count_FAIL_1.html +0 -119
- package/tests/rules/oj-html-cca-tagname/ccatag_FAIL_1.html +0 -7
- package/tests/rules/oj-html-cca-tagname/ccatag_PASS_1.html +0 -7
- package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_1.html +0 -8
- package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_2.html +0 -8
- package/tests/rules/oj-html-cca-tagname/tag_ns_FAIL_3.html +0 -8
- package/tests/rules/oj-html-cca-tagname/tag_ns_PASS_1.html +0 -10
- package/tests/rules/oj-html-cdn/html_cdn_FAIL_1.html +0 -18
- package/tests/rules/oj-html-cspexpr/cspexpr_FAIL_1.html +0 -14
- package/tests/rules/oj-html-cspexpr/cspexpr_FAIL_2.html +0 -10
- package/tests/rules/oj-html-cspexpr/cspexpr_PASS_1.html +0 -23
- package/tests/rules/oj-html-cspexpr/cspexpr_PASS_2.html +0 -10
- package/tests/rules/oj-html-cspexpr/cspexpr_PASS_3.html +0 -13
- package/tests/rules/oj-html-dlg-title/dlgtitle_FAIL_1.html +0 -12
- package/tests/rules/oj-html-dlg-title/dlgtitle_PASS_1.html +0 -12
- package/tests/rules/oj-html-form-noflex/noflex_FAIL_1.html +0 -10
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_1.html +0 -20
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_2.html +0 -13
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_3.html +0 -16
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_FAIL_4.html +0 -13
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_1.html +0 -6
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_2.html +0 -7
- package/tests/rules/oj-html-invalid-doctype/doctype_invalid_PASS_3.html +0 -7
- package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_1.html +0 -37
- package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_2.html +0 -34
- package/tests/rules/oj-html-jq-databind/jq-databind_FAIL_3.html +0 -27
- package/tests/rules/oj-html-jq-databind/jq-databind_PASS_1.html +0 -30
- package/tests/rules/oj-html-ko-comment/ko-comment_FAIL_1.html +0 -47
- package/tests/rules/oj-html-ko-comment/ko-comment_FAIL_2.html +0 -36
- package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_1.html +0 -24
- package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_2.html +0 -36
- package/tests/rules/oj-html-ko-databind/ko-databind_FAIL_3.html +0 -29
- package/tests/rules/oj-html-label-for-prefix/for_FAIL_1.html +0 -8
- package/tests/rules/oj-html-label-for-prefix/for_PASS_1.html +0 -8
- package/tests/rules/oj-html-missing-doctype/doctype_missing_FAIL_1.html +0 -12
- package/tests/rules/oj-html-missing-doctype/doctype_missing_FAIL_2.html +0 -11
- package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_1.html +0 -14
- package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_2.html +0 -5
- package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_3.html +0 -12
- package/tests/rules/oj-html-missing-doctype/doctype_missing_PASS_5.html +0 -6
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_1.html +0 -28
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_2.html +0 -14
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_3.html +0 -13
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_5.html +0 -28
- package/tests/rules/oj-html-nonvoid-close/close_FAIL_6.html +0 -28
- package/tests/rules/oj-html-nonvoid-close/close_PASS_1.html +0 -7
- package/tests/rules/oj-html-oj-lib/oj_lib_FAIL_1.html +0 -15
- package/tests/rules/oj-html-ojattr/ojattr_PASS_1.html +0 -8
- package/tests/rules/oj-html-ojattr/ojattr_PASS_2.html +0 -10
- package/tests/rules/oj-html-ojattr/ojattr_PASS_3.html +0 -7
- package/tests/rules/oj-html-ojattr/ojattr_PASS_4.html +0 -7
- package/tests/rules/oj-html-ojattr-deprecated/ojattr-dep_FAIL1.html +0 -156
- package/tests/rules/oj-html-ojattr-enum-deprecated/enum_FAIL_1.html +0 -19
- package/tests/rules/oj-html-ojattr-enum-deprecated/enum_FAIL_2.html +0 -20
- package/tests/rules/oj-html-ojattr-enum-deprecated/enum_PASS_1.html +0 -25
- package/tests/rules/oj-html-ojattr-evt-syntax/evt-attr-syntax_FAIL_1.html +0 -6
- package/tests/rules/oj-html-ojattr-evt-syntax/evt-attr-syntax_PASS_1.html +0 -6
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_1.html +0 -26
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_2.html +0 -26
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_3.html +0 -8
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_4.html +0 -8
- package/tests/rules/oj-html-ojattr-value/attr-value_FAIL_5.html +0 -8
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_1.html +0 -26
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_2.html +0 -8
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_3.html +0 -7
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_6.html +0 -7
- package/tests/rules/oj-html-ojattr-value/attr-value_PASS_7.html +0 -10
- package/tests/rules/oj-html-ojattr-value/attr_value_PASS_4.html +0 -7
- package/tests/rules/oj-html-ojattr-value/attr_value_PASS_5.html +0 -9
- package/tests/rules/oj-html-ojslot/ojslot_FAIL_1.html +0 -11
- package/tests/rules/oj-html-ojslot/ojslot_PASS_1.html +0 -12
- package/tests/rules/oj-html-ojstyle/style_FAIL_1.html +0 -103
- package/tests/rules/oj-html-ojstyle/style_PASS_2.html +0 -7
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_1.html +0 -10
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_2.html +0 -18
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_FAIL_3.html +0 -10
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_PASS_1.html +0 -28
- package/tests/rules/oj-html-ojtag-datacmd/datacmd_PASS_2.html +0 -15
- package/tests/rules/oj-html-ojtag-datactx/datactx_FAIL_1.html +0 -14
- package/tests/rules/oj-html-ojtag-datactx/datactx_PASS_1.html +0 -14
- package/tests/rules/oj-html-ojtag-globattr-noprefix/globattr-noprefix_FAIL_1.html +0 -36
- package/tests/rules/oj-html-ojtag-nonglobattr-prefix/nonglobattr-prefix_FAIL_1.html +0 -26
- package/tests/rules/oj-html-slot-name/slot_name.FAIL_1.html +0 -24
- package/tests/rules/oj-html-slot-name/slot_name.FAIL_2.html +0 -46
- package/tests/rules/oj-html-slot-name/slot_name.FAIL_3.html +0 -10
- package/tests/rules/oj-html-slot-name/slot_name.PASS_1.html +0 -24
- package/tests/rules/oj-html-slot-name/slot_name.PASS_2.html +0 -39
- package/tests/rules/oj-html-slot-name/slot_name.PASS_3.html +0 -10
- package/tests/rules/oj-html-slot-name/slot_name_PASS_4.html +0 -16
- package/tests/rules/oj-html-slot-name/slot_name_PASS_5.html +0 -11
- package/tests/rules/oj-html-slot-name/slot_name_PASS_6.html +0 -14
- package/tests/rules/oj-html-slot-name/slot_name_PASS_7.html +0 -10
- package/tests/rules/oj-html-style/style_FAIL_1.html +0 -7
- package/tests/rules/oj-html-style/style_PASS_1.html +0 -12
- package/tests/rules/oj-html-style/style_PASS_2.html +0 -7
- package/tests/rules/oj-html-style-bp-color/color-FAIL_1.html +0 -17
- package/tests/rules/oj-html-style-bp-color/color-FAIL_2.html +0 -15
- package/tests/rules/oj-html-style-bp-color/color-FAIL_3.html +0 -7
- package/tests/rules/oj-html-style-bp-color/color-PASS_1.html +0 -7
- package/tests/rules/oj-html-style-bp-font-family/fam_FAIL_1.html +0 -23
- package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_FAIL_1.html +0 -15
- package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_FAIL_2.html +0 -9
- package/tests/rules/oj-html-tag-attr-noprefix/attr-noprefix_PASS_1.html +0 -9
- package/tests/rules/oj-html-unsup-theme/unsup_FAIL_1.html +0 -8
- package/tests/rules/oj-html-wctag-for/for_FAIL_1.html +0 -8
- package/tests/rules/oj-html-wctag-for/for_PASS_1.html +0 -8
- package/tests/rules/oj-js-comp-attr-deprecated/attr-del_FAIL_1.js +0 -20
- package/tests/rules/oj-js-comp-attr-deprecated/attr-dep_FAIL_1.js +0 -20
- package/tests/rules/oj-js-comp-meth-deprecated/meth-del_FAIL_1.js +0 -20
- package/tests/rules/oj-js-comp-meth-deprecated/meth-dep_FAIL_1.js +0 -20
- package/tests/rules/oj-js-define-promise/def-prom_FAIL_1.js +0 -16
- package/tests/rules/oj-js-define-promise/def-prom_FAIL_2.js +0 -16
- package/tests/rules/oj-js-diagnose/es6_PASS_1.js +0 -24
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_1.js +0 -30
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_2.js +0 -23
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_3.js +0 -22
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_4.js +0 -20
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_5.js +0 -24
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_6.js +0 -30
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_7.js +0 -15
- package/tests/rules/oj-js-no-ext-final/noextfinal_FAIL_8.js +0 -16
- package/tests/rules/oj-js-no-ext-final/noextfinal_PASS_1.js +0 -17
- package/tests/rules/oj-js-no-ext-final/noextfinal_PASS_2.js +0 -17
- package/tests/rules/oj-js-noconsole/nocons_FAIL_1.js +0 -11
- package/tests/rules/oj-js-ojcomp-deprecated/jscomp_FAIL_1.js +0 -27
- package/tests/rules/oj-json-syntax/json_FAIL_1.json +0 -8
- package/tests/rules/oj-json-syntax/json_FAIL_2.json +0 -12
- package/tests/rules/oj-json-syntax/json_PASS_1.json +0 -25
- package/tests/rules/oj-json-syntax/json_PASS_2.json +0 -12
- package/tests/rules/oj-json-syntax/json_PASS_3.json +0 -14
- package/tests/rules/ojcompjson/attrreq_FAIL_1/component.json +0 -69
- package/tests/rules/pack-compjson/audit-pack/component-1/component-1-view.html +0 -6
- package/tests/rules/pack-compjson/audit-pack/component-1/component-1-viewModel.js +0 -56
- package/tests/rules/pack-compjson/audit-pack/component-1/component.json +0 -13
- package/tests/rules/pack-compjson/audit-pack/component-1/loader.js +0 -20
- package/tests/rules/pack-compjson/audit-pack/component-1/resources/nls/component-1-strings.js +0 -18
- package/tests/rules/pack-compjson/audit-pack/component-2/component-2-view.html +0 -5
- package/tests/rules/pack-compjson/audit-pack/component-2/component-2-viewModel.js +0 -56
- package/tests/rules/pack-compjson/audit-pack/component-2/component.json +0 -13
- package/tests/rules/pack-compjson/audit-pack/component-2/loader.js +0 -20
- package/tests/rules/pack-compjson/audit-pack/component-2/resources/nls/component-1-strings.js +0 -18
- package/tests/rules/pack-compjson/audit-pack/component.json +0 -12
- package/tests/rules/pack-compjson/audit-singleton-1/audit-singleton-1-view.html +0 -5
- package/tests/rules/pack-compjson/audit-singleton-1/audit-singleton-1-viewModel.js +0 -56
- package/tests/rules/pack-compjson/audit-singleton-1/component.json +0 -20
- package/tests/rules/pack-compjson/audit-singleton-1/loader.js +0 -20
- package/tests/rules/pack-compjson/audit-singleton-1/resources/nls/audit-singleton-1-strings.js +0 -18
- package/tests/rules/pack-compjson/audit-singleton-2/audit-singleton-2-view.html +0 -8
- package/tests/rules/pack-compjson/audit-singleton-2/audit-singleton-2-viewModel.js +0 -56
- package/tests/rules/pack-compjson/audit-singleton-2/component.json +0 -15
- package/tests/rules/pack-compjson/audit-singleton-2/loader.js +0 -20
- package/tests/rules/pack-compjson/audit-singleton-2/resources/nls/audit-singleton-2-strings.js +0 -18
- package/tests/rules/parse-html/proc_instr.html +0 -9
- package/tests/rules/spoc-dom-manip/dom-manip_FAIL_1.js +0 -113
- package/tests/rules/spoc-dom-manip/dom-manip_FAIL_2.js +0 -151
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_1.js +0 -149
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_2.js +0 -147
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_3.js +0 -147
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_4.js +0 -20
- package/tests/rules/spoc-dom-manip/dom-manip_PASS_5.js +0 -246
- package/tests/rules/tab-tests/tab-test_FAIL_1.html +0 -37
- package/tests/rules/tab-tests/tab-test_FAIL_2.html +0 -8
- package/tests/rules/webcomptests/jet-composites/oj-html-wctag-$props/prop_PASS_1.html +0 -8
- package/tests/rules/webcomptests/jet-composites/oj-html-wctag-$props/prop_PASS_2.html +0 -8
- package/tests/rules/webcomptests/jet-composites/oj-html-wctag-for/for_FAIL_1.html +0 -8
- package/tests/rules/webcomptests/jet-composites/oj-html-wctag-for/for_PASS_1.html +0 -8
- package/tests/src/JetTest.js +0 -1
- package/tests/src/server.js +0 -1
- package/tests/test.js +0 -1
package/src/JafCore.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
var nodeDeps;const HtmlParser=require("htmlparser2");const RULE_JS_DIAGNOSE="jaf-js-diagnose";const RULE_CSS_DIAGNOSE="jaf-css-diagnose";const RULE_HTML_DIAGNOSE="jaf-html-diagnose";const RULE_INIT_SCHEMA="jaf-init-schema";const Reporter=require("../lib/Reporter");const Issue=require("../lib/Issue");const Rules=require("../lib/Rules");const RuleSet=require("../lib/RuleSet");const JafLib=require("../lib/JafLib");const FileSet=require("../lib/FileSet");const Writer=require("../lib/Writer");var metaLib=require("../lib/MetaLib");const Parser=require("../lib/Parser");const HtmlTree=require("../lib/HtmlTree");const DomUtils=require("../lib/DomUtils");const CssLib=require("../lib/CssLib");const CssUtils=require("../lib/CssUtils");const Utils=require("../lib/Utils");const FileIndex=require("../lib/FileIndex");var AST=require("../lib/AST");var AstJson=require("../lib/AstJson");var Comments=require("../lib/Comments");const Severity=require("../lib/Severity");const NodeType=require("../lib/NodeTypes");const REG=require("../lib/RegTypes");var VERSION;var DESCRIPTION;const CONFIG_FILE="jafconfig.json";const CONFIG_FILE_OJET="oraclejafconfig.json";const META_FILE_OBJ="jetauditmeta.js";const TEMP_DIR="jaftmp@";const MIN_NODE_VER="8.5.0";const DEFAULT_JETVER="10.1.0".replace(/(\d*\.\d*)(\.\d*)+$/g,"$1")+".0";const FILETYPE_HTML="html";const FILETYPE_CSS="css";const FILETYPE_JS="js";const FILETYPE_TS="ts";const FILETYPE_ZIP="zip";const FILETYPE_JSON="json";const FILETYPES=[FILETYPE_HTML,FILETYPE_CSS,FILETYPE_JS,FILETYPE_TS,FILETYPE_ZIP,FILETYPE_JSON];const ZIP_FILETYPES=[FILETYPE_HTML,FILETYPE_CSS,FILETYPE_JS,FILETYPE_TS,FILETYPE_JSON];const FORMAT_JSON="json";const FORMAT_PROSE="prose";const FORMAT_LINE="line";const GROUPS=["all","jet-html","jet-css","jet-js","jet-ts","jet-json","jet-aria","jet-deprecated","jet-deleted","jet-override","jet-cca","jet-spoc","jet-csp","jet-demo","jet-bp","html5"];const MACROS={cwd:"$jafcwd",date:"$jafdate",time:"$jaftime",ver:"$jafver",config:"$jafconfig",jetver:"$jetver"};const AUTO="auto";const ERRORS="errors";const JAF_RSI=0;const JET_RSI=JAF_RSI+1;const COMPONENT_JSON="component.json";const ARROW="\u2192 ";const UNDEF="undefined";var elapsed;var Colors;function JafCore(nd,runMode="cli"){this._configPath=null;this._metaPath=null;this._outPath=null;this._rulePath=null;this._base=null;this._outFormat=null;this._json=null;this._HtmlTree=null;this._DomUtils=null;this._Ast=null;this._AstJson=null;this._events=null;this._tabs=null;this._cliSev=null;this._curDir=null;this._tmpDir=null;this._fileSet=null;this._fileSep=null;this._runMode=runMode;this._isCLI=runMode==="cli";this._isAPI=runMode==="api";this._isAMD=runMode==="amd";this._isOJETCLI=false;this._isOJET=null;this._isCliOrApi=this._isCLI||this._isAPI;this._isApiOrAmd=this._isAPI||this._isAMD;this._isCliMode=this._isCLI||this._isOJETCLI;this._isAsync=false;this._ctxCB=null;this._isManual=false;this._retCode;this._config=null;this._reporter=null;this._rules=null;this._Utils=new Utils(nd);this._sevLib=null;this._appContext=null;this._writer=null;this._components=null;this._componentSvcs=null;this._userDefs=null;this._attrIndex=0;this._curContainer=null;this._curFile=null;this._curFileType=null;this._srcStack=null;this._CSSLinkStack=[];this._JSLinkStack=[];this._msgIdLookup=null;this._messageStack=[];this._verboseMode=false;this._debugMode=false;this._colorMode=true;Colors=nd.colors;this._msgIdMode=false;this._isRawAttrs=true;this._macros={$jafcwd:null,$jafdate:null,$jaftime:null,$jafver:null,$jafconfig:null,$jetver:null};this._totalFilesAudited=0;this._totalIssues=0;this._totalIssueFiles=0;this._errorFiles=0;this._parseErrors=0;this._totalUrlsAudited=0;this._severityStats={critical:0,blocker:0,major:0,minor:0,info:0};this._totalSevStats={critical:0,blocker:0,major:0,minor:0,info:0};this._dumpRulesSet=false;this._dumpRulesJsonSet=false;this._dumpRulesSonarSet=false;this._dumpRulesInternalSet=false;this._jetverSet=false;this._severitySet=false;this._followLinksSet=false;this._groupsSet=false;this._debugSet=false;this._verboseSet=false;this._msgIdModeSet=false;this._dryRunSet=false;this._colorSet=false;this._regListenerTypesSet=false;this._scaffoldSet=false;this._scaffoldRuleSet=false;this._jetverListSet=false;this._cmdNSList=false;this._cmdMetaHist=false;this._unitTest=false;this._VsCodeExtHint=false;this._errors=0;this._warnings=0;this._asserts=0;this._parser=null;this._treeNode=null;this._curTagNode=null;this._startCssPosition=null;this._startJsPosition=null;this._ctxTag=null;this._ctxAttr=null;this._ctxCss=null;this._ctxFileHook=null;this._cbMsgObj=null;this._isStdoutRedirected=false;this._isStderrRedirected=false;this._useStderr=false;this._debugIssueOrder=false;nodeDeps=nd;this._curDir=nd.process.cwd();this._fileSep=nd.path?nd.path.sep:null;this._cbMsgObj={};this._severity=new Severity;this._fileSet=new FileSet(nodeDeps);if(nodeDeps.fsUtils){nodeDeps.fsUtils.setNodeDeps(nodeDeps,this._Utils)}this._writer=new Writer(nodeDeps,this._getMsgCtx());this._fileIndex=new FileIndex(this._Utils);this._AstJson=new AstJson(this._getMsgCtx());_getPackageInfo(runMode);this._initMacros();if(this._isCLI){this._isStdoutRedirected=!process.stdout.isTTY;this._isStderrRedirected=!process.stderr.isTTY;this._useStderr=this._isStdoutRedirected&&!this._isStderrRedirected;this._useStderr=false}};JafCore.prototype.start=function(){var rc;try{rc=this._startupValidation()}catch(e){rc=e.stack.indexOf("\n");rc=e.stack.indexOf("\n",rc+1);this._error("[JAF-9000]: internal error - "+e.stack.substring(0,rc));rc=1}if(rc){if(rc>0){this._error("Terminated due to a previous error");if(this._events){this._events.removeAllListeners()}rc=-1}else{rc=0}return this._transformRetCodeFinal(rc)}rc=0;if(this._rules.getActiveRuleCount()>0){if(!this._errors){this._displayStartMsg();if(this._isCLI){if(this._watchSet){this._watchFiles();return 99}else{this._startLifeCycle()}}else{return 0}}if(this._isCLI){this._displayFinalStats();this._displayErrorsAndAsserts();if(!this._unitTest){rc=this._totalIssues}}}else{this._info("No active rules! Audit teminated.")}return this._transformRetCodeFinal(rc)};JafCore.prototype._watchFiles=function(){let files=this._config.getFiles();let watch=new nodeDeps.Watch(files[0],this._watchCB,nodeDeps,this._getMsgCtx());watch.watchFiles();console.log("Watching...")};JafCore.prototype._watchCB=function(){};JafCore.prototype.API_startSync=function(apiContext){this._ctxCB=apiContext;if(apiContext.config){let t=typeof apiContext.config;if(t==="string"){this._configPath=nodeDeps.path.join(this._curDir,apiContext.config)}else if(t==="object"){this._configPath=apiContext.config}else{this._error("Invalid config argument in init() : type is "+t);return 1}}if(apiContext.format&&apiContext.format!==FORMAT_PROSE){apiContext.format=FORMAT_PROSE}return this.start()};JafCore.prototype.API_start=function(apiContext,AmdMeta){var t,_self,rc;this._isAsync=true;this._ctxCB=apiContext;_self=this;return new Promise(function(resolve,reject){if(apiContext.config){t=typeof apiContext.config;if(t==="string"){_self._configPath=nodeDeps.path.join(_self._curDir,apiContext.config)}else if(t==="object"){_self._configPath=apiContext.config}else{_self._error("Invalid config argument in init() : type is "+t);reject(1)}}if(!_self._isAMD){_self._isAsync=false;_self._isAsyncTemp=true;rc=_self.API_startSync(apiContext);_self._isAsync=true;rc===0?resolve(rc):reject(_self._messageStack)}else{if(apiContext.format&&apiContext.format!==FORMAT_PROSE){apiContext.format=FORMAT_PROSE}_self._isAsync=false;_self._isAsyncTemp=true;_self._AmdMeta=AmdMeta;rc=_self.API_startSync(apiContext);_self._isAsync=true;rc===0?resolve(rc):reject(_self._messageStack)}})};JafCore.prototype.API_auditSync=function(filespec){this._isAsync=false;this._totalIssues=this._totalIssueFiles=this._errorFiles=this._parseErrors=this._totalFilesAudited=this._totalUrlsAudited=0;if(this._regListenerTypesSet||this._rules&&this._rules.getActiveRuleCount()===0){if(this._rules){this._emitApiRunSummary()}return}if(filespec){if(!Array.isArray(filespec)){filespec=[filespec]}this._fileSet.setFiles(filespec,this._config.getExclude(),this._getMsgCtx())}this._startLifeCycle();this._emitApiRunSummary()};JafCore.prototype.API_audit=function(filespec){var _self=this,obj;this._isAsync=true;this._totalIssues=this._totalIssueFiles=this._errorFiles=this._parseErrors=this._totalFilesAudited=this._totalUrlsAudited=0;if(filespec){if(!Array.isArray(filespec)){filespec=[filespec]}this._fileSet.setFiles(filespec,this._config.getExclude(),this._getMsgCtx())}return new Promise(function(resolve,reject){_self._isAsync=false;obj=_self._startLifeCycle();_self._isAsync=true;resolve(obj)})};JafCore.prototype.API_on=function(evName,fn,obj){if(this._listenerSetup()){this._events.setListener(evName,fn,obj)}};JafCore.prototype.API_removeListener=function(evName,fn){if(this._listenerSetup()){this._events.removeListener(evName,fn)}};JafCore.prototype.API_removeAllListeners=function(evName){if(this._listenerSetup()){this._events.removeAllListeners(evName)}};JafCore.prototype._listenerSetup=function(){if(!this._isCLI&&!this._events){this._events=new(require("../lib/JafEvents"))}return this._events};JafCore.prototype.API_getDescription=function(arg1,arg2,arg3){var issue,short,ruleName,sig=0,ret="";var arg1Type=this._Utils.getType(arg1);var arg2Type=this._Utils.getType(arg2);if(arg1Type==="object"){issue=arg1;if(arg2==="boolean"||arg2Type===UNDEF){short=arg2;sig=1;ruleName=issue.rule;msgId=issue.msgId}}else if(arg1Type==="string"){if(arg2Type==="string"){msgId=arg1;ruleName=arg2;short=!!arg3;sig=2}}var loadedRule,rsi,msgId,fn;if(sig){rsi=this._ruleSets.getRsiFromMsgId(msgId);if(rsi<0){return""}loadedRule=this._ruleSets.getLoadedRule(rsi,ruleName);fn=short?loadedRule.getShortDescription.bind(loadedRule):loadedRule.getDescription.bind(loadedRule);ret=fn()}return ret};JafCore.prototype.API_getActiveRulesetInfo=function(fmt){var ret;if(fmt===FORMAT_JSON)ret=this._rules.getRulesJson();else if(fmt===FORMAT_PROSE||fmt===FORMAT_LINE)ret=this._rules.getRulesProse();else ret=this._rules.getRulesSonar();return ret};JafCore.prototype.API_enableMsgId=function(msgid,state){var ret=false;if(this._config.setMessages(msgid,state)){this._reporter.setMessageFilter(this._config._config.messages);ret=true}return ret};JafCore.prototype.API_getConfig=function(){return this._config.getConfig()};JafCore.prototype.API_getSevLib=function(){return this._severity.getSevLib()};JafCore.prototype.API_setVsCodeExtHint=function(isVsCodeExt){this._VsCodeExtHint=isVsCodeExt};JafCore.prototype.enableRule=function(ruleName,state){return false};JafCore.prototype._transformRetCode=function(rc){if(this._isCliMode){let o=this._retCode;if(o!==AUTO){if(o===ERRORS){rc=rc>=0?0:-1}else if(typeof o==="number"){rc=o}}}return rc};JafCore.prototype._transformRetCodeFinal=function(rc){var xrc=this._transformRetCode(rc);if(this._verboseMode||this._debugMode){this._info(`RC: ${xrc} (raw = ${rc})`)}return xrc};JafCore.prototype._startLifeCycle=function(){if(!this._LF_start()){return}this._processActiveFileSet();this._auditJSLinkedFiles();this._auditCSSLinkedFiles();return this._LF_closedown()};JafCore.prototype._LF_start=function(){var hookRC=true;this._curContainer=null;if(this._dryRunSet){this._info("\n------------ Dry Run: The following fileset would have been audited ------------")}else{this._jafLib=new JafLib(nodeDeps,this._fileSet,this._getMsgCtx(),this._runMode,VERSION,this._metaLib.getRevisionInfo().jetVersion,this._config);this._rules.setJafLib(this._jafLib);if(this._rules.isTypeRegistered(REG.PHASE_STARTUP)){this._debug("\n** Firing hook rules : "+REG.PHASE_STARTUP+"'");hookRC=this._fireHookRules(REG.PHASE_STARTUP);this._jafLib.disable();if(typeof hookRC==="boolean"&&!hookRC){this._console("\nAudit terminated by startup hook rule","I");return false}}if(this._rules.isTypeRegistered(REG.PHASE_STARTUP_RULEPACK)){this._debug("\n** Firing hook rules : phase '"+REG.PHASE_STARTUP_RULEPACK+"'");hookRC=this._fireRPHookRules(REG.PHASE_STARTUP_RULEPACK)}if(this._rules.isTypeRegistered(REG.PHASE_START_AUDIT)){this._debug("\n** Firing hook rules : phase '"+REG.PHASE_START_AUDIT+"'");hookRC=this._fireHookRules(REG.PHASE_START_AUDIT);this._jafLib.disable()}this._flushIssues(null,true);if(typeof hookRC==="boolean"&&!hookRC){this._console("\nAudit terminated by ruleset startup hook rule","I");return false}}this._spinner=new nodeDeps.spinner;this._spinner.start("Reading files...");return true};JafCore.prototype._LF_closedown=function(){if(elapsed&&!this._isAMD){elapsed=nodeDeps.process.hrtime(elapsed)}this._curFile=this._curFileType=null;if(this._dryRunSet){if(this._totalFilesAudited===0){this._info("\n------------ Dry Run: No files were selected for audit!")}return}this._clearSeverityStats();if(this._rules.isTypeRegistered(REG.PHASE_END_AUDIT)){this._debug("\n** Firing hooks : phase 'endaudit'");this._fireHookRules(REG.PHASE_END_AUDIT)}if(this._rules.isTypeRegistered(REG.PHASE_CLOSEDOWN_RULEPACK)){this._debug("\n** Firing hooks : phase 'closedownRP'");this._fireRPHookRules(REG.PHASE_CLOSEDOWN_RULEPACK)}this._curFile=this._curFileType=null;if(this._rules.isTypeRegistered(REG.PHASE_CLOSEDOWN)){this._debug("\n** Firing hook rules : phase closedown");this._fireHookRules(REG.PHASE_CLOSEDOWN)}this._curContainer=null;this._flushIssues(null,true);this._addSevStatsToTotals();if(this._outFormat===FORMAT_JSON||this._isAPI&&this._isAsyncTemp){this._flushFinalJson()}if(this._isAPI&&this._isAsyncTemp){return this._json}};JafCore.prototype._processActiveFileSet=function(){var filePath;elapsed=this._isCliOrApi?nodeDeps.process.hrtime():0;while(true){this._curContainer=null;filePath=this._fileSet.getNextFile();if(filePath){this._processActiveFile(filePath);continue}this._spinner.stop();break}};JafCore.prototype._processActiveFile=function(filePath){var fileObj,fileType,groups,isUrl,resp,data;this._rules.setJSCommentCallback(null);fileObj=false;if(typeof filePath==="object"){fileObj=filePath;if(!fileObj.data){return}fileObj.name=fileObj.name||"*unspecified filename*";filePath=fileObj.name;fileType=fileObj.type?fileObj.type:_extractFileType(fileObj.name,true);if(!(fileType===FILETYPE_HTML||fileType===FILETYPE_JS||fileType===FILETYPE_TS||fileType===FILETYPE_CSS||fileType===FILETYPE_JSON)){return}}isUrl=typeof filePath==="string"&&filePath.startsWith("http");if(!fileObj){fileType=_extractFileType(filePath)}if(!_isSupportedFileType(fileType)){this._info("ignoring unsupported file type ("+fileType+"): "+filePath);return}if(fileType===FILETYPE_TS&&!(this._config._config.options&&this._config._config.options.xts)){return}this._handleStyles=this._handleJS=true;this._info(this._dryRunSet?filePath:"\n** Reading "+(isUrl?"resource":fileObj?"data-obj-> ":"file")+" "+(fileObj?fileObj.name:"'"+filePath+"'"));if(fileObj){data=fileObj.data}else if(isUrl){resp=this._processResource(filePath);if(resp&&resp.statusCode===200){data=resp.body;this._totalUrlsAudited++}else{return}}else{data=this._readFile(filePath,fileType===FILETYPE_ZIP)}this._auditActiveFile(filePath,fileType,isUrl,data)};JafCore.prototype._auditActiveFile=function(filePath,fileType,isUrl,data){var rc,tempFile;this._curFile=filePath;this._inZip=false;this._rawData=data;this._data=this._suppData=null;this._totalFilesAudited++;if(this._dryRunSet){return}this._clearSeverityStats();if((this._unitTest||this._config.getAppendFileList())&&this._outFormat===FORMAT_JSON){this._noteFileSet(filePath)}this._curFileType=fileType;if(fileType===FILETYPE_HTML||fileType===FILETYPE_CSS||fileType===FILETYPE_JS||fileType===FILETYPE_TS){if(data){this._spinner.setText("Auditing: "+filePath);if(fileType===FILETYPE_HTML||fileType===FILETYPE_CSS){this._auditPage(data)}else if(fileType===FILETYPE_JS){this._auditJS(data)}else if(fileType===FILETYPE_TS){this._auditTS(data)}}}else if(fileType===FILETYPE_ZIP){this._inZip=true;this._loadComponentSupport();rc=this._compSvcs.writeZipBufferToFile(data);if(typeof rc==="boolean"&&rc){tempFile=this._compSvcs.getLastZipFilePath();this._curContainer=isUrl?this._compSvcs.stripUrlQuery(filePath):filePath;this._auditComponentZip(tempFile);this._addSevStatsToTotals();return}else{this._error("Failed to create local temp zip file from URL '"+filePath+"' : "+rc.message);this._isOk=false}}else if(fileType===FILETYPE_JSON){this._auditJson(filePath,data)}this._addSevStatsToTotals()};JafCore.prototype._auditPage=function(data){var rc,topNode;this._attrIndex=0;this._data=data;this._rawData=!this._inZip?data:null;this._htmlParserCb=this._getPageCallbacks();this._reporter.clearIssues();this._fileIndex.clear();if(this._curFileType===FILETYPE_CSS){this._auditStyleSheet(data);return}this._htmlTree=new HtmlTree(nodeDeps,this._getAppCtx(),HtmlParser,this._DomUtils);this._htmlTree.parse(data);topNode=this._htmlTree.getTopNode();if(topNode===null){this._debug("File contains no useful data - '"+this._curFile+"'");return}if(this._config.getJetPagesOnly()){if(!this._DomUtils.isJetPage({node:topNode})){this._debug("File ignored - not a JET page and jetOnlyPages=true - '"+this._curFile+"'");return}};this._startIndex=0;this._endIndex=0;rc=this._fireHookFileRules(this._htmlTree.getTopNode());if(typeof rc==="boolean"&&!rc){return}this._setupCssParser();this._htmlTree.walk(this._htmlParserCb)};JafCore.prototype._getPageCallbacks=function(){var _self=this;var inScript=false,inScriptJS=false,inHeadSect=false,inHead=false,inStyle=false,inStyleSect=false,inLink=false;var inScriptJSLink=false,inScriptCSSLink=false,JsScriptData=null;var ignoreScript=false;var isDirective=false;var tagLower,temp;var ctx;this._inScriptJs=false;this._inScriptJsData=null;if(this._htmlParserCb){return this._htmlParserCb};return this._rules.filterHtmlCallbacks({onOpenTagname:function(node,tagName){if(ignoreScript||inScript){return}_self._curTagNode=node;if(!_self._curTagNode){_self._assert("tag \""+tagName+"\" has no node")}tagName=tagName.endsWith("\"")||tagName.endsWith("'")?tagName.substr(0,tagName.length-1):tagName;_self._currentTag=tagName;tagLower=tagName.toLowerCase();inHeadSect=inHeadSect?inHeadSect:tagLower==="head";inHead=tagLower==="head";inScript=tagLower==="script";inStyleSect=inStyleSect?inStyleSect:tagLower==="style";inStyle=tagLower==="style";inLink=tagLower==="link";if(inScript){inScriptJS=_self._htmlTree.isScriptExecutable(_self._curTagNode);inScriptJSLink=_self._htmlTree.isScriptJSLink(_self._curTagNode);if(inScriptJS&&!inScriptJSLink){if(_self._curTagNode.children&&_self._curTagNode.children.length){if(_self._curTagNode.children[0].type==="text"){JsScriptData=_self._curTagNode.children[0].data;JsScriptData=_getScriptData(_self._data,_self._curTagNode.children[0].startIndex,_self._curTagNode.endIndex);if(typeof JsScriptData==="string"){_self._jsNode=_self._curTagNode.children[0];_self._startJsPosition=_self._fileIndex.getRowCol(_self._data,{start:_self._jsNode.startIndex,end:_self._jsNode.endIndex},"js");_self._startJsPosition.startIndex=_self._jsNode.startIndex;_self._startJsPosition.endIndex=_self._jsNode.endIndex;if(_beginsWithNL(JsScriptData,_self._Utils)){_self._startJsPosition.col=1;_self._startJsPosition.row++;temp=_self._clearNL(JsScriptData);JsScriptData=temp.text;_self._startJsPosition.startIndex+=temp.stripped;_self._startJsPosition.endIndex+=temp.stripped}}else{JsScriptData=false}}else{JsScriptData=null}}}if(inScriptJSLink&&_self._followLinks&&_self._handleJS){_self._addJSLinkToStack(inScriptJSLink)}}else if(inLink){inScriptCSSLink=_isLinkCSSLink(_self._curTagNode);if(inScriptCSSLink&&_self._followLinks&&_self.handleStyles){_self._addStyleSheetLinkToStack(inScriptCSSLink)}}_self._reporter.setParseData(tagName,"tag");_self._startIndex=_self._curTagNode.startIndex+1;_self._endIndex=_self._startIndex+tagName.length-1;ctx=_self._ctxTag;ctx.position={start:_self._startIndex,end:_self._endIndex};ctx.tag=tagName;ctx.node=_self._curTagNode;ctx.tagNode=_self._curTagNode;ctx.data=_self._data;ctx.suppData=_self._suppData;ctx.elemStack=_self._htmlTree.getElemStack();ctx.utils.DomUtils=_self._DomUtils;ctx.NodeTypes=NodeType;if((tagLower==="script"||tagLower==="link")&&_self._rules.isTypeRegistered(tagLower)){ctx.type=tagLower;ctx.ojTag=ctx.ojNS=false;if(tagLower==="script"&&JsScriptData){ctx.suppData={data:JsScriptData}}_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,ctx.suppData?ctx.suppData.data:null)}if(_self._rules.isTypeRegistered(REG.ELEM)){ctx.type=REG.ELEM;ctx.ojTag=_self._metaLib.isJetTag(tagName);ctx.ojNS=ctx.ojTag||ctx.utils.DomUtils.isNamespaceTag(tagName);_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}ctx.type=tagLower.startsWith("oj-")?"ojtag":"tag";if(_self._rules.isTypeRegistered(ctx.type)){ctx.ojTag=_self._metaLib.isJetTag(tagName);ctx.ojNS=ctx.ojTag||ctx.utils.DomUtils.isNamespaceTag(tagName);_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}if(_self._rules.isTypeRegistered(REG.WEBCOMP)){let jwc=_self._metaLib.isJetTag(tagName);let awc=!jwc?_self._metaLib.isComponentTag(tagName):false;if(jwc||awc){ctx.type=REG.WEBCOMP;ctx.ojTag=jwc;ctx.ojNS=true;_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}}if(_self._rules.isTypeRegistered(REG.GLOBTAG)&&_self._DomUtils.isCommonElem(tagName)){ctx.type=REG.GLOBTAG;ctx.ojTag=ctx.ojNS=false;_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}this._attrIndex=0},onCloseTag:function(node,tagName){tagLower=tagName.toLowerCase();if(tagLower==="head"){inHead=inHeadSect=false}if(tagLower==="script"){inScript=ignoreScript=inScriptJS=inScriptJSLink=JsScriptData=false}if(tagLower==="style"){inStyle=inStyleSect=false}if(tagLower==="link"){inLink=inScriptCSSLink=false}if(_self._currentTag){_self._lastTag=_self._currentTag;_self._currentTag=null}_self._curTagNode=null},onAttribute:function(node,attrName,attrValue){var attrNameLower=attrName.toLowerCase();var attrRawValue,rowcol,issue;if(attrName.length===1){var invChar=attrName==="\""?"double-quote":attrName==="'"?"single-quote":attrName;if(attrName!==invChar){rowcol=_self._DomUtils.getAttrPosition(_self._data,node,attrName);issue=new Issue("Unexpected "+invChar+" found");_self._reportJafIssue(issue,RULE_HTML_DIAGNOSE,rowcol.row,rowcol.col,rowcol.start,rowcol.end);_self._parseErrors++;if(_self._debugMode||_self._verboseMode){_self._info("[PARSE ERROR(1)] : FILE "+(_self._curFile?_self._curFile:"N/A")+" "+_self._parseErrors)}return}}else if(attrName.endsWith("<")){rowcol=_self._DomUtils.getAttrPosition(_self._data,node,attrName);issue=new Issue(`Syntax error on elem '${node.name}' - missing end '>' perhaps?`);_self._reportJafIssue(issue,RULE_HTML_DIAGNOSE,rowcol.row,rowcol.col,rowcol.start,rowcol.end);return}if(attrValue&&attrValue.length&&_self._isRawAttrs){attrRawValue=_self._getAttrRawValue(_self._data,_self._getAttrIndex(_self._data,node.startIndex,attrName),attrName,attrValue)}if(ignoreScript){return}if(inScript&&attrName==="type"){if(attrValue==="text/html"){ignoreScript=true;return}}if(inScript||ignoreScript){return}if(!_self._currentTag){_self._info("** WARNING - no tag for attribute "+attrName+" (value "+attrValue+")");return}_self._reporter.setParseData(attrName,"attr");attrNameLower=attrNameLower.charAt(0)===":"?attrNameLower.substr(1):attrNameLower;ctx=_self._ctxAttr;ctx.type=attrNameLower==="class"?"class":attrNameLower==="style"?"style":inScript&&attrNameLower==="type"?"type":attrName.startsWith("on-oj-")?"event":"attr";if(ctx.type==="attr"&&attrNameLower.startsWith("on-")&&_self._metaLib.isComponentTag(_self._currentTag)){ctx.type="event"}if(_self._rules.isTypeRegistered(ctx.type)||_self._rules.isTypeRegistered(REG.ATTREXPR)){rowcol=_self._DomUtils.getAttrPosition(_self._data,node,attrName);ctx.tag=_self._currentTag;ctx.ojTag=_self._metaLib.isJetTag(_self._currentTag);ctx.position={line:rowcol.row,col:rowcol.col,start:rowcol.start,end:rowcol.end},ctx.tagNode=_self._curTagNode;ctx.data=_self._data;ctx.elemStack=_self._htmlTree.getElemStack();ctx.utils.DomUtils=_self._DomUtils;if(_self._curFileType==="html"||_self._curFileType==="css"){ctx.utils.CssUtils=CssUtils}ctx.ojNS=ctx.ojTag||ctx.utils.DomUtils.isNamespaceTag(ctx.tag);ctx.NodeTypes=NodeType;_self._rules.fireRules(ctx,attrName,_self._curFile,_self._curFileType,_self._isRawAttrs?{val:attrValue,rawval:attrRawValue}:attrValue)}if(ctx.type==="attr"&&_isAttrExpr(attrValue)&&_self._rules.isTypeRegistered(REG.ATTREXPR)){ctx.type=REG.ATTREXPR;_self._rules.fireRules(ctx,attrName,_self._curFile,_self._curFileType,_self._isRawAttrs?{val:attrValue,rawval:attrRawValue}:attrValue)}},onText:function(node,text){if(inHead){}else if(ignoreScript){_self._debug("[debug] text in script ignored ("+_self._curFile+")")}else if(inStyle){if(text.trim().length>0){if(_self._handleStyles){_self._startCssPosition=_self._fileIndex.getRowCol(_self._data,{start:node.startIndex,end:node.endIndex},"css");if(_beginsWithNL(text,_self._Utils)){_self._startCssPosition.col=1;_self._startCssPosition.row++}let adjust=_self._clearNL(text);_self._startCssPosition.index=node.startIndex+adjust.stripped;text=adjust.text;_self._parseCss(text)}}}else if(inScript&&inScriptJS&&JsScriptData){if(_self._handleJS){if(JsScriptData.length>0){_self._inScriptJs=true;_self._inScriptJsData=JsScriptData;_self._parseJS(JsScriptData,function(treenode){_self._fireHookFileRules(treenode,null)});_self._inScriptJs=false;_self._inScriptJsData=null}JsScriptData=null}}_self._htmlParserCb.onCloseTag(node,inStyle?"style":inScript?"script":inLink?"link":"what")},onEnd:function(){_self._flushIssues(_self._data)},onComment:function(node,text){if(inScript||ignoreScript||inStyle){return}if(!_self._rules.isTypeRegistered(REG.COMMENT)){return}_self._startIndex=node.startIndex;_self._endIndex=node.endIndex;_self._treeNode=node;text=text.trim();temp=_self._currentTag?_self._currentTag:"";_self._rules.fireRules({type:REG.COMMENT,ojTag:temp&&_self._metaLib.isJetTag(temp),position:{start:_self._startIndex,end:_self._endIndex},tag:temp?temp:null,elemStack:_self._htmlTree.getElemStack(),node:_self._treeNode,tagNode:_self._curTagNode,data:_self._data,suppData:_self._suppData,utils:{DomUtils:_self._DomUtils},NodeTypes:NodeType},null,_self._curFile,_self._curFileType,text)},oncommentend:function(data){},oncdatastart:function(data){},oncdataend:function(data){},onProcessingInstruction:function(node,data){var text,i;if(ignoreScript||inScript){return}if(!_self._rules.isTypeRegistered(REG.PROCSTMT)){return}_self._treeNode=node;if(!_self._treeNode){_self._assert("procstmt '"+data+"' has no node")}text=data?data.trim():data;temp=text.substr(1);i=_self._Utils.getIndexToWhitespace(temp);temp=temp.substr(i+1).trim();if(temp.charAt(temp.length-1)==="?"){temp=temp.substr(0,temp.length-1)}_self._rules.fireRules({type:REG.PROCSTMT,ojTag:false,position:{start:_self._startIndex,end:_self._endIndex},tag:null,node:_self._treeNode,tagNode:_self._curTagNode,suppData:_self._suppData,elemStack:_self._htmlTree.getElemStack(),utils:{DomUtils:_self._DomUtils},NodeTypes:NodeType},text,_self._curFile,_self._curFileType,temp)},onDirective:function(node,data){if(ignoreScript||inScript){return}if(data.toLowerCase().startsWith("!doctype")){if(!_self._rules.isTypeRegistered(REG.DOCTYPE)){return}}else{if(!_self._rules.isTypeRegistered(REG.DIRECTIVE)){return}isDirective=true}_self._treeNode=node;if(!_self._treeNode){_self._assert("directive \""+data+"\" has no node")}temp=data?data.trim():data;temp=data?data.substr(8).trim():data;_self._rules.fireRules({type:isDirective?REG.DIRECTIVE:REG.DOCTYPE,ojTag:false,position:{start:_self._startIndex,end:_self._endIndex},tag:null,node:_self._treeNode,tagNode:_self._curTagNode,rawData:_self._rawData,data:_self._data,suppData:_self._suppData,elemStack:_self._htmlTree.getElemStack(),utils:{DomUtils:_self._DomUtils},NodeTypes:NodeType},data,_self._curFile,_self._curFileType,temp)}})};JafCore.prototype._auditJSLinkedFiles=function(){var link,data;if(!this._JSLinkStack.length){return}this._info("\n** Auditing script links");this._fileSet.setFiles(this._JSLinkStack,this._config.getExclude(),this._getMsgCtx());while(true){link=this._fileSet.getNextFile();if(!link){return}this._info("\n** Reading link '"+link+"'");data=this._readFile(link);if(data){this._auditJS(data)}else{}}};JafCore.prototype._auditCSSLinkedFiles=function(){var link,data,i;for(i=0;i<this._CSSLinkStack.length;i++){link=this._CSSLinkStack[i];this._info("\n** Reading link '"+link+"'");data=this._readFile(link);if(data){this._auditStyleSheet(data)}}};JafCore.prototype._auditStyleSheet=function(data){this._reporter.clearIssues();this._fileIndex.clear();this._startCssPosition={row:1,col:1,index:0};this._data=data;this._rawData=!this._inZip?data:null;this._parseCss(data);this._flushIssues(data)};JafCore.prototype._addStyleSheetLinkToStack=function(link){var stylePath;if(!this._isCLI){return}if(link.toLowerCase().startsWith("http")){this._debug("ignoring remote stylesheet link '"+link+"'");return}if(nodeDeps.path.basename(link).startsWith("oj-alta")){this._debug("ignoring JET stylesheet link '"+link+"'");return}stylePath=nodeDeps.path.join(nodeDeps.path.dirname(this._curFile),link);if(this._CSSLinkStack.indexOf(stylePath)<0){if(nodeDeps.fsUtils.fileExists(stylePath)){this._CSSLinkStack.push(stylePath);this._debug("pushing stylesheet link '"+stylePath+"'")}else{this._warn("\nstylesheet not found - '"+stylePath+"'"+" (linked from '"+this._curFile+"'")}}};JafCore.prototype._addJSLinkToStack=function(path){var path;if(!this._isCLI){return}if(path.toLowerCase().startsWith("http")){this._debug("ignoring remote JavaScript <script> link '"+path+"'");return}path=nodeDeps.path.join(nodeDeps.path.dirname(this._curFile),path);if(this._JSLinkStack.indexOf(path)<0){if(nodeDeps.fsUtils.fileExists(path)){this._JSLinkStack.push(path);this._debug("pushing JS link '"+path+"'")}else{this._warn("\nJavaScript <script> src link not found - '"+path+"'"+" (linked from '"+this._curFile+"'")}}};JafCore.prototype._auditJson=function(filePath,data){var data,obj,fileName,rc;this._rawData=this._data=data;fileName=this._isAMD?filePath:nodeDeps.path.basename(filePath);if(fileName===COMPONENT_JSON){this._auditComponentJson(filePath);this._flushIssues();return}if(!data){return}if(fileName===CONFIG_FILE||fileName===CONFIG_FILE_OJET){return}obj=_isValidJson(data,false,this._Utils);if(typeof obj.msg==="string"){obj.ast=null;this._startIndex=this._endIndex=obj.position}else{obj.ast=this._AstJson.parse(data);this._startIndex=this._endIndex=0}rc=this._fireHookFileRules(obj.ast,obj);if(typeof rc==="undefined"||typeof rc==="boolean"&&rc){this._rules.fireRules({type:FILETYPE_JSON,obj:obj,tagNode:null,rawData:this._rawData,data:this._data,suppData:obj,zipContent:this._zipFileObjs},null,this._curFile,FILETYPE_JSON,obj,false)}this._flushIssues(data)};JafCore.prototype._auditComponentZip=function(filePath){var files,fileType,resp,rc,endZip;this._reporter.clearIssues();this._fileIndex.clear();files=this._compSvcs.getZipContents(filePath);if(files instanceof Error){files=files.message}if(this._debugMode){if(typeof files==="string"){this._debug("ZIP ERROR : "+files)}else{this._debug("Zip contents ("+filePath+" : "+this._curFile+")");this._debugZipContents(files)}}this._zipFileObjs=files;this._startIndex=0;this._endIndex=0;this._curFileType=FILETYPE_ZIP;this._rawData=null;rc=this._fireHookFileRules(files);if(typeof rc==="boolean"&&!rc){this._compSvcs.deleteZipFile();this._flushIssues();this._flushContainerIssuesAsObjects();return}this._rawData=this._data=null;if(Array.isArray(files)){this._iterateOverZipContents(files,function(obj,path){if(endZip){return}fileType=_extractFileType(obj.name);this._debug("zip entry -> "+path+obj.name);if(_isSupportedZipFileType(fileType)){this._rules.setJSCommentCallback(null);this._curFileType=fileType;this._curFile=path+obj.name;resp=this._createResponseObj(path+obj.name,fileType);if(resp.body){if(obj.name===COMPONENT_JSON){if(!this._auditComponentJson(null,resp)){endZip=true}this._flushIssues(resp.body)}else if(fileType===FILETYPE_HTML){this._auditPage(resp.body)}else if(fileType===FILETYPE_JS){this._auditJS(resp.body)}else if(fileType===FILETYPE_JSON){this._auditJson(obj.name,resp.body)}else if(fileType===FILETYPE_CSS){this._auditStyleSheet(resp.body)}}}}.bind(this))}this._compSvcs.deleteZipFile();this._flushContainerIssuesAsObjects()};JafCore.prototype._iterateOverZipContents=function(files,cb,path){var i,obj,path=path||"";for(i=0;i<files.length;i++){obj=files[i];if(obj.isFile&&obj.name===COMPONENT_JSON){cb(obj,path);break}}for(i=0;i<files.length;i++){obj=files[i];if(obj.isFile){if(obj.name!==COMPONENT_JSON){cb(obj,path)}}else{this._iterateOverZipContents(obj.files,cb,obj.path)}}};JafCore.prototype._auditComponentJson=function(resource,resp){var obj,data,rc,compType,fileName;if(!resp){if(resource){if(this._data){data=this._data}else{data=this._readFile(resource);this._data=data}if(!data){return false}fileName=this._isAMD?resource:nodeDeps.path.basename(resource);if(fileName!==COMPONENT_JSON){return}}else{return false}}else if(resp.type===FILETYPE_JSON){data=resp.body;this._data=data}obj=_isValidJson(data,false,this._Utils);if(typeof obj.msg==="string"){obj.ast=null;this._startIndex=this._endIndex=obj.position}else{obj.ast=this._AstJson.parse(data);this._startIndex=this._endIndex=0}if(this._inZip){this._suppData=obj}this._curFileType=FILETYPE_JSON;if(this._curFile.indexOf(COMPONENT_JSON)<0){this._curFile=COMPONENT_JSON}this._loadComponentServices();rc=this._fireHookFileRules(obj.ast,obj);if(typeof rc==="boolean"&&!rc){return false}if(obj.msg){return false}switch(obj.obj.type){case"composite":case"core":case"pack":case"reference":case"resource":case"vbcs-pattern":case"vbcs-template":compType=obj.obj.type;break;}this._rules.fireRules({type:"compjson",node:obj.ast,tagNode:null,rawData:this._rawData,data:this._data,suppData:obj,zipContent:this._zipFileObjs},null,this._curFile,FILETYPE_JSON,obj,false);if(!obj.obj.type){compType="composite"}if(compType){this._rules.fireRules({type:"compjson"+"-"+compType,node:obj.ast,tagNode:null,rawData:this._rawData,data:this._data,suppData:obj,zipContent:this._zipFileObjs},null,this._curFile,FILETYPE_JSON,obj,false)}return true};JafCore.prototype._parseCss=function(text){var ret=false;try{this._debug("Parsing CSS...");this._CssLib.parse(text,this._curFile,this._startCssPosition);ret=true}catch(e){for(var i=0;i<e.length;i++){this._console("[Fail]: ("+this._curFile+")\n "+e[i].message,"E");this._parseErrors++;if(this._debugMode||this._verboseMode){this._info("[PARSE ERROR(2)] : FILE "+(this._curFile?this._curFile:"N/A")+" "+this._parseErrors)}}}return ret};JafCore.prototype._cssErrorEvent=function(ev){var opts=this._rules.getRuleOptions(RULE_CSS_DIAGNOSE,JAF_RSI);if(!opts||!opts.enabled){for(var i=0;i<ev.length;i++){this._console("[Fail]: ("+this._curFile+")\n "+ev[i].message,"E");this._parseErrors++;if(this._debugMode||this._verboseMode){this._info("[PARSE ERROR(2)] : FILE "+(this._curFile?this._curFile:"N/A")+" "+this._parseErrors)}}return}var rowWas,rowNow,colWas,colNow,msg;var i,error;for(i=0;i<ev.length;i++){error=ev[i];rowWas=error.line;colWas=error.column;rowNow=rowWas+this._startCssPosition.row-1;colNow=colWas+this._startCssPosition.col-1;msg="("+error.name+") "+this._CssLib.formatMsg(error);this._reportJafIssue(new Issue(msg),RULE_CSS_DIAGNOSE,rowNow,colNow,0+this._startCssPosition.index+error.offset,1+this._startCssPosition.index+error.offset);this._parseErrors++;if(this._debugMode||this._verboseMode){this._info("[PARSE ERROR(3) : FILE "+(this._curFile?this._curFile:"N/A")+" "+this._parseErrors)}}};JafCore.prototype._setupCssParser=function(){this._CssLib.addListener("error",this._cssErrorEvent.bind(this));this._CssLib.addListener("Rule",this._cssRule.bind(this));this._CssLib.addListener("Selector",this._cssSelectorX.bind(this));this._CssLib.addListener("ClassSelector",this._cssSelectorX.bind(this));this._CssLib.addListener("TypeSelector",this._cssSelectorX.bind(this));this._CssLib.addListener("IdSelector",this._cssSelectorX.bind(this));this._CssLib.addListener("PsuedoSelector",this._cssSelectorX.bind(this));this._CssLib.addListener("SelectorList",this._cssSelectorX.bind(this));this._CssLib.addListener("Atrule",this._cssAtrule.bind(this));this._CssLib.addListener("StyleSheet",this._cssSheet.bind(this))};function _mapSelNodeToRegisterType(node){const SELTYPES={"Selector":"css-selector","SelectorList":"css-sel-list","ClassSelector":"css-sel-class","IdSelector":"css-sel-id","TypeSelector":"css-sel-type","PsuedoSelector":"css-sel-psuedo"};return SELTYPES[node.type]};JafCore.prototype._cssRule=function(node,ast,list){if(!this._rules.isTypeRegistered("css-rule")){return}var ctx=this._cssPrepCtx("css-rule",node,ast);ctx.offset=this._startCssPosition;ctx.position={line:node.loc.start.line+this._startCssPosition.row-1,col:node.loc.start.column+this._startCssPosition.col-1};this._rules.fireRules(ctx,node,this._curFile,this._curFileType,list,this._curFileType===FILETYPE_HTML)};JafCore.prototype._cssSelectorX=function(node,ast){var type=_mapSelNodeToRegisterType(node);if(!type){return}if(!this._rules.isTypeRegistered(type)){return}var ctx=this._cssPrepCtx(type,node,ast);ctx.offset=this._startCssPosition;ctx.position={line:node.loc.start.line+this._startCssPosition.row-1,col:node.loc.start.column+this._startCssPosition.col-1};this._rules.fireRules(ctx,node,this._curFile,this._curFileType,null,this._curFileType===FILETYPE_HTML)};JafCore.prototype._cssAtrule=function(node,ast){var type,fire;if(!this._rules.isTypeRegistered("css-atrule")){return}type="css-@"+node.name;fire=this._rules.isTypeRegistered(type);if(!fire){type=node.name;fire=this._rules.isTypeRegistered(type)}if(fire){var ctx=this._cssPrepCtx("type",node,ast);this._rules.fireRules(ctx,node,this._curFile,this._curFileType,node.name,this._curFileType===FILETYPE_HTML)}};JafCore.prototype._cssSheet=function(node,ast,list){if(!this._rules.isTypeRegistered("css-sheet")){return}var ctx=this._cssPrepCtx("css-sheet",node,ast);ctx.offset=this._startCssPosition;ctx.position={line:node.loc.start.line+this._startCssPosition.row-1,col:node.loc.start.column+this._startCssPosition.col-1};this._rules.fireRules(ctx,node,this._curFile,this._curFileType,list,this._curFileType===FILETYPE_HTML)};JafCore.prototype._cssPrepCtx=function(type,node,ast){var ctx=this._ctxCss;ctx.type=type;ctx.CssNode=node;ctx.ast=ast;ctx.position={},ctx.tagNode=this._curTagNode,ctx.rawData=this._rawData,ctx.data=this._data,ctx.suppData=this._suppData,ctx.zipContent=this._zipFileObjs,ctx.utils.CssUtils=CssUtils;return ctx};JafCore.prototype._auditTS=function(data,inner){this._debug("Auditing TS...");this._reporter.clearIssues();this._parser.startJsPosition={row:0,col:0,startIndex:0,endIndex:0};this._fileIndex.clear();this._data=data;this._rawData=!this._inZip?data:null;this._parser.parse(data,this._curFile,this._curFileType,inner);this._flushIssues(data)};JafCore.prototype._auditJS=function(data){this._debug("Auditing JS...");var _self=this,rc;this._reporter.clearIssues();this._startJsPosition={row:0,col:0,startIndex:0,endIndex:0};this._fileIndex.clear();this._data=data;this._rawData=!this._inZip?data:null;this._parseJS(data,function(treenode){rc=_self._fireHookFileRules(treenode,null)});_self._fireHookFileRules(null,null);this._flushIssues(data);return rc};JafCore.prototype._parseJS=function(data,cb){var ret=false,rowNow,colNow,issue,opts,arRawComs,isConfigComments;try{this._debug("Parsing JS...");isConfigComments=this._config.getComments();this._Ast=new AST(data,this._config.getEcmaVer(),isConfigComments);ret=true}catch(e){opts=this._rules.getRuleOptions(RULE_JS_DIAGNOSE,JAF_RSI);if(opts&&opts.enabled){rowNow=e.lineNumber+(this._startJsPosition.row===0?0:this._startJsPosition.row-2);colNow=e.column+(this._startJsPosition.col===0?0:this._startJsPosition.col-1);issue=new Issue("JavaScript syntax - "+e.message);this._reportJafIssue(issue,RULE_JS_DIAGNOSE,rowNow,colNow,e.index+this._startJsPosition.startIndex,e.index+this._startJsPosition.startIndex+1)}else{rowNow=e.lineNumber+(this._startJsPosition.row===0?0:this._startJsPosition.row-2);colNow=e.column+(this._startJsPosition.col===0?0:this._startJsPosition.col-1);console.log("\nJS-DIAGNOSE : ["+rowNow+", "+colNow+"] "+e.message+"\n File -> "+this._curFile)}this._parseErrors++;if(this._debugMode||this._verboseMode){this._info("[PARSE ERROR(4) : FILE "+(this._curFile?this._curFile:"N/A")+" "+this._parseErrors)}}if(ret){if(cb)cb(this._Ast.getProgram());ret=false;try{this._debug("Walking JS...");if(isConfigComments){arRawComs=this._Ast.getRawComments();if(arRawComs&&arRawComs.length){if(!this._comments){this._comments=new Comments(nodeDeps,this._rules,this._getMsgCtx,this._Utils)}this._comments.reset(this._Ast)}}this._Ast.walk(this._AstNodeHandler.bind(this));ret=true}catch(e){this._error("JavaScript walk failure - "+e+" in "+this._curFile)}}return ret};JafCore.prototype._AstNodeHandler=function(node){var coms;if(this._rules.isTypeRegistered(node.type)){if(this._comments){coms=this._comments.isDisabled(node);if(coms&&(!coms.rules||coms.rules.length===0)){return}this._rules.setJSCommentCallback(coms?function(ruleName){var b=coms.rules.includes(ruleName);return!coms.invert?b:!b}:null)}this._rules.fireRules({type:node.type,node:node,position:{offset:this._startJsPosition.startIndex,start:node.start,end:node.end},data:this._Ast.getData(),utils:{AstUtils:this._Ast.getUtils()}},node,this._curFile,this._curFileType,null)}};JafCore.prototype._processResource=function(url){var resp;this._loadComponentServices();resp=this._compSvcs.loadUrl(url);if(resp.statusCode==4242){this._error("Test server not started?");resp.statusCode==999}if(resp.statusCode!==200){this._warn("Server returned status "+resp.statusCode+" for resource '"+url+"'")}return resp};JafCore.prototype._flushIssues=function(data,noZeroIssueFlush){var i,len,issues,issue,rowcol,showContainer;issues=this._reporter.getIssues();len=issues.length;for(i=0;i<len;i++){issue=issues[i];if(issue.index&&issue.index.line!==undefined){rowcol={row:issue.index.line,col:issue.index.col}}else if(data===null||!issue.index||issue.index.start===undefined){rowcol={row:0,col:0}}else{rowcol=this._fileIndex.getRowCol(data,issue.index,this._curFileType)}issue.rowcol=rowcol}if(len){this._sortIssues(issues)}if(!len){if(!noZeroIssueFlush){if(this._isAPI&&!this._isAsyncTemp||this._isAMD){this._flushIssuesAsObjects(issues,data);this._reporter.clearIssues()}}return}if(this._curFile||this._curContainer){this._totalIssueFiles++}this._totalIssues+=len;this._updateSeverityStats(issues);if(this._outFormat===FORMAT_PROSE&&this._curFile){if(!this._titleShown&&this._config.getTitle()){this._showTitle();this._titleShown=true}if(this._outPath||this._isCLI){showContainer=this._curContainer&&this._curContainer!==this._curFile;this._msg("\n** Audit for "+(this._colorMode?Colors.BRIGHTCYAN(this._curFile):"'"+this._curFile+"'")+(showContainer?" ("+this._curContainer+")":""),"I")}}if(this._isAPI&&this._isAsyncTemp){this._flushIssuesJson(issues,data)}else{switch(this._outFormat){case FORMAT_JSON:this._flushIssuesJson(issues,data);break;default:this._flushIssuesProse(issues,data);}}this._reporter.clearIssues()};JafCore.prototype._flushIssuesProse=function(issues,data){if(!this._outPath&&(this._isAPI||this._isAMD)){this._flushIssuesAsObjects(issues,data);return}var i,len,issues,issue,msg,fmt;var sev,arrow,diagnostic,container;len=issues.length;for(i=0;i<len;i++){issue=issues[i];fmt=this._config.getProseFormat();if(fmt){msg=this._applyFormat(fmt,issue.severity,this._curFile,issue.msg,issue)}else if(this._outFormat===FORMAT_LINE){if(this._severity.isBlocker(issue.severity)||this._severity.isCritical(issue.severity)||this._severity.isMajor(issue.severity)){sev=this._colorMode?Colors.BRIGHTRED(issue.severity):issue.severity;arrow=this._colorMode?Colors.BRIGHTRED(ARROW):ARROW}else if(issue.severity===Severity.MINOR){sev=this._colorMode?Colors.YELLOW(issue.severity):issue.severity;arrow=this._colorMode?Colors.YELLOW(ARROW):ARROW}else{sev=this._colorMode?Colors.GREEN(issue.severity):issue.severity;arrow=this._colorMode?Colors.GREEN(ARROW):ARROW}container=this._curContainer&&this._curContainer!==this._curFile?this._curContainer+"/":"";diagnostic=this._colorMode?Colors.CYAN(issue.msg):issue.msg;fmt=this._config.getLineFormat();if(!fmt){fmt="\u25CF %s : %m"+(this._msgIdMode?" [%mid]":"")+"\n "+arrow+" %f:%l:%c"}msg=this._applyFormat(fmt,sev,container+this._curFile,diagnostic,issue)}else{fmt="%pos1 %s : %m";msg=this._applyFormat(fmt,issue.severity,"",issue.msg,issue);if(this._verboseMode||this._config.getOptions().ruleName){msg+=" ["+issue.prefix+"-"+issue.msgId+" : "+issue.ruleName+"]"}else if(this._msgIdMode){msg+=" ["+issue.prefix+"-"+issue.msgId+"]"}}if(this._isCLI&&this._outFormat!==FORMAT_LINE){if(this._severity.isBlocker(issue.severity)||this._severity.isCritical(issue.severity)||this._severity.isMajor(issue.severity)){msg=this._colorMode?Colors.BRIGHTRED(msg):msg}}this._writeIssue(msg)}};JafCore.prototype._applyFormat=function(fmt,sev,file,message,issue){var msg,pos,linecol;pos=issue.rowcol;linecol=pos.row+", "+pos.col;msg=fmt.replace("%pos1","["+linecol+"]");msg=msg.replace("%pos2","("+linecol+")");msg=msg.replace("%mid",issue.prefix+"-"+issue.msgId);msg=msg.replace("%l",pos.row);msg=msg.replace("%c",pos.col);msg=msg.replace("%s",sev);msg=msg.replace("%m",message);msg=msg.replace("%p",issue.prefix);msg=msg.replace("%n",issue.msgId);msg=msg.replace("%r",issue.ruleName);msg=msg.replace("%f",file);return msg};JafCore.prototype._flushIssuesAsObjects=function(issues,data){var obj,diag,position,i,len,issues,issue,rowcol;var ruleOpts,loadedRule,ruleDescriptType,descriptObj;ruleDescriptType=this._config.getRuleDescriptions();if(this._curContainer!==this._curFile){if(this._curContainer&&!this._containerIssues){this._containerIssues={container:this._curContainer,issues:[]}}}obj={file:this._curFile,issues:[]};if(ruleDescriptType!=="none"){obj.descriptions={}}len=issues.length;for(i=0;i<len;i++){diag={};issue=issues[i];if(!obj.file&&issue.filepath){obj.file=issue.filepath}ruleOpts=this._rules.getRuleOptions(issue.ruleName,issue.rsi);rowcol=issue.rowcol;diag.msg=issue.msg;diag.msgId=issue.prefix+"-"+issue.msgId;diag.severity=issue.severity;diag.rule=issue.ruleName;diag.position=position={};position.row=rowcol.row;position.col=rowcol.col;if(issue.index&&issue.index.start!==undefined){position.index={};position.index.start=issue.index.start;position.index.end=issue.index.end}diag.$hook=ruleOpts&&ruleOpts.$hook?true:false;loadedRule=this._ruleSets.getLoadedRule(issue.rsi,issue.ruleName);if(issue._msgEx){diag.msgEx=issue._msgEx}if(ruleDescriptType==="none"){if(loadedRule){diag.getDescription=loadedRule.getDescription.bind(loadedRule);diag.getShortDescription=loadedRule.getShortDescription.bind(loadedRule)}else{if(issue.ruleName===RULE_HTML_DIAGNOSE){diag.getDescription=function(){return"HTML syntax error."}}else if(issue.ruleName===RULE_JS_DIAGNOSE){diag.getDescription=function(){return"JavaScript syntax error."}}else if(issue.ruleName===RULE_CSS_DIAGNOSE){diag.getDescription=function(){return"CSS syntax error"}}diag.getShortDescription=diag.getDescription}}else{if(!obj.descriptions[diag.MsgId]){descriptObj={};if(loadedRule){if(ruleDescriptType==="short"||ruleDescriptType==="all"){descriptObj.short=loadedRule.getShortDescription()}if(ruleDescriptType==="long"||ruleDescriptType==="all"){descriptObj.long=loadedRule.getDescription()}}else{var fn;if(issue.ruleName===RULE_HTML_DIAGNOSE){fn=function(){return"HTML syntax error."}}else if(issue.ruleName===RULE_JS_DIAGNOSE){fn=function(){return"Javascript syntax error."}}else if(issue.ruleName===RULE_CSS_DIAGNOSE){fn=function(){return"CSS syntax error"}}else if(issue.ruleName===RULE_INIT_SCHEMA){fn=function(){return"component.json schema violation error"}}if(ruleDescriptType==="short"||ruleDescriptType==="all"){descriptObj.short=fn}if(ruleDescriptType==="long"||ruleDescriptType==="all"){descriptObj.long=fn}}obj.descriptions[diag.msgId]=descriptObj}}obj.issues.push(diag)}this._containerIssues?this._containerIssues.issues.push(obj):this._callbackIssue(obj)};JafCore.prototype._flushContainerIssuesAsObjects=function(){if(this._containerIssues){this._callbackIssue(this._containerIssues);this._containerIssues=null}};JafCore.prototype._flushIssuesJson=function(issues,data){var i,len,issues,issue,rowcol,position,curReport,curIssue,reported;var ruleOpts,ruleDescriptType,descriptObj;if(!this._isCLI&&!this._isAsyncTemp){return}ruleDescriptType=this._config.getRuleDescriptions();if(!this._json){this._json={};this._json.reported=[];this._json.summary={};this._json.messages=[];this._json.run={};if(ruleDescriptType!=="none"){this._json.descriptions={}}}len=issues.length;if(!len){return};reported=this._json.reported;curReport={};if(this._curContainer){curReport.container=this._curContainer}curReport.file=this._curFile;curReport.issues=[];for(i=0;i<len;i++){curIssue={};issue=issues[i];if(!curReport.file&&issue.filepath){curReport.file=issue.filepath}curIssue.severity=issue.severity;curIssue.msg=issue.msg;curIssue.msgId=issue.prefix+"-"+issue.msgId;curIssue.position=position={};ruleOpts=this._rules.getRuleOptions(issue.ruleName,issue.rsi);rowcol=issue.rowcol;position.row=rowcol.row;position.col=rowcol.col;if(issue.index){if(data!==null){position.start=issue.index.start!==undefined?issue.index.start:0;position.end=issue.index.end!==undefined?issue.index.end:0}}curIssue.$hook=ruleOpts&&ruleOpts.$hook?true:false;curIssue.rule=issue.ruleName;if(ruleDescriptType!=="none"){if(!this._json.descriptions[curIssue.msgId]){descriptObj={};if(ruleDescriptType==="short"||ruleDescriptType==="all"){descriptObj.short=this._rules.getRuleDescription(issue.prefix,issue.ruleName,true)}if(ruleDescriptType==="long"||ruleDescriptType==="all"){descriptObj.long=this._rules.getRuleDescription(issue.prefix,issue.ruleName,false)}this._json.descriptions[curIssue.msgId]=descriptObj}}if(issue._msgEx){curIssue.msgEx=issue._msgEx}curReport.issues.push(curIssue)}reported.push(curReport);if(this._unitTest||this._config.getAppendFileList()){this._json.fileset=this._fileSetList}};JafCore.prototype._sortIssues=function(issues){if(!issues){return}issues.sort(function(a,b){if(a.rowcol.row===b.rowcol.row){return a.rowcol.col-b.rowcol.col}return a.rowcol.row-b.rowcol.row})};JafCore.prototype._flushFinalJson=function(){if(!this._json){this._json={};this._json.summary={};this._json.summary.severities={};this._json.messages=[];this._json.run={}}this._createRunSummary(this._json);this._json.messages=this._messageStack;if(this._isAPI&&this._isAsyncTemp){return this._json}if(this._outPath){const JsonFile=require("../lib//outfile");JsonFile.writeFileSyncJson(nodeDeps,this._outPath,this._json)}else{this._console(JSON.stringify(this._json,null,4))}};JafCore.prototype._reportJafIssue=function(issue,ruleName,line,col,start,end){var rulePack=this._rules.getRulePack(JAF_RSI);var ctx={rulePack:rulePack,_rsi:JAF_RSI,ruleName:ruleName,position:{line:line,col:col,start:start,end:end},getMsgId:this._getMsgId.bind(this)};rulePack._setCBCtx(ctx);this._reporter.addIssue(issue,ctx)};JafCore.prototype._createResponseObj=function(filePath,fileType){return{body:this._compSvcs.extractFileFromZip(filePath),type:fileType}};JafCore.prototype._createRunSummary=function(obj){var summary,run,sev,gitInfo;if(!obj){obj={}}obj.summary=summary={};obj.summary.severities=sev={};obj.run=run={};gitInfo=this._metaLib.getRevisionInfo();summary.issues=this._totalIssues;summary.issueFiles=this._totalIssueFiles;summary.errorFiles=this._errorFiles;summary.parseErrors=this._parseErrors;summary.errors=this._errors;summary.warnings=this._warnings;summary.asserts=this._asserts;summary.files=this._totalFilesAudited;summary.urls=this._totalUrlsAudited;summary.rulesActive=this._rules.getActiveRuleCount();summary.rulesFired=this._rules.getRulesFired();summary.hooksFired=this._rules.getHooksFired();var sevList=this._severity.getSevList(),sevCore,i;for(i=sevList.length-1;i>=0;i--){sevCore=sevList[i];sev[this._severity.map(sevCore)]=this._totalSevStats[sevCore]}if(this._config.getTitle()){run.title=this._applyMacrosToTitle(this._config.getTitle())}run.date=new Date().toUTCString();run.revision=gitInfo.revision;run.tag=gitInfo.revision;run.jetVersion=gitInfo.jetVersion;if(typeof this._configPath==="string"){run.config=this._configPath.replace(/\\/g,"/")}return obj};JafCore.prototype._getAttrIndex=function(data,index,attrName){var i,j,c,ret=-1;if(index<this._attrIndex){index=this._attrIndex}while(true){i=data.indexOf(attrName,index);if(i>=0){j=this._Utils.eatWhitespace(data,i+attrName.length);if(j>=0){c=data.charAt(j);if(c==="="||c===">"||this._Utils.isWhitespace(data.charAt(i))){ret=i;this._attrIndex=j;break}}index=j}else{break}}if(ret<0){this._error("ASSERT: getAttrIndex '"+attrName+"', "+index+", "+this._curFile)}return ret};JafCore.prototype._getAttrRawValue=function(data,index,attrName,attrValue){var ret=null,delim,i;i=index+attrName.length;if(data.charAt(i)==="="){i=this._Utils.eatWhitespace(data,i+1);delim=data.substr(i,1);delim=delim==="'"||delim==="\""?delim:"\"";ret=delim+attrValue+data.charAt(i+attrValue.length+1)}else{ret=attrValue}return ret};JafCore.prototype._fireHookRules=function(phase,ruleCtx,rsi){var rc;ruleCtx=ruleCtx?ruleCtx:this._rules.makeRuleContext();ruleCtx.type=phase;ruleCtx.phase=phase;ruleCtx.utils={};if(phase===REG.PHASE_STARTUP_RULEPACK||phase===REG.PHASE_CLOSEDOWN_RULEPACK){ruleCtx.ojetConfig=nodeDeps.scaffold?nodeDeps.scaffold.getOjetConfig():null}if(phase===REG.PHASE_STARTUP||phase===REG.PHASE_START_AUDIT){if(!ruleCtx.utils.jafLib){ruleCtx.utils.jafLib=this._jafLib.getPublic()}}else if(ruleCtx.utils.jafLib){delete ruleCtx.utils.jafLib}rc=this._rules.fireHookRules(ruleCtx,rsi);return rc};JafCore.prototype._fireHookFileRules=function(node,obj){var ctx;var endfile=!node&&!obj;ctx=this._ctxFileHook;if(this._curFileType!==FILETYPE_JS&&this._curFileType!==FILETYPE_TS&&ctx.utils.AstUtils!==undefined){delete ctx.utils.AstUtils}if(this._curFileType!==FILETYPE_HTML&&this._curFileType!==FILETYPE_JSON&&ctx.utils.DomUtils!==undefined){delete ctx.utils.DomUtils;delete ctx.utils.semVerUtils}if(this._curFileType!==FILETYPE_ZIP&&ctx.zipContent!==undefined){delete ctx.zipContext}ctx.type=endfile?this._inScriptJs?"endscript":"endfile":this._inScriptJs?"startscript":"file";ctx.phase=REG.PHASE_FILE;ctx.filename=this._curFile;ctx.filepath=this._curFile;ctx.filetype=this._curFileType;if(obj){ctx.suppData=obj}if(this._curFileType===FILETYPE_JSON){ctx.position={start:this._startIndex,end:this._endIndex}}else{ctx.setPosition(0,0)}if(this._curFileType===FILETYPE_JS||this._curFileType===FILETYPE_TS||this._inScriptJs){ctx.node=node;if(this._curFileType===FILETYPE_JS||this._inScripts){ctx.utils.AstUtils=this._Ast?this._Ast.getUtils():null}else{ctx.utils.AstUtils=this._parser.getAstUtils()}}else if(this._curFileType===FILETYPE_HTML){ctx.node=node;ctx.utils.DomUtils=this._DomUtils;ctx.NodeTypes=NodeType}else if(this._curFileType===FILETYPE_JSON){ctx.node=node}else if(this._curFileType===FILETYPE_ZIP){ctx.zipContent=node}ctx.rawData=this._rawData;ctx.data=this._inScriptJs?this._inScriptJsData:this._data;return this._rules.fireHookRules(ctx)};JafCore.prototype._fireRPHookRules=function(phase){var rsi,packs,ruleCtx,phase,rc;packs=this._ruleSets.getRulePacks();ruleCtx=this._rules.makeRuleContext();for(rsi=0;rsi<packs.length;rsi++){rc=this._fireHookRules(phase,ruleCtx,rsi);if(typeof rc==="boolean"&&!rc){break}}return rc};JafCore.prototype._updateSeverityStats=function(issues){var issues,issue,sevObj,i,len;len=issues.length;sevObj=this._severityStats;for(i=0;i<len;i++){issue=issues[i];switch(this._severity.unmap(issue.severity)){case this._severity.CRITICAL:sevObj.critical++;break;case this._severity.BLOCKER:sevObj.blocker++;break;case this._severity.MAJOR:sevObj.major++;break;case this._severity.MINOR:sevObj.minor++;break;case this._severity.INFO:sevObj.info++;break;}}};JafCore.prototype._dumpFile=function(data){var datalen,line=1,c,i;this._console("\n----------- Dump File ------------","D");datalen=data?data.length:0;for(i=0;i<datalen;i++){c=data.charAt(i);this._console("i="+i+" c="+(c==="\n"?"\\n":c==="\r"?"\\r":c),"D");if(c==="\n"){line++;this._console("NL i="+i+" line="+line,"D");continue}}this._console("\n----------- End Dump ------------\n","D")};JafCore.prototype._getPosition=function(){return{start:this._startIndex,end:this._endIndex}};JafCore.prototype._processCmdLine=function(){var rc,g,i,b;rc=nodeDeps.cmdLine.checkArgs(nodeDeps,this,this._severity,MACROS,FORMAT_PROSE,FORMAT_JSON,FORMAT_LINE);if(!rc||rc==="end"){return rc}if(this._groupsSet){for(i=0;i<this._groupsSet.length;i++){g=this._groupsSet[i];if(!GROUPS.includes(g)){if(g.startsWith("jet")||g.startsWith("htm")){this._error("Command line override of 'groups' -> '"+g+"' is not defined!");b=true}}}}if(b){return 0}if(this._verboseMode&&nodeDeps.cmdLine.isCmdLineOptionsSet(this)){nodeDeps.cmdLine.displayCmdLineOptionsSet()}return true};JafCore.prototype._dumpRules=function(){var ret=false;if(this._isCLI){if(this._debugMode||this._dryRunSet){return false}if(this._dumpRulesSet||this._dumpRulesJsonSet||this._dumpRulesSonarSet||this._dumpRulesInternalSet){let OutFile=require("../lib//outfile");if(this._dumpRulesJsonSet){let rulesObj=this._rules.getRulesJson();if(this._outPath){OutFile.writeFileSyncJson(nodeDeps,this._outPath,rulesObj)}else{console.log(JSON.stringify(rulesObj,null,3))}ret=true}else if(this._dumpRulesSonarSet){let rulesXML=this._rules.getRulesSonar();if(this._outPath){OutFile.writeFileSyncText(nodeDeps,this._outPath,rulesXML)}else{console.log(rulesXML)}ret=true}else{let rulesProse=this._rules.getRulesProse(this._dumpRulesInternalSet);if(this._outPath){OutFile.writeFileSyncText(nodeDeps,this._outPath,rulesProse)}else{console.log(rulesProse)}ret=true}}}return ret};JafCore.prototype._dumpCompositeNames=function(){var names,i;if(this._dryRunSet){return}names=this._components.getNames();if(!names.length){this._console("[info]: No valid web components declared!","I");return}this._console("[info] :--------- Declared Web Components ---------","I");for(i=0;i<names.length;i++){this._console(" "+names[i].name+" ("+names[i].version+")","I")}this._console("[info]: -------- End Declared Web Components ---------\n","I")};JafCore.prototype._startupValidation=function(){var i,path,val,ftype,err,noMetadata=false,jafConfig,rc;if(!(this._isCLI||this._isAPI||this._isAMD)){this._error("*** Unknown run mode!");return 1}if(this._isAPI&&this._isAsync){this._error("*** SYSTEM ERROR - API and Async mode incompatability check!");return 1}if(this._isCliOrApi&&!this._checkNodeVer()){return 1};nodeDeps.jetver.init(nodeDeps,DEFAULT_JETVER);if(this._isCliOrApi&&!this._isManual){this._metaLib=new metaLib(nodeDeps,this._runMode,this._getMsgCtx(),this._Utils)}else if(this._isAMD){if(!this._AmdMeta||!this._AmdMeta.jetMeta){this._error("AMD mode - no Metadata supplied.");return 1}this._metaLib=new metaLib(nodeDeps,this._runMode,this._getMsgCtx(),this._Utils);this._metaLib.setAmdMeta(this._AmdMeta)}if(!this._isManual){this._reporter=new Reporter(this._getMsgCtx())}if(this._isCLI){rc=this._processCmdLine();if(rc==="end"){return-1}if(!rc){return 1}if(this._cmdMetaHist){nodeDeps.metahist.show(nodeDeps);return-1}if(this._scaffoldRuleSet){return nodeDeps.scaffoldRule.genRule(this._curDir,this._scaffoldRuleSet,nodeDeps)?-1:1}this._isOJET=nodeDeps.scaffold.init(this._curDir,nodeDeps,this._getAppCtx());if(this._isOJET){jafConfig=nodeDeps.scaffold.handleOjetConfig(this._scaffoldSet);if(jafConfig==="error"){return 1}if(this._scaffoldSet){return-1}}else if(this._isOJETCLI){this._error("OJET CLI configuration file not found in '"+this._curDir+"'");return 1}else if(this._scaffoldSet){jafConfig=nodeDeps.scaffold.createNonOjetConfig();if(jafConfig==="error"){return 1}return-1}if(this._jetverList){nodeDeps.jetver.showList(this._colorMode);return-1}if(this._cmdNSList){nodeDeps.nslist.showNamespaces();return-1}}if(this._isCliOrApi){if(this._configPath!==null){if(typeof this._configPath==="string"){ftype=nodeDeps.fsUtils.getFileType(this._configPath);if(ftype==="d"){path=this._configPath+this._fileSep+CONFIG_FILE_OJET;ftype=nodeDeps.fsUtils.getFileType(path);if(ftype!=="f"){path=this._configPath+this._fileSep+CONFIG_FILE;ftype=nodeDeps.fsUtils.getFileType(path)}this._configPath=path}if(ftype!=="f"){this._error("cannot find configuration file '"+this._configPath+"'");return 1}}}}if(this._isCliOrApi){if(this._configPath===null){this._configPath=nodeDeps.path.join(this._curDir,CONFIG_FILE_OJET);this._configPath=nodeDeps.path.resolve(this._configPath);if(!nodeDeps.fsUtils.fileExists(this._configPath)){this._configPath=nodeDeps.path.join(this._curDir,CONFIG_FILE);this._configPath=nodeDeps.path.resolve(this._configPath)}}this._info("Config "+(typeof this._configPath==="object"?"is pre-built object":this._configPath?"is '"+this._configPath+"'":" is not defined"))}this._config=new nodeDeps.Config(nodeDeps,this._base,this._configPath,this._Rules,GROUPS,this._severity,this._groupsSet,this._cliSev,MACROS,this._getMsgCtx(),this._getModeCtx(),this._Utils);if(!this._config.isOk()){return 1}if(!this._debugSet&&this._config._config.options.debug){this._debugMode=true}if(this._config._config.options.$reg){this._regListenerTypesSet=true}this._processConfigOptions();this._metaLib.setTheme(this._config.getTheme());if(this._isStdoutRedirected){this._colorMode=false}if(this._isCliMode&&typeof this._retCode===UNDEF){let copts=this._config._config.options;let prop=typeof copts.retCode!==UNDEF?"retCode":typeof copts.rc!==UNDEF?"rc":null;this._retCode=prop?copts[prop]:AUTO}if(this._severitySet&&this._cliSev){if(!this._severity.isValidConfigSeverity(this._cliSev)){this._error("Config entry 'severity' ('"+this._cliSev+"') is not 'major/minor/blocker/critical/info', 'all', or a remapped severity!");return 1}}if(this._verboseMode||this._debugMode){this._info("Mode: "+this._runMode.toUpperCase());this._info("Config:\n"+(this._config._origConfig?JSON.stringify(this._config._origConfig,null,3):"None!")+"\n")}if(this._isManual){val=this._manCheckL||this._manCheckS;if(val.startsWith("jet-")||val.startsWith("jaf-")||val.startsWith("oj-")){this._config._config.ruleNames=[]}}if(!this._isAMD&&!this._isManual){this._tmpDir=this._config.getTempDir();this._tmpDir=nodeDeps.path.join(this._tmpDir?this._tmpDir:this._curDir,TEMP_DIR);if(nodeDeps.fsUtils.fileExists(this._tmpDir,true)){this._info("[Info]: Using temp work folder : "+this._tmpDir);nodeDeps.fsUtils.deleteFolder(this._tmpDir,false)}else{this._info("Creating temp work folder : "+this._tmpDir);rc=nodeDeps.fsUtils.createFolder(this._tmpDir);if(typeof rc!=="boolean"){this._error(rc);return 1}}}if(this._isCLI){this._metaLib.setStylesets(this._config.getStylesets())}if(this._isAMD&&this._AmdMeta.ccaMeta){this._processAMDUserCCAMeta(this._AmdMeta.ccaMeta);if(this._components.isOk()){this._metaLib.setComponentsLib(this._compSvcs,this._components)}}if(!this._isManual){if(this._isCliOrApi){if(!this._srcStack||this._srcStack.length===0){this._srcStack=this._config.getFiles();if(!this._srcStack||this._srcStack.length===0){this._srcStack=[];if(!this._isAPI){this._srcStack.push("./*.*")}}}if(this._srcStack){for(i=0;i<this._srcStack.length;i++){if(!this._srcStack[i].startsWith("http")){path=nodeDeps.path.normalize(this._srcStack[i]);path=nodeDeps.path.resolve(path)}else{path=this._srcStack[i]}this._srcStack[i]=path}}else{this._srcStack=[]}this._fileSet.setFiles(this._srcStack,this._config.getExclude(),this._getMsgCtx())}}if(this._isCliOrApi){val=this._jetverSet?this._jetverSet:this._config.getJetVer();this._metaPath=val.split(".");this._metaPath=this._metaPath[0]+"."+this._metaPath[1]+".0";this._metaPath=nodeDeps.path.join(__dirname,"../meta",this._metaPath,META_FILE_OBJ);this._info("[info]: Metadata path (for "+val+") is '"+this._metaPath+"'");if(noMetadata||!this._metaLib.loadMeta(this._metaPath)){return 1}}this._macros.$jetver=this._metaLib.getRevisionInfo().jetVersion;this._macros.$jafconfig=this._configPath;if(this._isCliOrApi&&!this._isManual){if(!this._outPath){val=this._config.getOutPath();if(val){if(typeof val==="string"&&val.length){this._outPath=val==="$noout"?null:val}else if(typeof val!=="string"){this._error("Config 'outPath' '"+val+"' is not a valid path - ignored");return 1}}}if(this._outPath==="$noout"){this._outPath=null}else if(this._outPath){this._info("[info]: Output path is '"+this._outPath+"'","I");if(nodeDeps.fsUtils.getFileType(this._outPath)==="d"){this._error("Config 'outPath' "+this._outPath+"' is a dir and not a filename");return 1}if(!this._dryRunSet){err=this._writer.open(this._outPath);if(err){this._error("Output path error - reverting to console : \n "+err.message)}}}if(!this._outFormat){val=this._config.getFormat();this._outFormat=val?val:FORMAT_PROSE}}if(this._isCliOrApi){if(!this._followLinksSet){this._followLinks=!!this._config.getFollowLinks()}if(this._verboseMode){this._info("[info]: "+(this._followLinks?"Following":"Not following")+" stylesheet/script <link>'s")}}if(this._config.getRunRuleNames()&&!this._isManual){val=this._config.getGroups();if(val.length>1||val.length===1&&val[0]!=="all"){this._error("Config \"groups\" and \"ruleNames\" are mutually exclusive");return 1}}val=this._config.getGroups();if(val.includes("jet-csp")&&!this._config.isBuiltinCspRules()){this._error("group 'jet-csp' specified, but CSP builtin rulepack not enabled");return 1}for(i=0;i<val.length;i++){if(val[i].startsWith("jet-")&&val[i]!=="jet-csp"){if(!this._config.isBuiltinJetRules()){this._error("group '"+val[i]+"' specified, but JET builtin rulepack not enabled");return 1}}}if(!this._isManual){this._tabs=require("../lib/tabs");this._tabs=new this._tabs;if(!this._tabs.validate(this._config.getTabs(),this._getMsgCtx())){return 1}this._fileIndex.setTabHandler(this._tabs);this._Utils.setTabHandler(this._tabs)}this._userDefs=this._config.getUserDefs();this._reporter.setOutFormat(this._outFormat);this._reporter.setSevInstance(this._severity);this._reporter.setMessageFilter(this._config._config.messages);this._ruleSets=new RuleSet(this._config,nodeDeps,this._getAppCtx());if(!this._ruleSets.loadRulePacks(this._config._config,this._dryRunSet,this._dumpRulesSet||this._dumpRulesJsonSet||this._dumpRulesSonarSet)||this._errors){return 1};if(this._regListenerTypesSet){this._ruleSets.dumpRegistry();return-1}this._rules=new Rules(this._ruleSets,nodeDeps,this._config._config,this._getMsgId.bind(this),this._getAppCtx());this._msgIdLookup=this._ruleSets.loadMsgIds();if(this._msgIdLookup===-1){return 1}if(this._dumpRules()){return-1}if(this._isCLI&&this._manualCheck()){return-1}if(!this._isManual){if(this._isCliOrApi){this._loadComponentSupport();if(this._components.isOk()){this._metaLib.setComponentsLib(this._compSvcs,this._components)}if(this._verboseMode){this._dumpCompositeNames()}}}this._DomUtils=new DomUtils(nodeDeps,this._getAppCtx(),this._tabs);this._metaLib.setDomUtils(this._DomUtils);this._ctxTag=this._rules.makeRuleContext();this._ctxAttr=this._rules.makeRuleContext();this._ctxCss=this._rules.makeRuleContext();this._ctxFileHook=this._rules.makeRuleContext();this._ctxTag.utils={};this._ctxAttr.utils={};this._ctxCss.utils={};this._ctxFileHook.utils={};this._CssLib=new CssLib(this._nd,this._getAppCtx());this._setupCssParser();this._parser=new Parser(this,nodeDeps,this._rules,this._fileIndex,this._DomUtils,this._getAppCtx(),this._getMsgCtx(),{RULE_JS_DIAGNOSE:"jaf-js-diagnose",RULE_CSS_DIAGNOSE:"jaf-css-diagnose",RULE_HTML_DIAGNOSE:"jaf-html-diagnose",RULE_INIT_SCHEMA:"jaf-init-schema",FILETYPE_HTML:FILETYPE_HTML,FILETYPE_CSS:FILETYPE_CSS,JAF_RSI:0})};JafCore.prototype._manualCheck=function(){if(this._isManual){return nodeDeps.manual.check(this._rules,this._manCheckL,this._manCheckS,this._colorMode?Colors:false)}return false};JafCore.prototype._displayFinalStats=function(){var msg,msg2,sevs,n,l;this._errorFiles+=this._fileSet.getFileErrorCount();n=this._errorFiles||this._notfoundFiles||this._parseErrors;msg="JET Audit: "+this._totalIssues+" issue"+(this._totalIssues!==1?"s":"")+(this._totalIssues!==1?" were":" was")+" found"+(this._totalIssues?" in "+this._totalIssueFiles+" file"+(this._totalIssueFiles!==1?"s":""):"")+".";msg="\n"+(this._totalIssues?this._colorMode?Colors.BLACKONRED(msg):msg:this._colorMode?Colors.GREEN(msg):msg);if(n){msg2=(this._errorFiles?" "+this._errorFiles+" file"+(this._errorFiles!==1?"s":"")+" could not be read.":"")+(this._parseErrors?" "+this._parseErrors+" parse error"+(this._parseErrors!==1?"s":"")+" "+(this._parseErrors===1?"was":"were")+" found.":"");msg+=this._colorMode?Colors.BLACKONRED(msg2):msg2}this._console(msg);if(this._useStderr){process.stderr.write(msg+"\n")}n=this._totalFilesAudited;msg=_rightAlign(n,6)+" file"+(n===1?" ":"s ")+(n===1?"was":"were")+" audited.";n=this._totalUrlsAudited;msg+="\n"+_rightAlign(n,6)+" URL"+(n===1?" ":"s ")+(n===1?"was":"were")+" audited.";n=this._rules.getRulesFired();msg+="\n"+_rightAlign(n,6)+" rule"+(n===1?" ":"s ")+(n===1?"was":"were")+" fired.";n=this._rules.getHooksFired();msg+="\n"+_rightAlign(n,6)+" hook rule"+(n===1?" ":"s ")+(n===1?"was":"were")+" fired.";var stats=new nodeDeps.stats(this._totalSevStats,40,this._colorMode,Colors);sevs=this._severity.getMappedArray()||this._severity.getSevList();l=0;sevs.forEach(function(v){n=v.length;l=n>l?n:l});l+=2;msg+="\n\n"+"-".repeat(10)+"Severities"+"-".repeat(10)+"\n"+_leftAlign(sevs[4],l)+": "+_rightAlign(this._totalSevStats.blocker,6)+" |"+stats.bar(this._totalSevStats.blocker)+"\n"+_leftAlign(sevs[3],l)+": "+_rightAlign(this._totalSevStats.critical,6)+" |"+stats.bar(this._totalSevStats.critical)+"\n"+_leftAlign(sevs[2],l)+": "+_rightAlign(this._totalSevStats.major,6)+" |"+stats.bar(this._totalSevStats.major)+"\n"+_leftAlign(sevs[1],l)+": "+_rightAlign(this._totalSevStats.minor,6)+" |"+stats.bar(this._totalSevStats.minor)+"\n"+_leftAlign(sevs[0],l)+": "+_rightAlign(this._totalSevStats.info,6)+" |"+stats.bar(this._totalSevStats.info)+"\n"+"-".repeat(30);if(this._warnings){msg2="Note: "+this._warnings+" warning"+(this._warnings!==1?"s":"")+(this._warnings===1?" was":" were")+" reported";if(this._colorMode){msg2=Colors.BLACKONRED(msg2)}msg+="\n\n"+msg2+"\n"}if(elapsed){msg+="\n[Elapsed: "+elapsed[0]+(elapsed[1]/1000000000).toString().substr(1,3)+"s]"}this._console(msg)};JafCore.prototype._displayErrorsAndAsserts=function(){var msg="";if(this._errors){msg+="[Error]: "+this._errors+" error";msg+=(this._errors===1?" was":"s were")+" found."}if(this._warnings){if(msg.length){msg+="\n"}msg+="[Warn]: "+this._warnings+" warning";msg+=(this._warnings===1?" was":"s were")+" found."}if(this._asserts){if(msg.length){msg+="\n"}msg+="[Warn]: "+this._asserts+" assert";msg+=(this._asserts===1?" was":"s were")+" found."}msg+="\n";if(!this._unitTest){this._info("\n"+(this._colorMode?Colors.BLACKONRED(msg):msg))}else{nodeDeps.fs.writeSync(process.stdout.fd,"\n"+(this._colorMode?Colors.BLACKONRED(msg):msg))}if(this._useStderr){process.stderr.write(msg+"\n")}};JafCore.prototype._emitApiRunSummary=function(){var o;o=this._createRunSummary();if(this._events){this._events.emit(this._events.JAF_EVENT_SUMMARY,o)}if(this._ctxCB.cbSummary){this._ctxCB.cbSummary(o)}};JafCore.prototype._clearSeverityStats=function(){let stats=this._severityStats;stats.critical=stats.blocker=stats.major=stats.minor=stats.info=0};JafCore.prototype._addSevStatsToTotals=function(){let fstats=this._severityStats;let tstats=this._totalSevStats;tstats.critical+=fstats.critical;tstats.blocker+=fstats.blocker;tstats.major+=fstats.major;tstats.minor+=fstats.minor;tstats.info+=fstats.info};JafCore.prototype.setApiCallbacks=function(cbIssue,cbMsg,cbSummary){if(this._ctxCB){if(cbIssue){this._ctxCB.cbIssue=cbIssue}if(cbMsg){this._ctxCB.cbMsg=cbMsg}if(cbSummary){this._ctxCB.cbSummary=cbSummary}}};JafCore.prototype._showHelp=function(){if(this._isCLI){nodeDeps.help(this._showVersion.bind(this),this._getMsgCtx())}};JafCore.prototype._showTitle=function(){var title=this._config.getTitle();if(title){title=this._applyMacrosToTitle(title);if(Array.isArray(title)){for(var i=0;i<title.length;i++){this._msg(title[i])}}else{this._msg(title)}}};JafCore.prototype._applyMacrosToTitle=function(title){if(title){if(Array.isArray(title)){for(var i=0;i<title.length;i++){title[i]=this._applyMacros(title[i])}}else{title=this._applyMacros(title)}}return title};JafCore.prototype._readFile=function(filePath,wantBuffer){var data;this._curFile=filePath;try{if(!wantBuffer){data=nodeDeps.fs.readFileSync(filePath,"utf8")}else{data=nodeDeps.fs.readFileSync(filePath)}}catch(e){this._errorFiles++;this._error(e.code+" reading file '"+filePath+"'");data=null}return data};JafCore.prototype._noteFileSet=function(filePath){if(!this._fileSetList){this._fileSetList=[]}this._fileSetList.push(filePath)};JafCore.prototype._displayStartMsg=function(){this._showVersion();this._showGitInfo()};JafCore.prototype._showGitInfo=function(){var git=this._metaLib.getRevisionInfo();this._console(`JET version : ${git.jetVersion}`,"I");this._console(`Meta built : ${git.date} - ${git.time.replace("edt","EDT").replace("pdt","PDT").replace("utc","UTC")}`,"I");this._console(`Audit run on: ${this._Utils.getCurrentDate()} - ${this._Utils.getCurrentTime()}`,"I");if(this._config.isBuiltinJetRules()){this._console(`Theme : ${this._config.getTheme()}`,"I")}};JafCore.prototype._showVersion=function(){var msg=`${this._isCLI?"\n":""}${DESCRIPTION} (JAF ${VERSION} ${nodeDeps.os.platform()} )`;this._console(msg,"I")};JafCore.prototype._console=function(msg,type){this._isCLI?console.log(msg):this._callbackMsg(msg,type?type:"N")};JafCore.prototype._msg=function(msg){this._writer.put(msg)};JafCore.prototype._callbackMsg=function(msg,type){if(this._outFormat===FORMAT_JSON||this._isAPI&&this._isAsyncTemp){if(type==="E"||type==="W"||type==="A"){this._messageStack.push({msg:msg,type:type})}}if(this._events){this._cbMsgObj.type=type;this._cbMsgObj.msg=msg;this._events.emit(this._events.JAF_EVENT_MESSAGE,this._cbMsgObj)}if(this._ctxCB.cbMsg){this._cbMsgObj.type=type;this._cbMsgObj.msg=msg;this._ctxCB.cbMsg(this._cbMsgObj)}};JafCore.prototype._callbackIssue=function(obj){if(this._events){this._events.emit(this._events.JAF_EVENT_ISSUE,obj)}if(this._ctxCB.cbIssue){this._ctxCB.cbIssue(obj)}};JafCore.prototype._writeIssue=function(msg){this._msg(msg)};JafCore.prototype._info=function(msg,type,force){if(this._verboseMode||this._debugMode||force){if(this._isCLI){msg=this._colorMode?Colors.YELLOW(msg):msg}this._console(msg,type)}};JafCore.prototype._debug=function(msg){if(this._debugMode){msg="[debug]: "+msg;if(this._isCLI){msg=this._colorMode?Colors.CYAN(msg):msg}this._console(msg,"D")}};JafCore.prototype._error=function(msg){var s="[Error]: "+msg;if(this._isCLI){s=this._colorMode?Colors.BRIGHTRED(s):s}this._console(s,"E");this._errors++};JafCore.prototype._warn=function(msg){var nl="";if(msg.charAt(0)==="\n"){msg=msg.substring(1);nl="\n"}msg="[Warn]: "+msg;if(this._isCLI){msg=this._colorMode?Colors.PINK(msg):msg}this._console(nl+msg,"W");this._warnings++};JafCore.prototype._assert=function(msg){var s="[ASSERT]: "+msg;if(this._isCLI){s=this._colorMode?Colors.BRIGHTRED(s):s}this._console(s,"A");this._asserts++};JafCore.prototype._getAppCtx=function(){if(!this._appContext){this._appContext={msg:this._msg.bind(this),info:this._info.bind(this),debug:this._debug.bind(this),error:this._error.bind(this),warn:this._warn.bind(this),assert:this._assert.bind(this),metaLib:this._metaLib.getPublicInterface(),utils:this._Utils,tmpDir:this._tmpDir,reporter:this._reporter,Issue:Issue,flushIssues:this._flushIssues.bind(this),fireHookFileRules:this._fireHookFileRules.bind(this),getMsgId:this._getMsgId.bind(this),rules:this._rules,severity:this._severity,runMode:this._runMode,isUnitTest:this._unitTest,defaultJetVer:DEFAULT_JETVER,VsCodeExtHint:this._VsCodeExtHint,reportJafIssue:this._reportJafIssue.bind(this)}}else if(!this._appContext.rules){this._appContext.rules=this._rules}this._appContext.tmpDir=this._tmpDir;this._appContext.verboseMode=this._verboseMode;this._appContext.debugMode=this._debugMode;if(this._config){this._appContext.config=this._config}return this._appContext};JafCore.prototype._getMsgId=function(context,msgKey){var o;msgKey=msgKey?msgKey:context.ruleName;o=this._msgIdLookup[context.rulePack.getPrefix()];return o?o[msgKey]:"????"};JafCore.prototype._getMsgCtx=function(){if(!this._msgContext){this._msgContext={console:this._console.bind(this),info:this._info.bind(this),debug:this._debug.bind(this),warn:this._warn.bind(this),error:this._error.bind(this),msg:this._msg.bind(this),assert:this._assert.bind(this)}}this._msgContext.isDebug=this._debugMode;this._msgContext.isVerbose=this._verboseMode;return this._msgContext};JafCore.prototype._getModeCtx=function(){return{isOJET:this._isOJET,isOJETCLI:this._isOJETCLI,isCLI:this._isCLI,isAPI:this._isAPI,isAMD:this._isAMD}};JafCore.prototype._clearNL=function(text){var i,c;for(i=0;i<text.length;i++){c=text.charAt(i);if(!this._Utils.isWhitespace(c)){break}if(c==="\n"||c==="\r"){i++;if(i<text.length){c=text.charAt(i);if(c==="\n"||c==="\r"){i++}}text=text.substring(i);break}}return{text:text,stripped:i}};JafCore.prototype._checkNodeVer=function(){var ver=process.version;if(ver.charAt(0)==="v"){ver=ver.substr(1)}if(!require("semver").gte(ver,MIN_NODE_VER)){this._error("Node version "+ver+" detected. JET Audit requires at least "+MIN_NODE_VER);return false}return true};JafCore.prototype._loadComponentSupport=function(){this._loadComponentServices();if(!this._components&&nodeDeps.Components){this._components=new nodeDeps.Components(nodeDeps,this._runMode,this._compSvcs,this._config.getComponentsBase(),this._config.getComponentUrls(),this._config.getComponents(),this._config.get$JetCore(),this._getMsgCtx(),{isDryRun:this._dryRunSet,isDebug:this._debugMode},this._Utils)}};JafCore.prototype._loadComponentServices=function(){if(!this._compSvcs&&nodeDeps.ComponentSvcs){this._compSvcs=new nodeDeps.ComponentSvcs(nodeDeps,nodeDeps.path.dirname(this._metaPath),this._config,this._tmpDir,this._getAppCtx());this._metaLib.setComponentsLib(this._compSvcs)}};JafCore.prototype._processAMDUserCCAMeta=function(arMeta){var i,comp;if(arMeta){this._loadComponentSupport();for(i=0;i<arMeta.length;i++){comp=arMeta[i];if(comp){this._components.processComponentJson(comp,"",false)}}}};JafCore.prototype._applyMacros=function(str){var s=str,macro,regex;for(macro in this._macros){if(s.includes(macro)){regex=new RegExp((macro.startsWith("$")?"\\":"")+macro,"g");s=s.replace(regex,this._macros[macro])}}return s};JafCore.prototype._initMacros=function(){this._macros.$jafcwd=this._curDir;this._macros.$jafdate=this._Utils.getCurrentDate();this._macros.$jaftime=this._Utils.getCurrentTime();this._macros.$jafver=VERSION};JafCore.prototype._debugZipContents=function(entries,indent,lastPath){var i,entry,indent=indent||0,lastPath=lastPath||"";if(Array.isArray(entries)){for(i=0;i<entries.length;i++){entry=entries[i];this._debug(entry.path?entry.path:lastPath+entry.name);if(!entry.isFile){this._debugZipContents(entry.files,indent+2,entry.path)}}}else{this._debug("no valid data found in zip")}};JafCore.prototype.getUnitTestJetVer=function(){var runvers=this._metaLib.getMetaVers();return runvers.runver};function _isAttrExpr(attrValue){var rc=false;if(typeof attrValue==="string"){attrValue=attrValue.trim();rc=attrValue.startsWith("[[")||attrValue.startsWith("{{")}return rc};function _isLinkCSSLink(scriptNode){var ret=null;var attribs=scriptNode.attribs;if(!attribs){return ret}if(attribs.rel){if(attribs.rel.toLowerCase()==="stylesheet"){if(attribs.href){ret=attribs.href.toLowerCase().endsWith(FILETYPE_CSS)?attribs.href:null}}}return ret};function _isSupportedFileType(fileType){return FILETYPES.indexOf(fileType)>=0};function _isSupportedZipFileType(fileType){return ZIP_FILETYPES.indexOf(fileType)>=0};function _getPackageInfo(runMode){var package=require(__dirname+"./../package.json");if(runMode==="amd"){package=JSON.parse(package)}VERSION=package.Jaf.version;DESCRIPTION=package.description};function _isValidJson(data,comments,utils){var obj,ret={obj:null,msg:null,line:0,col:0};try{ret.obj=JSON.parse(comments?nodeDeps.decomment(data):data)}catch(e){if(e.toString().startsWith("SyntaxError")){obj=_convertMsgToRowCol(e.message,data,utils);if(!obj){ret.msg=e.message;ret.line=ret.col=ret.position=0}else{ret.msg=obj.msg;ret.line=obj.row;ret.col=obj.col;ret.position=obj.position}}else{ret.msg=e.message}}return ret};function _convertMsgToRowCol(msg,data,utils){var x,n,obj;x=msg.indexOf("position");if(x<0){return null}n=parseInt(msg.substr(x+8).trim());obj=utils.getRowColFromIndex(data,n,"json",this._tabs);obj.msg=msg.substr(0,x)+"line "+obj.row+", col "+obj.col+" (position "+n+")";obj.position=n;return obj};function _beginsWithNL(text,utils){var i,c,ret=false;for(i=0;i<text.length;i++){c=text.charAt(i);if(!utils.isWhitespace(c)){break}if(c==="\n"||c==="\r"){ret=true;break}}return ret};function _extractFileType(filePath,isNonFile){if(isNonFile){var i=filePath.lastIndexOf(".");return i>=0?filePath.substr(i+1):""}return nodeDeps.fsUtils.getFileExt(filePath)};JafCore.prototype._processConfigOptions=function(){var val;val=this._config.getOptions();if(!val){return}if(!this._debugSet){if(val.debug!==undefined){this._debugMode=!!val.debug}}else{val.debug=true}if(!this._verboseSet){if(val.verbose!==undefined){this._verboseMode=!!val.verbose}}else{val.verbose=true}if(nodeDeps.colors){if(this._colorSet){val.nocolor=!this._colorSet}else{if(val.color!==undefined){this._colorMode=!!val.color}}}else{this._colorMode=this._colorSet=false}if(!this._msgIdModeSet){if(val.msgid!==undefined){this._msgIdMode=!!val.msgid}}else{val.msgid=true}val.ruleName=!!val.ruleName;val.xts=this._experimentalTsSet?true:!!val.xts;if(val.xts&&this._isAMD){this._experimentalTsSet=this._config._config.options.xts=false}};function _getScriptData(data,start,end){var s=data.substring(start,end);var x=s.indexOf("</script");s=s.substring(0,x);return s};function _rightAlign(num,len){var s=""+num;return len>s.length?" ".repeat(len-s.length)+s:s};function _leftAlign(num,len){var s=""+num;return len>s.length?s+" ".repeat(len-s.length):s};module.exports=JafCore;
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 2022, 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
|
+
var nodeDeps;const HtmlParser=require("htmlparser2");const RULE_JS_DIAGNOSE="jaf-js-diagnose";const RULE_TS_DIAGNOSE="jaf-ts-diagnose";const RULE_CSS_DIAGNOSE="jaf-css-diagnose";const RULE_HTML_DIAGNOSE="jaf-html-diagnose";const RULE_INIT_SCHEMA="jaf-init-schema";const Reporter=require("../lib/Reporter");const Issue=require("../lib/Issue");const Rules=require("../lib/Rules");const RuleSet=require("../lib/RuleSet");const JafLib=require("../lib/JafLib");const FileSet=require("../lib/FileSet");const Writer=require("../lib/Writer");var metaLib=require("../lib/MetaLib");const Parser=require("../lib/Parser");const HtmlTree=require("../lib/HtmlTree");const DomUtils=require("../lib/DomUtils");const CssLib=require("../lib/CssLib");const CssUtils=require("../lib/CssUtils");const Utils=require("../lib/Utils");const FileIndex=require("../lib/FileIndex");const Stats=require("../lib/Stats");var AST=require("../lib/AST");var Comments=require("../lib/Comments");const Severity=require("../lib/Severity");const NodeType=require("../lib/NodeTypes");const REG=require("../lib/RegTypes");const FILETYPE=require("../lib/filetypes");const GROUPS=require("../lib/groups");const DEFAULTS=require("../lib/defaults");const OUTFMT=require("../lib/outFormat");var VERSION;var DESCRIPTION;const CONFIG_FILE="jafconfig.json";const CONFIG_FILE_OJET="oraclejafconfig.json";const META_FILE_OBJ="jetauditmeta.js";const TEMP_DIR="jaftmp@";const MIN_NODE_VER="8.5.0";const AUTO="auto";const ERRORS="errors";const JAF_RSI=0;const JET_RSI=JAF_RSI+1;const ENV_JAF_COLOR="JAF_COLOR";const COMPONENT_JSON="component.json";const ARROW="\u2192 ";const UNDEF="undefined";var elapsed;var Colors;function JafCore(nd,runMode="cli"){this._configPath=null;this._metaPath=null;this._outPath=null;this._rulePath=null;this._base=null;this._outFormat=null;this._json=null;this._HtmlTree=null;this._Ast=null;this._events=null;this._tabs=null;this._cliSev=null;this._curDir=null;this._tmpDir=null;this._fileSet=null;this._fileSep=null;this._groupsSet=false;this._followLinks=true;this._runMode=runMode;this._isCLI=runMode==="cli";this._isAPI=runMode==="api";this._isAMD=runMode==="amd";this._isOJETCLI=false;this._isOJET=null;this._isCliOrApi=this._isCLI||this._isAPI;this._isApiOrAmd=this._isAPI||this._isAMD;this._isCliMode=this._isCLI||this._isOJETCLI;this._isAsync=false;this._ctxCB=null;this._isManual=false;this._retCode;this._unitTest=false;this._VsCodeExtHint=false;this._config=null;this._reporter=null;this._rules=null;this._metaLib=null;this._Utils=new Utils(nd);this._DomUtils=null;this._sevLib=null;this._appContext=null;this._writer=null;this._components=null;this._componentSvcs=null;this._stats=new Stats;this._userDefs=null;this._attrIndex=0;this._curContainer=null;this._curFile=null;this._curFileType=null;this._srcStack=null;this._targFiletypes=null;this._CSSLinkStack=[];this._JSLinkStack=[];this._msgIdLookup=null;this._messageStack=[];this._verboseMode=false;this._debugMode=false;this._isInfo=false;this._colorMode=true;Colors=nd.colors;this._msgIdMode=false;this._isRawAttrs=true;this._macros={$jafcwd:null,$jafdate:null,$jaftime:null,$jafver:null,$jafconfig:null,$jetver:null};this._rtf={jetverSet:false,severitySet:false,followLinksSet:false,debugSet:false,verboseSet:false,msgIdModeSet:false,dryRunSet:false,colorSet:false,regListenerTypesSet:false,scaffoldSet:false,scaffoldRuleSet:false,dacSet:false,jetverList:false,defList:false,cmdNSList:false,groupList:false,xgroupList:false,disList:false,cmdMetaHist:false,dumpRulesSet:false,dumpRulesJsonSet:false,dumpRulesSonarSet:false,dumpRulesInternalSet:false,configPath:null,outFormat:null,outPath:null,base:null,groupsSet:false,followLinks:true,retCode:undefined,cliSev:null,verboseMode:false,debugMode:false,colorMode:true,msgIdMode:false,cmdArg:undefined,manCheckL:undefined,manCheckS:undefined,isManual:false,unitTest:false,experimentalSet:false};this._parser=null;this._treeNode=null;this._curTagNode=null;this._startCssPosition=null;this._startJsPosition=null;this._ctxTag=null;this._ctxAttr=null;this._ctxCss=null;this._ctxFileHook=null;this._cbMsgObj=null;this._isStdoutRedirected=false;this._isStderrRedirected=false;this._useStderr=false;nodeDeps=nd;this._curDir=nd.process.cwd();this._fileSep=nd.path?nd.path.sep:null;this._cbMsgObj={};this._severity=new Severity;this._fileSet=new FileSet(nodeDeps);if(nodeDeps.fsUtils){nodeDeps.fsUtils.setNodeDeps(nodeDeps,this._Utils)}this._writer=new Writer(nodeDeps,this._getMsgCtx());this._fileIndex=new FileIndex(this._Utils);_getPackageInfo(runMode);this._initMacros();if(this._isCLI){this._isStdoutRedirected=!process.stdout.isTTY;this._isStderrRedirected=!process.stderr.isTTY;this._useStderr=this._isStdoutRedirected&&!this._isStderrRedirected;this._useStderr=false}};JafCore.prototype.start=function(){var rc;try{rc=this._startupValidation()}catch(e){rc=e.stack.indexOf("\n");rc=e.stack.indexOf("\n",rc+1);this._error("[JAF-9000]: internal error - "+e.stack.substring(0,rc));rc=1}if(rc){if(rc>0){this._error("Terminated due to a previous error");if(this._events){this._events.removeAllListeners()}rc=-1}else{rc=0}return this._transformRetCodeFinal(rc)}this._isInfo=this._verboseMode||this._debugMode;rc=0;if(this._rules.getActiveRuleCount()>0){if(!this._stats.errors){this._displayStartMsg();if(this._isCLI){if(this._watchSet){this._watchFiles();return 99}else{this._startLifeCycle()}}else{return 0}}if(this._isCLI){this._displayCliFinalStats();if(!this._unitTest){rc=this._stats.totalIssues}}}else{this._info("No active rules! Audit teminated.")}return this._transformRetCodeFinal(rc)};JafCore.prototype._watchFiles=function(){let files=this._config.getFiles();let watch=new nodeDeps.Watch(files[0],this._watchCB,nodeDeps,this._getMsgCtx());watch.watchFiles();console.log("Watching...")};JafCore.prototype._watchCB=function(){};JafCore.prototype._listenerSetup=function(){if(!this._isCLI&&!this._events){this._events=new(require("../lib/JafEvents"))}return this._events};JafCore.prototype.enableRule=function(){return false};JafCore.prototype._transformRetCode=function(rc){if(this._isCliMode){let o=this._retCode;if(o!==AUTO){if(o===ERRORS){rc=rc>=0?0:-1}else if(typeof o==="number"){rc=o}else if(Array.isArray(o)){let n=0;for(let i=0;i<o.length;i++){n+=this._stats.totalSevStats[o[i]]}rc=n}}}return rc};JafCore.prototype._transformRetCodeFinal=function(rc){var xrc=this._transformRetCode(rc);if(this._verboseMode||this._debugMode){this._info(`RC: ${xrc} (raw = ${rc})`)}return xrc};JafCore.prototype._startLifeCycle=function(){if(!this._LF_start()){return}this._processActiveFileSet();this._auditJSLinkedFiles();this._auditCSSLinkedFiles();return this._LF_closedown()};JafCore.prototype._LF_start=function(){var hookRC=true;this._curContainer=null;if(this._dryRunSet){this._info("\n------ Dry Run: Based on the configuration the following files would have been audited/ignored ------")}else{this._jafLib=new JafLib(nodeDeps,this._fileSet,this._getMsgCtx(),this._runMode,VERSION,this._metaLib.getRevisionInfo().jetVersion,this._config);this._rules.setJafLib(this._jafLib);if(this._rules.isTypeRegistered(REG.PHASE_STARTUP)){this._debug("\n** Firing hook rules : "+REG.PHASE_STARTUP+"'");hookRC=this._fireHookRules(REG.PHASE_STARTUP);this._jafLib.disable();if(typeof hookRC==="boolean"&&!hookRC){this._console("\nAudit terminated by 'startup' hook rule","I");return false}}if(this._rules.isTypeRegistered(REG.PHASE_STARTUP_RULEPACK)){this._debug("\n** Firing hook rules : phase '"+REG.PHASE_STARTUP_RULEPACK+"'");hookRC=this._fireRPHookRules(REG.PHASE_STARTUP_RULEPACK)}if(this._rules.isTypeRegistered(REG.PHASE_START_AUDIT)){this._debug("\n** Firing hook rules : phase '"+REG.PHASE_START_AUDIT+"'");hookRC=this._fireHookRules(REG.PHASE_START_AUDIT);this._jafLib.disable();if(typeof hookRC==="boolean"&&!hookRC){this._console("\nAudit terminated by 'startaudit' hook rule","I");return false}}this._flushIssues(null,true);this._stats.addSevStatsToTotals();if(typeof hookRC==="boolean"&&!hookRC){this._console("\nAudit terminated by ruleset startup hook rule","I");return false}}this._spinner=new nodeDeps.spinner;this._spinner.start("Reading files...");return true};JafCore.prototype._LF_closedown=function(){if(elapsed&&!this._isAMD){elapsed=nodeDeps.process.hrtime(elapsed)}this._curFile=this._curFileType=null;if(this._dryRunSet){if(this._stats.totalFilesAudited===0){this._info("\n------------ Dry Run: No files were selected for audit!")}return}this._stats.clearSevStats();if(this._rules.isTypeRegistered(REG.PHASE_END_AUDIT)){this._debug("\n** Firing hooks : phase 'endaudit'");this._fireHookRules(REG.PHASE_END_AUDIT)}if(this._rules.isTypeRegistered(REG.PHASE_CLOSEDOWN_RULEPACK)){this._debug("\n** Firing hooks : phase 'closedownRP'");this._fireRPHookRules(REG.PHASE_CLOSEDOWN_RULEPACK)}this._curFile=this._curFileType=null;if(this._rules.isTypeRegistered(REG.PHASE_CLOSEDOWN)){this._debug("\n** Firing hook rules : phase closedown");this._fireHookRules(REG.PHASE_CLOSEDOWN)}this._curContainer=null;this._flushIssues(null,true);this._stats.addSevStatsToTotals();if(this._outFormat===OUTFMT.JSON||this._isAPI&&this._isAsyncTemp){this._flushFinalJson()}if(this._isAPI&&this._isAsyncTemp){return this._json}};JafCore.prototype._processActiveFileSet=function(){var filePath;elapsed=this._isCliOrApi?nodeDeps.process.hrtime():0;while(true){this._curContainer=null;if(filePath=this._fileSet.getNextFile()){this._processActiveFile(filePath);continue}this._spinner.stop();break}};JafCore.prototype._processActiveFile=function(filePath){var fileObj,fileType,isUrl,resp,data;this._stats.totalFilesSelected++;this._rules.setJSCommentCallback(null);fileObj=false;if(typeof filePath==="object"){fileObj=filePath;if(!fileObj.data){return}fileObj.name=fileObj.name||"*unspecified filename*";filePath=fileObj.name;fileType=fileObj.type?fileObj.type:_extractFileType(fileObj.name,true);if(!FILETYPE.isFileTypeSupportedInObj(fileType)){return}}isUrl=typeof filePath==="string"&&filePath.startsWith("http");if(!fileObj){fileType=_extractFileType(filePath)}if(!FILETYPE.isFileTypeSupported(fileType)){if(this._isInfo){this._info(`ignoring unsupported file type (.${fileType}): ${filePath}`)}return}else if(this._targFiletypes.length&&!this._targFiletypes.includes(fileType)&&fileType!==FILETYPE.ZIP){if(this._isInfo){this._info(`ignoring untargeted file type (.${fileType}): ${filePath}`)}return}this._handleStyles=this._handleJS=true;if(this._isInfo){this._info(this._dryRunSet?filePath:"\n** Reading "+(isUrl?"resource":fileObj?"data-obj-> ":"file")+" "+(fileObj?fileObj.name:"'"+filePath+"'"))}if(fileObj){data=fileObj.data}else if(isUrl){resp=this._processResource(filePath);if(resp&&resp.statusCode===200){data=resp.body;this._stats.totalUrlsAudited++}else{return}}else{data=this._readFile(filePath,fileType===FILETYPE.ZIP)}this._auditActiveFile(filePath,fileType,isUrl,data)};JafCore.prototype._auditActiveFile=function(filePath,fileType,isUrl,data){var rc,tempFile;this._curFile=filePath;this._inZip=false;this._rawData=data;this._data=this._suppData=null;this._stats.totalFilesAudited++;if(this._dryRunSet){return}this._stats.clearSevStats();if((this._unitTest||this._config.getAppendFileList())&&this._outFormat===OUTFMT.JSON){this._noteFileSet(filePath)}this._curFileType=fileType;if(fileType===FILETYPE.HTML||fileType===FILETYPE.CSS||fileType===FILETYPE.JS||fileType===FILETYPE.TS||fileType===FILETYPE.TSX){if(data){this._spinner.setText("Auditing: "+filePath);if(fileType===FILETYPE.HTML||fileType===FILETYPE.CSS){this._auditHtml(data)}else if(fileType===FILETYPE.JS){this._auditJS(data)}else if(FILETYPE.isFileTypeTsOrTsx(fileType)){this._auditTS(data)}}}else if(fileType===FILETYPE.JSON){this._auditJson(filePath,data)}else if(fileType===FILETYPE.MD){this._auditMarkdown(filePath,data)}else if(fileType===FILETYPE.ZIP){this._inZip=true;this._loadComponentSupport();rc=this._compSvcs.writeZipBufferToFile(data);if(typeof rc==="boolean"&&rc){tempFile=this._compSvcs.getLastZipFilePath();this._curContainer=isUrl?this._compSvcs.stripUrlQuery(filePath):filePath;this._auditComponentZip(tempFile);this._stats.addSevStatsToTotals();return}else{this._error(`Failed to create local temp zip file from URL '${filePath}' : ${rc.message}`);this._isOk=false}}this._stats.addSevStatsToTotals()};JafCore.prototype._auditHtml=function(data){var rc,topNode;this._attrIndex=0;this._data=data;this._rawData=!this._inZip?data:null;this._htmlParserCb=this._getPageCallbacks();this._reporter.clearIssues();this._fileIndex.clear();if(this._curFileType===FILETYPE.CSS){this._auditStyleSheet(data);return}this._debug("Parsing HTML...");this._htmlTree=new HtmlTree(nodeDeps,this._getAppCtx(),HtmlParser,this._DomUtils);this._htmlTree.parse(data);topNode=this._htmlTree.getTopNode();if(topNode===null){this._debug("File contains no useful data - '"+this._curFile+"'");return}if(this._config.getJetPagesOnly()){if(!this._DomUtils.isJetPage({node:topNode})){this._debug("File ignored - not a JET page and jetOnlyPages=true - '"+this._curFile+"'");return}};this._startIndex=0;this._endIndex=0;rc=this._fireHookFileRules(this._htmlTree.getTopNode());if(typeof rc==="boolean"&&!rc){return}this._setupCssParser();this._htmlTree.walk(this._htmlParserCb)};JafCore.prototype._getPageCallbacks=function(){var _self=this;var inScript=false,inScriptJS=false,inHeadSect=false,inHead=false,inStyle=false,inStyleSect=false,inLink=false;var inScriptJSLink=false,inScriptCSSLink=false,JsScriptData=null;var ignoreScript=false;var isDirective=false;var tagLower,temp;var ctx;this._inScriptJs=false;this._inScriptJsData=null;if(this._htmlParserCb){return this._htmlParserCb};return this._rules.filterHtmlCallbacks({onOpenTagname:function(node,tagName){if(ignoreScript||inScript){return}_self._curTagNode=node;if(!_self._curTagNode){_self._assert("tag \""+tagName+"\" has no node")}tagName=tagName.endsWith("\"")||tagName.endsWith("'")?tagName.substr(0,tagName.length-1):tagName;_self._currentTag=tagName;tagLower=tagName.toLowerCase();inHeadSect=inHeadSect?inHeadSect:tagLower==="head";inHead=tagLower==="head";inScript=tagLower==="script";inStyleSect=inStyleSect?inStyleSect:tagLower==="style";inStyle=tagLower==="style";inLink=tagLower==="link";if(inScript){inScriptJS=_self._htmlTree.isScriptExecutable(_self._curTagNode);inScriptJSLink=_self._htmlTree.isScriptJSLink(_self._curTagNode);if(inScriptJS&&!inScriptJSLink){if(_self._curTagNode.children&&_self._curTagNode.children.length){if(_self._curTagNode.children[0].type==="text"){JsScriptData=_self._curTagNode.children[0].data;JsScriptData=_getScriptData(_self._data,_self._curTagNode.children[0].startIndex,_self._curTagNode.endIndex);if(typeof JsScriptData==="string"){_self._jsNode=_self._curTagNode.children[0];_self._startJsPosition=_self._fileIndex.getRowCol(_self._data,{start:_self._jsNode.startIndex,end:_self._jsNode.endIndex},"js");_self._startJsPosition.startIndex=_self._jsNode.startIndex;_self._startJsPosition.endIndex=_self._jsNode.endIndex;if(_beginsWithNL(JsScriptData,_self._Utils)){_self._startJsPosition.col=1;_self._startJsPosition.row++;temp=_self._clearNL(JsScriptData);JsScriptData=temp.text;_self._startJsPosition.startIndex+=temp.stripped;_self._startJsPosition.endIndex+=temp.stripped}}else{JsScriptData=false}}else{JsScriptData=null}}}if(inScriptJSLink&&_self._followLinks&&_self._handleJS){_self._addJSLinkToStack(inScriptJSLink)}}else if(inLink){inScriptCSSLink=_isLinkCSSLink(_self._curTagNode);if(inScriptCSSLink&&_self._followLinks&&_self.handleStyles){_self._addStyleSheetLinkToStack(inScriptCSSLink)}}_self._reporter.setParseData(tagName,"tag");_self._startIndex=_self._curTagNode.startIndex+1;_self._endIndex=_self._startIndex+tagName.length-1;ctx=_self._ctxTag;ctx.position={start:_self._startIndex,end:_self._endIndex};ctx.tag=tagName;ctx.node=_self._curTagNode;ctx.tagNode=_self._curTagNode;ctx.data=_self._data;ctx.suppData=_self._suppData;ctx.elemStack=_self._htmlTree.getElemStack();ctx.utils.DomUtils=_self._DomUtils;ctx.NodeTypes=NodeType;if((tagLower==="script"||tagLower==="link")&&_self._rules.isTypeRegistered(tagLower)){ctx.type=tagLower;ctx.ojTag=ctx.ojNS=false;if(tagLower==="script"&&JsScriptData){ctx.suppData={data:JsScriptData}}_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,ctx.suppData?ctx.suppData.data:null)}if(_self._rules.isTypeRegistered(REG.ELEM)){ctx.type=REG.ELEM;ctx.ojTag=_self._metaLib.isJetTag(tagName);ctx.ojNS=ctx.ojTag||ctx.utils.DomUtils.isNamespaceTag(tagName);_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}ctx.type=tagLower.startsWith("oj-")?"ojtag":"tag";if(_self._rules.isTypeRegistered(ctx.type)){ctx.ojTag=_self._metaLib.isJetTag(tagName);ctx.ojNS=ctx.ojTag||ctx.utils.DomUtils.isNamespaceTag(tagName);_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}if(tagName.indexOf("-")>0||tagName==="template"||tagName==="style"){if(_self._rules.isTypeRegisteredAsElemName("<"+tagName+">")){ctx.type="<"+tagName+">";ctx.ojTag=_self._metaLib.isJetTag(tagName);ctx.ojNS=ctx.ojTag||ctx.utils.DomUtils.isNamespaceTag(tagName);_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}}if(_self._rules.isTypeRegistered(REG.WEBCOMP)){let jwc=_self._metaLib.isJetTag(tagName);let awc=!jwc?_self._metaLib.isComponentTag(tagName):false;if(jwc||awc){ctx.type=REG.WEBCOMP;ctx.ojTag=jwc;ctx.ojNS=true;_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}}if(_self._rules.isTypeRegistered(REG.GLOBTAG)&&_self._DomUtils.isCommonElem(tagName)){ctx.type=REG.GLOBTAG;ctx.ojTag=ctx.ojNS=false;_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}if(_self._metaLib.isBindingTag(tagName)){ctx.type=REG.BINDING_TAG;ctx.ojTag=ctx.ojNS=true;_self._rules.fireRules(ctx,tagName,_self._curFile,_self._curFileType,null)}this._attrIndex=0},onCloseTag:function(node,tagName){tagLower=tagName.toLowerCase();if(tagLower==="head"){inHead=inHeadSect=false}if(tagLower==="script"){inScript=ignoreScript=inScriptJS=inScriptJSLink=JsScriptData=false}if(tagLower==="style"){inStyle=inStyleSect=false}if(tagLower==="link"){inLink=inScriptCSSLink=false}if(_self._currentTag){_self._lastTag=_self._currentTag;_self._currentTag=null}_self._curTagNode=null},onAttribute:function(node,attrName,attrValue){var attrNameLower=attrName.toLowerCase();var attrRawValue,rowcol,issue;var isElemAttrReg,isAttrExprReg,isAttrOnlyReg;var attrType,elemAttrType;if(attrName.length===1){var invChar=attrName==="\""?"double-quote":attrName==="'"?"single-quote":attrName;if(attrName!==invChar){rowcol=_self._DomUtils.getAttrPosition(_self._data,node,attrName);issue=new Issue("Unexpected "+invChar+" found");_self._reportJafIssue(issue,RULE_HTML_DIAGNOSE,rowcol.row,rowcol.col,rowcol.start,rowcol.end);_self._stats.parseErrors++;if(_self._debugMode||_self._verboseMode){_self._info("[PARSE ERROR(1)] : FILE "+(_self._curFile?_self._curFile:"N/A")+" "+_self._stats.parseErrors)}return}}else if(attrName.endsWith("<")){rowcol=_self._DomUtils.getAttrPosition(_self._data,node,attrName);issue=new Issue(`Syntax error on elem '${node.name}' - missing end '>' perhaps?`);_self._reportJafIssue(issue,RULE_HTML_DIAGNOSE,rowcol.row,rowcol.col,rowcol.start,rowcol.end);return}if(attrValue&&attrValue.length&&_self._isRawAttrs){attrRawValue=_self._getAttrRawValue(_self._data,_self._getAttrIndex(_self._data,node.startIndex,attrName),attrName,attrValue)}if(ignoreScript){return}if(inScript&&attrName==="type"){if(attrValue==="text/html"){ignoreScript=true;return}}if(ignoreScript){return}if(!_self._currentTag){_self._info("** WARNING - no tag for attribute "+attrName+" (value "+attrValue+")");return}_self._reporter.setParseData(attrName,"attr");attrNameLower=attrNameLower.charAt(0)===":"?attrNameLower.substr(1):attrNameLower;ctx=_self._ctxAttr;ctx.type=attrNameLower==="class"?"class":attrNameLower==="style"?"style":inScript&&attrNameLower==="type"?"type":attrName.startsWith("on-oj-")?"event":"attr";if(ctx.type==="attr"&&attrNameLower.startsWith("on-")&&_self._metaLib.isWCTag(_self._currentTag)){ctx.type="event"}if(ctx.type==="attr"||ctx.type==="event"){temp=attrName.startsWith(":")?attrName.substring(1):attrName;elemAttrType=`<${_self._curTagNode.name}|${temp}>`;isElemAttrReg=_self._rules.isTypeRegistered(elemAttrType);attrType=`<${temp}=>`;isAttrOnlyReg=_self._rules.isTypeRegistered(attrType);isAttrExprReg=_self._rules.isTypeRegistered(REG.ATTREXPR)}if(_self._rules.isTypeRegistered(ctx.type)||isAttrExprReg||isElemAttrReg||isAttrOnlyReg){rowcol=_self._DomUtils.getAttrPosition(_self._data,node,attrName);ctx.tag=_self._currentTag;ctx.ojTag=_self._metaLib.isJetTag(_self._currentTag);ctx.position={line:rowcol.row,col:rowcol.col,start:rowcol.start,end:rowcol.end},ctx.tagNode=_self._curTagNode;ctx.data=_self._data;ctx.elemStack=_self._htmlTree.getElemStack();ctx.utils.DomUtils=_self._DomUtils;if(_self._curFileType==="html"||_self._curFileType==="css"){ctx.utils.CssUtils=CssUtils}ctx.ojNS=ctx.ojTag||ctx.utils.DomUtils.isNamespaceTag(ctx.tag);ctx.NodeTypes=NodeType;_self._rules.fireRules(ctx,attrName,_self._curFile,_self._curFileType,_self._isRawAttrs?{val:attrValue,rawval:attrRawValue}:attrValue)}else{return}if(ctx.type==="attr"&&_isAttrExpr(attrValue)&&isAttrExprReg){ctx.type=REG.ATTREXPR;_self._rules.fireRules(ctx,attrName,_self._curFile,_self._curFileType,_self._isRawAttrs?{val:attrValue,rawval:attrRawValue}:attrValue);ctx.type="attr"}if(ctx.type==="attr"||ctx.type==="event"){if(isElemAttrReg){ctx.type=elemAttrType;_self._rules.fireRules(ctx,attrName,_self._curFile,_self._curFileType,_self._isRawAttrs?{val:attrValue,rawval:attrRawValue}:attrValue)}if(isAttrOnlyReg){ctx.type=attrType;_self._rules.fireRules(ctx,attrName,_self._curFile,_self._curFileType,_self._isRawAttrs?{val:attrValue,rawval:attrRawValue}:attrValue)}}},onText:function(node,text){if(inHead){}else if(ignoreScript){_self._debug("[debug] text in script ignored ("+_self._curFile+")")}else if(inStyle){if(text.trim().length>0){if(_self._handleStyles){_self._startCssPosition=_self._fileIndex.getRowCol(_self._data,{start:node.startIndex,end:node.endIndex},"css");if(_beginsWithNL(text,_self._Utils)){_self._startCssPosition.col=1;_self._startCssPosition.row++}let adjust=_self._clearNL(text);_self._startCssPosition.index=node.startIndex+adjust.stripped;text=adjust.text;_self._parseCss(text)}}}else if(inScript&&inScriptJS&&JsScriptData){if(_self._handleJS){if(JsScriptData.length>0){_self._inScriptJs=true;_self._inScriptJsData=JsScriptData;_self._parseJS(JsScriptData,function(treenode){_self._fireHookFileRules(treenode,null)});_self._inScriptJs=false;_self._inScriptJsData=null}JsScriptData=null}}_self._htmlParserCb.onCloseTag(node,inStyle?"style":inScript?"script":inLink?"link":"what")},onEnd:function(){_self._flushIssues(_self._data)},onComment:function(node,text){if(inScript||ignoreScript||inStyle){return}if(!_self._rules.isTypeRegistered(REG.COMMENT)){return}_self._startIndex=node.startIndex;_self._endIndex=node.endIndex;_self._treeNode=node;text=text.trim();temp=_self._currentTag?_self._currentTag:"";_self._rules.fireRules({type:REG.COMMENT,ojTag:temp&&_self._metaLib.isJetTag(temp),position:{start:_self._startIndex,end:_self._endIndex},tag:temp?temp:null,elemStack:_self._htmlTree.getElemStack(),node:_self._treeNode,tagNode:_self._curTagNode,data:_self._data,suppData:_self._suppData,utils:{DomUtils:_self._DomUtils},NodeTypes:NodeType},null,_self._curFile,_self._curFileType,text)},oncommentend:function(){},oncdatastart:function(){},oncdataend:function(){},onProcessingInstruction:function(node,data){var text,i;if(ignoreScript||inScript){return}if(!_self._rules.isTypeRegistered(REG.PROCSTMT)){return}_self._treeNode=node;if(!_self._treeNode){_self._assert("procstmt '"+data+"' has no node")}text=data?data.trim():data;temp=text.substr(1);i=_self._Utils.getIndexToWhitespace(temp);temp=temp.substr(i+1).trim();if(temp.charAt(temp.length-1)==="?"){temp=temp.substr(0,temp.length-1)}_self._rules.fireRules({type:REG.PROCSTMT,ojTag:false,position:{start:_self._startIndex,end:_self._endIndex},tag:null,node:_self._treeNode,tagNode:_self._curTagNode,suppData:_self._suppData,elemStack:_self._htmlTree.getElemStack(),utils:{DomUtils:_self._DomUtils},NodeTypes:NodeType},text,_self._curFile,_self._curFileType,temp)},onDirective:function(node,data){if(ignoreScript||inScript){return}if(data.toLowerCase().startsWith("!doctype")){if(!_self._rules.isTypeRegistered(REG.DOCTYPE)){return}}else{if(!_self._rules.isTypeRegistered(REG.DIRECTIVE)){return}isDirective=true}_self._treeNode=node;if(!_self._treeNode){_self._assert("directive \""+data+"\" has no node")}temp=data?data.trim():data;temp=data?data.substr(8).trim():data;_self._rules.fireRules({type:isDirective?REG.DIRECTIVE:REG.DOCTYPE,ojTag:false,position:{start:_self._startIndex,end:_self._endIndex},tag:null,node:_self._treeNode,tagNode:_self._curTagNode,rawData:_self._rawData,data:_self._data,suppData:_self._suppData,elemStack:_self._htmlTree.getElemStack(),utils:{DomUtils:_self._DomUtils},NodeTypes:NodeType},data,_self._curFile,_self._curFileType,temp)}})};JafCore.prototype._auditJSLinkedFiles=function(){var link,data;if(!this._JSLinkStack.length){return}this._info("\n** Auditing script links");this._fileSet.setFiles(this._JSLinkStack,this._config.getExclude(),this._getMsgCtx());while(true){link=this._fileSet.getNextFile();if(!link){return}this._info("\n** Reading link '"+link+"'");data=this._readFile(link);if(data){this._auditJS(data)}else{}}};JafCore.prototype._auditCSSLinkedFiles=function(){var link,data,i;for(i=0;i<this._CSSLinkStack.length;i++){link=this._CSSLinkStack[i];this._info("\n** Reading link '"+link+"'");data=this._readFile(link);if(data){this._auditStyleSheet(data)}}};JafCore.prototype._auditStyleSheet=function(data){this._reporter.clearIssues();this._fileIndex.clear();this._startCssPosition={row:1,col:1,index:0};this._data=data;this._rawData=!this._inZip?data:null;this._parseCss(data);this._flushIssues(data)};JafCore.prototype._addStyleSheetLinkToStack=function(link){var stylePath;if(!this._isCLI){return}if(link.toLowerCase().startsWith("http")){this._debug("ignoring remote stylesheet link '"+link+"'");return}if(nodeDeps.path.basename(link).startsWith("oj-alta")){this._debug("ignoring JET stylesheet link '"+link+"'");return}stylePath=nodeDeps.path.join(nodeDeps.path.dirname(this._curFile),link);if(this._CSSLinkStack.indexOf(stylePath)<0){if(nodeDeps.fsUtils.fileExists(stylePath)){this._CSSLinkStack.push(stylePath);this._debug("pushing stylesheet link '"+stylePath+"'")}else{this._warn("\nstylesheet not found - '"+stylePath+"'"+" (linked from '"+this._curFile+"'")}}};JafCore.prototype._addJSLinkToStack=function(path){var path;if(!this._isCLI){return}if(path.toLowerCase().startsWith("http")){this._debug("ignoring remote JavaScript <script> link '"+path+"'");return}path=nodeDeps.path.join(nodeDeps.path.dirname(this._curFile),path);if(this._JSLinkStack.indexOf(path)<0){if(nodeDeps.fsUtils.fileExists(path)){this._JSLinkStack.push(path);this._debug("pushing JS link '"+path+"'")}else{this._warn("\nJavaScript <script> src link not found - '"+path+"'"+" (linked from '"+this._curFile+"'")}}};JafCore.prototype._auditJson=function(filePath,data){var fileName;this._rawData=this._data=data;fileName=this._isAMD?filePath:nodeDeps.path.basename(filePath);if(fileName===COMPONENT_JSON){this._auditComponentJson(filePath);this._flushIssues();return}if(!data){return}if(fileName===CONFIG_FILE||fileName===CONFIG_FILE_OJET){return}this._parser.parse(data,this._curFile,this._curFileType);this._flushIssues(data)};JafCore.prototype._auditMarkdown=function(filePath,data){if(!data){return}this._rawData=this._data=data;this._parser.parse(data,this._curFile,this._curFileType);this._flushIssues(data)};JafCore.prototype._auditComponentZip=function(filePath){var files,fileType,resp,rc,endZip;this._reporter.clearIssues();this._fileIndex.clear();files=this._compSvcs.getZipContents(filePath);if(files instanceof Error){files=files.message}if(this._debugMode){if(typeof files==="string"){this._debug("ZIP ERROR : "+files)}else{this._debug("Zip contents ("+filePath+" : "+this._curFile+")");this._debugZipContents(files)}}this._zipFileObjs=files;this._startIndex=0;this._endIndex=0;this._curFileType=FILETYPE.ZIP;this._rawData=null;rc=this._fireHookFileRules(files);if(typeof rc==="boolean"&&!rc){this._compSvcs.deleteZipFile();this._flushIssues();this._flushContainerIssuesAsObjects();return}this._rawData=this._data=null;if(Array.isArray(files)){this._iterateOverZipContents(files,function(obj,path){if(endZip){return}fileType=_extractFileType(obj.name);this._debug("zip entry -> "+path+obj.name);if(FILETYPE.isFileTypeSupportedInZip(fileType)&&this._targFiletypes.includes(fileType)){this._rules.setJSCommentCallback(null);this._curFileType=fileType;this._curFile=path+obj.name;resp=this._createResponseObj(path+obj.name,fileType);if(resp.body){if(obj.name===COMPONENT_JSON){if(!this._auditComponentJson(null,resp)){endZip=true}this._flushIssues(resp.body)}else if(fileType===FILETYPE.HTML){this._auditHtml(resp.body)}else if(fileType===FILETYPE.JS){this._auditJS(resp.body)}else if(fileType===FILETYPE.JSON){this._auditJson(obj.name,resp.body)}else if(fileType===FILETYPE.CSS){this._auditStyleSheet(resp.body)}}}}.bind(this))}this._compSvcs.deleteZipFile();this._flushContainerIssuesAsObjects()};JafCore.prototype._iterateOverZipContents=function(files,cb,path){var i,obj,path=path||"";for(i=0;i<files.length;i++){obj=files[i];if(obj.isFile&&obj.name===COMPONENT_JSON){cb(obj,path);break}}for(i=0;i<files.length;i++){obj=files[i];if(obj.isFile){if(obj.name!==COMPONENT_JSON){cb(obj,path)}}else{this._iterateOverZipContents(obj.files,cb,obj.path)}}};JafCore.prototype._auditComponentJson=function(resource,resp){var obj,data,rc,compType,fileName;if(!resp){if(resource){if(this._data){data=this._data}else{data=this._readFile(resource);this._data=data}if(!data){return false}fileName=this._isAMD?resource:nodeDeps.path.basename(resource);if(fileName!==COMPONENT_JSON){return}}else{return false}}else if(resp.type===FILETYPE.JSON){data=resp.body;this._data=data}this._curFileType=FILETYPE.JSON;if(this._curFile.indexOf(COMPONENT_JSON)<0){this._curFile=COMPONENT_JSON}obj=this._parser.parseOnly(data,this._curFile,FILETYPE.JSON);if(typeof obj.msg==="string"){this._startIndex=this._endIndex=obj.position}else{this._startIndex=this._endIndex=0}if(this._inZip){this._suppData=obj}this._loadComponentServices();rc=this._fireHookFileRules(obj.ast,obj);if(typeof rc==="boolean"&&!rc){return false}if(obj.msg){return false}switch(obj.obj.type){case"composite":case"core":case"pack":case"reference":case"resource":case"vbcs-pattern":case"vbcs-template":compType=obj.obj.type;break;}this._rules.fireRules({type:"compjson",node:obj.ast,tagNode:null,rawData:this._rawData,data:this._data,suppData:obj,zipContent:this._zipFileObjs},null,this._curFile,FILETYPE.JSON,obj,false);if(!obj.obj.type){compType="composite"}if(compType){this._rules.fireRules({type:"compjson"+"-"+compType,node:obj.ast,tagNode:null,rawData:this._rawData,data:this._data,suppData:obj,zipContent:this._zipFileObjs},null,this._curFile,FILETYPE.JSON,obj,false)}return true};JafCore.prototype._parseCss=function(text){var ret=false;try{this._debug("Parsing CSS...");this._CssLib.parse(text,this._curFile,this._startCssPosition);ret=true}catch(e){for(var i=0;i<e.length;i++){this._console("[Fail]: ("+this._curFile+")\n "+e[i].message,"E");this._stats.parseErrors++;if(this._debugMode||this._verboseMode){this._info("[PARSE ERROR(2)] : FILE "+(this._curFile?this._curFile:"N/A")+" "+this._stats.parseErrors)}}}return ret};JafCore.prototype._cssErrorEvent=function(ev){var opts=this._rules.getRuleOptions(RULE_CSS_DIAGNOSE,JAF_RSI);if(!opts||!opts.enabled){for(var i=0;i<ev.length;i++){this._console("[Fail]: ("+this._curFile+")\n "+ev[i].message,"E");this._stats.parseErrors++;if(this._debugMode||this._verboseMode){this._info("[PARSE ERROR(2)] : FILE "+(this._curFile?this._curFile:"N/A")+" "+this._stats.parseErrors)}}return}var rowWas,rowNow,colWas,colNow,msg;var i,error;for(i=0;i<ev.length;i++){error=ev[i];rowWas=error.line;colWas=error.column;rowNow=rowWas+this._startCssPosition.row-1;colNow=colWas+this._startCssPosition.col-1;msg="("+error.name+") "+this._CssLib.formatMsg(error);this._reportJafIssue(new Issue(msg),RULE_CSS_DIAGNOSE,rowNow,colNow,0+this._startCssPosition.index+error.offset,1+this._startCssPosition.index+error.offset);this._stats.parseErrors++;if(this._debugMode||this._verboseMode){this._info("[PARSE ERROR(3) : FILE "+(this._curFile?this._curFile:"N/A")+" "+this._stats.parseErrors)}}};JafCore.prototype._setupCssParser=function(){this._CssLib.addListener("error",this._cssErrorEvent.bind(this));this._CssLib.addListener("Rule",this._cssRule.bind(this));this._CssLib.addListener("Selector",this._cssSelectorX.bind(this));this._CssLib.addListener("ClassSelector",this._cssSelectorX.bind(this));this._CssLib.addListener("TypeSelector",this._cssSelectorX.bind(this));this._CssLib.addListener("IdSelector",this._cssSelectorX.bind(this));this._CssLib.addListener("PseudoClassSelector",this._cssSelectorX.bind(this));this._CssLib.addListener("SelectorList",this._cssSelectorX.bind(this));this._CssLib.addListener("Atrule",this._cssAtrule.bind(this));this._CssLib.addListener("StyleSheet",this._cssSheet.bind(this))};function _mapSelNodeToRegisterType(node){const SELTYPES={"Selector":"css-selector","SelectorList":"css-sel-list","ClassSelector":"css-sel-class","IdSelector":"css-sel-id","TypeSelector":"css-sel-type","PseudoClassSelector":"css-sel-pseudo"};return SELTYPES[node.type]};JafCore.prototype._cssRule=function(node,ast,list){if(!this._rules.isTypeRegistered("css-rule")){return}var ctx=this._cssPrepCtx("css-rule",node,ast);ctx.offset=this._startCssPosition;ctx.position={line:node.loc.start.line+this._startCssPosition.row-1,col:node.loc.start.column+this._startCssPosition.col-1};this._rules.fireRules(ctx,node,this._curFile,this._curFileType,list,this._curFileType===FILETYPE.HTML)};JafCore.prototype._cssSelectorX=function(node,ast){var type=_mapSelNodeToRegisterType(node);if(!type){return}if(!this._rules.isTypeRegistered(type)){return}var ctx=this._cssPrepCtx(type,node,ast);ctx.offset=this._startCssPosition;ctx.position={line:node.loc.start.line+this._startCssPosition.row-1,col:node.loc.start.column+this._startCssPosition.col-1};this._rules.fireRules(ctx,node,this._curFile,this._curFileType,null,this._curFileType===FILETYPE.HTML)};JafCore.prototype._cssAtrule=function(node,ast){var type,fire,ctx,i;for(i=0;i<2;i++){switch(i){case 0:type="css-@"+node.name;break;case 1:type="css-atrule";break;}fire=this._rules.isTypeRegistered(type);if(fire){if(!ctx){ctx=this._cssPrepCtx(type,node,ast);ctx.offset=this._startCssPosition;ctx.position={line:node.loc.start.line+this._startCssPosition.row-1,col:node.loc.start.column+this._startCssPosition.col-1}}else{ctx.type=type}this._rules.fireRules(ctx,node,this._curFile,this._curFileType,node.name,this._curFileType===FILETYPE.HTML)}}};JafCore.prototype._cssSheet=function(node,ast,list){if(!this._rules.isTypeRegistered("css-sheet")){return}var ctx=this._cssPrepCtx("css-sheet",node,ast);ctx.offset=this._startCssPosition;ctx.position={line:node.loc.start.line+this._startCssPosition.row-1,col:node.loc.start.column+this._startCssPosition.col-1};this._rules.fireRules(ctx,node,this._curFile,this._curFileType,list,this._curFileType===FILETYPE.HTML)};JafCore.prototype._cssPrepCtx=function(type,node,ast){var ctx=this._ctxCss;ctx.type=type;ctx.CssNode=node;ctx.ast=ast;ctx.position={},ctx.tagNode=this._curTagNode,ctx.rawData=this._rawData,ctx.data=this._data,ctx.suppData=this._suppData,ctx.zipContent=this._zipFileObjs,ctx.utils.CssUtils=CssUtils;return ctx};JafCore.prototype._auditTS=function(data,inner){this._debug("Auditing TS...");this._reporter.clearIssues();this._parser.startJsPosition={row:0,col:0,startIndex:0,endIndex:0};this._fileIndex.clear();this._data=data;this._rawData=!this._inZip?data:null;this._parser.parse(data,this._curFile,this._curFileType,inner);this._flushIssues(data)};JafCore.prototype._auditJS=function(data){this._debug("Auditing JS...");var _self=this,rc;this._reporter.clearIssues();this._startJsPosition={row:0,col:0,startIndex:0,endIndex:0};this._fileIndex.clear();this._data=data;this._rawData=!this._inZip?data:null;this._parseJS(data,function(treenode){rc=_self._fireHookFileRules(treenode,null)});_self._fireHookFileRules(null,null);this._flushIssues(data);return rc};JafCore.prototype._parseJS=function(data,cb){var ret=false,rowNow,colNow,issue,opts,arRawComs,isConfigComments;try{this._debug("Parsing JS...");isConfigComments=this._config.getComments();this._Ast=new AST(data,this._config.getEcmaVer(),isConfigComments,this._getMsgCtx());ret=true}catch(e){opts=this._rules.getRuleOptions(RULE_JS_DIAGNOSE,JAF_RSI);if(opts&&opts.enabled){rowNow=e.lineNumber+(this._startJsPosition.row===0?0:this._startJsPosition.row-2);colNow=e.column+(this._startJsPosition.col===0?0:this._startJsPosition.col-1);issue=new Issue("JavaScript syntax - "+e.message);this._reportJafIssue(issue,RULE_JS_DIAGNOSE,rowNow,colNow,e.index+this._startJsPosition.startIndex,e.index+this._startJsPosition.startIndex+1)}else{rowNow=e.lineNumber+(this._startJsPosition.row===0?0:this._startJsPosition.row-2);colNow=e.column+(this._startJsPosition.col===0?0:this._startJsPosition.col-1);console.log("\nJS-DIAGNOSE : ["+rowNow+", "+colNow+"] "+e.message+"\n File -> "+this._curFile)}this._stats.parseErrors++;if(this._debugMode||this._verboseMode){this._info("[PARSE ERROR(4) : FILE "+(this._curFile?this._curFile:"N/A")+" "+this._stats.parseErrors)}}if(ret){if(cb)cb(this._Ast.getProgram());ret=false;try{this._debug("Walking JS...");if(isConfigComments){arRawComs=this._Ast.getRawComments();if(arRawComs&&arRawComs.length){if(!this._comments){this._comments=new Comments(nodeDeps,this._rules,this._getMsgCtx,this._Utils)}this._comments.reset(this._Ast)}}this._Ast.walk(this._AstNodeHandler.bind(this));ret=true}catch(e){this._error("JavaScript walk failure - "+e+" in "+this._curFile)}}return ret};JafCore.prototype._AstNodeHandler=function(node){var coms;if(this._rules.isTypeRegistered(node.type)){if(this._comments){coms=this._comments.isDisabled(node);if(coms&&(!coms.rules||coms.rules.length===0)){return}this._rules.setJSCommentCallback(coms?function(ruleName){var b=coms.rules.includes(ruleName);return!coms.invert?b:!b}:null)}this._rules.fireRules({type:node.type,node:node,position:{offset:this._startJsPosition.startIndex,start:node.start,end:node.end},data:this._Ast.getData(),utils:{AstUtils:this._Ast.getUtils()}},node,this._curFile,this._curFileType,null)}};JafCore.prototype._processResource=function(url){var resp;this._loadComponentServices();resp=this._compSvcs.loadUrl(url);if(resp.statusCode==4242){this._error("Test server not started?");resp.statusCode==999}if(resp.statusCode!==200){this._warn("Server returned status "+resp.statusCode+" for resource '"+url+"'")}return resp};JafCore.prototype._flushIssues=function(data,noZeroIssueFlush){var i,len,issues,issue,rowcol,showContainer;issues=this._reporter.getIssues();len=issues.length;for(i=0;i<len;i++){issue=issues[i];if(issue.index&&issue.index.line!==undefined){rowcol={row:issue.index.line,col:issue.index.col}}else if(data===null||!issue.index||issue.index.start===undefined){rowcol={row:0,col:0}}else{rowcol=this._fileIndex.getRowCol(data,issue.index,this._curFileType)}issue.rowcol=rowcol}if(len){this._sortIssues(issues)}if(!len){if(!noZeroIssueFlush){if(this._isAPI&&!this._isAsyncTemp||this._isAMD){this._flushIssuesAsObjects(issues,data);this._reporter.clearIssues()}}return}if(this._curFile||this._curContainer){this._stats.totalIssueFiles++}this._stats.totalIssues+=len;this._updateSeverityStats(issues);if(this._outFormat===OUTFMT.PROSE&&this._curFile){if(!this._titleShown&&this._config.getTitle()){this._showTitle();this._titleShown=true}if(this._outPath||this._isCLI){showContainer=this._curContainer&&this._curContainer!==this._curFile;this._msg("\n** Audit for "+(this._colorMode?Colors.BRIGHTCYAN(this._curFile):"'"+this._curFile+"'")+(showContainer?" ("+this._curContainer+")":""),"I")}}if(this._isAPI&&this._isAsyncTemp){this._flushIssuesJson(issues,data)}else{switch(this._outFormat){case OUTFMT.JSON:this._flushIssuesJson(issues,data);break;default:this._flushIssuesProse(issues,data);}}this._reporter.clearIssues()};JafCore.prototype._flushIssuesProse=function(issues,data){if(!this._outPath&&(this._isAPI||this._isAMD)){this._flushIssuesAsObjects(issues,data);return}var i,len,issues,issue,msg,fmt;var sev,arrow,diagnostic,container;len=issues.length;for(i=0;i<len;i++){issue=issues[i];fmt=this._config.getProseFormat();if(fmt){msg=this._applyFormat(fmt,issue.severity,this._curFile,issue.msg,issue)}else if(this._outFormat===OUTFMT.LINE){if(this._severity.isBlocker(issue.severity)||this._severity.isCritical(issue.severity)||this._severity.isMajor(issue.severity)){sev=Colors.BRIGHTRED(issue.severity);arrow=Colors.BRIGHTRED(ARROW)}else if(issue.severity===Severity.MINOR){sev=Colors.YELLOW(issue.severity);arrow=Colors.YELLOW(ARROW)}else{sev=Colors.GREEN(issue.severity);arrow=Colors.GREEN(ARROW)}container=this._curContainer&&this._curContainer!==this._curFile?this._curContainer+"/":"";diagnostic=Colors.CYAN(issue.msg);fmt=this._config.getLineFormat();if(!fmt){fmt="\u25CF %s : %m"+(this._msgIdMode?" [%mid]":"")+"\n "+arrow+" %f:%l:%c"}msg=this._applyFormat(fmt,sev,container+this._curFile,diagnostic,issue)}else{fmt="%pos1 %s : %m";msg=this._applyFormat(fmt,issue.severity,"",issue.msg,issue);if(this._verboseMode||this._config.getOptions().ruleName){msg+=" ["+issue.prefix+"-"+issue.msgId+" : "+issue.ruleName+"]"}else if(this._msgIdMode){msg+=" ["+issue.prefix+"-"+issue.msgId+"]"}}if(this._isCLI&&this._outFormat!==OUTFMT.LINE){if(this._severity.isBlocker(issue.severity)||this._severity.isCritical(issue.severity)||this._severity.isMajor(issue.severity)){msg=Colors.BRIGHTRED(msg)}}this._writeIssue(msg)}};JafCore.prototype._applyFormat=function(fmt,sev,file,message,issue){var msg,pos,linecol;pos=issue.rowcol;linecol=pos.row+", "+pos.col;msg=fmt.replace("%pos1","["+linecol+"]");msg=msg.replace("%pos2","("+linecol+")");msg=msg.replace("%mid",issue.prefix+"-"+issue.msgId);msg=msg.replace("%l",pos.row);msg=msg.replace("%c",pos.col);msg=msg.replace("%s",sev);msg=msg.replace("%m",message);msg=msg.replace("%p",issue.prefix);msg=msg.replace("%n",issue.msgId);msg=msg.replace("%r",issue.ruleName);msg=msg.replace("%f",file);return msg};JafCore.prototype._flushIssuesAsObjects=function(issues){var obj,diag,position,i,len,issues,issue,rowcol;var ruleOpts,loadedRule,ruleDescriptType,descriptObj;ruleDescriptType=this._config.getRuleDescriptions();if(this._curContainer!==this._curFile){if(this._curContainer&&!this._containerIssues){this._containerIssues={container:this._curContainer,issues:[]}}}obj={file:this._curFile,issues:[]};if(ruleDescriptType!=="none"){obj.descriptions={}}len=issues.length;for(i=0;i<len;i++){diag={};issue=issues[i];if(!obj.file&&issue.filepath){obj.file=issue.filepath}ruleOpts=this._rules.getRuleOptions(issue.ruleName,issue.rsi);rowcol=issue.rowcol;diag.msg=issue.msg;diag.msgId=issue.prefix+"-"+issue.msgId;diag.severity=issue.severity;diag.rule=issue.ruleName;diag.position=position={};position.row=rowcol.row;position.col=rowcol.col;if(issue.index&&issue.index.start!==undefined){position.index={};position.index.start=issue.index.start;position.index.end=issue.index.end}diag.$hook=ruleOpts&&ruleOpts.$hook?true:false;loadedRule=this._ruleSets.getLoadedRule(issue.rsi,issue.ruleName);if(issue._msgEx){diag.msgEx=issue._msgEx}if(ruleDescriptType==="none"){if(loadedRule){diag.getDescription=loadedRule.getDescription.bind(loadedRule);diag.getShortDescription=loadedRule.getShortDescription.bind(loadedRule)}else{if(issue.ruleName===RULE_HTML_DIAGNOSE){diag.getDescription=function(){return"HTML syntax error."}}else if(issue.ruleName===RULE_JS_DIAGNOSE){diag.getDescription=function(){return"JavaScript syntax error."}}else if(issue.ruleName===RULE_TS_DIAGNOSE){diag.getDescription=function(){return"TypeScript syntax error."}}else if(issue.ruleName===RULE_CSS_DIAGNOSE){diag.getDescription=function(){return"CSS syntax error"}}diag.getShortDescription=diag.getDescription}}else{if(!obj.descriptions[diag.MsgId]){descriptObj={};if(loadedRule){if(ruleDescriptType==="short"||ruleDescriptType==="all"){descriptObj.short=loadedRule.getShortDescription()}if(ruleDescriptType==="long"||ruleDescriptType==="all"){descriptObj.long=loadedRule.getDescription()}}else{var fn;if(issue.ruleName===RULE_HTML_DIAGNOSE){fn=function(){return"HTML syntax error."}}else if(issue.ruleName===RULE_JS_DIAGNOSE){fn=function(){return"Javascript syntax error."}}else if(issue.ruleName===RULE_CSS_DIAGNOSE){fn=function(){return"CSS syntax error"}}else if(issue.ruleName===RULE_INIT_SCHEMA){fn=function(){return"component.json schema violation error"}}if(ruleDescriptType==="short"||ruleDescriptType==="all"){descriptObj.short=fn}if(ruleDescriptType==="long"||ruleDescriptType==="all"){descriptObj.long=fn}}obj.descriptions[diag.msgId]=descriptObj}}obj.issues.push(diag)}this._containerIssues?this._containerIssues.issues.push(obj):this._callbackIssue(obj)};JafCore.prototype._flushContainerIssuesAsObjects=function(){if(this._containerIssues){this._callbackIssue(this._containerIssues);this._containerIssues=null}};JafCore.prototype._flushIssuesJson=function(issues,data){var i,len,issues,issue,rowcol,position,curReport,curIssue,reported;var ruleOpts,ruleDescriptType,descriptObj;if(!this._isCLI&&!this._isAsyncTemp){return}ruleDescriptType=this._config.getRuleDescriptions();if(!this._json){this._json={};this._json.reported=[];this._json.summary={};this._json.messages=[];this._json.run={};if(ruleDescriptType!=="none"){this._json.descriptions={}}}len=issues.length;if(!len){return};reported=this._json.reported;curReport={};if(this._curContainer){curReport.container=this._curContainer}curReport.file=this._curFile;curReport.issues=[];for(i=0;i<len;i++){curIssue={};issue=issues[i];if(!curReport.file&&issue.filepath){curReport.file=issue.filepath}curIssue.severity=issue.severity;curIssue.msg=issue.msg;curIssue.msgId=issue.prefix+"-"+issue.msgId;curIssue.position=position={};ruleOpts=this._rules.getRuleOptions(issue.ruleName,issue.rsi);rowcol=issue.rowcol;position.row=rowcol.row;position.col=rowcol.col;if(issue.index){if(data!==null){position.start=issue.index.start!==undefined?issue.index.start:0;position.end=issue.index.end!==undefined?issue.index.end:0}}curIssue.$hook=ruleOpts&&ruleOpts.$hook?true:false;curIssue.rule=issue.ruleName;if(ruleDescriptType!=="none"){if(!this._json.descriptions[curIssue.msgId]){descriptObj={};if(ruleDescriptType==="short"||ruleDescriptType==="all"){descriptObj.short=this._rules.getRuleDescription(issue.prefix,issue.ruleName,true)}if(ruleDescriptType==="long"||ruleDescriptType==="all"){descriptObj.long=this._rules.getRuleDescription(issue.prefix,issue.ruleName,false)}this._json.descriptions[curIssue.msgId]=descriptObj}}if(issue._msgEx){curIssue.msgEx=issue._msgEx}curReport.issues.push(curIssue)}reported.push(curReport);if(this._unitTest||this._config.getAppendFileList()){this._json.fileset=this._fileSetList}};JafCore.prototype._sortIssues=function(issues){if(!issues){return}issues.sort(function(a,b){if(a.rowcol.row===b.rowcol.row){return a.rowcol.col-b.rowcol.col}return a.rowcol.row-b.rowcol.row})};JafCore.prototype._flushFinalJson=function(){if(!this._json){this._json={};this._json.summary={};this._json.summary.severities={};this._json.messages=[];this._json.run={}}this._createRunSummary(this._json);this._json.messages=this._messageStack;if(this._isAPI&&this._isAsyncTemp){return this._json}if(this._outPath){const JsonFile=require("../lib//outfile");JsonFile.writeFileSyncJson(nodeDeps,this._outPath,this._json)}else{this._console(JSON.stringify(this._json,null,4))}};JafCore.prototype._reportJafIssue=function(issue,ruleName,line,col,start,end){var rulePack=this._rules.getRulePack(JAF_RSI);var ctx={rulePack:rulePack,_rsi:JAF_RSI,ruleName:ruleName,position:{line:line,col:col,start:start,end:end},getMsgId:this._getMsgId.bind(this)};rulePack._setCBCtx(ctx);this._reporter.addIssue(issue,ctx)};JafCore.prototype._createResponseObj=function(filePath,fileType){return{body:this._compSvcs.extractFileFromZip(filePath),type:fileType}};JafCore.prototype._createRunSummary=function(obj){var summary,run,sev,gitInfo;if(!obj){obj={}}obj.summary=summary={};obj.summary.severities=sev={};obj.run=run={};gitInfo=this._metaLib.getRevisionInfo();summary.issues=this._stats.totalIssues;summary.issueFiles=this._stats.totalIssueFiles;summary.errorFiles=this._stats.errorFiles;summary.parseErrors=this._stats.parseErrors;summary.errors=this._stats.errors;summary.warnings=this._stats.warnings;summary.asserts=this._stats.asserts;summary.filesSelected=this._stats.totalFilesSelected;summary.files=this._stats.totalFilesAudited;summary.urls=this._stats.totalUrlsAudited;summary.rulesActive=this._rules.getActiveRuleCount();summary.rulesFired=this._stats.rulesFired;summary.hooksFired=this._stats.hooksFired;if(this._unitTest||this._config.getRulesFired()){summary.packRulesFired=this._stats.packRulesFired}var sevList=this._severity.getSevList(),sevCore,i;for(i=sevList.length-1;i>=0;i--){sevCore=sevList[i];sev[this._severity.map(sevCore)]=this._stats.totalSevStats[sevCore]}if(this._config.getTitle()){run.title=this._applyMacrosToTitle(this._config.getTitle())}run.date=new Date().toUTCString();run.revision=gitInfo.revision;run.tag=gitInfo.revision;run.jetVersion=gitInfo.jetVersion;if(typeof this._configPath==="string"){run.config=this._configPath.replace(/\\/g,"/")}return obj};JafCore.prototype._getAttrIndex=function(data,index,attrName){var i,j,c,ret=-1;if(index<this._attrIndex){index=this._attrIndex}while(true){i=data.indexOf(attrName,index);if(i>=0){j=this._Utils.eatWhitespace(data,i+attrName.length);if(j>=0){c=data.charAt(j);if(c==="="||c===">"||this._Utils.isWhitespace(data.charAt(i))){ret=i;this._attrIndex=j;break}}index=j}else{break}}if(ret<0){this._error("ASSERT: getAttrIndex '"+attrName+"', "+index+", "+this._curFile)}return ret};JafCore.prototype._getAttrRawValue=function(data,index,attrName,attrValue){var ret=null,delim,i;i=index+attrName.length;if(data.charAt(i)==="="){i=this._Utils.eatWhitespace(data,i+1);delim=data.substr(i,1);delim=delim==="'"||delim==="\""?delim:"\"";ret=delim+attrValue+data.charAt(i+attrValue.length+1)}else{ret=attrValue}return ret};JafCore.prototype._fireHookRules=function(phase,ruleCtx,rsi){var rc;ruleCtx=ruleCtx?ruleCtx:this._rules.makeRuleContext();ruleCtx.type=phase;ruleCtx.phase=phase;ruleCtx.utils={};if(phase===REG.PHASE_STARTUP_RULEPACK||phase===REG.PHASE_CLOSEDOWN_RULEPACK){ruleCtx.ojetConfig=nodeDeps.scaffold?nodeDeps.scaffold.getOjetConfig():null}if(phase===REG.PHASE_STARTUP||phase===REG.PHASE_START_AUDIT){if(!ruleCtx.utils.jafLib){ruleCtx.utils.jafLib=this._jafLib.getPublic()}}else if(ruleCtx.utils.jafLib){delete ruleCtx.utils.jafLib}rc=this._rules.fireHookRules(ruleCtx,rsi);return rc};JafCore.prototype._fireHookFileRules=function(node,obj){var ctx;var endfile=!node&&!obj;ctx=this._ctxFileHook;if(this._curFileType!==FILETYPE.JS&&!FILETYPE.isFileTypeTsOrTsx(this._curFileType)&&ctx.utils.AstUtils!==undefined){delete ctx.utils.AstUtils}if(this._curFileType!==FILETYPE.HTML&&this._curFileType!==FILETYPE.JSON&&ctx.utils.DomUtils!==undefined){delete ctx.utils.DomUtils;delete ctx.utils.semVerUtils}if(this._curFileType!==FILETYPE.ZIP&&ctx.zipContent!==undefined){delete ctx.zipContext}ctx.type=endfile?this._inScriptJs?"endscript":"endfile":this._inScriptJs?"startscript":"file";ctx.phase=REG.PHASE_FILE;ctx.filename=this._curFile;ctx.filepath=this._curFile;ctx.filetype=this._curFileType;if(obj){ctx.suppData=obj}if(this._curFileType===FILETYPE.JSON){ctx.position={start:this._parser.startIndex,end:this._parser.endIndex}}else{ctx.setPosition(0,0)}if(this._curFileType===FILETYPE.JS||FILETYPE.isFileTypeTsOrTsx(this._curFileType)||this._inScriptJs){ctx.node=node;if(this._curFileType===FILETYPE.JS||this._inScripts){ctx.utils.AstUtils=this._Ast?this._Ast.getUtils():null}else{ctx.utils.AstUtils=this._parser.getAstUtils()}}else if(this._curFileType===FILETYPE.HTML){ctx.node=node;ctx.utils.DomUtils=this._DomUtils;ctx.NodeTypes=NodeType}else if(this._curFileType===FILETYPE.JSON||this._curFileType===FILETYPE.MD){ctx.node=node}else if(this._curFileType===FILETYPE.ZIP){ctx.zipContent=node}ctx.rawData=this._rawData;ctx.data=this._inScriptJs?this._inScriptJsData:this._data;return this._rules.fireHookRules(ctx)};JafCore.prototype._fireRPHookRules=function(phase){var rsi,packs,ruleCtx,phase,rc;packs=this._ruleSets.getRulePacks();ruleCtx=this._rules.makeRuleContext();for(rsi=0;rsi<packs.length;rsi++){rc=this._fireHookRules(phase,ruleCtx,rsi);if(typeof rc==="boolean"&&!rc){break}}return rc};JafCore.prototype._updateSeverityStats=function(issues){var issues,issue,sevStats,i,len;len=issues.length;sevStats=this._stats.sevStats;for(i=0;i<len;i++){issue=issues[i];switch(this._severity.unmap(issue.severity)){case this._severity.CRITICAL:sevStats.critical++;break;case this._severity.BLOCKER:sevStats.blocker++;break;case this._severity.MAJOR:sevStats.major++;break;case this._severity.MINOR:sevStats.minor++;break;case this._severity.INFO:sevStats.info++;break;}}};JafCore.prototype._dumpFile=function(data){var datalen,line=1,c,i;this._console("\n----------- Dump File ------------","D");datalen=data?data.length:0;for(i=0;i<datalen;i++){c=data.charAt(i);this._console("i="+i+" c="+(c==="\n"?"\\n":c==="\r"?"\\r":c),"D");if(c==="\n"){line++;this._console("NL i="+i+" line="+line,"D");continue}}this._console("\n----------- End Dump ------------\n","D")};JafCore.prototype._getPosition=function(){return{start:this._startIndex,end:this._endIndex}};JafCore.prototype._processCmdLine=function(){var rc,g,i,b;rc=nodeDeps.cmdLine.checkArgs(nodeDeps,this._rtf,this._showHelp.bind(this),this._showVersion.bind(this),this._getMsgCtx());if(!rc||rc==="end"){return rc}this._verboseMode=this._rtf.verboseSet?this._rtf.verboseMode:false;this._debugMode=this._rtf.debugSet?this._rtf.isDebugMode:false;this._dryRunSet=this._rtf.dryRunSet;this._configPath=this._rtf.configPath;this._outPath=this._rtf.outPath;this._outFormat=this._rtf.outFormat;this._srcStack=this._rtf.srcStack;this._base=this._rtf.base;this._followLinksSet=this._rtf.followLinksSet;this._followLinks=this._rtf.followLinksSet?this._rtf.followLinks:true;this._retCode=this._rtf.retCode;this._cliSev=this._rtf.severitySet?this._rtf.cliSev:null;this._colorMode=this._rtf.colorSet?this._rtf.colorMode:true;this._colorSet=this._rtf.colorSet;this._msgIdMode=this._rtf.msgIdModeSet?this._rtf.msgIdMode:false;this._isManual=this._rtf.isManual;this._unitTest=this._rtf.unitTest;if(this._rtf.groupsSet){this._groupsSet=this._rtf.groupsSet;for(i=0;i<this._groupsSet.length;i++){g=this._groupsSet[i];if(!GROUPS.isGroup(g)){if(g.startsWith("jet")||g.startsWith("htm")){this._error("Command line override of 'groups' -> '"+g+"' is not defined!");b=true}}}}if(b){return 0}if(this._verboseMode&&nodeDeps.cmdLine.isCmdLineOptionsSet(this._rtf)){nodeDeps.cmdLine.displayCmdLineOptionsSet(this._rtf,this._getMsgCtx())}return true};JafCore.prototype._dumpRules=function(){var ret=false;if(this._isCLI){if(this._debugMode||this._dryRunSet){return false}if(this._rtf.dumpRulesSet||this._rtf.dumpRulesJsonSet||this._rtf.dumpRulesSonarSet||this._rtf.dumpRulesInternalSet){let OutFile=require("../lib//outfile");if(this._rtf.dumpRulesJsonSet){let rulesObj=this._rules.getRulesJson();if(this._outPath){OutFile.writeFileSyncJson(nodeDeps,this._outPath,rulesObj)}else{console.log(JSON.stringify(rulesObj,null,3))}ret=true}else if(this._rtf.dumpRulesSonarSet){let rulesXML=this._rules.getRulesSonar();if(this._outPath){OutFile.writeFileSyncText(nodeDeps,this._outPath,rulesXML)}else{console.log(rulesXML)}ret=true}else{let rulesProse=this._rules.getRulesProse(this._rtf.dumpRulesInternalSet);if(this._outPath){OutFile.writeFileSyncText(nodeDeps,this._outPath,rulesProse)}else{console.log(rulesProse)}ret=true}}}return ret};JafCore.prototype._dumpCompositeNames=function(){var names,meta,obj,name,i;if(this._dryRunSet){return}names=this._components.getNames();if(!names.length){this._console("[info]: No valid web components declared!","I");return}meta=this._components.getTagMetadata(name);this._console("[info] :--------- Declared Web Components ---------","I");for(i=0;i<names.length;i++){obj=names[i];this._console(` ${obj.name} (${obj.version})`,"I");meta=this._components.getTagMetadata(obj.name);if(meta.implements){this._console(` Impls: ${meta.implements.join(",")}`)}}this._console("[info]: -------- End Declared Web Components ---------\n","I")};JafCore.prototype._startupValidation=function(){var i,path,val,ftype,err,noMetadata=false,jafConfig,rc;if(!(this._isCLI||this._isAPI||this._isAMD)){this._error("*** Unknown run mode!");return 1}if(this._isAPI&&this._isAsync){this._error("*** SYSTEM ERROR - API and Async mode incompatability check!");return 1}if(this._isCliOrApi&&!this._checkNodeVer()){return 1};nodeDeps.jetver.init(nodeDeps);if(this._isCliOrApi&&!this._isManual){this._metaLib=new metaLib(nodeDeps,this._runMode,this._getMsgCtx(),this._Utils)}else if(this._isAMD){if(!this._AmdMeta||!this._AmdMeta.jetMeta){this._error("AMD mode - no Metadata supplied.");return 1}this._metaLib=new metaLib(nodeDeps,this._runMode,this._getMsgCtx(),this._Utils);this._metaLib.setAmdMeta(this._AmdMeta)}if(!this._isManual){this._reporter=new Reporter(this._getMsgCtx())}if(this._isCLI){rc=this._processCmdLine();if(rc==="end"){return-1}if(!rc){return 1}if(this._rtf.cmdMetaHist){nodeDeps.metahist.show(nodeDeps);return-1}if(this._isManual){if(nodeDeps.manual.showBuiltinMsgHelp(nodeDeps,this._rtf.manCheckL,this._getMsgCtx())){return-1}}if(this._rtf.jetverList){nodeDeps.jetver.showList();return-1}if(this._rtf.defList){nodeDeps.defList.showList();return-1}if(this._rtf.cmdNSList){nodeDeps.nslist.showNamespaces();return-1}if(this._rtf.groupList){nodeDeps.grouplist.showBuiltinGroups(nodeDeps,this._rtf.cmdArg,this._getMsgCtx());return-1}if(this._rtf.disList){nodeDeps.dislist.show(nodeDeps,this._rtf.cmdArg,this._getMsgCtx());return-1}if(this._rtf.scaffoldRuleSet){return nodeDeps.scaffoldRule.genRule(this._curDir,this._rtf.scaffoldRuleSet,nodeDeps)?-1:1}this._isOJET=nodeDeps.scaffold.init(this._curDir,nodeDeps,this._getAppCtx());if(this._isOJET){jafConfig=nodeDeps.scaffold.handleOjetConfig(this._rtf.scaffoldSet);if(jafConfig==="error"){return 1}if(this._rtf.scaffoldSet){return-1}}else if(this._isOJETCLI){this._error("OJET CLI configuration file not found in '"+this._curDir+"'");return 1}else if(this._rtf.scaffoldSet){jafConfig=nodeDeps.scaffold.createNonOjetConfig();if(jafConfig==="error"){return 1}return-1}}if(this._isCliOrApi){if(this._configPath!==null){if(typeof this._configPath==="string"){ftype=nodeDeps.fsUtils.getFileType(this._configPath);if(ftype==="d"){path=this._configPath+this._fileSep+CONFIG_FILE_OJET;ftype=nodeDeps.fsUtils.getFileType(path);if(ftype!=="f"){path=this._configPath+this._fileSep+CONFIG_FILE;ftype=nodeDeps.fsUtils.getFileType(path)}this._configPath=path}if(ftype!=="f"){this._error("cannot find configuration file '"+this._configPath+"'");return 1}}}}if(this._isCliOrApi){if(this._configPath===null){this._configPath=nodeDeps.path.join(this._curDir,CONFIG_FILE_OJET);this._configPath=nodeDeps.path.resolve(this._configPath);if(!nodeDeps.fsUtils.fileExists(this._configPath)){this._configPath=nodeDeps.path.join(this._curDir,CONFIG_FILE);this._configPath=nodeDeps.path.resolve(this._configPath)}}let objConfig=typeof this._configPath==="object";this._info((objConfig?"C":"Active C")+"onfig "+(objConfig?"is pre-built object":this._configPath?"is '"+this._configPath+"'":" is not defined"))}this._config=new nodeDeps.Config(nodeDeps,this._base,this._configPath,this._applyMacros.bind(this),this._Rules,this._severity,this._groupsSet,this._cliSev,this._getMsgCtx(),this._getModeCtx(),this._Utils,(verbose,debug)=>{if(!this._rtf.debugSet){this._verboseMode=verbose;this._debugMode=debug}});if(!this._config.isOk()){return 1}if(this._config._config.options.$reg){this._rtf.regListenerTypesSet=true}this._processConfigOptions();if(this._unitTest){this._console("Unit Test Invocation")}this._metaLib.setTheme(this._config.getTheme());if(this._isStdoutRedirected){this._colorMode=false}if(this._isCliMode){if(typeof this._retCode===UNDEF){let copts=this._config._config.options;let prop=typeof copts.retCode!==UNDEF?"retCode":typeof copts.rc!==UNDEF?"rc":null;this._retCode=prop?copts[prop]:AUTO}else{val=this._config.validateRetCode(this._retCode,sev=>{this._error(`command line error : --retCode severity '${sev}' is invalid!`)});if(val||typeof val==="number"){this._retCode=val}else{return 1}}}if(this._rtf.severitySet&&this._cliSev){if(!this._severity.isValidConfigSeverity(this._cliSev)){this._error(`Config entry 'severity' ('${this._cliSev}') is not 'major/minor/blocker/critical/info', 'all', or a remapped severity!`);return 1}}if(this._verboseMode||this._debugMode){this._info(`Mode: ${this._runMode.toUpperCase()}`);this._info("\n---------------\nOriginal Config:\n---------------\n"+(this._config._origConfig?JSON.stringify(this._config._origConfig,null,3):"None!")+"\n")}if(this._rtf.dacSet){console.log("+---------------+\n| Active Config |\n+---------------+\n"+(this._config._config?JSON.stringify(this._config._config,null,3):"None!")+"\n");if(!this._dryRunSet){return-1}}if(this._isManual){val=this._rtf.manCheckL||this._rtf.manCheckS;if(val.startsWith("jet-")||val.startsWith("jaf-")||val.startsWith("oj-")){this._config._config.ruleNames=[]}}if(!this._isAMD&&!this._isManual){this._tmpDir=this._config.getTempDir();this._tmpDir=nodeDeps.path.join(this._tmpDir?this._tmpDir:this._curDir,TEMP_DIR);if(nodeDeps.fsUtils.fileExists(this._tmpDir,true)){this._info("[Info]: Using temp work folder : "+this._tmpDir);nodeDeps.fsUtils.deleteFolder(this._tmpDir,false)}else{this._info("Creating temp work folder : "+this._tmpDir);rc=nodeDeps.fsUtils.createFolder(this._tmpDir);if(typeof rc!=="boolean"){this._error(rc);return 1}}}if(this._isCLI){this._metaLib.setStylesets(this._config.getStylesets())}if(this._isAMD&&this._AmdMeta.ccaMeta){this._processAMDUserCCAMeta(this._AmdMeta.ccaMeta);if(this._components.isOk()){this._metaLib.setComponentsLib(this._compSvcs,this._components)}}if(!this._isManual){if(this._isCliOrApi){if(!this._srcStack||this._srcStack.length===0){this._srcStack=this._config.getFiles();if(!Array.isArray(this._srcStack)){this._srcStack=[]}if(this._srcStack.length===0){if(!this._isAPI){path=nodeDeps.path.resolve("./*.*");this._srcStack.push(path)}}}this._fileSet.setFiles(this._srcStack,this._config.getExclude(),this._getMsgCtx())}}if(this._isCliOrApi){val=this._rtf.jetverSet?this._rtf.jetverSet:this._config.getJetVer();this._metaPath=val.split(".");this._metaPath=this._metaPath[0]+"."+this._metaPath[1]+".0";this._metaPath=nodeDeps.path.join(__dirname,"../meta",this._metaPath,META_FILE_OBJ);this._info("[info]: Metadata path (for "+val+") is '"+this._metaPath+"'");if(noMetadata||!this._metaLib.loadMeta(this._metaPath)){return 1}}if(this._verboseMode){this._metaLib.displayImpls()}this._macros.$jetver=this._metaLib.getRevisionInfo().jetVersion;this._macros.$jafconfig=this._configPath;if(this._isCliOrApi&&!this._isManual){if(!this._outPath){val=this._config.getOutPath();if(val){if(typeof val==="string"&&val.length){this._outPath=val==="$noout"?null:val}else if(typeof val!=="string"){this._error("Config 'outPath' '"+val+"' is not a valid path - ignored");return 1}}}if(this._outPath==="$noout"){this._outPath=null}else if(this._outPath){this._info("[info]: Output path is '"+this._outPath+"'","I");if(nodeDeps.fsUtils.getFileType(this._outPath)==="d"){this._error("Config 'outPath' "+this._outPath+"' is a dir and not a filename");return 1}if(!this._dryRunSet){err=this._writer.open(this._outPath);if(err){this._error("Output path error - reverting to console : \n "+err.message)}}}if(!this._outFormat){val=this._config.getFormat();this._outFormat=val?val:OUTFMT.PROSE}}if(this._isCliOrApi){if(!this._rtf.followLinksSet){this._followLinks=!!this._config.getFollowLinks()}if(this._verboseMode){this._info("[info]: "+(this._followLinks?"Following":"Not following")+" stylesheet/script <link>'s")}}if(this._config.getRunRuleNames()&&!this._isManual){val=this._config.getGroups();if(val.length>1||val.length===1&&val[0]!=="all"){this._error("Config \"groups\" and \"ruleNames\" are mutually exclusive");return 1}}val=this._config.getGroups();if(val.includes("jet-csp")&&!this._config.isBuiltinCspRules()){this._error("group 'jet-csp' specified, but CSP builtin rulepack not enabled");return 1}for(i=0;i<val.length;i++){if(val[i].startsWith("jet-")&&val[i]!=="jet-csp"){if(!this._config.isBuiltinJetRules()){this._error("group '"+val[i]+"' specified, but JET builtin rulepack not enabled");return 1}}}if(!this._isManual){this._tabs=require("../lib/tabs");this._tabs=new this._tabs;if(!this._tabs.validate(this._config.getTabs(),this._getMsgCtx())){return 1}this._fileIndex.setTabHandler(this._tabs);this._Utils.setTabHandler(this._tabs)}this._userDefs=this._config.getUserDefs();this._reporter.setOutFormat(this._outFormat);this._reporter.setSevInstance(this._severity);this._reporter.setMessageFilter(this._config._config.messages);this._ruleSets=new RuleSet(this._config,nodeDeps,this._getAppCtx(),this._AmdRulePacks);if(!this._ruleSets.loadRulePacks(this._config._config,this._dryRunSet,this._rtf.dumpRulesSet||this._rtf.dumpRulesJsonSet||this._rtf.dumpRulesSonarSet)||this._stats.errors){return 1};if(this._rtf.regListenerTypesSet){this._ruleSets.dumpRegistry();return-1}if(this._isCLI&&this._rtf.xgroupList){nodeDeps.grouplist.showExternalGroups(this._ruleSets.getRuleSets(),this._rtf.cmdArg,nodeDeps);return-1}this._targFiletypes=this._ruleSets.getActiveFiletypes();if(this._verboseMode||this._debugMode){val=function(self){var s="",i;for(i=0;i<self._targFiletypes.length;i++){if(i){s+=", "}s+="'."+self._targFiletypes[i]+"'"}return s}(this);this._info(`[info]: Filetypes targeted : [${val}]`)}this._rules=new Rules(this._ruleSets,nodeDeps,this._config._config,this._getMsgId.bind(this),this._getAppCtx());this._msgIdLookup=this._ruleSets.loadMsgIds();if(this._msgIdLookup===-1){return 1}if(this._dumpRules()){return-1}if(this._isCLI&&this._manualCheckForNonJet()){return-1}if(!this._isManual){if(this._isCliOrApi){this._loadComponentSupport();if(this._components.isOk()){this._metaLib.setComponentsLib(this._compSvcs,this._components)}if(this._verboseMode){this._dumpCompositeNames()}}}this._DomUtils=new DomUtils(nodeDeps,this._getAppCtx(),this._tabs,this._fileIndex);this._metaLib.setDomUtils(this._DomUtils);this._ctxTag=this._rules.makeRuleContext();this._ctxAttr=this._rules.makeRuleContext();this._ctxCss=this._rules.makeRuleContext();this._ctxFileHook=this._rules.makeRuleContext();this._ctxTag.utils={};this._ctxAttr.utils={};this._ctxCss.utils={};this._ctxFileHook.utils={};this._CssLib=new CssLib(this._nd,this._getAppCtx());this._setupCssParser();this._parser=new Parser(this,nodeDeps,this._rules,this._fileIndex,this._DomUtils,this._getAppCtx(),this._getMsgCtx(),{RULE_JS_DIAGNOSE:"jaf-js-diagnose",RULE_TS_DIAGNOSE:"jaf-ts-diagnose",RULE_CSS_DIAGNOSE:"jaf-css-diagnose",RULE_HTML_DIAGNOSE:"jaf-html-diagnose",RULE_INIT_SCHEMA:"jaf-init-schema",FILETYPE_HTML:FILETYPE.HTML,FILETYPE_CSS:FILETYPE.CSS,JAF_RSI:0})};JafCore.prototype._manualCheckForNonJet=function(){if(this._isManual){return nodeDeps.manual.showExternalMsgHelp(this._rules,this._rtf.manCheckL,this._rtf.manCheckS,nodeDeps,this._getMsgCtx())}return false};JafCore.prototype._displayCliFinalStats=function(){this._stats.errorFiles+=this._fileSet.getFileErrorCount();var cliStats=new nodeDeps.cliStats(nodeDeps,this._stats,this._severity,this._console.bind(this),this._info.bind(this),this._unitTest,this._useStderr);cliStats.displayStatsAndHisto(elapsed);cliStats.displayErrorsAndAsserts()};JafCore.prototype._emitApiRunSummary=function(){var o;o=this._createRunSummary();if(this._events){this._events.emit(this._events.JAF_EVENT_SUMMARY,o)}if(this._ctxCB.cbSummary){this._ctxCB.cbSummary(o)}};JafCore.prototype.setApiCallbacks=function(cbIssue,cbMsg,cbSummary){if(this._ctxCB){if(cbIssue){this._ctxCB.cbIssue=cbIssue}if(cbMsg){this._ctxCB.cbMsg=cbMsg}if(cbSummary){this._ctxCB.cbSummary=cbSummary}}};JafCore.prototype.getStats=function(){return this._stats};JafCore.prototype._showHelp=function(){if(this._isCLI){nodeDeps.help(this._showVersion.bind(this),nodeDeps.colors,this._getMsgCtx())}};JafCore.prototype._showTitle=function(){var title=this._config.getTitle();if(title){title=this._applyMacrosToTitle(title);if(Array.isArray(title)){for(var i=0;i<title.length;i++){this._msg(title[i])}}else{this._msg(title)}}};JafCore.prototype._applyMacrosToTitle=function(title){if(title){if(Array.isArray(title)){for(var i=0;i<title.length;i++){title[i]=this._applyMacros(title[i])}}else{title=this._applyMacros(title)}}return title};JafCore.prototype._readFile=function(filePath,wantBuffer){var data;this._curFile=filePath;try{if(!wantBuffer){data=nodeDeps.fs.readFileSync(filePath,"utf8")}else{data=nodeDeps.fs.readFileSync(filePath)}}catch(e){this._stats.errorFiles++;this._error(e.code+" reading file '"+filePath+"'");data=null}return data};JafCore.prototype._noteFileSet=function(filePath){if(!this._fileSetList){this._fileSetList=[]}this._fileSetList.push(filePath)};JafCore.prototype._displayStartMsg=function(){this._showVersion();this._showGitInfo()};JafCore.prototype._showGitInfo=function(){var git=this._metaLib.getRevisionInfo();this._console(`JET version : ${git.jetVersion}`,"I");this._console(`Meta built : ${git.date} - ${git.time.replace("edt","EDT").replace("pdt","PDT").replace("utc","UTC")}`,"I");this._console(`Audit run on: ${this._Utils.getCurrentDate()} - ${this._Utils.getCurrentTime()}`,"I");if(this._config.isBuiltinJetRules()){this._console(`Theme : ${this._config.getTheme()}`,"I")}};JafCore.prototype._showVersion=function(){var msg=`${this._isCLI?"\n":""}${DESCRIPTION} (JAF ${VERSION} ${nodeDeps.os.platform()})`;this._console(msg,"I")};JafCore.prototype._getInfo=function(){return{version:VERSION,description:DESCRIPTION,platform:nodeDeps.os.platform(),packageVer:DEFAULTS.JETVER}};JafCore.prototype._console=function(msg,type){this._isCLI?console.log(msg):this._callbackMsg(msg,type?type:"N")};JafCore.prototype._msg=function(msg){this._writer.put(msg)};JafCore.prototype._callbackMsg=function(msg,type){if(this._outFormat===OUTFMT.JSON||this._isAPI&&this._isAsyncTemp){this._messageStack.push({msg:msg,type:type})}if(this._events){this._cbMsgObj.type=type;this._cbMsgObj.msg=msg;this._events.emit(this._events.JAF_EVENT_MESSAGE,this._cbMsgObj)}if(this._ctxCB.cbMsg){this._cbMsgObj.type=type;this._cbMsgObj.msg=msg;this._ctxCB.cbMsg(this._cbMsgObj)}};JafCore.prototype._callbackIssue=function(obj){if(this._events){this._events.emit(this._events.JAF_EVENT_ISSUE,obj)}if(this._ctxCB.cbIssue){this._ctxCB.cbIssue(obj)}};JafCore.prototype._writeIssue=function(msg){this._msg(msg)};JafCore.prototype._info=function(msg,type,force){if(this._verboseMode||this._debugMode||force){if(this._isCLI){msg=Colors.YELLOW(msg)}this._console(msg,type)}};JafCore.prototype._debug=function(msg){if(this._debugMode){msg="[debug]: "+msg;if(this._isCLI){msg=Colors.CYAN(msg)}this._console(msg,"D")}};JafCore.prototype._error=function(msg){var s="[Error]: "+msg;if(this._isCLI){s=Colors.BRIGHTRED(s)}this._console(s,"E");this._stats.errors++};JafCore.prototype._warn=function(msg){var nl="";if(msg.charAt(0)==="\n"){msg=msg.substring(1);nl="\n"}msg="[Warn]: "+msg;if(this._isCLI){msg=Colors.PINK(msg)}this._console(nl+msg,"W");this._stats.warnings++};JafCore.prototype._assert=function(msg){var s="[ASSERT]: "+msg;if(this._isCLI){s=this._colorMode?Colors.BRIGHTRED(s):s}this._console(s,"A");this._stats.asserts++};JafCore.prototype._getAppCtx=function(){if(!this._appContext){this._appContext={msg:this._msg.bind(this),info:this._info.bind(this),debug:this._debug.bind(this),error:this._error.bind(this),warn:this._warn.bind(this),assert:this._assert.bind(this),metaLib:this._metaLib.getPublicInterface(),utils:this._Utils,tmpDir:this._tmpDir,reporter:this._reporter,Issue:Issue,flushIssues:this._flushIssues.bind(this),fireHookFileRules:this._fireHookFileRules.bind(this),getMsgId:this._getMsgId.bind(this),rules:this._rules,severity:this._severity,Stats:this._stats,runMode:this._runMode,isUnitTest:this._unitTest,defaultJetVer:DEFAULTS.JETVER,VsCodeExtHint:this._VsCodeExtHint,reportJafIssue:this._reportJafIssue.bind(this)}}else if(!this._appContext.rules){this._appContext.rules=this._rules}this._appContext.tmpDir=this._tmpDir;this._appContext.verboseMode=this._verboseMode;this._appContext.debugMode=this._debugMode;this._isInfo=this._verboseMode||this._debugMode;if(this._config){this._appContext.config=this._config}return this._appContext};JafCore.prototype._getMsgId=function(context,msgKey){var o;msgKey=msgKey?msgKey:context.ruleName;o=this._msgIdLookup[context.rulePack.getPrefix()];return o?o[msgKey]:"????"};JafCore.prototype._getMsgCtx=function(){if(!this._msgContext){this._msgContext={console:this._console.bind(this),info:this._info.bind(this),debug:this._debug.bind(this),warn:this._warn.bind(this),error:this._error.bind(this),msg:this._msg.bind(this),assert:this._assert.bind(this)}}this._msgContext.isDebug=this._debugMode;this._msgContext.isVerbose=this._verboseMode;return this._msgContext};JafCore.prototype._getModeCtx=function(){return{isOJET:this._isOJET,isOJETCLI:this._isOJETCLI,isCLI:this._isCLI,isAPI:this._isAPI,isAMD:this._isAMD,isUnitTest:this._unitTest}};JafCore.prototype._clearNL=function(text){var i,c;for(i=0;i<text.length;i++){c=text.charAt(i);if(!this._Utils.isWhitespace(c)){break}if(c==="\n"||c==="\r"){i++;if(i<text.length){c=text.charAt(i);if(c==="\n"||c==="\r"){i++}}text=text.substring(i);break}}return{text:text,stripped:i}};JafCore.prototype._checkNodeVer=function(){var ver=process.version;if(ver.charAt(0)==="v"){ver=ver.substr(1)}if(!require("semver").gte(ver,MIN_NODE_VER)){this._error("Node version "+ver+" detected. JET Audit requires at least "+MIN_NODE_VER);return false}return true};JafCore.prototype._loadComponentSupport=function(){this._loadComponentServices();if(!this._components&&nodeDeps.Components){this._components=new nodeDeps.Components(nodeDeps,this._runMode,this._compSvcs,this._config.getComponentsBase(),this._config.getComponentUrls(),this._config.getComponents(),this._metaLib,this._config.get$JetCore(),this._getMsgCtx(),{isDryRun:this._dryRunSet,isDebug:this._debugMode},this._Utils);this._metaLib.setComponentsLib(null,this._components)}};JafCore.prototype._loadComponentServices=function(){if(!this._compSvcs&&nodeDeps.ComponentSvcs){this._compSvcs=new nodeDeps.ComponentSvcs(nodeDeps,nodeDeps.path.dirname(this._metaPath),this._config,this._tmpDir,this._getAppCtx());this._metaLib.setComponentsLib(this._compSvcs)}};JafCore.prototype._processAMDUserCCAMeta=function(arMeta){var i,comp;if(arMeta){this._loadComponentSupport();for(i=0;i<arMeta.length;i++){comp=arMeta[i];if(comp){this._components.processComponentJson(comp,"")}}}};JafCore.prototype._applyMacros=function(str){var s=str,macro,regex,repl;for(macro in this._macros){if(s.includes(macro)){repl=this._macros[macro];if(typeof repl==="undefined"||repl===null){continue}regex=new RegExp((macro.startsWith("$")?"\\":"")+macro,"g");s=s.replace(regex,repl)}}return s};JafCore.prototype._initMacros=function(){this._macros.$jafcwd=this._curDir;this._macros.$jafdate=this._Utils.getCurrentDate();this._macros.$jaftime=this._Utils.getCurrentTime();this._macros.$jafver=VERSION};JafCore.prototype._debugZipContents=function(entries,indent,lastPath){var i,entry,indent=indent||0,lastPath=lastPath||"";if(Array.isArray(entries)){for(i=0;i<entries.length;i++){entry=entries[i];this._debug(entry.path?entry.path:lastPath+entry.name);if(!entry.isFile){this._debugZipContents(entry.files,indent+2,entry.path)}}}else{this._debug("no valid data found in zip")}};JafCore.prototype.getUnitTestJetVer=function(){var runvers=this._metaLib.getMetaVers();return runvers.runver};function _isAttrExpr(attrValue){var rc=false;if(typeof attrValue==="string"){attrValue=attrValue.trim();rc=attrValue.startsWith("[[")||attrValue.startsWith("{{")}return rc};function _isLinkCSSLink(scriptNode){var ret=null;var attribs=scriptNode.attribs;if(!attribs){return ret}if(attribs.rel){if(attribs.rel.toLowerCase()==="stylesheet"){if(attribs.href){ret=attribs.href.toLowerCase().endsWith(FILETYPE.CSS)?attribs.href:null}}}return ret};function _getPackageInfo(runMode){var package=require(__dirname+"./../package.json");if(runMode==="amd"){package=JSON.parse(package)}VERSION=package.Jaf.version;DESCRIPTION=package.description};function _beginsWithNL(text,utils){var i,c,ret=false;for(i=0;i<text.length;i++){c=text.charAt(i);if(!utils.isWhitespace(c)){break}if(c==="\n"||c==="\r"){ret=true;break}}return ret};function _extractFileType(filePath,isNonFile){if(isNonFile){var i=filePath.lastIndexOf(".");return i>=0?filePath.substr(i+1):""}return nodeDeps.fsUtils.getFileExt(filePath)};JafCore.prototype._processConfigOptions=function(){var val,envClr;val=this._config.getOptions();if(!val){return}if(!this._rtf.debugSet){if(val.debug!==undefined){this._debugMode=!!val.debug}}else{val.debug=true}if(!this._rtf.verboseSet){if(val.verbose!==undefined){this._verboseMode=!!val.verbose}}else{val.verbose=true}this._isInfo=this._verboseMode||this._debugMode;if(nodeDeps.colors){if(this._rtf.colorSet){val.nocolor=!this._rtf.colorSet}else{if(val.color!==undefined){this._colorMode=!!val.color}else if(this._isCLI){if(envClr=process.env[ENV_JAF_COLOR]){envClr=envClr.replace(/["']/g,"").toLowerCase().charAt(0);this._colorMode=envClr==="y"||envClr==="t"}}}if(!this._colorMode){Colors.enable(false)}}else{this._colorMode=this._rtf.colorSet=false}if(!this._rtf.msgIdModeSet){if(val.msgid!==undefined){this._msgIdMode=!!val.msgid}}else{val.msgid=this._rtf.msgIdMode}val.ruleName=!!val.ruleName;if(!this._rtf.unitTest&&val["$unittest"]){this._unitTest=true}};function _getScriptData(data,start,end){var s=data.substring(start,end);var x=s.indexOf("</script");s=s.substring(0,x);return s};module.exports=JafCore;
|