@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/lib/cmdline.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
const ARG_CONFIG="--config";const ARG_CONFIG_SHORT="-c";const ARG_BASE="--base";const ARG_BASE_SHORT="-b";const ARG_SEVERITY="--severity";const ARG_SEVERITY_SHORT="-s";const ARG_FORMAT="--format";const ARG_FORMAT_SHORT="-t";const ARG_RULEPATH="--rulepath";const ARG_RULEPATH_SHORT="-rp";const ARG_FOLLOWLINKS="--followlinks";const ARG_FOLLOWLINKS_SHORT="-fl";const ARG_NOFOLLOWLINKS="--nofollowlinks";const ARG_NOFOLLOWLINKS_SHORT="-nfl";const ARG_SHOWRULES="--rules";const ARG_SHOWRULES_SHORT="-r";const ARG_SHOWRULESJSON="--rulesjson";const ARG_SHOWRULESJSON_SHORT="-rj";const ARG_SHOWRULESSONAR="--rulessonar";const ARG_SHOWRULESSONAR_SHORT="-rs";const ARG_SHOWRULES_INTERNAL="-rx";const ARG_OUTPATH="--outpath";const ARG_OUTPATH_SHORT="-o";const ARG_NO_OUT="--noout";const ARG_NO_OUT_SHORT="-no";const ARG_NOCOLOR="--nocolor";const ARG_NOCOLOR_SHORT="-nc";const ARG_GROUPS="--groups";const ARG_GROUPS_SHORT="-g";const ARG_MSGID="--msgid";const ARG_MSGID_SHORT="-id";const ARG_WATCH="--watch";const ARG_WATCH_SHORT="-w";const ARG_VERSION="--version";const ARG_VERSION_SHORT="-v";const ARG_JETLIST="--jetlist";const ARG_JETLIST_SHORT="-jl";const ARG_JETVER="--jetver";const ARG_JETVER_SHORT="-jv";const ARG_NAMESPACE_LIST="--nslist";const ARG_NAMESPACE_LIST_SHORT="-nsl";const ARG_METAHIST="--metahist";const ARG_METAHIST_SHORT="-mh";const ARG_RC="--retcode";const ARG_RC_SHORT="-rc";const ARG_DRYRUN="--dryrun";const ARG_DRYRUN_SHORT="-dr";const ARG_REG="--reg";const ARG_REG_SHORT="-reg";const ARG_HELP="--help";const ARG_HELP_SHORT="-h";const ARG_HELP_SHORT_S="-hs";const ARG_EXTRA="--extra";const ARG_EXTRA_SHORT="-e";const ARG_DEBUG="--debug";const ARG_DEBUG_SHORT="-d";const ARG_SCAFFOLD="--init";const ARG_SCAFFOLD_SHORT="-i";const ARG_SCAFFOLD_RULE="--initrule";const ARG_SCAFFOLD_RULE_SHORT="-ir";const ARG_UNIT_TEST="-ut";const ARG_OJET="--ojet";const ARG_OJET_SHORT="-ojet";const ARG_EXPERIMENTAL="--x";const ARG_EXPERIMENTAL_SHORT="-x";const ARG_EXPERIMENTAL_TS="--xts";const ARG_EXPERIMENTAL_TS_SHORT="-xts";var configSet,baseSet,rulePathSet,formatSet,outPathSet;var JafCore;module.exports.checkArgs=function(nodeDeps,Core,Severity,macros,FORMAT_PROSE,FORMAT_JSON,FORMAT_LINE){var argLen,argOrig,arg,dontRun,ftype,temp,bArgsOk=true,bWantHelp=false,debugTitle;JafCore=Core;JafCore._jetauditdir=nodeDeps.process.argv[1];JafCore._jetauditdir=nodeDeps.path.dirname(JafCore._jetauditdir);_checkBaseOptions(Core);argLen=process.argv.length;for(var i=2;i<argLen;i++){argOrig=process.argv[i];arg=argOrig.toLowerCase().trim();if(arg.length===0){continue}if(arg.charAt(0)!=="-"){if(!JafCore._srcStack){JafCore._srcStack=[]}arg=process.argv[i];arg=_handleQuotes(arg);arg=nodeDeps.path.normalize(arg);arg=nodeDeps.path.resolve(arg);JafCore._srcStack.push(arg);if(JafCore._debugMode||JafCore._verboseMode){if(!debugTitle){JafCore._info("Command line files specified:");debugTitle=true}JafCore._info(" "+arg)}continue}if(arg===ARG_EXTRA||arg===ARG_EXTRA_SHORT){continue}else if(arg===ARG_DEBUG||arg===ARG_DEBUG_SHORT){continue}else if(arg===ARG_NOCOLOR||arg===ARG_NOCOLOR_SHORT){continue}else if(arg===ARG_MSGID||arg===ARG_MSGID_SHORT){JafCore._msgIdMode=true;JafCore._msgIdModeSet=true}else if(arg===ARG_VERSION||arg===ARG_VERSION_SHORT){JafCore._showVersion();dontRun=true}else if(arg===ARG_HELP||arg===ARG_HELP_SHORT||arg===ARG_HELP_SHORT_S){if(i+1<argLen){temp=process.argv[i+1];if(arg===ARG_HELP||arg===ARG_HELP_SHORT){JafCore._manCheckL=temp}else{JafCore._manCheckS=temp}JafCore._isManual=true;if(configSet){break}}else{JafCore._showHelp();dontRun=true;break}}else if(arg===ARG_JETLIST||arg===ARG_JETLIST_SHORT){JafCore._jetverList=true;break}else if(arg===ARG_NAMESPACE_LIST||arg===ARG_NAMESPACE_LIST_SHORT){JafCore._cmdNSList=true;break}else if(arg===ARG_METAHIST||arg===ARG_METAHIST_SHORT){JafCore._cmdMetaHist=true;break}else if(arg===ARG_CONFIG||arg===ARG_CONFIG_SHORT){i++;if(i<argLen){arg=process.argv[i];JafCore._configPath=nodeDeps.path.normalize(arg);JafCore._configPath=nodeDeps.path.resolve(JafCore._configPath);configSet=true;if(JafCore._isManual){break}}else{JafCore._error("Invalid --config option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_BASE||arg===ARG_BASE_SHORT){i++;if(i<argLen){JafCore._base=process.argv[i];if(JafCore._base===macros.cwd||nodeDeps.fsUtils.getFileType(JafCore._base)==="d"){JafCore._baseSet=true}else{JafCore._error("'--base' "+JafCore._base+" is not a directory!!");bArgsOk=false;bWantHelp=true}}else{JafCore._error("Invalid --base option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_SEVERITY||arg===ARG_SEVERITY_SHORT){i++;if(i<argLen){JafCore._severitySet=true;JafCore._cliSev=process.argv[i]}else{JafCore._error("Invalid --severity option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_JETVER||arg===ARG_JETVER_SHORT){i++;argOrig=i<argLen?process.argv[i]:null;arg=nodeDeps.jetver.validate(argOrig);if(arg){JafCore._error(arg);bArgsOk=false;break}arg=nodeDeps.jetver.getBestVersion(argOrig);if(!arg){JafCore._error("'"+argOrig+"' is not a valid JET version");bArgsOk=false;break}JafCore._jetverSet=arg;if((JafCore._verboseMode||JafCore._debugMode)&&arg!==argOrig){JafCore._info("[Info]: JET version '"+argOrig+"' was promoted to '"+arg+"'")}}else if(arg===ARG_RULEPATH||arg===ARG_RULEPATH_SHORT){i++;if(i<argLen){JafCore._rulePath=process.argv[i];ftype=nodeDeps.fsUtils.getFileType(JafCore._rulePath);if(ftype==="d"){rulePathSet=true}else{JafCore._error("'--rulepath' "+JafCore._rulepath+" not a directory!!");bArgsOk=false;bWantHelp=true}}else{JafCore._error("Invalid --rulepath option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_FORMAT||arg===ARG_FORMAT_SHORT){i++;if(i<argLen){argOrig=process.argv[i];arg=argOrig.toLowerCase();if(arg!==FORMAT_JSON&&arg!==FORMAT_PROSE&&arg!==FORMAT_LINE){JafCore._error("Invalid --format(-t) option '"+argOrig+"'");bArgsOk=false;bWantHelp=true}else{JafCore._outFormat=arg;formatSet=true}}else{JafCore._error("Invalid --format option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_OUTPATH||arg===ARG_OUTPATH_SHORT){i++;if(outPathSet){JafCore._error("--outPath and --noout are mutually exclusive");bArgsOk=false;bWantHelp=true}else{if(i<argLen){arg=process.argv[i];arg=nodeDeps.path.normalize(arg);JafCore._outPath=nodeDeps.path.resolve(arg);outPathSet=true}else{JafCore._error("Invalid --outPath option");bArgsOk=false;bWantHelp=true}}}else if(arg===ARG_NO_OUT||arg===ARG_NO_OUT_SHORT){if(outPathSet){JafCore._error("--outPath and --noout are mutually exclusive");bArgsOk=false;bWantHelp=true}else{JafCore._outPath="$noout";outPathSet=true}}else if(arg===ARG_FOLLOWLINKS||arg===ARG_FOLLOWLINKS_SHORT){JafCore._followLinks=true;JafCore._followLinksSet=true}else if(arg===ARG_NOFOLLOWLINKS||arg===ARG_NOFOLLOWLINKS_SHORT){JafCore._followLinks=false;JafCore._followLinksSet=true}else if(arg===ARG_GROUPS||arg===ARG_GROUPS_SHORT){JafCore._groupsSet=_checkGroups(process.argv,i+1);if(!JafCore._groupsSet.groups||JafCore._groupsSet.groups.length===0){JafCore._error(!JafCore._groupsSet.groups?"groups missing after flag "+argOrig:"Invalid "+argOrig+" specification");bArgsOk=false;bWantHelp=true}i=JafCore._groupsSet.next;JafCore._groupsSet=JafCore._groupsSet.groups}else if(arg===ARG_RC||arg===ARG_RC_SHORT){i++;if(i<argLen){temp=process.argv[i];if(temp==="auto"||temp==="errors"){JafCore._retCode=temp}else{temp=parseInt(temp);if(!isNaN(temp)){JafCore._retCode=temp}else{JafCore._error(`--retCode '${process.argv[i]}' is invalid!`);bArgsOk=false;bWantHelp=true}}}else{JafCore._error("Invalid --retCode option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_SHOWRULES||arg===ARG_SHOWRULES_SHORT){JafCore._dumpRulesSet=true}else if(arg===ARG_SHOWRULESJSON||arg===ARG_SHOWRULESJSON_SHORT){JafCore._dumpRulesJsonSet=true}else if(arg===ARG_SHOWRULESSONAR||arg===ARG_SHOWRULESSONAR_SHORT){JafCore._dumpRulesSonarSet=true}else if(arg===ARG_SHOWRULES_INTERNAL){JafCore._dumpRulesInternalSet=true}else if(arg===ARG_DRYRUN||arg===ARG_DRYRUN_SHORT){JafCore._dryRunSet=true;JafCore._verboseMode=true;JafCore._verboseSet=true;JafCore._dumpRulesSet=true}else if(arg===ARG_REG||arg===ARG_REG_SHORT){JafCore._regListenerTypesSet=true}else if(arg===ARG_UNIT_TEST){JafCore._unitTest=true}else if(arg===ARG_OJET||arg===ARG_OJET_SHORT){JafCore._isOJETCLI=true}else if(arg===ARG_EXPERIMENTAL||arg===ARG_EXPERIMENTAL_SHORT){JafCore._experimentalSet=true}else if(arg===ARG_EXPERIMENTAL_TS||arg===ARG_EXPERIMENTAL_TS_SHORT){JafCore._experimentalTsSet=true}else if(arg===ARG_WATCH||arg===ARG_WATCH_SHORT){if(JafCore._experimentalSet){JafCore._watchSet=true}}else if(arg===ARG_SCAFFOLD||arg===ARG_SCAFFOLD_SHORT){JafCore._scaffoldSet=true}else if(arg===ARG_SCAFFOLD_RULE||arg===ARG_SCAFFOLD_RULE_SHORT){i++;if(i<argLen){JafCore._scaffoldRuleSet=process.argv[i]}else{JafCore._error("Invalid --initrule argument: rule name missing ");bArgsOk=false;bWantHelp=true}}else if(arg==="-z"){}else{JafCore._error("Invalid command flag \""+argOrig+"\"");bArgsOk=false;bWantHelp=true}}if(!dontRun&&bWantHelp){nodeDeps.help(JafCore._showVersion.bind(JafCore),JafCore._getMsgCtx())}return dontRun?"end":bArgsOk};module.exports.displayCmdLineOptionsSet=function(){JafCore._console("\n** Command line options:");if(JafCore._dryRunSet){JafCore._console(" - Dry run ON")}if(JafCore._verboseMode){JafCore._console(" - Verbose mode ON")}if(JafCore._debugMode){JafCore._console(" - Debug mode ON")}if(JafCore._watchSet){JafCore._console(" - watch mode ON")}if(JafCore._groupsSet){JafCore._console(" - Groups set to "+JafCore._groupsSet)}if(JafCore._colorSet){JafCore._console(" - Color mode "+(JafCore._colorMode?"ON":"OFF"))}if(JafCore._msgIdModeSet){JafCore._console(" - Show msg ID's "+(JafCore._msgIdModeSet?"ON":"OFF"))}if(formatSet){JafCore._console(" - Output in "+JafCore._outFormat.toUpperCase()+" format")}if(configSet){JafCore._console(" - Config set to "+JafCore._configPath)}if(JafCore._severitySet){JafCore._console(" - Severity set to '"+JafCore._severity+"'")}if(outPathSet){JafCore._console(" - Outpath set to "+(JafCore._outPath==="$noout"?"'none'":JafCore._outPath))}if(baseSet){JafCore._console(" - Base set to "+JafCore._base)}if(JafCore._jetverSet){JafCore._console(" - JET version set to "+JafCore._jetverSet)}if(JafCore._followLinksSet){JafCore._console(" - following stylesheet links is "+(JafCore._followLinks?"ON":"OFF"))}if(JafCore._dumpRulesSet||JafCore._dumpRulesJsonSet||JafCore._dumRulesSonarSet){JafCore._console(" - Dump Rules ON")}if(JafCore._retCode){JafCore._console(` - retCode set to ${JafCore._retCode}`)}JafCore._console("\n");return true};module.exports.isCmdLineOptionsSet=function(JafCore){return JafCore._verboseMode||JafCore._debugMode||JafCore._colorSet||configSet||baseSet||JafCore._dumpRulesSet||JafCore._dumpRulesJsonSet||JafCore._dumpRulesSonarSet||JafCore._dumpRulesInternalSet||formatSet||JafCore._configSet||JafCore._msgIdModeSet||outPathSet||JafCore._severitySet||rulePathSet||JafCore._watchSet||JafCore._jetverSet||JafCore._followLinksSet||JafCore._dryRunSet};function _checkBaseOptions(JafCore){var i,arg,argLen=process.argv.length;for(i=2;i<argLen;i++){arg=process.argv[i];if(arg.length===0||arg.charAt(0)!=="-"){continue}arg=arg.toLowerCase();if(arg===ARG_EXTRA||arg===ARG_EXTRA_SHORT){JafCore._verboseMode=true;JafCore._verboseSet=true}else if(arg===ARG_DEBUG||arg===ARG_DEBUG_SHORT){JafCore._debugMode=true;JafCore._debugSet=true}else if(arg===ARG_NOCOLOR||arg===ARG_NOCOLOR_SHORT){JafCore._colorMode=false;JafCore._colorSet=true}}};function _checkGroups(args,i){var arg,a,x,last,bound,groups;x=i;for(;;i++){if(i>=args.length||args[i].charAt(0)==="-"||last){break}arg=args[i].trim();if(x===i){bound=arg.startsWith("[")||arg.startsWith("(")}last=bound&&(arg.endsWith("]")||arg.endsWith(")"));arg=arg.replace(/[\[\(\)\]]/g,"").trim();if(!arg.length){break}arg=arg.replace(/,/g," ");arg=arg.replace(/ +(?= )/g,"").trim();if(!groups){groups=[]}a=arg.split(" ");groups=groups.concat(a)}return{next:bound?i:x,groups:groups}};function _handleQuotes(s){return s.replace(/[\"\']/g,"")};
|
|
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
|
+
const OUTFMT=require("../lib/outFormat");const MACROS=require("../lib/macros");const ARG_CONFIG="--config";const ARG_CONFIG_SHORT="-c";const ARG_BASE="--base";const ARG_BASE_SHORT="-b";const ARG_SEVERITY="--severity";const ARG_SEVERITY_SHORT="-s";const ARG_FORMAT="--format";const ARG_FORMAT_SHORT="-t";const ARG_FOLLOWLINKS="--followlinks";const ARG_FOLLOWLINKS_SHORT="-fl";const ARG_NOFOLLOWLINKS="--nofollowlinks";const ARG_NOFOLLOWLINKS_SHORT="-nfl";const ARG_SHOWRULES="--rules";const ARG_SHOWRULES_SHORT="-r";const ARG_SHOWRULESJSON="--rulesjson";const ARG_SHOWRULESJSON_SHORT="-rj";const ARG_SHOWRULESSONAR="--rulessonar";const ARG_SHOWRULESSONAR_SHORT="-rs";const ARG_SHOWRULES_INTERNAL="-rx";const ARG_OUTPATH="--outpath";const ARG_OUTPATH_SHORT="-o";const ARG_NO_OUT="--noout";const ARG_NO_OUT_SHORT="-no";const ARG_NOCOLOR="--nocolor";const ARG_NOCOLOR_SHORT="-nc";const ARG_GROUPS="--groups";const ARG_GROUPS_SHORT="-g";const ARG_GROUPS_EQ="--groups=";const ARG_GROUPS_EQ_SHORT="-g=";const ARG_MSGID="--msgid";const ARG_MSGID_SHORT="-id";const ARG_WATCH="--watch";const ARG_WATCH_SHORT="-w";const ARG_VERSION="--version";const ARG_VERSION_SHORT="-v";const ARG_JETLIST="--jetlist";const ARG_JETLIST_SHORT="-jl";const ARG_DEFLIST="--default";const ARG_DEFLIST_ALT="--deflist";const ARG_DEFLIST_SHORT="-def";const ARG_GROUPLIST="--grouplist";const ARG_GROUPLIST_SHORT="-gl";const ARG_XGROUPLIST="--xgrouplist";const ARG_XGROUPLIST_SHORT="-xgl";const ARG_DISLIST="--dislist";const ARG_DISLIST_SHORT="-dl";const ARG_JETVER="--jetver";const ARG_JETVER_SHORT="-jv";const ARG_NAMESPACE_LIST="--nslist";const ARG_NAMESPACE_LIST_SHORT="-nsl";const ARG_METAHIST="--metahist";const ARG_METAHIST_SHORT="-mh";const ARG_RC="--retcode";const ARG_RC_EQ="--retcode=";const ARG_RC_SHORT="-rc";const ARG_RC_EQ_SHORT="-rc=";const ARG_DRYRUN="--dryrun";const ARG_DRYRUN_SHORT="-dr";const ARG_DAC="--daconfig";const ARG_DAC_SHORT="-dac";const ARG_REG="--reg";const ARG_REG_SHORT="-reg";const ARG_HELP="--help";const ARG_HELP_SHORT="-h";const ARG_HELP_SHORT_S="-hs";const ARG_EXTRA="--extra";const ARG_EXTRA_SHORT="-e";const ARG_DEBUG="--debug";const ARG_DEBUG_SHORT="-d";const ARG_SCAFFOLD="--init";const ARG_SCAFFOLD_SHORT="-i";const ARG_SCAFFOLD_RULE="--initrule";const ARG_SCAFFOLD_RULE_SHORT="-ir";const ARG_UNIT_TEST="-ut";const ARG_OJET="--ojet";const ARG_OJET_SHORT="-ojet";const ARG_EXPERIMENTAL="--x";const ARG_EXPERIMENTAL_SHORT="-x";module.exports.checkArgs=function(nodeDeps,rtf,showHelp,showVersion,msgCtx){var argLen,argOrig,arg,dontRun,temp,x,bArgsOk=true,bWantHelp=false,debugTitle;rtf.jetauditdir=nodeDeps.process.argv[1];rtf.jetauditdir=nodeDeps.path.dirname(rtf.jetauditdir);_checkBaseOptions(rtf,nodeDeps);if(rtf.debugSet){_dumpCmdLine()}argLen=process.argv.length;for(var i=2;i<argLen;i++){argOrig=process.argv[i];arg=argOrig.toLowerCase().trim();if(arg.length===0){continue}if(arg.charAt(0)!=="-"){if(!rtf.srcStack){rtf.srcStack=[]}arg=process.argv[i];arg=_handleQuotes(arg);arg=nodeDeps.path.normalize(arg);arg=nodeDeps.path.resolve(arg);rtf.srcStack.push(arg);if(rtf.debugMode||rtf.verboseMode){if(!debugTitle){msgCtx.info("Command line files specified:");debugTitle=true}msgCtx.info(" "+arg)}continue}if(_isBaseOption(arg)){continue}else if(arg===ARG_MSGID||arg===ARG_MSGID_SHORT){rtf.msgIdMode=rtf.msgIdModeSet=true}else if(arg===ARG_VERSION||arg===ARG_VERSION_SHORT){showVersion();dontRun=true}else if(arg===ARG_HELP||arg===ARG_HELP_SHORT||arg===ARG_HELP_SHORT_S){if(i+1<argLen){temp=process.argv[i+1];if(temp.charAt(0)==="-"){showHelp();dontRun=true;if(!_isBaseOption(temp))msgCtx.error(`Unexpected '${temp}'`);break}i++;if(arg===ARG_HELP||arg===ARG_HELP_SHORT){rtf.manCheckL=temp}else{rtf.manCheckS=temp}rtf.isManual=true;if(rtf.st_configSet){break}}else{showHelp();dontRun=true;break}}else if(arg===ARG_JETLIST||arg===ARG_JETLIST_SHORT){rtf.jetverList=true;break}else if(arg.startsWith(ARG_DEFLIST)||arg.startsWith(ARG_DEFLIST_SHORT)||arg.startsWith(ARG_DEFLIST_ALT)){rtf.defList=true;break}else if(arg===ARG_NAMESPACE_LIST||arg===ARG_NAMESPACE_LIST_SHORT){rtf.cmdNSList=true;break}else if(arg===ARG_DISLIST||arg===ARG_DISLIST_SHORT){rtf.disList=true;rtf.cmdArg=checkPackArg(i,argLen,msgCtx.error);break}else if(arg===ARG_GROUPLIST||arg===ARG_GROUPLIST_SHORT){rtf.groupList=true;rtf.cmdArg=checkPackArg(i,argLen,msgCtx.error);break}else if(arg===ARG_XGROUPLIST||arg===ARG_XGROUPLIST_SHORT){rtf.xgroupList=true;rtf.cmdArg=checkPackArg(i,argLen,msgCtx.error)}else if(arg===ARG_METAHIST||arg===ARG_METAHIST_SHORT){rtf.cmdMetaHist=true;break}else if(arg===ARG_CONFIG||arg===ARG_CONFIG_SHORT){i++;if(i<argLen){arg=process.argv[i];rtf.configPath=nodeDeps.path.normalize(arg);rtf.configPath=nodeDeps.path.resolve(rtf.configPath);rtf.st_configSet=true;if(rtf.isManual||rtf.xgroupList){break}}else{msgCtx.error("Invalid --config option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_BASE||arg===ARG_BASE_SHORT){i++;if(i<argLen){rtf.base=process.argv[i];if(rtf.base===MACROS.cwd||nodeDeps.fsUtils.getFileType(rtf.base)==="d"){rtf.st_baseSet=true}else{msgCtx.error(`'--base' ${rtf.base} is not a directory or the '$jafcwd' macro!!`);bArgsOk=false;bWantHelp=true}}else{msgCtx.error("Invalid --base option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_SEVERITY||arg===ARG_SEVERITY_SHORT){i++;if(i<argLen){rtf.severitySet=true;rtf.cliSev=process.argv[i]}else{msgCtx.error("Invalid --severity option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_JETVER||arg===ARG_JETVER_SHORT){i++;argOrig=i<argLen?process.argv[i]:null;arg=nodeDeps.jetver.validate(argOrig);if(arg){msgCtx.error(arg);bArgsOk=false;break}arg=nodeDeps.jetver.getBestVersion(argOrig);if(!arg){msgCtx.error(`'${argOrig}' is not a valid JET version`);bArgsOk=false;break}rtf.jetverSet=arg;if((rtf.verboseMode||rtf.debugMode)&&arg!==argOrig){msgCtx._info(`[Info]: JET version '${argOrig}' was promoted to '${arg}'`)}}else if(arg===ARG_FORMAT||arg===ARG_FORMAT_SHORT){i++;if(i<argLen){argOrig=process.argv[i];arg=argOrig.toLowerCase();if(arg!==OUTFMT.JSON&&arg!==OUTFMT.PROSE&&arg!==OUTFMT.LINE){msgCtx.error(`Invalid --format(-t) option '${argOrig}'`);bArgsOk=false;bWantHelp=true}else{rtf.outFormat=arg;rtf.st_formatSet=true}}else{msgCtx.error("Invalid --format option");bArgsOk=false;bWantHelp=true}}else if(arg===ARG_OUTPATH||arg===ARG_OUTPATH_SHORT){i++;if(rtf.st_outPathSet){msgCtx.error("--outPath and --noout are mutually exclusive");bArgsOk=false;bWantHelp=true}else{if(i<argLen){arg=process.argv[i];arg=nodeDeps.path.normalize(arg);rtf.outPath=nodeDeps.path.resolve(arg);rtf.st_outPathSet=true}else{msgCtx.error("Invalid --outPath option");bArgsOk=false;bWantHelp=true}}}else if(arg===ARG_NO_OUT||arg===ARG_NO_OUT_SHORT){if(rtf.st_outPathSet){msgCtx.error("--outPath and --noout are mutually exclusive");bArgsOk=false;bWantHelp=true}else{rtf.outPath="$noout";rtf.st_outPathSet=true}}else if(arg===ARG_FOLLOWLINKS||arg===ARG_FOLLOWLINKS_SHORT){rtf.followLinks=rtf.followLinksSet=true}else if(arg===ARG_NOFOLLOWLINKS||arg===ARG_NOFOLLOWLINKS_SHORT){rtf.followLinks=false;rtf.followLinksSet=true}else if(arg.startsWith(ARG_GROUPS_EQ)||arg.startsWith(ARG_GROUPS_EQ_SHORT)){x=arg.indexOf("=");if(temp=_convertToArray(argOrig.substring(x+1))){rtf.groupsSet=temp}else{msgCtx.error(`Invalid 'groups' declaration '${argOrig}`);bArgsOk=false;bWantHelp=true}}else if(arg===ARG_GROUPS||arg===ARG_GROUPS_SHORT){rtf.groupsSet=_checkGroups(process.argv,i+1);if(!rtf.groupsSet.groups||rtf.groupsSet.groups.length===0){msgCtx.error(!rtf.groupsSet.groups?`groups missing after flag ${argOrig}`:`Invalid ${argOrig} specification`);bArgsOk=false;bWantHelp=true}i=rtf.groupsSet.next;rtf.groupsSet=rtf.groupsSet.groups}else if(arg.startsWith(ARG_RC_EQ)||arg.startsWith(ARG_RC_EQ_SHORT)||arg===ARG_RC||arg===ARG_RC_SHORT){arg=argOrig;x=arg.indexOf("=");if(x>0){temp=argOrig.substring(0,x);arg=argOrig.substring(x+1)}else{temp=arg;i++;if(i<argLen){arg=process.argv[i]}else{msgCtx.error(`missing arguments after '${argOrig}'`);bArgsOk=false;bWantHelp=true}}if(bArgsOk){temp=_processRetCode(temp,arg);if(temp||typeof temp==="number"){rtf.retCode=temp;rtf.st_retCodeSet=true}else{msgCtx.error(`'${argOrig}' : ${arg.length?"'${arg}' is invalid":"missing argument?"}`);bArgsOk=false;bWantHelp=true}}}else if(arg===ARG_SHOWRULES||arg===ARG_SHOWRULES_SHORT){rtf.dumpRulesSet=true}else if(arg===ARG_SHOWRULESJSON||arg===ARG_SHOWRULESJSON_SHORT){rtf.dumpRulesJsonSet=true}else if(arg===ARG_SHOWRULESSONAR||arg===ARG_SHOWRULESSONAR_SHORT){rtf.dumpRulesSonarSet=true}else if(arg===ARG_SHOWRULES_INTERNAL){rtf.dumpRulesInternalSet=true}else if(arg===ARG_DRYRUN||arg===ARG_DRYRUN_SHORT){rtf.dryRunSet=rtf.dacSet=rtf.verboseMode=rtf.verboseSet=rtf.dumpRulesSet=true}else if(arg===ARG_DAC||arg===ARG_DAC_SHORT){rtf.dacSet=true}else if(arg===ARG_REG||arg===ARG_REG_SHORT){rtf.regListenerTypesSet=true}else if(arg===ARG_UNIT_TEST){rtf.unitTest=true}else if(arg===ARG_OJET||arg===ARG_OJET_SHORT){rtf.isOJETCLI=true}else if(arg===ARG_EXPERIMENTAL||arg===ARG_EXPERIMENTAL_SHORT){rtf.experimentalSet=true}else if(arg===ARG_WATCH||arg===ARG_WATCH_SHORT){if(rtf.experimentalSet){rtf.watchSet=true}}else if(arg===ARG_SCAFFOLD||arg===ARG_SCAFFOLD_SHORT){rtf.scaffoldSet=true}else if(arg===ARG_SCAFFOLD_RULE||arg===ARG_SCAFFOLD_RULE_SHORT){i++;if(i<argLen){rtf.scaffoldRuleSet=process.argv[i]}else{msgCtx.error("Invalid --initrule argument: rule name missing ");bArgsOk=false;bWantHelp=true}}else if(arg==="-z"){}else{msgCtx.error(`Invalid command flag '${argOrig}'`);bArgsOk=false;bWantHelp=true}}if(!dontRun&&bWantHelp){showHelp()}return dontRun?"end":bArgsOk};module.exports.displayCmdLineOptionsSet=function(rtf,msgCtx){var s="\n** Command line options:\n";if(rtf.dryRunSet){s+=" - Dry run ON\n"}if(rtf.dacSet){s+=" - Display active config ON\n"}if(rtf.verboseMode){s+=" - Verbose mode ON\n"}if(rtf.debugMode){s+=" - Debug mode ON\n"}if(rtf.watchSet){s+=" - watch mode ON\n"}if(rtf.groupsSet){s+=` - Groups set to ${rtf.groupsSet}\n`}if(rtf.st_retCodeSet){s+=` - retCode set to ${rtf.retCode}\n`}if(rtf.colorSet){s+=` - Color mode ${rtf.colorMode}? "ON" : "OFF"}\n`}if(rtf.msgIdModeSet){s+=` - Show msg ID's(${rtf.msgIdModeSet}? "ON" : "OFF"}\n`}if(rtf.st_formatSet){s+=` - Output in ${rtf.outFormat.toUpperCase()} format\n`}if(rtf.st_configSet){s+=` - Config set to ${rtf.configPath}\n`}if(rtf.severitySet){s+=` - Severity set to '${rtf.severity}'\n`}if(rtf.st_outPathSet){s+=` - Outpath set to ${rtf.outPath==="$noout"?"'none'":rtf.outPath}\n`}if(rtf.st_baseSet){s+=` - Base set to ${rtf.base}\n`}if(rtf.jetverSet){s+=` - JET version set to ${rtf.jetverSet}\n`}if(rtf.followLinksSet){s+=` - following stylesheet links is ${rtf.followLinks?"ON":"OFF"}\n`}if(rtf.dumpRulesSet||rtf.dumpRulesJsonSet||rtf.dumRulesSonarSet){s+=" - Dump Rules ON\n"}msgCtx.console(s+"\n")};module.exports.isCmdLineOptionsSet=function(rtf){return rtf.verboseMode||rtf.debugMode||rtf.colorSet||rtf.dumpRulesSet||rtf.dumpRulesJsonSet||rtf.dumpRulesSonarSet||rtf.dumpRulesInternalSet||rtf.msgIdModeSet||rtf.severitySet||rtf.watchSet||rtf.jetverSet||rtf.followLinksSet||rtf.dryRunSet||rtf.jetverList||rtf.cmdNSList||rtf.groupList||rtf.xgroupList||rtf.disList||rtf.cmdMetaHist||rtf.st_baseSet||rtf.st_formatSet||rtf.st_configSet||rtf.st_outPathSet||rtf.st_retCodeSet};function _checkBaseOptions(rtf,nd){var i,arg,argLen=process.argv.length;for(i=2;i<argLen;i++){arg=process.argv[i];if(arg.length===0||arg.charAt(0)!=="-"){continue}arg=arg.toLowerCase();if(arg===ARG_EXTRA||arg===ARG_EXTRA_SHORT){rtf.verboseMode=rtf.verboseSet=true}else if(arg===ARG_DEBUG||arg===ARG_DEBUG_SHORT){rtf.debugMode=rtf.debugSet=true}else if(arg===ARG_NOCOLOR||arg===ARG_NOCOLOR_SHORT){rtf.colorMode=false;rtf.colorSet=true;nd.colors.enable(false)}}};function _isBaseOption(arg){return arg===ARG_EXTRA||arg===ARG_EXTRA_SHORT||arg===ARG_DEBUG||arg===ARG_DEBUG_SHORT||arg===ARG_NOCOLOR||arg===ARG_NOCOLOR_SHORT};function _checkGroups(args,i){var arg,a,x,last,bound,groups;x=i;for(;;i++){if(i>=args.length||args[i].charAt(0)==="-"||last){break}arg=args[i].trim();if(x===i){bound=arg.startsWith("[")||arg.startsWith("(")}last=bound&&(arg.endsWith("]")||arg.endsWith(")"));arg=arg.replace(/[\[\(\)\]]/g,"").trim();if(!arg.length){break}arg=arg.replace(/,/g," ");arg=arg.replace(/ +(?= )/g,"").trim();if(!groups){groups=[]}a=arg.split(" ");groups=groups.concat(a)}return{next:bound?i:x,groups:groups}};function _processRetCode(arg,val){var temp,ret;if(val==="auto"||val==="errors"){ret=val}else{temp=parseInt(val);if(!isNaN(temp)){ret=temp}else{if(temp=_convertToArray(val)){ret=temp}}}return ret};function checkPackArg(i,argLen,error){var temp,lcTemp;if(i+1<argLen){temp=process.argv[i+1];lcTemp=temp.toLowerCase();if(temp.charAt(0)==="-"){if(!_isBaseOption(temp)&&lcTemp!==ARG_CONFIG&&lcTemp!==ARG_CONFIG_SHORT){error(`Unexpected '${temp}' - expected nothing, or a built-in pack prefix`)}temp=undefined}}return temp};function _convertToArray(s){var a,n,i;if(s.charAt(0)==="["){s=s.substring(1);if(!s.length){return null}}if(s.charAt(s.length-1)==="]"){s=s.substring(0,s.length-1)}s=s.trim();if(!s.length){return null}s=s.replace(/\,/g," ");s=s.replace(/\s\s+/g," ").trim();a=s.split(" ");n=0;for(i=0;i<a.length;i++){if(a[i].length){n++}else{a=a.splice(i,1);i--}}return n?a:null};function _handleQuotes(s){return s.replace(/[\"\']/g,"")};function _dumpCmdLine(){var s="";for(var i=0;i<process.argv.length;i++){s+=`[${i}]: |${process.argv[i]}|\n`}console.log(s)}
|
package/lib/colors.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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
|
+
function _nop(s){return s}function _fRed(s){return _set(_color.RED,s)}function _fBrightRed(s){return _set(_color.BRIGHTRED,s)}function _fGreen(s){return _set(_color.GREEN,s)}function _fBrightGreen(s){return _set(_color.BRIGHTGREEN,s)}function _fBlue(s){return _set(_color.BLUE,s)}function _fBrightBlue(s){return _set(_color.BLUE,s)}function _fCyan(s){return _set(_color.CYAN,s)}function _fBrightCyan(s){return _set(_color.BRIGHTCYAN,s)}function _fYellow(s){return _set(_color.YELLOW,s)}function _fBrightYellow(s){return _set(_color.BRIGHTYELLOW,s)}function _fPink(s){return _set(_color.PINK,s)}function _fWhite(s){return _set(_color.WHITE,s)};function _fWhiteOnBlue(s){return _set(_color.WHITEONBLUE,s)};function _fWhiteOnRed(s){return _set(_color.WHITEONRED,s)};function _fBlackOnRed(s){return _set(_color.BLACKONRED,s)};const _color={BLACK:"30m",RED:"31m",BRIGHTRED:"91m",GREEN:"32m",BRIGHTGREEN:"92m",YELLOW:"33m",BRIGHTYELLOW:"93m",BLUE:"34m",BRIGHTBLUE:"94m",PURPLE:"35m",PINK:"95m",CYAN:"36m",BRIGHTCYAN:"96m",WHITE:"37m",WHITEONBLUE:"104m",WHITEONRED:"101m",BLACKONRED:"101;30m"};const START="\x1B[";const RESET="\x1B[0m";function _set(c,s){return c?START+c+s+RESET:s};module.exports={enabled:true,isColor:function(){return this.enabled},enable:function(b){if(b&&!this.enabled){this.RED=_fRed;this.BRIGHTRED=_fBrightRed;this.GREEN=_fGreen;this.BRIGHTGREEN=_fBrightGreen;this.BLUE=_fBlue;this.BRIGHTBLUE=_fBrightBlue;this.CYAN=_fCyan;this.BRIGHTCYAN=_fBrightCyan;this.PINK=_fPink;this.YELLOW=_fYellow;this.BRIGHTYELLOW=_fBrightYellow;this.WHITEONBLUE=_fWhiteOnBlue;this.WHITEONRED=_fWhiteOnRed;this.BLACKONRED=_fBlackOnRed}else if(this.enabled){this.RED=_nop;this.BRIGHTRED=_nop;this.GREEN=_nop;this.BRIGHTGREEN=_nop;this.BLUE=_nop;this.BRIGHTBLUE=_nop;this.CYAN=_nop;this.BRIGHTCYAN=_nop;this.PINK=_nop;this.YELLOW=_nop;this.BRIGHTYELLOW=_nop;this.WHITEONBLUE=_nop;this.WHITEONRED=_nop;this.BLACKONRED=_nop}this.enabled=b},RED:_fRed,BRIGHTRED:_fBrightRed,GREEN:_fGreen,BRIGHTGREEN:_fBrightGreen,BLUE:_fBlue,BRIGHTBLUE:_fBrightBlue,CYAN:_fCyan,BRIGHTCYAN:_fBrightCyan,PINK:_fPink,YELLOW:_fYellow,BRIGHTYELLOW:_fBrightYellow,WHITE:_fWhite,WHITEONBLUE:_fWhiteOnBlue,WHITEONRED:_fWhiteOnRed,BLACKONRED:_fBlackOnRed};
|
package/lib/defaults.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const defaults={JETVER:'12.0.0'.replace(/(\d*\.\d*)(\.\d*)+$/g,'$1')+'.0',THEME:'Alta',ECMAVER:11};module.exports=defaults;
|
package/lib/deflist.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const defs=require("./defaults");const indent=" ";function _show(){console.log(`\nDefault JAF Values:\n\n${indent}jetVer : "${defs.JETVER}"\n${indent}theme : "${defs.THEME}"\n${indent}ecmaVer : ${defs.ECMAVER}`)};module.exports.showList=_show;
|
package/lib/dislist.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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 _color;function show(nd,arg,msgCtx){var packs;_init(nd);if(packs=nd.builtinpacks.getPackMetadata(nd,msgCtx)){let prefixes=nd.builtinpacks.getPrefixes();arg=arg?arg.toLowerCase():arg;for(let pack of prefixes){if(!arg||arg===pack)_display(packs[pack])}}};function _display(pack){var rules,rule,opts,oos,summary=[];console.log(`\n\n${_color.BRIGHTRED("\u25CF")} ${_color.CYAN("Pack")} ${_color.BRIGHTRED(`${pack.prefix}`)} ${_color.CYAN(" - Rules disabled by default")}`);rules=pack.rules;for(rule in rules){opts=rules[rule];oos=opts.hasOwnProperty("inservice")&&!opts.inservice;if(oos||opts.hasOwnProperty("enabled")&&!opts.enabled){summary.push(rule+(oos?"_":""))}}if(summary.length){summary=summary.sort()}else{console.log(_color.BRIGHTYELLOW(`● None - all enabled.`));return}for(rule of summary){oos=rule.endsWith("_");rule=oos?rule.substring(0,rule.length-1):rule;console.log(_color.BRIGHTYELLOW(`● ${rule}`)+_color.RED(`${oos?" (out of service)":""}`))}};function _init(nd){_color=nd.colors};module.exports.show=show;
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const ELLIPSIS="...";const INDENT=" ";const INDENT2=" ";const INDENT3=" ";const proseIndent=4;const SPACER=" ".repeat(proseIndent);const SPACER2=" ".repeat(proseIndent+3);const SPACER3=" ".repeat(proseIndent+5);const NL="\n";var utils;var out;var severity;var jsonRules;var haveProseRules=false;function getXml(){return out+"</rules>"};function getProse(){return out};function getJson(){return out};function ruleToXml(ruleName,rule,options){var ruleName,val,opt,xml,i;xml=INDENT+"<rule>\n";xml+=INDENT2+"<key>"+ruleName+"</key>\n";xml+=INDENT2+"<name>"+_limitLength(_escapeChevrons(rule.getShortDescription()),utils)+"</name>\n";xml+=INDENT2+"<description>\n";xml+=INDENT3+"<![CDATA["+_escapeCData(rule.getDescription())+"]]>\n";xml+=INDENT2+"</description>\n";for(opt in options){val=options[opt];if(opt==="severity"){xml+=INDENT2+"<severity>"+val.toUpperCase()+"</severity>\n"}else if(opt==="status"){val=val.toUpperCase();val=val==="PRODUCTION"?"READY":val;xml+=INDENT2+"<status>"+val+"</status>\n"}else if(opt==="group"){if(typeof val==="string"){xml+=INDENT2+"<tag>"+val+"</tag>\n"}else{for(i=0;i<val.length;i++){xml+=INDENT2+"<tag>"+val[i]+"</tag>\n"}}}}out+=xml+INDENT+"</rule>\n"};function setupRulesToXml(fnUtils){utils=fnUtils;out="<rules>\n"};function setupRulesToProse(severity,fnUtils){utils=fnUtils;out="\n------------ Rules Currently Active (rule severity: "+severity+") ---------------\n"};function setupRulesToJson(obj,sev,fnUtils){out=obj||{};severity=sev;out.rulesets=[];utils=fnUtils};function packToProse(rules,path,rsi){if(!rules){out+=SPACER2+"* No enabled rules available for this severity."+NL+NL}else{out+="["+(rsi+1)+"] "+rules.title+NL;out+=SPACER+"version : "+rules.version+NL;out+=SPACER+"prefix : "+rules.prefix+NL;out+=SPACER+"path : "+path+NL}haveProseRules=false};function ruleToProse(ruleName,rule,opts){out+=!haveProseRules?SPACER+"Rules:"+NL:"";out+=SPACER2+"* "+ruleName+" :"+NL;out+=SPACER3+"options : "+JSON.stringify(opts)+NL;out+=SPACER3+"short : "+rule.getShortDescription()+NL;out+=SPACER3+"long : "+rule.getDescription()+NL;out+=NL;haveProseRules=true};function getJson(){out.meta={"severity":severity};return out};function packToJson(rulePack){var ruleset;ruleset={};out.rulesets.push(ruleset);ruleset.title=rulePack.rulesJson.title;ruleset.path=rulePack.path;ruleset.prefix=rulePack.rulesJson.prefix;ruleset.version=rulePack.rulesJson.version;ruleset.rules=jsonRules={}};function ruleToJson(ruleName,rule,opts){jsonRules[ruleName]=opts;opts.shortDescription=rule.getShortDescription();opts.description=rule.getDescription()};function _limitLength(s,utils){if(s.length>200){for(let i=196;i>0;i--){if(utils.isWhitespace(s.charAt(i))){return s.substring(0,i+1)+ELLIPSIS}}s=ELLIPSIS}return s};function _escapeChevrons(s){let ret=s.replace(/\</g,"<");ret=ret.replace(/\>/g,">");return ret.replace(/ /g," ")};function _escapeCData(s){var i,bChange;while(true){bChange=false;i=s.indexOf("<oj-");if(i>=0){s=s.substr(0,i)+"<"+s.substr(i+1);bChange=true;i=s.indexOf(">",i+1);if(i>=0){s=s.substr(0,i)+">"+s.substr(i+1)}i=s.indexOf("</oj-",i);if(i>=0){s=s.substr(0,i)+"<"+s.substr(i+1);bChange=true;i=s.indexOf(">",i+1);if(i>=0){s=s.substr(0,i)+">"+s.substr(i+1)}}}i=s.indexOf("<!DOCTYPE");if(i>=0){s=s.substr(0,i)+"<"+s.substr(i+1);i=s.indexOf(">",i+1);if(i>=0){s=s.substr(0,i)+">"+s.substr(i+1);bChange=true}}if(!bChange){break}}return s.replace(/ /g," ")};module.exports={getXml:getXml,getProse:getProse,getJson:getJson,ruleToXml:ruleToXml,ruleToProse:ruleToProse,packToProse:packToProse,packToJson:packToJson,ruleToJson:ruleToJson,setupRulesToXml:setupRulesToXml,setupRulesToProse:setupRulesToProse,setupRulesToJson:setupRulesToJson};
|
package/lib/extends.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const TSCONFIG="tsconfig.json";const MERGEABLE_BY_DEFAULT={components:true,componentUrls:true,exclude:true,files:true,groups:true,message:true,nameSpaces:true,options:true,ruleMods:true,ruleNames:true,rulePacks:true,typescript:true};const MERGEABLE_BY_OPTION={};const EXOPT_IGNORE="ignore";const EXOPT_MERGE="merge";const MSG={OBJ:"Config '%s' is not an object - %p",ARRAY:"Config '%s' is not an array - %p",STR:"Config '%s' is not a string - %p",STR_OR_AR_STR:"Config '%s' is not a string or an array of strings - %p",AR_OBJ:"Config '%s' is not an array of objects - %p",AR_STR:"Config '%s' is not an array of strings - %p",AR_STR_OBJ:"Config '%s' is not an array of strings or objects - %p",BOOL:"Config '%s' is not a boolean - %p",EXT_OPT:"Config 'extendOptions.%s' cannot be 'merge' - %p",EXT_OPT_VAL:"Config 'extendOptions.%s' not 'ignore' or 'merge' - %p",UNKNOWN:"Unknown config prop - '%s' - %p"};const REPL_PROP="%s";const REPL_PATH="%p";class Extends{constructor(configLib,configInst,cfg,path,nd,msgCtx,utils){this._path=path;this._cfg=cfg;this._fp=cfg.base;this._nd=nd;this._msgCtx=msgCtx;this._utils=utils;this._cwd=nd.process.cwd();this._cfgLib=configLib;this._cfgInst=configInst;this._stack=[];this._extendOpts=null;this._error=msgCtx.error;this._info=msgCtx.info;this._mergeHandlers={components:this._mergePropComponents.bind(this),componentUrls:this._mergePropCompUrls.bind(this),exclude:this._mergePropExclude.bind(this),files:this._mergePropFiles.bind(this),groups:this._mergePropGroups.bind(this),messages:this._mergePropMessages,nameSpaces:this._mergePropNameSpaces.bind(this),options:this._mergePropOptions.bind(this),ruleMods:this._mergePropRuleMods,ruleNames:this._mergePropRuleNames.bind(this),rulePacks:this._mergePropRulePacks,typescript:this._mergePropTypescript.bind(this)}}extend(){var debug;if(debug=this._cfg.options&&(this._cfg.options.verbose||this._cfg.options.debug)){this._msgCtx.info("[Info]: Merging configurations...","I",true)}if(!this._createStack()){return null}if(debug){this._dumpStack()}if(!this._isError){this._checkMergePropTypes()}if(this._isError){return null}if(!this._stack.length){return this._cfg}return this._mergeStack()}_createStack(cfg,fp){var json,fp,first,o;if(first=!cfg){cfg=this._cfg;fp=this._path?this._path:this._fp}else{fp=cfg.extends}if(!fp){return true}if(first){json=cfg}else{fp=this._getAbsolutePath(fp);if(!this._nd.fsUtils.fileExists(fp)){this._error(`Configuration file not found : ${fp}`);return false}if(this._isCircular(fp)){this._error(`Circular configuration 'extends' detected : ${fp}`);return false}try{json=this._nd.fs.readFileSync(fp,"utf8");json=this._nd.decomment(json);json=this._preprocessRawJson(json,fp);if(!json){return false}o=this._utils.parseJson(json,false);if(o.msg){this._error(`Config 'extends' error : ${o.msg} : ${fp}`);return false}else{json=o.obj}}catch(e){this._error(`Error reading 'extends' config : ${fp}`);return false}}this._stack.push({path:fp,cfg:json});if(json.extends){if(!this._createStack(json,json.extends)){return false}}return true}_preprocessRawJson(txt,fp){var json=this._cfgInst.processIncludes(txt,fp);if(this._cfgInst.isOk()){json=this._cfgInst.processTokens(json);if(this._cfgInst.isOk()){}}return this._cfgInst.isOk()?json:null}_mergeStack(){if(!this._fixupPaths()){return null}for(let i=this._stack.length-1;i>0;i--){if(!this._mergePair(this._stack[i-1],this._stack[i])){return null}}if(this._isMergeProp("files")){if(this._stack[0].cfg.hasOwnProperty("files")){this._stack[0].cfg.files=_removeDupes(this._stack[0].cfg.files)}}if(this._isMergeProp("exclude")){if(this._stack[0].cfg.hasOwnProperty("exclude")){this._stack[0].cfg.exclude=_removeDupes(this._stack[0].cfg.exclude)}}return this._stack[0].cfg}_mergePair(parSE,chSE){var props,parent,child,merger,ret=true;parent=parSE.cfg;child=chSE.cfg;this._extendOpts=parSE.cfg.extendOptions||{};props=Object.keys(child);props.forEach(prop=>{if(prop.startsWith("_")||prop==="base"||prop==="extends"||prop==="tokens"||this._extendOpts[prop]===EXOPT_IGNORE){return}if(!parent.hasOwnProperty(prop)){parent[prop]=child[prop];return}if(!this._isMergeProp(prop)){return}if(merger=this._mergeHandlers[prop]){if(!merger(parSE,chSE)){ret=false}}});if(!ret){return ret}this._msgCtx.info(`[Info]: Inherited config '${chSE.path}'`,"I",true);return true}_checkMergePropTypes(){var cfg,se,prop,prop2,val;for(let i=0;i<this._stack.length;i++){se=this._stack[i];cfg=se.cfg;if(!this._cfgLib.checkPropNames(cfg,se.path)){this._isError=true}if(cfg.extendOptions){if(this._utils.isObject(cfg.extendOptions)){this._extendOpts=cfg.extendOptions;for(prop in this._extendOpts){val=this._extendOpts[prop];if(val===EXOPT_MERGE&&!MERGEABLE_BY_OPTION[prop]){this._emitErrorMsg(MSG.EXT_OPT,prop,se.path);return}else if(val!==EXOPT_MERGE&&val!==EXOPT_IGNORE){this._emitErrorMsg(MSG.EXT_OPT_VAL,prop,se.path);return}}}else{this._emitErrorMsg(MSG.OBJ,"extendOptions",se.path);return}}else{this._extendOpts={}}for(prop in cfg){if(!this._isMergeProp(prop)){continue}val=cfg[prop];if(prop==="components"||prop==="componentUrls"){if(typeof val!=="string"&&!Array.isArray(val)||!this._utils.isArrayContentsType(val,"string")){this._emitErrorMsg(MSG.STR_OR_AR_STR,prop,se.path)}}else if(prop==="files"){if(!Array.isArray(val)){this._emitErrorMsg(prop,prop,se.path)}if(!this._utils.isArrayContentsType(val,["string","object"])){this._emitErrorMsg(MSG.AR_STR_OBJ,prop,se.path)}}else if(prop==="exclude"){if(!Array.isArray(val)||!this._utils.isArrayContentsType(val,"string")){this._emitErrorMsg(MSG.STR_OR_AR_STR,prop,se.path)}}else if(prop==="groups"){if(!Array.isArray(val)){this._emitErrorMsg(MSG.STR,prop,se.path)}}else if(prop==="messages"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}if(se.messages.reject){if(!Array.isArray(se.messages.reject)){this._emitErrorMsg(MSG.OBJ,"messages.reject",se.path)}}if(se.messages.accept){if(!Array.isArray(se.messages.accept)){this._emitErrorMsg(MSG.OBJ,"messages.accept",se.path)}}}else if(prop==="nameSpaces"){if(!Array.isArray(val)){this._emitErrorMsg(MSG.AR_STR,prop,se.path)}}else if(prop==="options"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}}else if(prop==="ruleMods"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path);continue}for(prop2 in val){if(prop2==="enable"||prop2==="disable"){if(!Array.isArray(val[prop2])){this._emitErrorMsg(MSG.AR_OBJ,prop2==="enable"?"ruleMods.enable":"ruleMods.disable",se.path)}}else{if(!this._utils.isObject(val[prop2])){this._emitErrorMsg(MSG.AR_OBJ,prop+"."+prop2,se.path)}}}}else if(prop==="ruleNames"){if(!Array.isArray(val)||!this._utils.isArrayContentsType(val,"string")){this._emitErrorMsg(MSG.AR_STR,prop,se.path)}}else if(prop==="rulePacks"){if(!Array.isArray(val)||!this._utils.isArrayContentsType(val,"object")){this._emitErrorMsg(MSG.AR_OBJ,prop,se.path)}}else if(prop==="sevMap"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}if(val.sevMsg&&!this._utils.isObject(val.sevMsg)){this._emitErrorMsg(MSG.OBJ,prop+".sevMsg",se.path)}if(val.sevSet&&!this._utils.isObject(val.sevSet)){this._emitErrorMsg(MSG.OBJ,prop+".sevSet",se.path)}}else if(prop==="tokens"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}}else if(prop==="typescript"){if(!this._utils.isObject(val)){this._emitErrorMsg(MSG.OBJ,prop,se.path)}for(prop2 in val){if(prop2==="tsconfig"&&typeof val[prop2]!=="string"){this._emitErrorMsg(MSG.STR,"typescript.tsconfig",se.path)}if(prop2==="compile"&&typeof val[prop2]!=="boolean"){this._emitErrorMsg(MSG.BOOL,"typescript.compile",se.path)}}}else{this._error(`JAF ERROR: unhandled 'extends' property '${prop}' - ${se.path}`);this._isError=true}}}}_fixupPaths(){var se,ret=true;for(let i=this._stack.length-1;i>=0;i--){se=this._stack[i];if(!(this._cleanBase(se)&&this._fixupConfig(se))){ret=false;break}}return ret}_cleanBase(se){var src,ft;var nd=this._nd;src=se.cfg.base;if(src==="$jafcwd"){src=this._cwd}else{if(!src){src=this._nd.path.dirname(se.path)}src=nd.path.normalize(src);if(!nd.path.isAbsolute(src)){src=nd.path.join(nd.path.dirname(se.path),src)}ft=nd.fsUtils.getFileType(src);if(ft!=="d"){this._msgCtx.error(`Config file 'base' is not a directory - '${src}' in ${se.path}`);return false}}se.cfg.base=src;this._info(`[Info]: Using config base '${src}' in ${se.path}`,"I");return true}_fixupConfig(se){var nd,cfg,src,dir,ft,i;nd=this._nd;cfg=se.cfg;if(cfg.files){if(!this._cfgLib.validateFileList(cfg.files)){this._bErrors=true;return}if(src=se.cfg.files){for(i=0;i<src.length;i++){if(!src[i].startsWith("http")){src[i]=nd.path.normalize(src[i]);src[i]=nd.path.resolve(cfg.base,src[i])}}}}if(cfg.exclude){if(!this._cfgLib.validateFileList(cfg.exclude)){this._bErrors=true;return}if(src=cfg.exclude){for(i=0;i<src.length;i++){src[i]=nd.path.normalize(src[i]);src[i]=nd.path.resolve(cfg.base,src[i])}}}src=cfg.components;if(src){for(i=0;i<src.length;i++){dir=nd.path.normalize(src[i]);dir=nd.path.resolve(cfg.base,dir);cfg.components[i]=dir}}src=cfg.outPath;if(src&&src!=="$noout"){src=nd.path.normalize(src);src=nd.path.resolve(cfg.base,src);cfg.outPath=src}src=cfg.rulePacks;if(src){for(i=0;i<src.length;i++){dir=src[i].path;dir=nd.path.normalize(dir);src[i].path=nd.path.resolve(cfg.base,dir);if(src[i].path.endsWith(".zip")){continue}ft=nd.fsUtils.getFileType(src[i].path);if(ft!=="d"){this._error("'rulePacks (entry "+(i+1)+"): path' is not a directory - \""+src[i].path+"\"");this._bErrors=true}}}if(cfg.typescript&&cfg.typescript.tsconfig){src=cfg.typescript.tsconfig;if(src&&typeof src==="string"){if(!nd.path.isAbsolute(src)){dir=nd.path.normalize(src);dir=nd.path.resolve(cfg.base,dir)}else{dir=src}if(!dir.endsWith(TSCONFIG)){dir=nd.path.join(dir,TSCONFIG)}cfg.typescript.tsconfig=dir}}if(this._bErrors){this._error(`Errors found in inherited config '${se.path}'`)}return!this._bErrors}_getAbsolutePath(fp){if(this._nd.path.isAbsolute(fp)){return fp}let p=this._nd.path.join(this._cfg.base,fp);if(!this._nd.path.isAbsolute(p)){p=this._nd.path.join(this._dir,p)}return p}_isCircular(fp){var ret;for(let i=0;i<this._stack.length;i++){if(this._stack[i].path===fp){ret=true;break}}return ret}_isMergeProp(p){return MERGEABLE_BY_DEFAULT[p]||this._extendOpts[p]===EXOPT_MERGE}_mergePropFiles(parSE,chSE){return this._mergePropFilesExclude(parSE,chSE,"files")}_mergePropExclude(parSE,chSE){return this._mergePropFilesExclude(parSE,chSE,"exclude")}_mergePropFilesExclude(parSE,chSE,prop){var parent,child,ch,i;var parent=parSE.cfg[prop];var child=chSE.cfg[prop];for(i=0;i<child.length;i++){ch=child[i];if(!parent.includes(ch)){parent.push(ch)}}return true}_mergePropOptions(parSE,chSE){return this._mergeObjects(parSE,chSE,"options")}_mergePropGroups(parSE,chSE){return this._mergeArrays(parSE,chSE,"groups")}_mergePropTokens(parSE,chSE){return this._mergeObjects(parSE,chSE,"tokens")}_mergePropNameSpaces(parSE,chSE){return this._mergeArrays(parSE,chSE,"nameSpaces")}_mergePropRuleMods(parSE,chSE){var parent,child,pname,parPack,rule,rval,prval,i;var parent=parSE.cfg.ruleMods;var child=chSE.cfg.ruleMods;for(pname in child){rval=child[pname];if(!parent[pname]){parent[pname]=rval;continue}if(pname==="enable"||pname==="disable"){prval=parent[pname];for(i=0;i<rval.length;i++){if(!prval.includes(rval[i])){prval.push(rval[i])}}continue}parPack=parent[pname];for(rule in rval){if(!parPack[rule]){parPack[rule]=rval[rule]}}}return true}_mergePropRuleNames(parSE,chSE){return this._mergeArrays(parSE,chSE,"ruleNames")}_mergePropRulePacks(parSE,chSE){var parent=parSE.cfg.rulePacks;var child=chSE.cfg.rulePacks;for(let i=0;i<child.length;i++){let ch=child[i];let b=false;for(let j=0;j<parent.length;j++){let par=parent[j];if(ch.path===par.path){b=true;break}}if(!b){parent.push(ch)}}return true}_mergePropMessages(parSE,chSE){var parent=parSE.cfg.messages;var child=chSE.cfg.messages;var parReject=parent.reject;var chReject=child.reject;if(!parReject&&chReject){parent.reject=chReject}else if(parReject&&chReject){parent.reject=_removeDupes(parReject.concat(chReject))}var parAccept=parent.accept;var chAccept=child.accept;if(!parAccept&&chAccept){parent.accept=chAccept}else if(parAccept&&chAccept){parent.accept=_removeDupes(parAccept.concat(chAccept))}return true}_mergePropComponents(parSE,chSE){return this._mergeArrays(parSE,chSE,"components")}_mergePropCompUrls(parSE,chSE){return this._mergeArrays(parSE,chSE,"componentUrls")}_mergePropTypescript(parSE,chSE){return this._mergeObjects(parSE,chSE,"typescript")}_mergeObjects(parSE,chSE,prop){var parent,child;parent=parSE.cfg[prop];child=chSE.cfg[prop];for(let prop in child){if(!parent.hasOwnProperty(prop)){parent[prop]=child[prop]}}return true}_mergeArrays(parSE,chSE,prop){var parent,child,isPS,isCS,isPA,isCA,val;parent=parSE.cfg[prop];child=chSE.cfg[prop];isPS=typeof parent==="string";isCS=typeof child==="string";if(isPS&&isCS&&parent===child){return}isPA=Array.isArray(parent);isCA=Array.isArray(child);parent=isPA?parent:[parent];child=isCA?child:[child];for(let i=0;i<child.length;i++){val=child[i];if(!parent.includes(val)){parent.push(val)}}return true}_emitErrorMsg(s,prop,path){var s=s||MSG.UNKNOWN;if(prop){s=s.replace(REPL_PROP,prop)}this._error(s.replace(REPL_PATH,path));this._isError=true}_parseError(msg){this._parseError=msg}_dumpStack(){this._msgCtx.info("[Info]: Config 'extends' stack","I",true);for(let i=0;i<this._stack.length;i++){this._msgCtx.info(`[Info]: ${this._stack[i].path}`,"I",true)}}}function _removeDupes(ar){return Array.isArray(ar)?ar.filter((val,x)=>ar.indexOf(val)===x):ar};module.exports=Extends;
|
package/lib/filetypes.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const _FILETYPES={html:true,css:true,js:true,ts:true,tsx:true,json:true,md:true,zip:true};const _OBJ_FILETYPES={html:true,css:true,js:true,ts:true,tsx:true,json:true,md:true};const _ZIP_FILETYPES={html:true,css:true,js:true,ts:true,tsx:true,json:true,md:true};module.exports.HTML="html";module.exports.CSS="css";module.exports.JS="js";module.exports.TS="ts";module.exports.TSX="tsx";module.exports.JSON="json";module.exports.MD="md";module.exports.ZIP="zip";module.exports.isFileTypeSupported=ft=>{return _FILETYPES[ft]};module.exports.isFileTypeSupportedInObj=ft=>{return _OBJ_FILETYPES[ft]};module.exports.isFileTypeSupportedInZip=ft=>{return _ZIP_FILETYPES[ft]};module.exports.isFileTypeTsOrTsx=ft=>{return ft==="ts"||ft==="tsx"};
|
package/lib/grouplist.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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 _color;function showBuiltinGroups(nd,arg,msgCtx){var packs;_init(nd);if(packs=nd.builtinpacks.getPackMetadata(nd,msgCtx)){let prefixes=nd.builtinpacks.getPrefixes();for(let pack of prefixes){if(!arg||arg===pack){_display(packs[pack],true)}}}};function showExternalGroups(packs,arg,nd){var pack,isExternal;_init(nd);if(arg){arg=arg.toLowerCase()}for(pack of packs){if(!pack.builtin){if(!arg||arg===pack.prefix.toLowerCase()){_display(pack);isExternal=true}}}if(!isExternal){console.log(_color.BRIGHTRED(" No external rule packs declared!"))}};function _display(pack,isBuiltin){var rules,rule,opts,summary={},oos=[],dis=[],groups,group,msg;if(isBuiltin){_title(pack);rules=pack.rules;for(rule in rules){opts=rules[rule];if(!(groups=opts.group)){continue};if(typeof groups==="string"){groups=[groups]}for(group of groups){if(!summary[group]){summary[group]=[]}summary[group].push(rule)}if(opts.hasOwnProperty("inservice")&&!opts.inservice){oos.push(rule)}else{if(opts.hasOwnProperty("enabled")&&!opts.enabled){dis.push(rule)}}}groups=Object.keys(summary);groups=groups.sort()}else{_title(pack);if(pack.groupMap){summary=pack.groupMap;groups=Object.keys(pack.groupMap);groups=groups.sort()}}if(!groups){console.log(_color.BRIGHTYELLOW(`● No groups`));return}for(group of groups){console.log(_color.BRIGHTYELLOW(`● ${group}:`));rules=summary[group];for(rule of rules){msg=` ${rule}`;if(oos.includes(rule)){msg+=_color.RED(" (out of service)")}else if(dis.includes(rule)){msg+=_color.RED(" (disabled by default)")}console.log(msg)}}};function _title(pack){console.log(`\n\n${_color.BRIGHTRED("\u25CF")} ${_color.CYAN("Pack")} ${_color.BRIGHTRED(`${pack.prefix}`)} ${_color.CYAN(" - Group Rule Membership")}`)};function _init(nd){_color=nd.colors};module.exports.showBuiltinGroups=showBuiltinGroups;module.exports.showExternalGroups=showExternalGroups;
|
package/lib/groups.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const _GROUPS={all:true,'jet-html':true,'jet-css':true,'jet-js':true,'jet-ts':true,'jet-tsx':true,'jet-json':true,'jet-md':true,'jet-aria':true,'jet-deprecated':true,'jet-deleted':true,'jet-override':true,'jet-cca':true,'jet-spoc':true,'jet-csp':true,'jet-demo':true,'jet-bp':true,'jet-perf':true,html5:true};module.exports.isGroup=g=>{return _GROUPS[g]};
|
package/lib/help.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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
|
+
const FLAGS=["\n Command line: %ojaf [flags] [ files/directory space separated list]%\n","\n Audit related flags:\n"," ~--config~ or ^-c^ : %followed by filepath to configuration file. If%"," %omitted, current directory is used.%"," ~--base~ or ^-b^ : %followed by filepath used to resolve relative paths. If%"," %omitted, current directory is used.%"," ~--jetver~ or ^-jv^ : %sets the JET version - must be followed by a version number x[.y[.z]]%"," ~--format~ or ^-t^ : %followed by output format 'prose' | 'json' | 'line'%"," ~--outPath~ or ^-o^ : %followed by output file path%"," ~--noout~ or ^-no^ : %do not write to output file path%"," ~--severity~ or ^-s^ : %report on this rule severity only%"," ~--groups~ or ^-g^ : %followed by group(s)%"," ~--groups=~ or ^-g=^ : %followed by group(s)%"," ~--followlinks~ or ^-fl^ : %follow stylesheet/script links%"," ~--nofollowlinks~ or ^-nfl^ : %do not follow stylesheet/script links%"," ~--extra~ or ^-e^ : %verbose - show extra details%"," ~--retcode~ or ^-rc^ : %followed by 'auto' | 'errors' | number, to override return code%"," ~--retcode=~ or ^-rc=^ : %followed by 'auto' | 'errors' | number, to override return code%"," ~--msgid~ or ^-id^ : %show audit message id's in the ouput if format 'prose'%"," ~--nocolor~ or ^-nc^ : %do not colorize output%"," ~--debug~ or ^-d^ : %debug mode%","\n Immediate command flags - display JAF info or scaffold files (no auditing involved)\n"," ~--help~ or ^-h^ : %show this help%"," ~--help~ or ^-h^ : %followed by messageID | rulename : show rule description%"," ~--version~ or ^-v^ : %show the ojaf version%"," ~--jetlist~ or ^-jl^ : %show the supported JET versions%"," ~--nslist~ or ^-nsl^ : %show the supported registered Namespaces%"," ~--grouplist~ or ^-gl^ : %show built-in rules by group. May be followed by an%"," %optional pack prefix.%"," ~--xgrouplist~ or ^-xgl^ : %show external pack rules by group. May be followed by an%"," %optional pack prefix.%"," ~--dislist~ or ^-dl^ : %show the JET built-in rules disabled by default. May be followed%"," %by an optional pack prefix.%"," ~--metahist~ or ^-mh^ : %show the renamed/deleted JET component history%\n"," ~--dac~ or ^-dac^ : %display active config and terminate (no audit performed)%"," ~--reg~ or ^-reg^ : %display rule listener types (debug)%"," ~--init~ or ^-i^ : %scaffold a JAF config file%"," ~--initrule~ or ^-ir^ : %followed by rulename (no file extension) - scaffold a rule file%\n"," ~--rules~ or ^-r^ : %display rule information%"," ~--rulessonar~ or ^-rs^ : %display rule information - sonar format%"," ~--rulesjson~ or ^-rj^ : %display rule information - json format%"," ~--dryrun~ or ^-dr^ : %dry run - show setup and files that would have been audited (no%"," %audit performed)%","\n1) Command line args override corresponding properties in the configuration file.","2) Command flags are case independent."];module.exports=function(fnShowVersion,color,msgContext){var console=msgContext.console;var by=color.BRIGHTYELLOW;var cy=color.CYAN;var x1,x2,x3,x4,x5,x6,msg;fnShowVersion();FLAGS.forEach(s=>{msg="";if((x1=s.indexOf("~"))>=0){x2=s.indexOf("~",x1+1);msg=s.substring(0,x1)+by(s.substring(x1+1,x2));if((x3=s.indexOf("^",x2+1))>=0){x4=s.indexOf("^",x3+1);msg+=s.substring(x2+1,x3)+by(s.substring(x3+1,x4));if((x5=s.indexOf("%",x4+1))>=0){x6=s.indexOf("%",x5+1);msg+=s.substring(x4+1,x5)+cy(s.substring(x5+1,x6))+s.substring(x6+1)}else{msg+=s.substring(x4+1)}}else{msg+=s.substring(x2+1)}}else if((x5=s.indexOf("%"))>=0){x6=s.indexOf("%",x5+1);msg+=s.substring(0,x5)+cy(s.substring(x5+1,x6))+s.substring(x6+1)}else{msg=s}console(msg)})};
|
package/lib/jetver.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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
|
+
const verList=require("../meta/metaverlist.json");const DEFAULTS=require("./defaults");const SUP="\xB9";var verData;var nd;function init(nodeDeps){nd=nodeDeps;if(!verData){let o=verList.metaList,o2={},v,s;for(s in o){v=o[s];o2[v.version]={date:v.date,time:v.time}}verData={metaList:o2}}};function showList(){let keys,ver,a,built,isDefVer,list=verData.metaList,indent=" \u2022 ";let sup=nd.colors.BRIGHTYELLOW(SUP);keys=Object.keys(list).sort(function(a,b){var va=a.split(".");var vb=b.split(".");va.forEach(function(v,i,a){a[i]=parseInt(v)});vb.forEach(function(v,i,a){a[i]=parseInt(v)});if(va[0]>vb[0]){return 1}if(va[0]<vb[0]){return-1}if(va[1]>vb[1]){return 1}if(va[1]<vb[1]){return-1}if(va[2]>vb[2]){return 1}if(va[2]<vb[2]){return-1}return 0}).reverse();console.log("\n"+" JET versions supported:");keys.forEach(function(verName){ver=list[verName];a=verName.split(".");a.forEach(function(s,x){a[x]=parseInt(s)});if(a[0]<10){verName=" "+verName}built=" ("+ver.date+" "+ver.time+")";if(isDefVer=verName===DEFAULTS.JETVER){let def=" Default";built+=nd.colors.BRIGHTYELLOW(def)+sup}verName=isDefVer?nd.colors.BRIGHTYELLOW(verName):nd.colors.CYAN(verName);console.log(indent+verName+built)});let footnote="Default config 'jetVer' value if not specified.";footnote=nd.colors.BRIGHTYELLOW(footnote);console.log(`\n${sup} ${footnote}`)};function validate(v){var a;var i;if(v===null){return _getMVError(v,1)}if(typeof v!=="string"){return _getMVError(v,2)}a=v.split(".");for(i=0;i<a.length;i++){if(a[i]===""||parseInt(a[i])===NaN){return _getMVError(v,3)}}return null};function getBestVersion(v,a){return _findVer(v,a)}function _findVer(v,a){var keys=Object.keys(verData.metaList);var suspects=[];var s,i,ret;if(!Array.isArray(a)){a=v.split(".")}if(a.length===3&&a[2]==="0"){a.length=2}if(a.length===2){s=a[0]+"."+a[1]+".";for(i=0;i<keys.length;i++){if(keys[i].startsWith(s)){suspects.push(keys[i])}}}else if(a.length===1){s=a[0]+".";for(i=0;i<keys.length;i++){if(keys[i].startsWith(s)){suspects.push(keys[i])}}}if(suspects.length===1){return suspects[0]}if(!suspects.length){return null}ret="0.0.0";for(i=0;i<suspects.length;i++){if(suspects[i]>ret){ret=suspects[i]}}return ret};function getVersions(){return verData.metaList};function _getMVError(v,errno){var s;switch(errno){case 1:s="missing version arg after --jetver";break;case 2:s="--jetver '"+v+"' : invalid - expected major.minor.patch";break;case 3:s="--jetver '"+v+"' : invalid version specification";break;default:s="unknown error";}return s};module.exports.init=init;module.exports.validate=validate;module.exports.getVersions=getVersions;module.exports.getBestVersion=getBestVersion;module.exports.showList=showList;
|
package/lib/macros.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
const MACROS={cwd:"$jafcwd",date:"$jafdate",time:"$jaftime",ver:"$jafver",config:"$jafconfig",jetver:"$jetver"};module.exports=MACROS;
|
package/lib/manual.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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 PREFIX;var RP_PREFIX;const RULES_JSON="rules.json";const MSGID_JSON="msgid.json";const JS=".js";const RE_WS=/^\s*$/;const RE_MARKUP=/<[^>]*>/g;const RE_MULTI_BLANKS=/\s{2,}/g;const EMPTY="";const LINELEN=100;const LIST_INDENT=2;var _nd;var _error;var _path;var _rDir;var _rpDir;var _isMsgId;var _prefix;var _msgNum;var _rawArg;var _sev;var _multiIDs=[];var _color;function showBuiltinMsgHelp(nd,arg,msgCtx){var rc;_init(nd,msgCtx);rc=_initArg(arg);return rc>0?_processBuiltin():rc===0};function showExternalMsgHelp(rules,manCheckL,manCheckS,nd,msgCtx){var check,temp,isShort,o,x,ret=false;_init(nd,msgCtx);check=manCheckL||manCheckS;if(check){temp=check.toLowerCase();x=temp.indexOf("-");check=x>=0?temp.substring(0,x):"";check=check.toUpperCase()+temp.substring(x);isShort=!!manCheckS;if(rules.getRSIByRuleName(temp)>=0){o=rules.getRuleDescriptionEx(null,temp,isShort)}else{o=rules.getRuleDescriptionEx(check,null,isShort)}if(o&&o.descrip){_display(o)}else{msgCtx.error(`Unable to locate '${temp}' via the configuration file.`)}ret=true}return ret};function _processBuiltin(){var meta;_rDir=_path.join(__dirname,"../rules");_rpDir=_path.join(__dirname,"../rulepacks");if(!(meta=_loadRuleMetadata())){return true}return _isMsgId?_processMsgId(meta):_processRuleName(meta)};function _processMsgId(meta){var mjson=meta.mjson;var rname,r,x;for(r in mjson){if(_msgNum===mjson[r]){rname=r;break}}if(!rname){_error(`No rule found for message ID ${_prefix}-${_msgNum}.`);return true}x=rname.indexOf("_");if(x>=0){rname=rname.substring(0,x)}return _displayIt(rname,_prefix,meta)};function _processRuleName(meta){var rname,rjson,r;rname=_rawArg.toLowerCase();rjson=meta.rjson.rules;for(r in rjson){if(r===rname){return _displayIt(rname,_prefix,meta)}}_error(`Rule ${rname} is not a core rule`);return!rname.startsWith("oj-")};function _displayIt(rname,prefix,meta){var rule,r,mjson,rjson,prefix;mjson=meta.mjson;for(r in mjson){if(r.startsWith(rname)){_multiIDs.push(mjson[r])}}rjson=meta.rjson;for(r in rjson.rules){if(r===rname){_sev=rjson.rules[r].severity;break}}_sev=_sev||"unknown";if(rule=_loadRule(rname,meta)){let o={descrip:rule.getDescription(),rule:rname,prefix:prefix,sev:_sev,idList:_multiIDs};_display(o);return true}return false};function _loadRule(rname,meta){var rule,ruleJS,fp;try{fp=_nd.path.join(meta.rdir,rname+JS);ruleJS=_nd.ruleLoader(fp);if(ruleJS.prototype||!ruleJS.getName){try{rule=new ruleJS}catch(e){_error(`Failed to instantiate rule ${rname}`)}}else{rule=ruleJS}return rule}catch(e){_error(`Failed to load rule ${rname}`)}};function _loadRuleMetadata(){var meta,fp;fp=RP_PREFIX.includes(_prefix)?_nd.path.join(_rpDir,_prefix):_nd.path.join(_rDir,_prefix);meta=_loadRulesJson(fp);return meta};function _loadRulesJson(dir){var rjson,mjson,fp;fp=_nd.path.join(dir,RULES_JSON);if(_nd.fsUtils.fileExists(fp)){rjson=_nd.jsonLoader.load(fp,_nd,m=>{_error(m)},true,_nd.utils)}else{_error(`Internal error: rule manifest for ${_prefix} not found`);return false}fp=_nd.path.join(dir,MSGID_JSON);if(_nd.fsUtils.fileExists(fp)){mjson=_nd.jsonLoader.load(fp,_nd,m=>{_error(m)},true,_nd.utils)}else{if(!RP_PREFIX.includes(_prefix)){_error(`Internal error: rule message ID manifest for ${_prefix} not found`);return false}}if(rjson){return{rjson:rjson,mjson:mjson,rdir:dir}}};function _init(nd,msgCtx){_nd=nd;_error=msgCtx.error;_path=nd.path;_color=nd.colors;PREFIX=nd.builtinpacks.getPrefixes();RP_PREFIX=nd.builtinpacks.getRulepackFolderPrefixes()};function _initArg(arg){var x;_rawArg=arg;arg=arg.toLowerCase();x=arg.indexOf("-");if(x<0){if(!isNaN(parseInt(arg))){arg="jet-"+arg;x=3}else{_error("Expected a message ID or rulename to follow --help");return 0}}_prefix=arg.substring(0,x);_msgNum=arg.substring(x+1);x=parseInt(_msgNum);_isMsgId=!isNaN(x);if(_isMsgId){if(_msgNum.length<4){_msgNum="0".repeat(4-_msgNum.length)+_msgNum}}else{_msgNum=null;if(arg.startsWith("oj-")){_prefix="jet"}}if(PREFIX.includes(_prefix)){return 1}return-1};var first;function _display(o){var lines,line,s,s1,s2,s3;var list,temp,indent;var multiSev=o.idList.length>1;s=_color.BRIGHTGREEN("Rule: ");s1=_color.BRIGHTGREEN("Severity: ");s2=_color.BRIGHTGREEN("Message ID");s3=_color.BRIGHTYELLOW("\xB9");line="\n"+s+_color.BRIGHTYELLOW(o.rule)+" "+s1+_color.BRIGHTYELLOW(o.sev)+(multiSev?s3:EMPTY)+" "+s2+(multiSev?"'s":EMPTY)+": "+o.prefix+"-"+o.idList.join(", ");console.log(line);s=_removeMarkup(o.descrip);s=_removeColorMarkup(s);indent=0;lines=s.split("\n");for(let i=0;i<lines.length;i++){line=lines[i];if(line.charAt(0)==="\x12"){list=true;temp=line.indexOf("/",1);indent=parseInt(line.substring(1,temp));line=line.substring(temp+1).trim();first=true}_displayLine(line,list,indent);if(list){if(line.indexOf("\x13")>=0){list=false;indent=0}}}if(multiSev){s="\n"+s3+_color.BRIGHTYELLOW(" Possibility of more than 1 severity since there are "+o.idList.length+" message ID's");console.log(s)}console.log("")};function _displayLine(s,list,indent){var line,c,x;var start=0;var end=LINELEN;while(end<s.length){x=_NL(s,start,end);if(x>=0){line=s.substring(start,x).trim();if(list){if(line.indexOf("\x13")>=0){indent=0}}line=_fixup(line);console.log((list?" ".repeat((first?0:indent)+LIST_INDENT):"")+_color.CYAN(line));first=false;start=x+1;end=start+LINELEN;continue}c=s.charAt(end);if(RE_WS.test(c)){line=s.substring(start,end).trim();line=_fixup(line);console.log((list?" ".repeat((first?0:indent)+LIST_INDENT):"")+_color.CYAN(line));first=false;start=end;end+=LINELEN;continue}else{end--}}if(start<end){line=s.substring(start,end).trim();line=_fixup(line);console.log((list?" ".repeat((first?0:indent)+LIST_INDENT):"")+_color.CYAN(line));first=false}};function _removeMarkup(s){s=s.replace(/<oj\-/g,"@@01").replace(/<\/oj\-/g,"@@02").replace(/<br>/g,"@@03").replace(/<p>/g,"@@03@@03").replace(/<b>/g,"@@04").replace(/<em>/g,"@@04").replace(/<i>/g,"@@05").replace(/<\/b>/g,"@@06").replace(/<\/em>/g,"@@06").replace(/<\/i>/g,"@@06").replace(/<div/g,"@@7").replace(/<\/div>/g,"@@8").replace(/<template>/g,"@@9").replace(/<\/template>/g,"@@10").replace(/<ol/g,"@@11").replace(/<\/ol>/g,"@@12").replace(/<ul/g,"@@13").replace(/<\/ul>/g,"@@14").replace(/<li/g,"@@15").replace(/<\/li>/g,"@@16").replace(/ /g,"\x11").replace(RE_MARKUP,EMPTY).replace(RE_MULTI_BLANKS," ").trimRight().replace(/@@01/g,"<oj-").replace(/@@02/g,"</oj-").replace(/@@03/g,"\n").replace(/</g,"<").replace(/>/g,">").replace(/@@9/g,"<template>").replace(/@@10/g,"</template>").replace(/@@7/g,"<div").replace(/@@8/g,"</div>").replace(/@@11/g,"<ol").replace(/@@12/g,"</ol>").replace(/@@13/g,"<ul").replace(/@@14/g,"</ul>").replace(/@@15/g,"<li").replace(/@@16/g,"</li>");if(!_nd.colors.isColor()){s=s.replace(/@@4/g,EMPTY).replace(/@@5/g,EMPTY).replace(/@@6/g,EMPTY)}return _handleLists(s)};function _removeColorMarkup(s){if(_nd.colors.isColor()){s=s.replace(/@@04/g,EMPTY).replace(/@@05/g,EMPTY).replace(/@@06/g,EMPTY)}return s.trim()};function _handleLists(s){var start,end,ordered,rep;while(true){ordered=false;if((start=s.indexOf("<ol>"))>=0){ordered=true}else{start=s.indexOf("<ul>")}if(start>=0){end=s.indexOf("</ol>",start);rep=_handleList(s,start,end,ordered);s=s.substring(0,start)+rep+s.substring(end+4)}else{break}}return s};function _handleList(s,start,end,ordered){var list,itemStart,itemEnd,count=0,sCount,rep="";list=s.substring(start+4,end).trim();itemEnd=0;while(true){if((itemStart=list.indexOf("<li>",itemEnd))>=0){itemEnd=list.indexOf("</li>",itemStart);sCount=(ordered?""+ ++count+")":"*")+" ";rep+="\n\n"+"\x12"+sCount.length+"/"+sCount+list.substring(itemStart+4,itemEnd).trimRight()+"\x13"}else{break}}return rep}function _fixup(s){return s.replace(/\x11/g," ")};function _NL(s,start,end){while(start<end){if(s.charAt(start)==="\n"){return start}start++}return-1};module.exports={showBuiltinMsgHelp,showExternalMsgHelp};
|
package/lib/metaLoader.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
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
|
+
*/
|
|
1
6
|
function loadMeta(metaFile,nodeDeps){const fs=require("fs");var obj=null;try{if(nodeDeps.fsUtils.fileExists(metaFile)){var js=fs.readFileSync(metaFile,"utf8");js=js.replace("define","obj=");eval(js);obj=obj()}}catch(e){console.log(e)}return obj};module.exports.loadMeta=loadMeta;
|
package/lib/metahist.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 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
|
+
*/
|
|
1
6
|
const fs=require("fs");const path=require("path");const META_DIR=path.join(__dirname,"../meta");const META_FILE="jetauditmeta.js";function show(nd){var meta,delHist,renHist;meta=_getMetaData(nd);if(!meta){return}delHist=meta.delMeta;renHist=meta.renMeta;_showTagDeletes(delHist);_showRenames(renHist);_showDeletes(delHist)};function _showTagDeletes(delHist){var tags,tag;tags=delHist.tags;if(!tags){return}var line="-".repeat(36);console.log("\n"+line);console.log(" Deleted Web Components ");console.log(line+"\n");for(tag in tags){console.log(tag)}};function _showRenames(o){var line="-".repeat(35);console.log("\n"+line);console.log(" Renamed Classes ");console.log(line+"\n");var len=_longest(o);for(let n in o){console.log(`${_ljust(n,len)} -> ${o[n].to} (${o[n].since})`)}console.log("\n")};function _showDeletes(o){var clazzes,clazz,ce,line,len;if(o.classes){line="-".repeat(36);console.log("\n"+line);console.log(" Deleted Classes ");console.log(line+"\n");len=_longest(o.classes);clazzes=o.classes;for(clazz in clazzes){console.log(`${_ljust(clazz,len)} (${clazzes[clazz]})`)}}line="-".repeat(45);console.log("\n"+line);console.log(" Deleted Methods & Members ");console.log(line);len=_longest(o);for(clazz in o){let meths,mems,meth,mem;if(clazz==="classes"||clazz==="tags"){continue}ce=o[clazz];console.log("\n"+clazz);if(ce.methods){meths=ce.methods;len=_longest(meths)+2;for(meth in meths){console.log(` ${_ljust(meth+"()",len)} (${meths[meth]})`)}}if(ce.members){mems=ce.members;len=_longest(mems);for(mem in mems){console.log(` ${_ljust(mem,len)} (${mems[mem]})`)}}}console.log("\n")};function _ljust(s,n){var len=n-s.length>=0?n-s.length:0;return s+" ".repeat(len)}function _longest(o){var len=0;for(let n in o){if(n!=="classes"&&n!=="tags"){len=n.length>len?n.length:len}}return len};function _getMetaData(nd){var jetVers,metaVer,metaFile,meta;jetVers=_getVersionList(nd);if(!jetVers||!jetVers.length){return}metaVer=jetVers[jetVers.length-1];metaFile=path.join(META_DIR,metaVer,META_FILE);try{meta=nd.metaLoader.loadMeta(metaFile,nd)}catch(e){meta=null;this._error("Metadata '"+metaFile+"' not found!")}return meta};function _getVersionList(nd){var verList=[];var files,inFile,ftype,i;try{files=fs.readdirSync(META_DIR);for(i=0;i<files.length;i++){inFile=files[i];ftype=nd.fsUtils.getFileTypeSync(path.join(META_DIR,inFile));if(ftype==="d"){verList.push(inFile)}else if(ftype instanceof Error){throw ftype}}}catch(e){console.log(e.message)}if(verList&&verList.length){verList.sort(function(a,b){var va=a.split(".");var vb=b.split(".");va.forEach(function(v,i,a){a[i]=parseInt(v)});vb.forEach(function(v,i,a){a[i]=parseInt(v)});if(va[0]>vb[0]){return 1}if(va[0]<vb[0]){return-1}if(va[1]>vb[1]){return 1}if(va[1]<vb[1]){return-1}if(va[2]>vb[2]){return 1}if(va[2]<vb[2]){return-1}return 0})}return verList};module.exports.show=show;
|
package/lib/msgidLoader.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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
|
+
module.exports=function(fp,nd,appCtx){var json,obj;if(nd.fsUtils.fileExists(fp)){json=nd.fs.readFileSync(fp,'utf8');obj=appCtx.utils.parseJson(json,true);if(obj.msg){appCtx.error(`Internal error: rule message ID manifest syntax error : ${obj.msg} line ${obj.line} col ${obj.col} - ${fp}`);return null}return obj.obj}appCtx.error(`Internal error: rule message ID manifest not found - '${fp}'`);return null};
|
package/lib/ns.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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
|
+
const _ns=["oj-acx","oj-acx-assets","oj-adp","oj-approvals","oj-av","oj-bi","oj-bi-sac","oj-cegbu","oj-cegbu-scp","oj-cgbu","oj-cgm","oj-communities","oj-core","oj-cp","oj-cso","oj-cx","oj-cx-ap","oj-cx-cg","oj-cx-dcs","oj-cx-fsvc","oj-cx-hd","oj-cx-iss","oj-cx-km","oj-cx-km-agent","oj-cx-marketing","oj-cx-ma","oj-cx-mc","oj-cx-ol","oj-cx-svc","oj-cxi","oj-cxm","oj-dbt","oj-dcs","oj-doceng","oj-ee","oj-em","oj-epm","oj-fa","oj-faw","oj-fa-fin","oj-fnd","oj-fom","oj-fsgbu","oj-fsgbu-demo","oj-fwk","oj-gbu","oj-gbu-comp","oj-gcs","oj-hcm","oj-hed","oj-hsgbu","oj-hsp","oj-hsp-common","oj-hsp-cruise","oj-hsp-hdp","oj-hsp-ohip","oj-hsp-opera","oj-ia","oj-i18n","oj-idaas","oj-ips","oj-j4s","oj-jv","oj-lux","oj-lx","oj-mca","oj-mcps","oj-oa","oj-oac","oj-oal","oj-oal-ni","oj-oal-ux","oj-oax","oj-ob","oj-oc","oj-oce","oj-oda","oj-oda-chat","oj-odcs","oj-odcs-oit","oj-odps","oj-ofsc","oj-ohi","oj-oic","oj-oit","oj-ofs","oj-ol","oj-omc","oj-omnichannel","oj-opa","oj-opaas","oj-opac","oj-pa","oj-psc","oj-prmt","oj-psm","oj-ref","oj-rgbu","oj-rgbu-jraf","oj-scs","oj-sp","oj-spatial","oj-spectra","oj-svc","oj-ux","oj-vb","oj-vb-sample","oj-vbdt","oj","oj-cc","oj-dynamic","oj-ext","oj-sample","oj-sample-internal","ns","ns-ui","demo","my"];const _setNS=new Set(_ns);module.exports={has:function(k){return _setNS.has(k)},getKeys:function(){return[..._setNS]}};
|
package/lib/nslist.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
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
|
+
*/
|
|
1
6
|
const NS=require("./ns").getKeys();const OJ="oj-";function show(){var oj,noj,m,i;oj=[];noj=[];for(i=0;i<NS.length;i++){if(NS[i].startsWith(OJ)){oj.push(NS[i])}else{noj.push(NS[i])}}oj=oj.sort();var col1l,col2l;var col1l=Math.floor(oj.length/3)+(oj.length%3?1:0);if(!(oj.length%3)){col2l=col1l}else{if(oj.length-col1l){col2l=Math.floor((oj.length-col1l)/2)+(oj.length%2?1:0)}else{col2l=0}}col2l+=col1l;var col1w=0,col2w=0;for(i=0;i<col1l;i++){if(oj[i].length>col1w){col1w=oj[i].length}}for(i=col1l;i<col2l;i++){if(oj[i].length>col2w){col2w=oj[i].length}}col1w+=3;col2w+=3;m="\nJET Registered Namespaces";console.log(`\n${m}\n${"-".repeat(m.length)}`);for(i=0;i<col1l;i++){let col1=oj[i];let col2=i+col1l<col2l?oj[i+col1l]:"";let col3=i+col2l<oj.length?oj[i+col2l]:"";console.log(`${_left(col1,col1w)}${_left(col2,col2w)}${col3}`)}noj.sort();m="\nMiscellaneous Non-OJ Registered Namespaces";console.log(`\n${m}\n${"-".repeat(m.length)}`);for(i=0;i<noj.length;i++){console.log(noj[i])}};function _left(s,len){var l=len-s.length;if(l<0){l=0}return s+" ".repeat(l)};module.exports.showNamespaces=show;
|
package/lib/outFormat.js
ADDED
package/lib/outfile.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
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
|
+
*/
|
|
1
6
|
function writeFileSyncJson(nodeDeps,filepath,obj,options){var indent=options&&options.indent?options.indent:3;nodeDeps.fs.writeFileSync(filepath,JSON.stringify(obj,null,indent))};function writeFileSyncText(nodeDeps,filepath,text){nodeDeps.fs.writeFileSync(filepath,text)};module.exports={writeFileSyncJson:writeFileSyncJson,writeFileSyncText:writeFileSyncText};
|
package/lib/ruleLoader.js
CHANGED
package/lib/scaffold.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
const DEFAULT_ECMAVER=11;const DEFAULT_THEME="Alta";const OJET_CONFIG="oraclejetconfig.json";const OJAF_CONFIG="oraclejafconfig.json";const OJAF_DEFAULT_CONFIG="jafconfig.json";const DEPENDENCIES_VER_PROP="@oracle/oraclejet";const EXCH_COMPS_FOLDER="jet_components";const COMPOSITES_FOLDER="jet-composites";const EXTENSION_FOLDER="extension";const RESOURCES_FOLDER="resources";const COMP_JSON="component.json";const PACKAGE_JSON="package.json";const SUFFIX_HTML="/**/*.html";const SUFFIX_JS="/**/*.js";const SUFFIX_CSS="/**/*.css";const SUFFIX_JSON="*.json";const SUFFIX_ALL="/**/*.*";const OJET_COMMENT="OJET Based Configuration";const NON_OJET_COMMENT="Default Configuration";const SLASHIFY=/\\\\|\\/g;var ojetCommon;var ojetComposites;var cwd,appCtx,nd,ojet,ojConfig,jafConfig,initDone;function init(cwdir,nodeDeps,appContext){if(!initDone){cwd=_fwdSlashify(cwdir);nd=nodeDeps;appCtx=appContext;ojet=isOJET();initDone=true}return ojet}function isOJET(){return initDone?!!ojConfig:nd.fsUtils.fileExists(nd.path.join(cwd,OJET_CONFIG))};function handleOjetConfig(isScaffold){var ojetPath,ojafPath,doUpdate=false,temp,hash,defaultExists,error=false;ojetPath=nd.path.join(cwd,OJET_CONFIG);ojConfig=nd.jsonLoader.load(ojetPath,nd,function(errMsg){appCtx.error(_extractMsg(errMsg));error=true},false,appCtx.utils);if(isScaffold){if(error){appCtx.error("Cannot continue with --init");return"error"}else if(ojConfig){appCtx.msg("Scaffolding JAF configuration in "+_getFolderName()+" ...")}else{appCtx.error("OJET CLI config not found - cannot continue with --init");return"error"}}ojafPath=nd.path.join(cwd,OJAF_CONFIG);if(nd.fsUtils.fileExists(ojafPath)){jafConfig=_readJAFConfig(ojafPath);if(jafConfig==="error"){return"error"}}if(isScaffold){defaultExists=_defaultConfigExists();if(jafConfig||defaultExists){appCtx.error("Pre-existing configuration found - '"+(defaultExists?OJAF_DEFAULT_CONFIG:OJAF_CONFIG)+"'");return"error"}}if(!isScaffold&&!ojConfig&&jafConfig){appCtx.warn("JAF Configuration '"+OJAF_CONFIG+"' found, but OJET configuration '"+OJET_CONFIG+"' no longer exists.\n")}ojetCommon="./"+ojConfig.paths.source.common;ojetComposites=ojetCommon+"/"+ojConfig.paths.source.javascript+"/"+COMPOSITES_FOLDER;hash=_ojetFileChange(ojetPath,jafConfig);if(jafConfig){if(hash){if(jafConfig.ojet&&jafConfig.ojet.update){if(appCtx.verboseMode||appCtx.debugMode){appCtx.info(OJET_CONFIG+" change detected - updating "+OJAF_CONFIG)}jafConfig.files=_getFileSet();jafConfig.exclude=_getExcludes();jafConfig.components=_getComposites();temp=_getJetVer();if(jafConfig.jetVer!==temp){jafConfig.jetVer=temp}temp=_getTheme();if(jafConfig.theme!==temp){jafConfig.theme=temp}if(!jafConfig.ojet){jafConfig.ojet={}}jafConfig.ojet.md5=hash;if(typeof jafConfig.ojet.update!=="boolean"){jafConfig.ojet.update=true}doUpdate=true}}}else if(isScaffold){jafConfig={base:"$jafcwd",files:_getFileSet(),exclude:_getExcludes(),components:_getComposites(),builtinJetRules:true,jetVer:_getJetVer(),ecmaVer:DEFAULT_ECMAVER,theme:_getTheme(),format:"prose",severity:"all",groups:["all"],options:{verbose:false,color:true},title:["+---------------------------------------------------------------------+","| OJET Application Audit |","+---------------------------------------------------------------------+","JAF $jafver - Jet $jetver : ($jafdate, $jaftime)\n"],ojet:{update:true,md5:hash}};doUpdate=true}if(doUpdate&&!_writeJAFConfig(OJAF_CONFIG,true)){appCtx.error("Failed to "+(isScaffold?"scaffold":"persist")+" OJAF config '"+nd.path.join(cwd,OJAF_CONFIG)+"'");return"error"}if(isScaffold){scaffoldSuccessful(OJAF_CONFIG)}if(appCtx.debugMode){appCtx.debug("JAFConfig :\n"+JSON.stringify(jafConfig,null,3))}return jafConfig};function getOjetConfig(){return ojConfig}function _getFileSet(){var source,files;files=[];source=ojConfig.paths.source;files.push("./"+source.common+SUFFIX_HTML);files.push("./"+source.common+SUFFIX_JS);files.push("./"+source.web+SUFFIX_HTML);files.push("./"+source.web+SUFFIX_JS);files.push("./"+source.hybrid+SUFFIX_HTML);files.push("./"+source.hybrid+SUFFIX_JS);files.push("./"+source.common+"/"+source.styles+SUFFIX_CSS);files.push("./"+nd.path.join(ojetComposites,"**"+"/",COMP_JSON));return _fwdSlashify(files)};function createNonOjetConfig(){var oj;oj=_ojetJafConfigExists();if(oj||_defaultConfigExists()){appCtx.error("Default configuration '"+(oj?OJAF_CONFIG:OJAF_DEFAULT_CONFIG)+"' exists - terminating --init");return"'error"}jafConfig=_createDefault();setFileProps(jafConfig);if(!_writeJAFConfig(OJAF_DEFAULT_CONFIG,false)){appCtx.error("Failed to scaffold OJAF config '"+OJAF_DEFAULT_CONFIG+"'");return"error"}scaffoldSuccessful(OJAF_DEFAULT_CONFIG)};function _getExcludes(){var files=[],source;files.push("./"+nd.path.join(EXCH_COMPS_FOLDER,SUFFIX_ALL));files.push("./"+nd.path.join(ojetComposites,"**"+"/"+EXTENSION_FOLDER,SUFFIX_ALL));files.push("./"+nd.path.join(ojetComposites,"**"+"/"+RESOURCES_FOLDER,SUFFIX_ALL));source=ojConfig.paths.source.common;if(source.tests){files.push("./"+source.tests+SUFFIX_HTML);files.push("./"+source.tests+SUFFIX_JS)}source=ojConfig.paths.source.common;files.push("./"+nd.path.join(source,"**"+"/"+"*-min.js"));files.push("./"+nd.path.join(source,"**"+"/"+"*-min.css"));files.push("./**/node_modules/**/*.*");return _fwdSlashify(files)};function _getComposites(){var a=[],dir;dir=nd.path.join(cwd,ojetComposites);if(nd.fsUtils.fileExists(dir,true)){a.push(ojetComposites)}if(ojConfig.components){var c=_getExchComponents();if(c&&c.length){a.push.apply(a,c)}}return _fwdSlashify(a)};function _getJetVer(){var i,ojetPackage,ver,error;ojetPackage=nd.jsonLoader.load(nd.path.join(cwd,PACKAGE_JSON),nd,function(errMsg){appCtx.error(_extractMsg(errMsg));appCtx.warn("Defaulting to "+appCtx.defaultJetVer);error=true});if(!error&&ojetPackage&&ojetPackage.dependencies){ver=ojetPackage.dependencies[DEPENDENCIES_VER_PROP]}else{ver=appCtx.defaultJetVer}if(ver){for(i=0;i<ver.length;i++){if(!isNaN(ver.charAt(i))){ver=ver.substring(i);break}}ver=ver.replace(".tgz","");i=ver.lastIndexOf(".");ver=ver.substring(0,i)}return ver};function _getExchComponents(){var dirComps,comps,compName,o,a,ret=[],dir,rel;comps=ojConfig.components;if(!comps){return null}dirComps=nd.path.join(cwd,EXCH_COMPS_FOLDER);if(!nd.fsUtils.fileExists(dirComps,true)){return null}if(!(dirComps&&comps)){return null}for(compName in comps){dir=nd.path.join(cwd,EXCH_COMPS_FOLDER,compName);rel="./"+nd.path.join(EXCH_COMPS_FOLDER,compName);o=_readComponentJson(dir);if(o){if(o.type==="pack"){a=_expandPack(rel,o,comps[compName]);if(a.length){ret.push.apply(ret,a)}}else if(o.type==="composite"||!o.type){ret.push(rel)}}}return ret};function _getTheme(){var dt=ojConfig.defaultTheme;if(dt){dt=dt.charAt(0).toUpperCase()+dt.substring(1)}else{dt=DEFAULT_THEME}return dt};function _readComponentJson(dir){var compJson=nd.jsonLoader.load(nd.path.join(dir,COMP_JSON),nd,function(errMsg){appCtx.error(_extractMsg(errMsg))});return compJson};function _expandPack(dir,json,compObj){var comps,compName,a=[];comps=compObj.components;if(comps){for(compName in comps){a.push(dir+"/"+compName)}}return _fwdSlashify(a)};function _getFolderName(){return nd.path.basename(cwd)};function _readJAFConfig(path){var error;var json=nd.jsonLoader.load(path,nd,function(errMsg){appCtx.error(_extractMsg(errMsg));error=true},true);return error?"error":json};function _writeJAFConfig(name,isOjet){var data,ret=false;try{data="// JAF Generated "+(isOjet?OJET_COMMENT:NON_OJET_COMMENT)+"\n"+JSON.stringify(jafConfig,null,3);nd.fs.writeFileSync(nd.path.join(cwd,name),data);ret=true}catch(e){appCtx.error(e)}return ret};function _ojetFileChange(ojPath,jafConfig){var md5=require("md5");var ojetMd5,ojafMd5;ojetMd5=md5(_readFile(ojPath));ojafMd5=jafConfig&&jafConfig.ojet&&jafConfig.ojet.md5;return ojetMd5!==ojafMd5?ojetMd5:null};function _readFile(inFile){var data;try{data=nd.fs.readFileSync(inFile,"utf8")}catch(e){}return data};function _extractMsg(msg){var i=msg.indexOf(":");if(i>=0){msg=msg.substring(i+1)}return msg};function _fwdSlashify(path){if(Array.isArray(path)){for(var i=0;i<path.length;i++){path[i]=path[i].replace(SLASHIFY,"/")}return path}else if(path){return path.replace(SLASHIFY,"/")}};function _createDefault(){return{"base":"$jafcwd","files":[],"exclude":[],"components":[],"builtinJetRules":true,"jetVer":appCtx.defaultJetVer,"ecmaVer":DEFAULT_ECMAVER,"theme":DEFAULT_THEME,"groups":["all"],"format":"prose","options":{"verbose":false,"color":true},"title":["+---------------------------------------------------------------------+","| OJET Application Audit |","+---------------------------------------------------------------------+","JAF $jafver - Jet $jetver : ($jafdate, $jaftime)\n"]}};function setFileProps(obj){var path,folder;folder="src";path=_getPathTo(folder);if(path){obj.files.push(path+"/**/*.html");obj.files.push(path+"/**/*.js");obj.files.push(path+"/**/*.css");obj.exclude.push(path+"/**/*-min.js");obj.exclude.push(path+"/**/*-min.css")}folder="jet-composites";path=_getPathTo(folder);if(path){obj.components=[path];obj.exclude.push(path+"/**/extension/**/*.*");obj.exclude.push(path+"/**/resources/**/*.*")}};function _getPathTo(folder){var path=nd.fsUtils.findFile(cwd,folder,function(dir,file){return file!=="node_modules"&&!dir.includes("node_modules")});if(path){path=nd.path.join(path,folder);path=_fwdSlashify(path);path="."+path.replace(cwd,"")}else{path=null}return path};function _defaultConfigExists(){var file=nd.path.join(cwd,OJAF_DEFAULT_CONFIG);return nd.fsUtils.fileExists(file)};function _ojetJafConfigExists(){var file=nd.path.join(cwd,OJAF_CONFIG);return nd.fsUtils.fileExists(file)};function scaffoldSuccessful(configName){appCtx.msg(" __ ___");appCtx.msg(" __ / /___ _/ _/ Configuration generation successful");appCtx.msg(" / // // _ `/ _/ created: '@@'".replace("@@",configName));appCtx.msg(" \\___/ \\_,_/_/\n")};module.exports={init,isOJET,handleOjetConfig,createNonOjetConfig,getOjetConfig};
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 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
|
+
const DEFAULTS=require("./defaults");const OJET_CONFIG="oraclejetconfig.json";const OJAF_CONFIG="oraclejafconfig.json";const OJAF_DEFAULT_CONFIG="jafconfig.json";const DEPENDENCIES_VER_PROP="@oracle/oraclejet";const COMPOSITES_FOLDER="jet-composites";const EXTENSION_FOLDER="extension";const RESOURCES_FOLDER="resources";const JS_FOLDER="js";const TS_FOLDER="ts";const COMP_JSON="component.json";const PACKAGE_JSON="package.json";const TSCONFIG="tsconfig.json";const SUFFIX_HTML="/**/*.html";const SUFFIX_JS="/**/*.js";const SUFFIX_TS="/**/*.ts";const SUFFIX_CSS="/**/*.css";const SUFFIX_COMPJSON="/**/component.json";const SUFFIX_ALL="/**/*.*";const OJET_COMMENT="OJET Based Configuration";const NON_OJET_COMMENT="Default Configuration";const SLASHIFY=/\\\\|\\/g;var ojetCommon;var cwd,appCtx,nd,ojet,jetConfig,jafConfig,initDone;var md5;function init(cwdir,nodeDeps,appContext){if(!initDone){cwd=_fwdSlashify(cwdir);nd=nodeDeps;appCtx=appContext;ojet=isOJET();initDone=true}return ojet}function isOJET(){return initDone?!!jetConfig:nd.fsUtils.fileExists(nd.path.join(cwd,OJET_CONFIG))};function handleOjetConfig(isScaffold){var ojetPath,ojafPath,doUpdate=false,temp,hash,tsHash,tsc,defaultExists,error=false;ojetPath=nd.path.join(cwd,OJET_CONFIG);jetConfig=nd.jsonLoader.load(ojetPath,nd,errMsg=>{appCtx.error(errMsg);error=true},false,appCtx.utils);if(isScaffold){if(error){appCtx.error("Cannot continue with --init");return"error"}else if(jetConfig){appCtx.msg(`Scaffolding JAF configuration in ${_getFolderName()} ...`)}else{appCtx.error("OJET CLI config not found - cannot continue with --init");return"error"}}ojafPath=nd.path.join(cwd,OJAF_CONFIG);if(nd.fsUtils.fileExists(ojafPath)){jafConfig=_readJAFConfig(ojafPath);if(jafConfig==="error"){return"error"}}if(isScaffold){defaultExists=_defaultConfigExists();if(jafConfig||defaultExists){appCtx.error("Pre-existing configuration found - '"+(defaultExists?OJAF_DEFAULT_CONFIG:OJAF_CONFIG)+"'");return"error"}}if(!isScaffold&&!jetConfig&&jafConfig){appCtx.warn(`JAF Configuration '${OJAF_CONFIG}' found, but OJET configuration '${OJET_CONFIG}' no longer exists.\n`)}if(jetConfig.paths){if(jetConfig.paths.source&&jetConfig.paths.source.common){ojetCommon="./"+jetConfig.paths.source.common;ojetComposites=ojetCommon+"/"+jetConfig.paths.source.javascript+"/"+COMPOSITES_FOLDER;if(jetConfig.paths.source.typescript)ojetCompositesTs=ojetCommon+"/"+jetConfig.paths.source.typescript+"/"+COMPOSITES_FOLDER}}hash=_isOjetFileChange(ojetPath,jafConfig);if(jafConfig){if(hash){if(jafConfig.ojet&&jafConfig.ojet.update){if(appCtx.verboseMode||appCtx.debugMode){if(hash){appCtx.info(`${OJET_CONFIG} change detected - updating ${OJAF_CONFIG}`)}if(tsHash){if(typeof tsHash==="string"){appCtx.info(`${TSCONFIG} change detected - updating ${OJAF_CONFIG}`)}else{appCtx.info(`${TSCONFIG} no longer found - updating ${OJAF_CONFIG}`)}}}jafConfig.files=_getFileSet();jafConfig.exclude=_getExcludes();jafConfig.components=_getComposites();if(tsc=_getTsConfigPath()){if(jafConfig.typescript){jafConfig.typescript.tsconfig=tsc}else{jafConfig.typescript={tsconfig:tsc}}}else if(jafConfig.typescript&&jafConfig.typescript.tsconfig){delete jafConfig.typescript}if(jafConfig.tsconfig){delete jafConfig.tsconfig}temp=_getJetVer();if(jafConfig.jetVer!==temp){jafConfig.jetVer=temp}temp=_getTheme();if(jafConfig.theme!==temp){jafConfig.theme=temp}if(!jafConfig.ojet){jafConfig.ojet={}}if(hash){jafConfig.ojet.md5=hash}if(typeof jafConfig.ojet.update!=="boolean"){jafConfig.ojet.update=true}if(typeof tsHash==="string"){jafConfig.ojet.tsmd5=tsHash}else if(tsHash&&jafConfig.ojet.tsmd5){delete jafConfig.ojet.tsmd5}doUpdate=true;_backupJAFConfig(ojafPath)}else{const changeMsg=" changes detected, but oraclejafconfig updates are disabled";if(hash){appCtx.warn(OJET_CONFIG+changeMsg)}if(tsHash){appCtx.warn(TSCONFIG+changeMsg)}}}}else if(isScaffold){jafConfig={base:"$jafcwd",files:_getFileSet(),exclude:_getExcludes(),components:_getComposites(),builtinJetRules:true,jetVer:_getJetVer(),ecmaVer:DEFAULTS.ECMAVER,theme:_getTheme(),format:"prose",severity:"all",groups:["all"]};if(tsc=_getTsConfigPath()){jafConfig.typescript={tsconfig:tsc}}if(tsHash){jafConfig.ojet.tsmd5=tsHash}jafConfig.options={verbose:false,color:true};jafConfig.title=["+---------------------------------------------------------------------+","| OJET Application Audit |","+---------------------------------------------------------------------+","JAF $jafver - Jet $jetver : ($jafdate, $jaftime)\n"];jafConfig.ojet={update:true,md5:hash};doUpdate=true}if(doUpdate&&!_writeJAFConfig(OJAF_CONFIG,true)){appCtx.error("Failed to "+(isScaffold?"scaffold":"update")+" OJAF config '"+nd.path.join(cwd,OJAF_CONFIG)+"'");return"error"}if(isScaffold){scaffoldSuccessful(OJAF_CONFIG)}if(appCtx.debugMode){appCtx.debug("JAFConfig :\n"+JSON.stringify(jafConfig,null,3))}return jafConfig};function getOjetConfig(){return jetConfig}function _getFileSet(){var source,src,files=[];if(jetConfig&&jetConfig.paths){if(source=jetConfig.paths.source){if(src=source.common){files.push("./"+src+SUFFIX_HTML);if(source.javascript){files.push("./"+src+SUFFIX_JS)}if(source.typescript){files.push("./"+src+SUFFIX_TS)}files.push("./"+src+SUFFIX_COMPJSON)}if(source.styles){files.push("./"+src+"/"+source.styles+SUFFIX_CSS)}}}return _fwdSlashify(files)};function createNonOjetConfig(){var oj;oj=_ojetJafConfigExists();if(oj||_defaultConfigExists()){appCtx.error("Default configuration '"+(oj?OJAF_CONFIG:OJAF_DEFAULT_CONFIG)+"' exists - terminating --init");return"'error"}jafConfig=_createDefaultNonOjetConfig();_setFileProps(jafConfig);if(!_writeJAFConfig(OJAF_DEFAULT_CONFIG,false)){appCtx.error("Failed to scaffold OJAF config '"+OJAF_DEFAULT_CONFIG+"'");return"error"}scaffoldSuccessful(OJAF_DEFAULT_CONFIG)};function _getExcludes(){var files=[],source;if(jetConfig.paths&&jetConfig.paths.source){source=jetConfig.paths.source.common;files.push("./"+nd.path.join(source,"**"+"/"+"*-min.js"));files.push("./"+nd.path.join(source,"**"+"/"+"*-min.css"));files.push("./**/node_modules/**/*.*")}return _fwdSlashify(files)};function _getComposites(){var a=[],dir;dir="./jet-components/**/component.json";a.push(dir);return _fwdSlashify(a)};function _getTsConfigPath(){return _tsConfigExists()?".":null};function _getJetVer(){var i,ojetPackage,ver,error;ojetPackage=nd.jsonLoader.load(nd.path.join(cwd,PACKAGE_JSON),nd,function(errMsg){appCtx.error(errMsg);appCtx.warn("Defaulting to "+appCtx.defaultJetVer);error=true});if(!error&&ojetPackage&&ojetPackage.dependencies){ver=ojetPackage.dependencies[DEPENDENCIES_VER_PROP];if(ver){for(i=0;i<ver.length;i++){if(!isNaN(ver.charAt(i))){ver=ver.substring(i);break}}ver=ver.replace(".tgz","");i=ver.lastIndexOf(".");ver=ver.substring(0,i)}}return ver?ver:appCtx.defaultJetVer};function _getTheme(){var dt=jetConfig.defaultTheme;if(dt){dt=dt.charAt(0).toUpperCase()+dt.substring(1)}else{dt=DEFAULTS.THEME}return dt};function _getFolderName(){return nd.path.basename(cwd)};function _readJAFConfig(path){var error;var json=nd.jsonLoader.load(path,nd,function(errMsg){appCtx.error(errMsg);error=true},true,appCtx.utils);if(error){appCtx.error(`JSON syntax error -> '${path}`)}return error?"error":json};function _writeJAFConfig(name,isOjet){var data,ret=false;try{data=`// JAF Generated ${isOjet?OJET_COMMENT:NON_OJET_COMMENT}\n// Updated: ${new Date().toString()}\n\n${JSON.stringify(jafConfig,null,3)}`;nd.fs.writeFileSync(nd.path.join(cwd,name),data);ret=true}catch(e){appCtx.error(e)}return ret};function _backupJAFConfig(fp){var data,ret=false;try{data=_readFile(fp);if(data){nd.fs.writeFileSync(fp+".bak",data);ret=true}}catch(e){appCtx.error(e)}return ret};function _isOjetFileChange(ojPath,jafConfig){if(!md5){md5=require("md5")}var ojetMd5,ojafMd5;ojetMd5=md5(_readFile(ojPath));ojafMd5=jafConfig&&jafConfig.ojet&&jafConfig.ojet.md5;return ojetMd5!==ojafMd5?ojetMd5:false};function _readFile(fp){var data;try{data=nd.fs.readFileSync(fp,"utf8")}catch(e){}return data};function _fwdSlashify(path){if(Array.isArray(path)){for(var i=0;i<path.length;i++){path[i]=path[i].replace(SLASHIFY,"/")}return path}else if(path){return path.replace(SLASHIFY,"/")}};function _createDefaultNonOjetConfig(){var o={"base":"$jafcwd","files":[],"exclude":[],"components":["./jet-components/**/component.json"],"builtinJetRules":true,"jetVer":appCtx.defaultJetVer,"ecmaVer":DEFAULTS.ECMAVER,"theme":DEFAULTS.THEME,"groups":["all"],"format":"prose","severity":"all","options":{verbose:false,color:true},"title":["+---------------------------------------------------------------------+","| Application Audit |","+---------------------------------------------------------------------+","JAF $jafver - Jet $jetver : ($jafdate, $jaftime)\n"]};if(_tsConfigExists()){o.typescript={tsconfig:cwd}}return o};function _setFileProps(obj){var path,folder;folder="src";path=_getPathTo(folder);if(path){obj.files.push(path+"/**/*.html");obj.files.push(path+"/**/*.js");obj.files.push(path+"/**/*.ts");obj.files.push(path+"/**/*.css");obj.exclude.push(path+"/**/*-min.js");obj.exclude.push(path+"/**/*-min.css")}folder="jet-composites";path=_getPathTo(folder);if(path){obj.components=[path];obj.exclude.push(path+"/**/extension/**/*.*");obj.exclude.push(path+"/**/resources/**/*.*")}obj.exclude.push("./**/node_modules/**/*.*")};function _getPathTo(folder){var path=nd.fsUtils.findFile(cwd,folder,function(dir,file){return file!=="node_modules"&&!dir.includes("node_modules")});if(path){path=nd.path.join(path,folder);path=_fwdSlashify(path);path="."+path.replace(cwd,"")}else{path=null}return path};function _defaultConfigExists(){var file=nd.path.join(cwd,OJAF_DEFAULT_CONFIG);return nd.fsUtils.fileExists(file)};function _ojetJafConfigExists(){var file=nd.path.join(cwd,OJAF_CONFIG);return nd.fsUtils.fileExists(file)};function _tsConfigExists(){var file=nd.path.join(cwd,TSCONFIG);return nd.fsUtils.fileExists(file)};function scaffoldSuccessful(configName){appCtx.msg(" __ ___");appCtx.msg(" __ / /___ _/ _/ Configuration generation successful");appCtx.msg(" / // // _ `/ _/ created: '@@'".replace("@@",configName));appCtx.msg(" \\___/ \\_,_/_/\n")};module.exports={init,isOJET,handleOjetConfig,createNonOjetConfig,getOjetConfig};
|
package/lib/scaffoldRule.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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
|
+
const RULE=["/**"," * Copyright (c) 2018, 2022, Oracle and/or its affiliates."," * Licensed under The Universal Permissive License (UPL), Version 1.0"," * as shown at https://oss.oracle.com/licenses/upl/"," */","","/*--------------------------------------------------------------------------------*/","/* JAF Rule: '%r' */","/* Purpose : */","/*--------------------------------------------------------------------------------*/","","","const RULENAME = \"%s\";","const DESCRIPTION = \"long description/help - can include HTML markup\";","const SHORT_DESCRIPTION = \"short description\";","","class Rule {"," getName() {"," return RULENAME;"," }",""," getDescription() {"," return DESCRIPTION;"," }",""," getShortDescription() {"," return SHORT_DESCRIPTION;"," }",""," /**"," * Registration - declare listeners"," * @param {Object} regCtx the registration context"," */"," register( /*regCtx*/ ) {"," // register listener(s)"," // return { xxx : this._onXXX }"," }",""," /**"," *"," * @param {Object} ruleCtx the rule context"," */"," _onXXX(ruleCtx) {"," // implement rule listener(s)"," }","","}","","","","module.exports = Rule;"];const LOGO=[" __ ___"," __ / /___ _/ _/ Rule '"+"%r"+"'"," / // // _ `/ _/ Created successfully"," \\___/ \\_,_/_/\n"];const JS=".js";const PC_R="%r";const PC_S="%s";function genRule(dir,ruleName,nodeDeps){var np=nodeDeps.path;var fsUtils=nodeDeps.fsUtils;var ext=np.extname(ruleName);var rule,fp,text;if(ext===""){rule=ruleName}else if(ext.toLowerCase()!==JS){console.log("[error]: invalid rule file extension '"+ext+"'. Do not specify a file extension!");return true}else{rule=ruleName.substring(0,ruleName.length-3)}ruleName=rule+JS;fp=np.join(dir,ruleName);try{if(fsUtils.fileExists(fp)){console.log("[Warning]: Rule '"+ruleName+"' already exists. ojaf will not overwrite it!");return true}text=_updateText(text,rule);nodeDeps.fs.writeFileSync(fp,text);_logo(rule);return true}catch(e){console.log("[Error]: "+e)}return false};function _updateText(text,rule){var i;text=RULE.join("\n").replace(PC_S,rule);i=text.indexOf(PC_R);text=text.replace(PC_R," ");return _insertText(text,i,rule)};function _insertText(text,i,rule){return text.substring(0,i)+rule+"'"+text.substring(i+1+rule.length)};function _logo(rule){console.log(LOGO.join("\n").replace("%r",rule))}module.exports.genRule=genRule;
|
package/lib/schema.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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 _validate;const EMPTY_INDEX="['']";function validateComponentJson(obj){var errors,error,s,i,ret=null;if(!_validate){_init()}if(!_validate(obj)){ret=[];errors=_validate.errors;for(i=0;i<errors.length;i++){error=errors[i];s=_cleanAjvMessages(error);if(!s.includes("(if)")){ret.push({msg:s,error:error})}}}return ret};function _cleanAjvMessages(error){var keyword,i;var prop,subProp,propType,propId,param,dataPath,msg,ret;keyword=error.keyword;switch(keyword){case"required":ret=error.message;break;case"enum":prop=error.dataPath;if(prop.charAt(0)==="."){prop=prop.substr(1)};ret="bad property '"+prop+"' value : "+error.message+" ["+error.params.allowedValues+"]";break;case"additionalProperties":if(error.params){ret=error.params["additionalProperty"];dataPath=error.dataPath||"";if(dataPath){if(dataPath.charAt(0)==="."){dataPath=dataPath.substring(1)}if(dataPath.endsWith(EMPTY_INDEX)){dataPath=dataPath.substring(0,dataPath.indexOf(EMPTY_INDEX))}dataPath=" in "+dataPath}ret=`unexpected additional property '${ret}'${dataPath}`}else{prop=error.dataPath;i=prop.indexOf("[");propType=prop.substring(0,i);prop=prop.substring(i);prop=_smartRemoveSquareBrackets(prop);i=prop.indexOf(".");propId=prop.substring(0,i);propId=propId.replace(/[\'\"]/g,"");param=prop.substring(i);i=param.indexOf("'");if(i>=0){param=param.substring(0,i)+"."+param.substring(i+1);param=param.replace(/[\'\"]/g,"")}propType=_getSchemaPropType(propType);ret=propType+" "+propId+" has unexpected additional sub-property '"+param+"'"}break;case"type":msg=error.dataPath;if(msg.charAt(0)==="."){msg=msg.substring(1)}ret=msg+" - "+error.message;break;case"not":msg=error.message;msg=msg.replace("should NOT be ","is not ");propType=error.dataPath.startsWith(".prop")?"property":error.dataPath.startsWith(".events")?"events":error.dataPath.startsWith(".name")?"name":"";prop=error.propertyName?error.propertyName:null;if(!propType){ret=(prop?" property '"+prop+"'":"")+" - "+msg}else{ret="property '"+propType+"'"+(prop?" '"+prop+"' ":" ")+"- "+msg}break;case"propertyNames":ret=error.message;break;case"pattern":prop=error.dataPath;if(prop.charAt(0)==="."){prop=prop.substring(1)}return"property '"+prop+"' failed a schema format pattern match";break;case"format":prop=error.dataPath;if(prop.charAt(0)==="."){prop=prop.substring(1)}return"property '"+prop+"' format - "+error.message;break;case"anyOf":prop=error.dataPath;return"property "+(prop.charAt(0)==="."?prop.substring(1):prop)+" - "+error.message;break;default:ret="unknown error ("+error.keyword+")";}return ret};function _getSchemaPropType(propType){if(propType.startsWith(".prop")){propType="property"}else if(propType.startsWith(".even")){propType="event"}else if(propType.startsWith(".meth")){propType="method"}else{propType="UNNKNOWN"}return propType};function _smartRemoveSquareBrackets(prop){var i,x=0,s;while(true){i=prop.indexOf("[",x);if(i>=0){s=prop.substring(i+1,i+2).trim();if(!/\d/.test(s)){prop=prop.replace("[","");prop=prop.replace("]","");x=i;continue}}break}return prop};function _init(){var schema=require("../schema/component-schema.json");var Ajv=require("ajv");var _ajv=new Ajv({allErrors:true});_validate=_ajv.compile(schema)};module.exports.validateComponentJson=validateComponentJson;
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
(function clone(exports){'use strict';var Syntax,VisitorOption,VisitorKeys,BREAK,SKIP,REMOVE;function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==='object'&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}Syntax={AssignmentExpression:'AssignmentExpression',AssignmentPattern:'AssignmentPattern',ArrayExpression:'ArrayExpression',ArrayPattern:'ArrayPattern',ArrowFunctionExpression:'ArrowFunctionExpression',AwaitExpression:'AwaitExpression',BlockStatement:'BlockStatement',BinaryExpression:'BinaryExpression',BreakStatement:'BreakStatement',CallExpression:'CallExpression',CatchClause:'CatchClause',ChainExpression:'ChainExpression',ClassBody:'ClassBody',ClassDeclaration:'ClassDeclaration',ClassExpression:'ClassExpression',ComprehensionBlock:'ComprehensionBlock',ComprehensionExpression:'ComprehensionExpression',ConditionalExpression:'ConditionalExpression',ContinueStatement:'ContinueStatement',DebuggerStatement:'DebuggerStatement',DirectiveStatement:'DirectiveStatement',DoWhileStatement:'DoWhileStatement',EmptyStatement:'EmptyStatement',ExportAllDeclaration:'ExportAllDeclaration',ExportDefaultDeclaration:'ExportDefaultDeclaration',ExportNamedDeclaration:'ExportNamedDeclaration',ExportSpecifier:'ExportSpecifier',ExpressionStatement:'ExpressionStatement',ForStatement:'ForStatement',ForInStatement:'ForInStatement',ForOfStatement:'ForOfStatement',FunctionDeclaration:'FunctionDeclaration',FunctionExpression:'FunctionExpression',GeneratorExpression:'GeneratorExpression',Identifier:'Identifier',IfStatement:'IfStatement',ImportExpression:'ImportExpression',ImportDeclaration:'ImportDeclaration',ImportDefaultSpecifier:'ImportDefaultSpecifier',ImportNamespaceSpecifier:'ImportNamespaceSpecifier',ImportSpecifier:'ImportSpecifier',Literal:'Literal',LabeledStatement:'LabeledStatement',LogicalExpression:'LogicalExpression',MemberExpression:'MemberExpression',MetaProperty:'MetaProperty',MethodDefinition:'MethodDefinition',ModuleSpecifier:'ModuleSpecifier',NewExpression:'NewExpression',ObjectExpression:'ObjectExpression',ObjectPattern:'ObjectPattern',Program:'Program',Property:'Property',RestElement:'RestElement',ReturnStatement:'ReturnStatement',SequenceExpression:'SequenceExpression',SpreadElement:'SpreadElement',Super:'Super',SwitchStatement:'SwitchStatement',SwitchCase:'SwitchCase',TaggedTemplateExpression:'TaggedTemplateExpression',TemplateElement:'TemplateElement',TemplateLiteral:'TemplateLiteral',ThisExpression:'ThisExpression',ThrowStatement:'ThrowStatement',TryStatement:'TryStatement',UnaryExpression:'UnaryExpression',UpdateExpression:'UpdateExpression',VariableDeclaration:'VariableDeclaration',VariableDeclarator:'VariableDeclarator',WhileStatement:'WhileStatement',WithStatement:'WithStatement',YieldExpression:'YieldExpression',ClassProperty:'ClassProperty',TSAsExpression:'TSAsExpression',TSImportEqualsDeclaration:'TSImportEqualsDeclaration',TSTypeAliasDeclaration:'TSTypeAliasDeclaration',TSInterfaceDeclaration:'TSInterfaceDeclaration',JSXElement:'JsxElement',JSXOpeningElement:'JSXOpeningElement'};VisitorKeys={AssignmentExpression:['left','right'],AssignmentPattern:['left','right'],ArrayExpression:['elements'],ArrayPattern:['elements'],ArrowFunctionExpression:['params','body'],AwaitExpression:['argument'],BlockStatement:['body'],BinaryExpression:['left','right'],BreakStatement:['label'],CallExpression:['callee','arguments'],CatchClause:['param','body'],ChainExpression:['expression'],ClassBody:['body'],ClassDeclaration:['id','superClass','body'],ClassExpression:['id','superClass','body'],ComprehensionBlock:['left','right'],ComprehensionExpression:['blocks','filter','body'],ConditionalExpression:['test','consequent','alternate'],ContinueStatement:['label'],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:['body','test'],EmptyStatement:[],ExportAllDeclaration:['source'],ExportDefaultDeclaration:['declaration'],ExportNamedDeclaration:['declaration','specifiers','source'],ExportSpecifier:['exported','local'],ExpressionStatement:['expression'],ForStatement:['init','test','update','body'],ForInStatement:['left','right','body'],ForOfStatement:['left','right','body'],FunctionDeclaration:['id','params','body'],FunctionExpression:['id','params','body'],GeneratorExpression:['blocks','filter','body'],Identifier:[],IfStatement:['test','consequent','alternate'],ImportExpression:['source'],ImportDeclaration:['specifiers','source'],ImportDefaultSpecifier:['local'],ImportNamespaceSpecifier:['local'],ImportSpecifier:['imported','local'],Literal:[],LabeledStatement:['label','body'],LogicalExpression:['left','right'],MemberExpression:['object','property'],MetaProperty:['meta','property'],MethodDefinition:['key','value'],ModuleSpecifier:[],NewExpression:['callee','arguments'],ObjectExpression:['properties'],ObjectPattern:['properties'],Program:['body'],Property:['key','value'],RestElement:['argument'],ReturnStatement:['argument'],SequenceExpression:['expressions'],SpreadElement:['argument'],Super:[],SwitchStatement:['discriminant','cases'],SwitchCase:['test','consequent'],TaggedTemplateExpression:['tag','quasi'],TemplateElement:[],TemplateLiteral:['quasis','expressions'],ThisExpression:[],ThrowStatement:['argument'],TryStatement:['block','handler','finalizer'],UnaryExpression:['argument'],UpdateExpression:['argument'],VariableDeclaration:['declarations'],VariableDeclarator:['id','init'],WhileStatement:['test','body'],WithStatement:['object','body'],YieldExpression:['argument'],ClassProperty:[],TSAsExpression:[],TSImportEqualsDeclaration:[],TSTypeAliasDeclaration:[],TSInterfaceDeclaration:[],JSXElement:[],JSXOpeningElement:[]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(Array.isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(Array.isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.type=function(){var node=this.current();return node.type||this.__current.wrap};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype['break']=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=null;if(visitor.fallback==='iteration'){this.__fallback=Object.keys}else if(typeof visitor.fallback==='function'){this.__fallback=visitor.fallback}this.__keys=VisitorKeys;if(visitor.keys){this.__keys=Object.assign(Object.create(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==='object'&&typeof node.type==='string'}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&'properties'===key}function candidateExistsInLeaveList(leavelist,candidate){for(var i=leavelist.length-1;i>=0;--i){if(leavelist[i].node===candidate){return true}}return false}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=node.type||element.wrap;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=this.__fallback(node)}else{throw new Error('Unknown node type '+nodeType+'.')}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(Array.isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(candidateExistsInLeaveList(leavelist,candidate[current2])){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],'Property',null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){if(candidateExistsInLeaveList(leavelist,candidate)){continue}worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;function removeElem(element){var i,key,nextElem,parent;if(element.ref.remove()){key=element.ref.key;parent=element.ref.parent;i=worklist.length;while(i--){nextElem=worklist[i];if(nextElem.ref&&nextElem.ref.parent===parent){if(nextElem.ref.key<key){break}--nextElem.ref.key}}}}this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,'root'));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem(element)}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem(element);element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=node.type||element.wrap;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=this.__fallback(node)}else{throw new Error('Unknown node type '+nodeType+'.')}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(Array.isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],'Property',new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error('attachComments needs range information')}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller;exports.cloneEnvironment=function(){return clone({})};return exports})(exports);
|
package/lib/spinner.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
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
|
+
const Colors=require("./colors");const wcwidth=require("wcwidth");const CR="\r";const NL="\n";var Spinner=function(opts){this._options={text:"",textColor:"yellow",spincolor:"white",frame:[124,47,45,92],interval:100,hideCursor:true,gap:" ",stream:process.stderr};opts=this._mergeOpts(this._options,opts);this._textColor=opts.textColor;this._hideTheCursor=opts.hideCursor!==false;this._interval=opts.interval||100;this._stream=opts.stream;this._frame=opts.frame;this._gap=opts.gap;for(var i=0;i<opts.frame.length;i++){opts.frame[i]=String.fromCharCode(opts.frame[i])}this._frameIndex=0;this._canDo=!process.stdout.isTTY&&process.stderr.isTTY;this._lineCount=0;this._linesToClear=0;this._count=0};Spinner.prototype.start=function(text){if(!this._canDo){return}this.setText(text);if(this._hideTheCursor){this._hideCursor()}};Spinner.prototype.stop=function(text){if(!this._canDo){return}var opts;clearInterval(this._timer);this._timer=null;opts=this._options;this.setText(text);this._frameIndex=0;this.clear();if(this._hideTheCursor){this._showCursor()}};Spinner.prototype.setText=function(text){if(!this._canDo){return}text=typeof text==="string"?this._getNextFrameChar()+this._gap+text:"";text=this._setTextColor(text);const columns=this._stream.columns||80;this._lineCount=_stripAnsi("--"+text).split("\n").reduce((count,line)=>{return count+Math.max(1,Math.ceil(wcwidth(line)/columns))},0);_tslice(this)};Spinner.prototype._startTimer=function(){var opts=this._options;opts.stream.write(this._getNextFrameChar()+opts.gap+opts.text);this._timer=setInterval(_tslice,opts.interval,this)};function _tslice(self){self.clear();self._stream.write(self._text);self._linesToClear=self._lineCount};Spinner.prototype._getNextFrameChar=function(){var opts=this._options;this._frameIndex++;this._frameIndex=this._frameIndex%this._frame.length;return this._frame[this._frameIndex]};Spinner.prototype._hideCursor=function(){this._stream.write("\x1B[?25h");this._stream.write("\x1B[?25l")};Spinner.prototype._showCursor=function(){this._stream.write("\x1B[?25h")};Spinner.prototype._mergeOpts=function(optsTo,optsFrom){var prop;if(optsFrom){for(prop in optsFrom){if(optsFrom.hasOwnProperty(prop)){optsTo[prop]=optsFrom[prop]}}}return optsTo};Spinner.prototype.clear=function(){for(let i=0;i<this._linesToClear;i++){if(i>0){this._stream.moveCursor(0,-1)}this._stream.clearLine();this._stream.cursorTo(0)}this._linesToClear=0};Spinner.prototype._setTextColor=function(text){this._text=this._textColor==="yellow"?Colors.YELLOW(text):text;return this._text};function _stripAnsi(text){return typeof text==="string"?text.replace(_ansiRegex(),""):text};function _ansiRegex(){const pattern=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");return new RegExp(pattern,"g")};module.exports=Spinner;
|
package/lib/spinnernoop.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
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
|
+
*/
|
|
1
6
|
function SpinnerNoOp(){};SpinnerNoOp.prototype.start=_noop;SpinnerNoOp.prototype.stop=_noop;SpinnerNoOp.prototype.setText=_noop;SpinnerNoOp.prototype.clear=_noop;function _noop(){};module.exports=SpinnerNoOp;
|
package/lib/tabs.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2018, 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
|
+
*/
|
|
1
6
|
const FILE_TYPES=["html","js","css","json","all"];const defaultTabs={"all":{spaces:4}};function Tabs(){this._tabs={}};Tabs.prototype.validate=function(t,msgContext){var fileType,entry,count=0;if(!t){this._tabs=defaultTabs;return true}if(typeof t!=="object"){msgContext.error("invalid \"tabs\" property - object expected");this._tabs=defaultTabs;return false}for(fileType in t){if(!_isFileType(fileType)){msgContext.error("invalid 'tabs' property - unknown file type \""+fileType+"\"");this._tabs=defaultTabs;return false}entry=t[fileType];if(entry.spaces&&typeof entry.spaces!=="number"||entry.stops&&!_isTabStops(entry.stops)){msgContext.error("invalid 'tabs' property for file type \""+fileType+"\"");this._tabs=defaultTabs;return false}this._tabs[fileType]=entry;count++}if(count===0){this._tabs=defaultTabs}else if(!this._tabs.all){this._tabs.all=defaultTabs.all}return true};Tabs.prototype.getTabCol=function(col,fileType){var entry,len,stops,i;if(fileType&&_isFileType(fileType)){entry=this._tabs[fileType]}if(!entry){entry=this._tabs.all;if(!entry){entry=defaultTabs.all}}if(!entry.stops){return col+entry.spaces}else{len=len-1;stops=entry.stops;if(stops.length===0){return _computeTabStop(col,0,entry.spaces?entry.spaces:defaultTabs.spaces)}if(col>=stops[len]){return _computeTabStop(col,stops[len],entry.spaces?entry.spaces:defaultTabs.spaces)}if(col<stops[0]){return stops[0]}for(i=0;i<len;i++){if(col>=stops[i]&&col<stops[i+1]){return stops[i+1]}}}};function _computeTabStop(col,lastStop,inc){var span=col-lastStop;return col+span/inc*inc+span%inc};function _isArrayNumeric(a){var i,ret=-1;for(i=0;i<a.length;i++){if(typeof a[i]!=="number"){ret=i;break}}return ret};function _isTabStops(ts){return Array.isArray(ts)&&_isArrayNumeric(ts)}function _isFileType(fileType){return FILE_TYPES.includes(fileType.toLowerCase())};module.exports=Tabs;
|