Skip to content

Commit 58d873d

Browse files
authored
feat: add cdn build (#29)
1 parent 591b66c commit 58d873d

6 files changed

Lines changed: 377 additions & 5 deletions

File tree

.github/workflows/build_highlightjs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ jobs:
4646
tree .
4747
ls -Alh
4848
49-
- name: Upload Flix spec
49+
- name: Upload Flix CDN distributable
5050
uses: actions/upload-artifact@v3
5151
with:
52-
name: flix.min.js
53-
path: extra/flix/dist/flix.min.js
52+
name: flix.cdn.dist
53+
path: extra/flix/dist
5454

5555
- name: Upload minimal Highlight.js with Flix bundled
5656
uses: actions/upload-artifact@v3

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ tramp
9292

9393
# cask packages
9494
.cask/
95-
dist/
9695

9796
# Flycheck
9897
flycheck_*.el
@@ -304,7 +303,6 @@ out
304303

305304
# Nuxt.js build / generate output
306305
.nuxt
307-
dist
308306

309307
# Gatsby files
310308
.cache/

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ We refer you to
2929

3030
## Use
3131

32+
### Pre-built CDN files
33+
34+
There are pre-built CDN files that can just be dropped in to work with
35+
an existing highlight.js script.
36+
These can be found in the `dist/` directory of this repository.
37+
38+
Note that the `dist/highlight.min.js` file is the file
39+
built by the GitHub workflow in this repository and is a minimal
40+
highlight.js build that only supports Flix.
41+
This file is **NOT** part of the CDN pre-built files and should
42+
hence not but used if you intend to use highlight.js conventionally.
43+
44+
### Using GitHub workflow
45+
3246
The highlight.js file built by the GitHub workflow
3347
should work automatically when included on a website.
3448

dist/flix.es.min.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*! `flix` grammar compiled for Highlight.js 11.6.0 */
2+
var hljsGrammar=(()=>{"use strict";return e=>{const n={scope:"number",
3+
begin:e.C_NUMBER_RE+"(f(32|64)|i(8|16|32|64)|ii)?",relevance:0},t={
4+
scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE,{
5+
scope:"subst",begin:/(\$|\%)\{/,end:/\}/}]},a={scope:"title",
6+
begin:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,
7+
relevance:0},r={scope:"title.class",beginKeywords:"class|enum",
8+
end:/[:={\[\n;]|\(/,excludeEnd:!0,
9+
contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a]},i={
10+
scope:"title.function",beginKeywords:"def",end:/[(\[]/,excludeEnd:!0,
11+
contains:[a]},s={scope:"literal",variants:[{begin:/\?\?\?/},{begin:/\?/,
12+
contains:[a]}]};return{name:"Flix",keywords:{$pattern:e.IDENT_RE+"!?",
13+
keyword:["instance","lawful","law","type","alias","yield","lazy","force","override","def","with","let","sealed","pub","object","if","then","else","for","foreach","import","use","get","set","new","catch","class","case","default","try","match","enum","and","or","not","ref","deref","as","eff","upcast","static","spawn","solve","select","region","par","namespace","without","do","resume","chan","select","inject","project","into","from","where","query","inline","discard"],
14+
literal:["()","true","false","Nil","Some","None","LessThan","EqualTo","GreaterThan","Ok","Err"],
15+
type:["Unit","Bool","Char","Float32","Float64","Int8","Int16","Int32","Int64","String","BigInt"],
16+
built_in:["debug","debug!","debug!!","IO","ef","ef1","ef2","Read","Write","Channel","Eq","PartialOrder","Order","Cmp","List","Map","Set","RedBlackTree","Result","Array","ToString","toString","flip","on","identity","fst","snd","swap",">>","|>","||>","!>","print","println","bug!","unreachable!"]
17+
},contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t,n,i,r,{scope:"meta",
18+
begin:"@[A-Za-z]+"},s]}}})();export default hljsGrammar;

dist/flix.min.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*! `flix` grammar compiled for Highlight.js 11.6.0 */
2+
(()=>{var e=(()=>{"use strict";return e=>{const n={scope:"number",
3+
begin:e.C_NUMBER_RE+"(f(32|64)|i(8|16|32|64)|ii)?",relevance:0},t={
4+
scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE,{
5+
scope:"subst",begin:/(\$|\%)\{/,end:/\}/}]},a={scope:"title",
6+
begin:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,
7+
relevance:0},i={scope:"title.class",beginKeywords:"class|enum",
8+
end:/[:={\[\n;]|\(/,excludeEnd:!0,
9+
contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a]},r={
10+
scope:"title.function",beginKeywords:"def",end:/[(\[]/,excludeEnd:!0,
11+
contains:[a]},s={scope:"literal",variants:[{begin:/\?\?\?/},{begin:/\?/,
12+
contains:[a]}]};return{name:"Flix",keywords:{$pattern:e.IDENT_RE+"!?",
13+
keyword:["instance","lawful","law","type","alias","yield","lazy","force","override","def","with","let","sealed","pub","object","if","then","else","for","foreach","import","use","get","set","new","catch","class","case","default","try","match","enum","and","or","not","ref","deref","as","eff","upcast","static","spawn","solve","select","region","par","namespace","without","do","resume","chan","select","inject","project","into","from","where","query","inline","discard"],
14+
literal:["()","true","false","Nil","Some","None","LessThan","EqualTo","GreaterThan","Ok","Err"],
15+
type:["Unit","Bool","Char","Float32","Float64","Int8","Int16","Int32","Int64","String","BigInt"],
16+
built_in:["debug","debug!","debug!!","IO","ef","ef1","ef2","Read","Write","Channel","Eq","PartialOrder","Order","Cmp","List","Map","Set","RedBlackTree","Result","Array","ToString","toString","flip","on","identity","fst","snd","swap",">>","|>","||>","!>","print","println","bug!","unreachable!"]
17+
},contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t,n,r,i,{scope:"meta",
18+
begin:"@[A-Za-z]+"},s]}}})();hljs.registerLanguage("flix",e)})();

0 commit comments

Comments
 (0)