From 06b9ea597d6042d385e4f6b0fccb71a0aa1b82e6 Mon Sep 17 00:00:00 2001 From: David Schach Date: Tue, 31 May 2022 23:38:56 -0700 Subject: [PATCH] Release v1.1.0 Using GitHub Packages v1.1.0 Upgrade package.json to 1.1.0 Package name fix --- .npmrc | 1 + README.md | 2 +- demo/testcode.html | 4 +- dist/apex.es.min.js | 23 +-- dist/apex.min.js | 23 +-- package-lock.json | 293 +------------------------------- package.json | 3 +- src/languages/apex.js | 107 ++++-------- test/detect/apex/apexdetect.txt | 1 + 9 files changed, 68 insertions(+), 389 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..402eeca --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@highlightjs:registry=https://npm.pkg.github.com \ No newline at end of file diff --git a/README.md b/README.md index cace8bc..de09d4b 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ For more details see [Highlight.js main page](https://github.com/highlightjs/hig ### Using directly from jsDelivr ```html - + diff --git a/demo/testcode.html b/demo/testcode.html index 08a26ea..a86847e 100644 --- a/demo/testcode.html +++ b/demo/testcode.html @@ -53,7 +53,7 @@ } for(Account a : [SELECT Id FROM Account WHERE Id = :a.Id ORDER BY CreatedDate ASC] ){} actionPlan = (ActionPlan__c) stdController.getRecord(); - truestory = ActionPlansUtilities.getCanDisplayReminder(); + truestory = req.setHeader('X-Password', '{!$Credential.Password}'); } /** @@ -75,7 +75,7 @@ delete actionPlan; } catch (DMLException e) { ApexPages.addMessages(e); - return null; + return i++; } String retURL = '/' + ActionPlansUtilities.getObjectKeyPrefix(ActionPlansUtilities.namespacePrefix + 'ActionPlan__c') + '/o'; diff --git a/dist/apex.es.min.js b/dist/apex.es.min.js index 8b671b8..76df040 100644 --- a/dist/apex.es.min.js +++ b/dist/apex.es.min.js @@ -3,7 +3,7 @@ var hljsGrammar=(()=>{"use strict";return e=>{ const s=e.regex,t="[a-zA-Z][a-zA-Z_0-9]*",a={scope:"number",variants:[{ match:/\b[0-9]+(?:\.[0-9]+)?/},{match:/\s(?:[0-9,]+)?\.[0-9]+/}],relevance:0 },c={ -match:s.either(/-/,/~/,/\*/,/\*=/,/\/=/,/%/,/\.\.\./,/\.\./,/\+/,/<>/,/>=/,/<=/,/\s<\s/,/\s>\s/,/\^/,/\^=/,/!=/,/!/,/==/,/&&/,/&/,/\|\|/,/\|/,/\?:/,/=/,/=>/), +match:s.either(/-/,/~/,/\*/,/\*=/,/\/=/,/%/,/\+/,/<>/,/>=/,/<=/,/\s<\s/,/\s>\s/,/\^/,/\^=/,/!=/,/!/,/==/,/&&/,/&/,/\|\|/,/\|/,/(?<=\s)\?|:(?=\s)/,/=/,/=>/,/\?\./), scope:"operator",relevance:0},n={ match:[/\b/,s.either("ApexPages|10","AppLauncher","Approval","Auth","Cache","Canvas","ChatterAnswers|10","CommercePayments|10","ConnectApi|10","Database","Datacloud|10","DataSource|10","Dom","EventBus|10","Flow","Functions","KbManagement|10","Label","LxScheduler|10","Messaging","Metadata","Pref_center|10","Process","QuickAction","Reports","Schema","Search","Sfc|10","Sfdc_Checkout|10","sfdc_surveys|10","Site","Support","System","TerritoryMgmt|10","Test","Trigger|10","TxnSecurity|10","Type","UserProvisioning|10","VisualEditor|10","Wave|10"),/(?=\.)/], scope:{2:"built_in"},relevance:10 @@ -24,7 +24,7 @@ scope:{2:"title.function.invoke"}},{ begin:[/\./,s.concat("(?:"+t+")"),/(?=\s*\([^\)])/],scope:{ 2:"title.function.invoke"}},{ begin:[/(?<=\s)/,s.concat("(?:"+t+")"),/(?=\s*\()/],scope:{2:"title.function"} -}],contains:[r,o,e.APOS_STRING_MODE],relevance:0},d={ +}],contains:[r,o,e.APOS_STRING_MODE],relevance:0},m={ begin:/\[[\s\n]*(?=SELECT)/,end:/\]/,scope:"subst",relevance:10,contains:[{ begin:s.concat(/\b/,s.either("ABOVE_OR_BELOW","ABOVE","ACTIVE","ADVANCED","ALL",/ALL\s+FIELDS/,"AND","ANY","ARRAY","AS","ASC","BY","CATEGORY","CONTAINS","COUNT","COUNT_DISTINCT","SUM","MAX","MIN","HOUR_IN_DAY","CONVERTCURRENCY","CUBE","DATA","DESC","DIVISION","END","EXCLUDES","FIELDS","FIND","FIRST","FOR","FROM",/GROUP\s+BY/,"HAVING","INCLUDES","LAST","LAST_90_DAYS","LAST_MONTH","LAST_N_DAYS","LAST_WEEK","LAST","LIKE","LIMIT","NETWORK","NEXT_90_DAYS","NEXT_MONTH","NEXT_N_DAYS","NEXT_WEEK","NULLS","OFFSET","ON","OR",/ORDER\s+BY/,"REFERENCE","RETURNING","ROLLUP","ROWS","SEARCH","SECURITY_ENFORCED","SELECT","SNIPPET","SORT","THIS_MONTH","THIS_WEEK","TODAY","TOLABEL","TOMORROW","TRACKING","TYPEOF","UPDATE",/USING\s+SCOPE/,"VIEW","VIEWSTAT","VIEWSTATE","WHERE","WITH","YESTERDAY","USER_MODE"),/\b/), scope:"keyword"},{match:/(\bIN\b|<|<=|>|>=|\bNOT\s+IN\b|=|!\s*=|:{1})/, @@ -33,17 +33,17 @@ relevance:0},{match:/\b[a-zA-Z][a-zA-Z_0-9]*\b/,scope:"property"},a,A], illegal:"::"};return{name:"Apex",aliases:["apex","lightning"], case_insensitive:!0,disableAutodetect:!1,ignoreIllegals:!1,keywords:{ $pattern:"[A-Za-z][0-9A-Za-z$_]*", -keyword:["abstract","AccessLevel","USER_MODE","break","catch","continue","default","do","else","execute","exports","extends|6","finally","finish","for","get","put","set","global","if","implements","new","newMap|10","old|10","oldMap|10","override","private","protected","public","return","start","static","throws","throw","testmethod|10","try","virtual","webservice","when","while"], +keyword:["trigger|10","class","interface","abstract","AccessLevel","USER_MODE","break","catch","continue","default","do","else","execute","exports","extends|6","finally","finish","for","get","put","set","global","if","implements","new","newMap|10","old|10","oldMap|10","override","private","protected","public","return","start","static","throws","throw","testmethod|10","try","virtual","webservice","when","while"], "variable.language":["final","instanceof","super","this","transient"], -built_in:["trigger|10","class","interface","insert","update","upsert|8","delete","undelete","merge","schedulable|10","batchable|10","queueable|10","comparable|10","callable|10"], +built_in:["insert","update","upsert|8","delete","undelete","merge","schedulable|10","batchable|10","queueable|10","comparable|10","callable|10"], type:["anytype","blob|0","boolean|0","byte|0","currency|0","date|0","datetime|0","decimal|0","double|0","enum|0","float|0","integer|0","long|0","object","pagereference|10","selectoption|10","short|0","sobject|10","string|0","time|0","void|0","float|0"], literal:["false","true","null"]}, -illegal:["","\x3c!--","!DOCTYPE",/","\x3c!--","!DOCTYPE",/>/,/>=/,/<=/,/\s<\s/,/\s>\s/,/\^/,/\^=/,/!=/,/!/,/==/,/&&/,/&/,/\|\|/,/\|/,/\?:/,/=/,/=>/), +match:s.either(/-/,/~/,/\*/,/\*=/,/\/=/,/%/,/\+/,/<>/,/>=/,/<=/,/\s<\s/,/\s>\s/,/\^/,/\^=/,/!=/,/!/,/==/,/&&/,/&/,/\|\|/,/\|/,/(?<=\s)\?|:(?=\s)/,/=/,/=>/,/\?\./), scope:"operator",relevance:0},n={ match:[/\b/,s.either("ApexPages|10","AppLauncher","Approval","Auth","Cache","Canvas","ChatterAnswers|10","CommercePayments|10","ConnectApi|10","Database","Datacloud|10","DataSource|10","Dom","EventBus|10","Flow","Functions","KbManagement|10","Label","LxScheduler|10","Messaging","Metadata","Pref_center|10","Process","QuickAction","Reports","Schema","Search","Sfc|10","Sfdc_Checkout|10","sfdc_surveys|10","Site","Support","System","TerritoryMgmt|10","Test","Trigger|10","TxnSecurity|10","Type","UserProvisioning|10","VisualEditor|10","Wave|10"),/(?=\.)/], scope:{2:"built_in"},relevance:10 @@ -24,7 +24,7 @@ scope:{2:"title.function.invoke"}},{ begin:[/\./,s.concat("(?:"+t+")"),/(?=\s*\([^\)])/],scope:{ 2:"title.function.invoke"}},{ begin:[/(?<=\s)/,s.concat("(?:"+t+")"),/(?=\s*\()/],scope:{2:"title.function"} -}],contains:[r,o,e.APOS_STRING_MODE],relevance:0},d={ +}],contains:[r,o,e.APOS_STRING_MODE],relevance:0},u={ begin:/\[[\s\n]*(?=SELECT)/,end:/\]/,scope:"subst",relevance:10,contains:[{ begin:s.concat(/\b/,s.either("ABOVE_OR_BELOW","ABOVE","ACTIVE","ADVANCED","ALL",/ALL\s+FIELDS/,"AND","ANY","ARRAY","AS","ASC","BY","CATEGORY","CONTAINS","COUNT","COUNT_DISTINCT","SUM","MAX","MIN","HOUR_IN_DAY","CONVERTCURRENCY","CUBE","DATA","DESC","DIVISION","END","EXCLUDES","FIELDS","FIND","FIRST","FOR","FROM",/GROUP\s+BY/,"HAVING","INCLUDES","LAST","LAST_90_DAYS","LAST_MONTH","LAST_N_DAYS","LAST_WEEK","LAST","LIKE","LIMIT","NETWORK","NEXT_90_DAYS","NEXT_MONTH","NEXT_N_DAYS","NEXT_WEEK","NULLS","OFFSET","ON","OR",/ORDER\s+BY/,"REFERENCE","RETURNING","ROLLUP","ROWS","SEARCH","SECURITY_ENFORCED","SELECT","SNIPPET","SORT","THIS_MONTH","THIS_WEEK","TODAY","TOLABEL","TOMORROW","TRACKING","TYPEOF","UPDATE",/USING\s+SCOPE/,"VIEW","VIEWSTAT","VIEWSTATE","WHERE","WITH","YESTERDAY","USER_MODE"),/\b/), scope:"keyword"},{match:/(\bIN\b|<|<=|>|>=|\bNOT\s+IN\b|=|!\s*=|:{1})/, @@ -33,17 +33,17 @@ relevance:0},{match:/\b[a-zA-Z][a-zA-Z_0-9]*\b/,scope:"property"},a,A], illegal:"::"};return{name:"Apex",aliases:["apex","lightning"], case_insensitive:!0,disableAutodetect:!1,ignoreIllegals:!1,keywords:{ $pattern:"[A-Za-z][0-9A-Za-z$_]*", -keyword:["abstract","AccessLevel","USER_MODE","break","catch","continue","default","do","else","execute","exports","extends|6","finally","finish","for","get","put","set","global","if","implements","new","newMap|10","old|10","oldMap|10","override","private","protected","public","return","start","static","throws","throw","testmethod|10","try","virtual","webservice","when","while"], +keyword:["trigger|10","class","interface","abstract","AccessLevel","USER_MODE","break","catch","continue","default","do","else","execute","exports","extends|6","finally","finish","for","get","put","set","global","if","implements","new","newMap|10","old|10","oldMap|10","override","private","protected","public","return","start","static","throws","throw","testmethod|10","try","virtual","webservice","when","while"], "variable.language":["final","instanceof","super","this","transient"], -built_in:["trigger|10","class","interface","insert","update","upsert|8","delete","undelete","merge","schedulable|10","batchable|10","queueable|10","comparable|10","callable|10"], +built_in:["insert","update","upsert|8","delete","undelete","merge","schedulable|10","batchable|10","queueable|10","comparable|10","callable|10"], type:["anytype","blob|0","boolean|0","byte|0","currency|0","date|0","datetime|0","decimal|0","double|0","enum|0","float|0","integer|0","long|0","object","pagereference|10","selectoption|10","short|0","sobject|10","string|0","time|0","void|0","float|0"], literal:["false","true","null"]}, -illegal:["","\x3c!--","!DOCTYPE",/","\x3c!--","!DOCTYPE",/=8.3" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -233,15 +213,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "dev": true, - "engines": { - "node": ">= 10" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -438,27 +409,6 @@ "node": ">=4.x" } }, - "node_modules/handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "dev": true, - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -623,18 +573,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/minimatch": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", @@ -714,32 +652,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -788,18 +700,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parse-github-url": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz", - "integrity": "sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==", - "dev": true, - "bin": { - "parse-github-url": "cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -895,21 +795,6 @@ } ] }, - "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/serialize-javascript": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", @@ -973,15 +858,6 @@ "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", "dev": true }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -1047,41 +923,6 @@ "node": ">=8.0" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true - }, - "node_modules/uglify-js": { - "version": "3.15.5", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.5.tgz", - "integrity": "sha512-hNM5q5GbBRB5xB+PMqVRcgYe4c8jbyZ1pzZhS6jbq54/4F2gFK869ZheiE5A8/t+W5jtTNpWef/5Q9zk639FNQ==", - "dev": true, - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", - "dev": true - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1097,12 +938,6 @@ "node": ">= 8" } }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, "node_modules/workerpool": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", @@ -1141,12 +976,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", @@ -1246,19 +1075,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "auto-changelog": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.4.0.tgz", - "integrity": "sha512-vh17hko1c0ItsEcw6m7qPRf3m45u+XK5QyCrrBFViElZ8jnKrPC1roSznrd1fIB/0vR/zawdECCRJtTuqIXaJw==", - "dev": true, - "requires": { - "commander": "^7.2.0", - "handlebars": "^4.7.7", - "node-fetch": "^2.6.1", - "parse-github-url": "^1.0.2", - "semver": "^7.3.5" - } - }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1365,12 +1181,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1508,19 +1318,6 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, - "handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "dev": true, - "requires": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4", - "wordwrap": "^1.0.0" - } - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1637,15 +1434,6 @@ "is-unicode-supported": "^0.1.0" } }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, "minimatch": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", @@ -1705,21 +1493,6 @@ "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", "dev": true }, - "neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -1753,12 +1526,6 @@ "p-limit": "^3.0.2" } }, - "parse-github-url": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz", - "integrity": "sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==", - "dev": true - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -1813,15 +1580,6 @@ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true }, - "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, "serialize-javascript": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", @@ -1885,12 +1643,6 @@ "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", "dev": true }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -1935,35 +1687,6 @@ "is-number": "^7.0.0" } }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true - }, - "uglify-js": { - "version": "3.15.5", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.5.tgz", - "integrity": "sha512-hNM5q5GbBRB5xB+PMqVRcgYe4c8jbyZ1pzZhS6jbq54/4F2gFK869ZheiE5A8/t+W5jtTNpWef/5Q9zk639FNQ==", - "dev": true, - "optional": true - }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", - "dev": true - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "dev": true, - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1973,12 +1696,6 @@ "isexe": "^2.0.0" } }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, "workerpool": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", @@ -2008,12 +1725,6 @@ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", diff --git a/package.json b/package.json index b0dbe46..be6b676 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "highlightjs-apex", - "version": "1.0.0", + "version": "1.1.0", "description": "Apex Language of Salesforce highlighting plugin for highlight.js", "main": "src/languages/apex.js", "scripts": { @@ -27,7 +27,6 @@ }, "homepage": "https://github.com/highlightjs/highlightjs-apex#readme", "devDependencies": { - "auto-changelog": "^2.4.0", "highlight.js": "^11.5.1", "minimist": "^1.2.6", "mocha": "^9.2.2", diff --git a/src/languages/apex.js b/src/languages/apex.js index 494f08f..b22e0c8 100644 --- a/src/languages/apex.js +++ b/src/languages/apex.js @@ -25,6 +25,9 @@ export default function (hljs) { }; const MAIN_KEYWORDS = [ + 'trigger|10', + 'class', + 'interface', 'abstract', 'AccessLevel', 'USER_MODE', @@ -107,9 +110,6 @@ export default function (hljs) { ]; const BUILT_INS = [ - 'trigger|10', - 'class', - 'interface', 'insert', 'update', 'upsert|8', @@ -123,7 +123,8 @@ export default function (hljs) { 'callable|10' ]; - const APEX_ANNOTATIONS = [ + // Extraneous for now - will be useful if we go this route BUT will need more maintenance + /* const APEX_ANNOTATIONS = [ '@AuraEnabled', '@Deprecated', '@Future', @@ -143,7 +144,7 @@ export default function (hljs) { '@SuppressWarnings', '@TestSetup', '@TestVisible' - ]; + ]; */ const KEYWORDS = { $pattern: '[A-Za-z][0-9A-Za-z$_]*', @@ -160,12 +161,6 @@ export default function (hljs) { scope: 'keyword' }; - const CONSTANTS = { - relevance: 0, - match: /\b[A-Z][A-Z_0-9]*\b/, - scope: 'variable.constant' - } - const NAMESPACE_LIST = [ 'ApexPages|10', 'AppLauncher', @@ -217,8 +212,6 @@ export default function (hljs) { /\*=/, /\/=/, /%/, - /\.\.\./, - /\.\./, /\+/, /<>/, @@ -235,9 +228,10 @@ export default function (hljs) { /&/, /\|\|/, /\|/, - /\?:/, + /(?<=\s)\?|:(?=\s)/, /=/, - /=>/ + /=>/, + /\?\./ ]; const OPERATORS = { @@ -298,7 +292,7 @@ export default function (hljs) { ); // Extraneous for now - will be useful if we go this route BUT will need more maintenance - const ANNOTATION_MODIFIER_TYPES = [ + /* const ANNOTATION_MODIFIER_TYPES = [ 'required', 'label', 'description', @@ -313,11 +307,12 @@ export default function (hljs) { 'IconName', 'cacheable', 'scope' - ]; + ]; */ const ANNOTATIONS = { relevance: 10, scope: { 1: 'meta' }, + // We will allow any annotation, so we do not need to maintain this as often //match: [regex.either(...APEX_ANNOTATIONS), /(?=(\(|\b|\s))/], match: ['@' + APEX_IDENT_RE, /(?=(\(|\b|\s))/], }; @@ -444,9 +439,9 @@ export default function (hljs) { }, // Class Name { - match: [/\bclass/, /\s+/, APEX_IDENT_RE], + match: [/(?<=\bclass\b)/, /\s+/, APEX_IDENT_RE], scope: { - 1: 'keyword', + //1: 'keyword', 3: 'title.class' } }, @@ -459,10 +454,10 @@ export default function (hljs) { }, // Trigger { - begin: [/\btrigger/, /\s+/, APEX_IDENT_RE, /\s+/, 'on', /\s+/, APEX_IDENT_RE], + begin: [/(?<=\btrigger\b)/, /\s+/, APEX_IDENT_RE, /\s+/, 'on', /\s+/, APEX_IDENT_RE], end: '{', scope: { - 1: 'keyword', + //1: 'keyword', 3: 'title.class', 7: 'type' }, @@ -528,6 +523,15 @@ export default function (hljs) { } ]; + const MERGE_FIELDS = { + begin: ['{', /\$[a-zA-Z]+]/, '.', /\w+/], + end: '}', + scope: { + 2: "built_in", + 4: "property" + } + }; + const FOR_LOOP = { variants: [ { @@ -589,46 +593,6 @@ export default function (hljs) { } ]; - /* const TRIGGERS = { - begin: [/\btrigger/, /\s+/, APEX_IDENT_RE, /\s+/, 'on', /\s+/, APEX_IDENT_RE], - end: '{', - scope: { - 1: 'keyword', - 3: 'title.class', - 7: 'type' - }, - contains: [ - COMMENT_LINE, - COMMENT_BLOCK, - { - match: /(?:before|after)\s+(?:insert|update|delete|undelete)/, - scope: 'built_in', - relevance: 10 - } - ], - relevance: 10 - }; */ - - /* const METHOD_DEFINITION = { - begin: [ - '(?:' + GENERIC_IDENT_RE + '\\s+)', - '(?:' + GENERIC_IDENT_RE + '\\s+)', - hljs.UNDERSCORE_IDENT_RE, - /(?=\s*\()/ - ], - keywords: KEYWORDS, - scope: { 2: 'type', 3: 'title.function' }, - contains: [ - COMMENT_LINE, - COMMENT_BLOCK, - hljs.APOS_STRING_MODE, - COLLECTION_DECLARATION, - COLLECTION_MAP_VALUE - ], - relevance: 0, - illegal: [/\b_/, /_\b/] - }; */ - const SALESFORCE_ID = { match: /(?