@oracle/oraclejet-audit 16.0.1 → 16.0.2
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/jaf-amd.js +1 -1
- package/lib/Ts.js +1 -1
- package/lib/checkage.js +1 -1
- package/lib/defaults.js +1 -1
- package/meta/16.0.0/jetauditmeta.js +1 -1
- package/meta/metaverlist.json +1 -1
- package/package.json +2 -2
package/lib/Ts.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const AST=require("../lib/AST_Ts");const Comments=require("../lib/Comments");const JSX=require("../lib/jsx");const VAR_DECL="VariableDeclarator";const CALL_EXPR="CallExpression";const RETURN_STMT="ReturnStatement";const ASSIGN_EXPR="AssignmentExpression";const STYLE="style";function Ts(parser,nd,rules,fileIndex,appCtx,msgCtx){this._parser=parser;this._rules=rules;this._Issue=appCtx.Issue;this._reporter=appCtx.reporter;this._fileIndex=fileIndex;this._utils=appCtx.utils;this._msgCtx=msgCtx;this._nd=nd;this._Ast=null;this._jsx=new JSX(appCtx.metaLib,msgCtx);this._tsxUtils=appCtx.tsxUtils;this._debugMode=msgCtx.debugMode;this._debug=msgCtx.debug;this._error=msgCtx.error;this._info=msgCtx.info;this._verboseMode=msgCtx.isVerbose;this._config=appCtx.config;this._ecmaVer=appCtx.config.getEcmaVer();this._isComments=appCtx.config.getComments();this._reportJafIssue=appCtx.reportJafIssue;this._flushIssues=appCtx.flushIssues;this._runMode=appCtx.runMode};Ts.prototype.parse=function(data,file,fileType){var self=this;this._parseIt(data,file,fileType,function(treenode){let rc=self._parser.fireHookFileRules(treenode,null,false)});this._parser.fireHookFileRules(null,null)};Ts.prototype.hasParser=function(){return!!this._nd.tsparse};Ts.prototype.reportNoParser=function(){let issue=new this._Issue(`.ts/.tsx support not loaded - run mode '${this._runMode}'`);this._reportJafIssue(issue,this._parser.RULE_TS_NO_PARSER,0,0,0,0)};Ts.prototype.getAst=function(){return this._Ast.getAst()};Ts.prototype.getAstUtils=function(){return this._Ast?this._Ast.getUtils():null};Ts.prototype._parseIt=function(data,file,fileType,cb){var ret=false,rowNow,colNow,issue,opts,arRawComs,startPos;try{this._debug(`Parsing ${fileType.toUpperCase()}...`);this._Ast=new AST(data,file,fileType,this._nd,this._ecmaVer,this._isComments,this._msgCtx,this._config);ret=!!this._Ast.getAst()}catch(e){startPos=this._parser.startJsPosition;opts=this._rules.getRuleOptions(this._parser.RULE_TS_DIAGNOSE,this._parser.JAF_RSI);if(opts&&opts.enabled){rowNow=e.lineNumber+(startPos.row===0?0:startPos.row-2);colNow=e.column+(startPos.col===0?0:startPos.col-1);e.message=e.message.replace("}","{");issue=new this._Issue("TypeScript syntax - "+e.message);this._reportJafIssue(issue,this._parser.RULE_TS_DIAGNOSE,rowNow,colNow,e.index+startPos.startIndex,e.index+startPos.startIndex+1)}else{rowNow=e.lineNumber+(startPos.row===0?0:startPos.row-2);colNow=e.column+(startPos.col===0?0:startPos.col-1);console.log(`\nTS-DIAGNOSE : [${rowNow}, ${colNow}] ${e.message}\n File -> ${this._curFile}`)}this._parser.parseErrors++;if(this._debugMode||this._verboseMode){this._info(`[TS PARSE ERROR(4) #${this._parser.parseErrors} : '${e.message}' File -> ${this._parser.curFile?this._parser.curFile:"n/a"}`)}}if(!ret){return ret}if(cb)cb(this._Ast.getProgram());ret=false;try{this._debug("Walking TS...");if(this._isComments){arRawComs=this._Ast.getRawComments();if(arRawComs&&arRawComs.length){if(!this._comments){this._comments=new Comments(this._nd,this._rules,this._msgCtx,this._utils,true)}this._comments.reset(this._Ast)}}this._fileType=fileType;if(fileType==="tsx"){if(this._rules.isTypeRegistered("TsxFunction")){let namedFuncs,tsxComps;if(namedFuncs=this._Ast.extractNamedFuncs()){namedFuncs.forEach(tsxFunc=>{tsxFunc.returns.forEach(ret=>{if(tsxComps=this._jsx.genTsxRenderComponent(ret.node,this._Ast.getData())){if(tsxComps.components){tsxComps.components.forEach(tsxComp=>{ret.tsxComponent=tsxComp})}}})
|
|
6
|
+
const AST=require("../lib/AST_Ts");const Comments=require("../lib/Comments");const JSX=require("../lib/jsx");const VAR_DECL="VariableDeclarator";const CALL_EXPR="CallExpression";const RETURN_STMT="ReturnStatement";const ASSIGN_EXPR="AssignmentExpression";const STYLE="style";function Ts(parser,nd,rules,fileIndex,appCtx,msgCtx){this._parser=parser;this._rules=rules;this._Issue=appCtx.Issue;this._reporter=appCtx.reporter;this._fileIndex=fileIndex;this._utils=appCtx.utils;this._msgCtx=msgCtx;this._nd=nd;this._Ast=null;this._jsx=new JSX(appCtx.metaLib,msgCtx);this._tsxUtils=appCtx.tsxUtils;this._debugMode=msgCtx.debugMode;this._debug=msgCtx.debug;this._error=msgCtx.error;this._info=msgCtx.info;this._verboseMode=msgCtx.isVerbose;this._config=appCtx.config;this._ecmaVer=appCtx.config.getEcmaVer();this._isComments=appCtx.config.getComments();this._reportJafIssue=appCtx.reportJafIssue;this._flushIssues=appCtx.flushIssues;this._runMode=appCtx.runMode};Ts.prototype.parse=function(data,file,fileType){var self=this;this._parseIt(data,file,fileType,function(treenode){let rc=self._parser.fireHookFileRules(treenode,null,false)});this._parser.fireHookFileRules(null,null)};Ts.prototype.hasParser=function(){return!!this._nd.tsparse};Ts.prototype.reportNoParser=function(){let issue=new this._Issue(`.ts/.tsx support not loaded - run mode '${this._runMode}'`);this._reportJafIssue(issue,this._parser.RULE_TS_NO_PARSER,0,0,0,0)};Ts.prototype.getAst=function(){return this._Ast.getAst()};Ts.prototype.getAstUtils=function(){return this._Ast?this._Ast.getUtils():null};Ts.prototype._parseIt=function(data,file,fileType,cb){var ret=false,rowNow,colNow,issue,opts,arRawComs,startPos;try{this._debug(`Parsing ${fileType.toUpperCase()}...`);this._Ast=new AST(data,file,fileType,this._nd,this._ecmaVer,this._isComments,this._msgCtx,this._config);ret=!!this._Ast.getAst()}catch(e){startPos=this._parser.startJsPosition;opts=this._rules.getRuleOptions(this._parser.RULE_TS_DIAGNOSE,this._parser.JAF_RSI);if(opts&&opts.enabled){rowNow=e.lineNumber+(startPos.row===0?0:startPos.row-2);colNow=e.column+(startPos.col===0?0:startPos.col-1);e.message=e.message.replace("}","{");issue=new this._Issue("TypeScript syntax - "+e.message);this._reportJafIssue(issue,this._parser.RULE_TS_DIAGNOSE,rowNow,colNow,e.index+startPos.startIndex,e.index+startPos.startIndex+1)}else{rowNow=e.lineNumber+(startPos.row===0?0:startPos.row-2);colNow=e.column+(startPos.col===0?0:startPos.col-1);console.log(`\nTS-DIAGNOSE : [${rowNow}, ${colNow}] ${e.message}\n File -> ${this._curFile}`)}this._parser.parseErrors++;if(this._debugMode||this._verboseMode){this._info(`[TS PARSE ERROR(4) #${this._parser.parseErrors} : '${e.message}' File -> ${this._parser.curFile?this._parser.curFile:"n/a"}`)}}if(!ret){return ret}if(cb)cb(this._Ast.getProgram());ret=false;try{this._debug("Walking TS...");if(this._isComments){arRawComs=this._Ast.getRawComments();if(arRawComs&&arRawComs.length){if(!this._comments){this._comments=new Comments(this._nd,this._rules,this._msgCtx,this._utils,true)}this._comments.reset(this._Ast)}}this._fileType=fileType;if(fileType==="tsx"){if(this._rules.isTypeRegistered("TsxFunction")){let namedFuncs,tsxComps;if(namedFuncs=this._Ast.extractNamedFuncs()){namedFuncs.forEach(tsxFunc=>{if(tsxFunc.returns){tsxFunc.returns.forEach(ret=>{if(tsxComps=this._jsx.genTsxRenderComponent(ret.node,this._Ast.getData())){if(tsxComps.components){tsxComps.components.forEach(tsxComp=>{ret.tsxComponent=tsxComp})}}})}this._fireTsxRules(tsxFunc)})}}}this._Ast.walk(this._AstNodeHandler.bind(this));ret=true}catch(e){this._error(`TypeScript walk failure - ${e} in ${this._parser.curFile}`)}return ret};Ts.prototype._AstNodeHandler=function(node){var coms;if(this._rules.isTypeRegistered(node.type)){if(this._comments){coms=this._comments.isDisabled(node);if(coms&&(!coms.rules||coms.rules.length===0)){return}this._rules.setJSCommentCallback(coms?function(ruleName){var b=coms.rules.includes(ruleName);return!coms.invert?b:!b}:null)}this._rules.fireRules({type:node.type,node:node,position:{offset:this._parser.startJsPosition.startIndex,start:node.range[0],end:node.range[1]},data:this._Ast.getData(),utils:{AstUtils:this._Ast.getUtils(),tsxUtils:this._tsxUtils}},node,this._parser.curFile,this._parser.curFileType,null)}if(this._fileType==="tsx"){if(this._rules.isAnyTsxTypeRegistered()){this._fireTsxRules(node)}}};Ts.prototype._fireTsxRules=function(node){var _self=this;if(node.type===VAR_DECL||node.type===CALL_EXPR||node.type===RETURN_STMT||node.type===ASSIGN_EXPR){let result;if(result=this._jsx.genTsxRenderComponent(node,this._Ast.getData())){let syn=this._rules.getTsxRuleSynopsis();if(syn.isTsxRC){if(!Array.isArray(result)){_fireTsxRules(result)}else{result.forEach(tsxRC=>{_fireTsxRules(tsxRC)})}}if(syn.isTsxWC||syn.isTsxNamedComp||syn.isTsxComp||syn.isTsxElem||syn.isTsxJetWC||syn.isTsxProp||syn.isTsxEvent||syn.isTsxStyle){result.components.forEach(tsxComp=>{function _fireTsx(tsxComp){let props;if(syn.isTsxWC&&tsxComp.isWCTag){tsxComp.type="TsxWebComponent";_fireTsxRules(tsxComp)}if(syn.isTsxJetWC){tsxComp.type="TsxJetComponent";_fireTsxRules(tsxComp)}if(syn.isTsxComp){_fireTsxRules(tsxComp)}if(syn.isTsxElem&&!tsxComp.isPreactComp&&!tsxComp.isWCTag&&!tsxComp.NaT){tsxComp.type="TsxElem";_fireTsxRules(tsxComp)}if(syn.isTsxNamedComp){let t="Tsx<"+tsxComp.name+">";if(_self._rules.isTypeRegistered(t)){tsxComp.type=t;_fireTsxRules(tsxComp)}}if(syn.isAnyTsxCompAttr){if(props=tsxComp.properties){props.forEach(prop=>{let t=`Tsx<${tsxComp.name}|${prop.name}>`;if(_self._rules.isTypeRegistered(t)){prop.type=t;_fireTsxRules(prop)}})}}if(syn.isAnyTsxAttr){if(props=tsxComp.properties){props.forEach(prop=>{let t=`Tsx<${prop.name}=>`;if(_self._rules.isTypeRegistered(t)){prop.type=t;_fireTsxRules(prop)}})}}if(syn.isTsxProp){if(props=tsxComp.properties){props.forEach(prop=>{_fireTsxRules(prop)})}}if(syn.isTsxEvent){if(props=tsxComp.properties){props.forEach(prop=>{if(prop.name.startsWith("on")){prop.type="TsxEvent";_fireTsxRules(prop)}})}}if(syn.isTsxStyle){if(props=tsxComp.properties){props.forEach(prop=>{if(prop.name===STYLE){prop.type="TsxStyle";_fireTsxRules(prop)}})}}if(tsxComp.children){tsxComp.children.forEach(child=>{_fireTsx(child)})}}_fireTsx(tsxComp)})}}}else if(node.type==="TsxFunction"){_fireTsxRules(node)}function _fireTsxRules(tsxObj){var arg2=null;if(tsxObj.type!=="TsxRendercomponent"&&tsxObj.type!=="TsxProperty"){arg2=tsxObj.name}_self._rules.fireRules({type:tsxObj.type,node:tsxObj,position:{offset:_self._parser.startJsPosition.startIndex,start:tsxObj.range[0],end:tsxObj.range[1]},data:_self._Ast.getData(),utils:{AstUtils:_self._Ast.getUtils(),tsxUtils:_self._tsxUtils}},tsxObj,_self._parser.curFile,_self._parser.curFileType,arg2)}};Ts.prototype.getAst=function(){return this._Ast};Ts.prototype.clear=function(){};module.exports=Ts;
|
package/lib/checkage.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const BUILT="2024-
|
|
6
|
+
const BUILT="2024-04-10T16:38:37.644Z";const MAJOR_RELS=2;function CheckAge(burnedInJetVer,msgCtx){this._jetRels=-1;this._msgCtx=msgCtx;this._burnedInMajor=parseInt(burnedInJetVer.split(".")[0])};CheckAge.prototype.checkAge=function(){var curDate;var buildDate;var buildMonth;var monthsToNow;curDate=new Date;buildDate=BUILT==="@BUILT@"?curDate:new Date(BUILT);buildMonth=buildDate.getMonth()+1;monthsToNow=_getElapsedMonths(buildDate,curDate);if(!monthsToNow){this._jetRels=0}else{this._jetRels=_getReleases(buildMonth,monthsToNow);if(this._jetRels>MAJOR_RELS){this._emitMsg(monthsToNow)}}return this._jetRels};CheckAge.prototype.getJafReleaseCount=function(){return this._jetRels};CheckAge.prototype.getMajorReleaseCount=function(major){if(typeof major==="string"){let a=major.split(".");major=parseInt(a[0])}if(isNaN(major)){return this._jetRels}let estimatedMajor=this._burnedInMajor+this._jetRels;return estimatedMajor-major};CheckAge.prototype._emitMsg=function(old){var INDENT=" ".repeat(12);var s,h,p;if(this._jetRels){s=""+this._jetRels;if(this._jetRels===1){h="has";p=""}else{h="have";p="s"}}else{s="at least one";h="has";p=""}var s=`\nThis version of JAF is ${old} month${old===1?"":"s"} old, and there ${h} been ${s} scheduled public\n`+`${INDENT}major JET release${p}, together with JAF updates and fixes. It is strongly\n`+INDENT+"recommended that you install the latest version of JAF. [JAF-9100]\n";this._msgCtx.warn(s,"JAF-9100",true)};function _getElapsedMonths(start,end){return end.getMonth()-start.getMonth()+12*(end.getFullYear()-start.getFullYear())};function _getReleases(buildMonth,months){var toNextRel,releases=0;if(buildMonth===1){toNextRel=0}else if(buildMonth>1&&buildMonth<7){toNextRel=7-buildMonth}else if(buildMonth===7){toNextRel=0}else{toNextRel=13-buildMonth}if((releases=months-toNextRel)>=0){releases=1+Math.floor(releases/6)}else{releases=0}return releases};module.exports=CheckAge;
|
package/lib/defaults.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Licensed under The Universal Permissive License (UPL), Version 1.0
|
|
4
4
|
* as shown at https://oss.oracle.com/licenses/upl/
|
|
5
5
|
*/
|
|
6
|
-
const defaults={JETVER:"16.0.
|
|
6
|
+
const defaults={JETVER:"16.0.2".replace(/(\d*\.\d*)(\.\d*)+$/g,"$1")+".0",THEME:"Alta",ECMAVER:14};module.exports=defaults;
|