@live-codes/browser-compilers 0.5.2 → 0.5.3

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.
@@ -1 +0,0 @@
1
- export * as monaco from 'monaco-editor';
@@ -1,222 +0,0 @@
1
- export default {
2
- config: {
3
- comments: {
4
- blockComment: ['<!--', '-->'],
5
- },
6
- brackets: [
7
- ['---', '---'],
8
- ['<!--', '-->'],
9
- ['<', '>'],
10
- ['{', '}'],
11
- ['(', ')'],
12
- ],
13
- autoClosingPairs: [
14
- { open: '{', close: '}' },
15
- { open: '[', close: ']' },
16
- { open: '(', close: ')' },
17
- { open: "'", close: "'" },
18
- { open: '"', close: '"' },
19
- { open: '<!--', close: '-->', notIn: ['comment', 'string'] },
20
- { open: '/**', close: ' */', notIn: ['string'] },
21
- { open: '<', close: '>', notIn: ['string'] },
22
- ],
23
- autoCloseBefore: ';:.,=}])>` \n\t',
24
- surroundingPairs: [
25
- { open: "'", close: "'" },
26
- { open: '"', close: '"' },
27
- { open: '{', close: '}' },
28
- { open: '[', close: ']' },
29
- { open: '(', close: ')' },
30
- { open: '<', close: '>' },
31
- ],
32
- folding: {
33
- markers: {
34
- start: /^\\s*<!--\\s*#region\\b.*-->/,
35
- end: /^\\s*<!--\\s*#endregion\\b.*-->/,
36
- },
37
- },
38
- },
39
-
40
- tokens: {
41
- defaultToken: '',
42
- tokenPostfix: '.astro',
43
- ignoreCase: false,
44
-
45
- // non matched elements
46
- empty: [
47
- 'area',
48
- 'base',
49
- 'basefont',
50
- 'br',
51
- 'col',
52
- 'frame',
53
- 'hr',
54
- 'img',
55
- 'input',
56
- 'isindex',
57
- 'link',
58
- 'meta',
59
- 'param',
60
- ],
61
-
62
- // The main tokenizer for our languages
63
- tokenizer: {
64
- root: [
65
- [/<!DOCTYPE/, 'metatag', '@doctype'],
66
- [/<!--/, 'comment', '@comment'],
67
- [/^---/, 'comment', '@frontmatter'],
68
- [/{/, '', '@expression'],
69
- [/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, ['delimiter', 'tag', '', 'delimiter']],
70
- [/(<)(script)/, ['delimiter', { token: 'tag', next: '@script' }]],
71
- [/(<)(style)/, ['delimiter', { token: 'tag', next: '@style' }]],
72
- [/(<)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]],
73
- [/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ['delimiter', { token: 'tag', next: '@otherTag' }]],
74
- [/</, 'delimiter'],
75
- [/[^<{]+/], // text
76
- ],
77
-
78
- doctype: [
79
- [/[^>]+/, 'metatag.content'],
80
- [/>/, 'metatag', '@pop'],
81
- ],
82
-
83
- frontmatter: [
84
- [/^---/, { token: 'comment', next: '@pop', nextEmbedded: '@pop' }],
85
- [/./, { token: '@rematch', next: '@frontmatterEmbedded', nextEmbedded: 'text/javascript' }],
86
- ],
87
-
88
- frontmatterEmbedded: [
89
- [/[^-]+|-[^-][^-]+/, { token: '@rematch', next: '@pop' }],
90
- [/^---/, { token: 'comment', next: '@root', nextEmbedded: '@pop' }],
91
- ],
92
-
93
- expression: [
94
- [
95
- /[^<{}]/,
96
- { token: '@rematch', next: '@expressionEmbedded', nextEmbedded: 'text/javascript' },
97
- ],
98
- [/</, { token: '@rematch', next: '@pop' }],
99
- [/}/, { token: '', next: '@pop' }],
100
- ],
101
-
102
- expressionEmbedded: [
103
- [/{/, '@rematch', '@push'],
104
- [/</, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
105
- [/}/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
106
- ],
107
-
108
- comment: [
109
- [/-->/, 'comment', '@pop'],
110
- [/[^-]+/, 'comment.content'],
111
- [/./, 'comment.content'],
112
- ],
113
-
114
- otherTag: [
115
- [/\/?>/, 'delimiter', '@pop'],
116
- [/"([^"]*)"/, 'attribute.value'],
117
- [/'([^']*)'/, 'attribute.value'],
118
- [/[\w\-]+/, 'attribute.name'],
119
- [/=/, 'delimiter'],
120
- [/[ \t\r\n]+/], // whitespace
121
- ],
122
-
123
- // -- BEGIN <script> tags handling
124
-
125
- // After <script
126
- script: [
127
- [/type/, 'attribute.name', '@scriptAfterType'],
128
- [/"([^"]*)"/, 'attribute.value'],
129
- [/'([^']*)'/, 'attribute.value'],
130
- [/[\w\-]+/, 'attribute.name'],
131
- [/=/, 'delimiter'],
132
- [/>/, { token: 'delimiter', next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }],
133
- [/[ \t\r\n]+/], // whitespace
134
- [/(<\/)(script\s*)(>)/, ['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]],
135
- ],
136
-
137
- // After <script ... type
138
- scriptAfterType: [
139
- [/=/, 'delimiter', '@scriptAfterTypeEquals'],
140
- [/>/, { token: 'delimiter', next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }], // cover invalid e.g. <script type>
141
- [/[ \t\r\n]+/], // whitespace
142
- [/<\/script\s*>/, { token: '@rematch', next: '@pop' }],
143
- ],
144
-
145
- // After <script ... type =
146
- scriptAfterTypeEquals: [
147
- [/"([^"]*)"/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
148
- [/'([^']*)'/, { token: 'attribute.value', switchTo: '@scriptWithCustomType.$1' }],
149
- [/>/, { token: 'delimiter', next: '@scriptEmbedded', nextEmbedded: 'text/javascript' }], // cover invalid e.g. <script type=>
150
- [/[ \t\r\n]+/], // whitespace
151
- [/<\/script\s*>/, { token: '@rematch', next: '@pop' }],
152
- ],
153
-
154
- // After <script ... type = $S2
155
- scriptWithCustomType: [
156
- [/>/, { token: 'delimiter', next: '@scriptEmbedded.$S2', nextEmbedded: '$S2' }],
157
- [/"([^"]*)"/, 'attribute.value'],
158
- [/'([^']*)'/, 'attribute.value'],
159
- [/[\w\-]+/, 'attribute.name'],
160
- [/=/, 'delimiter'],
161
- [/[ \t\r\n]+/], // whitespace
162
- [/<\/script\s*>/, { token: '@rematch', next: '@pop' }],
163
- ],
164
-
165
- scriptEmbedded: [
166
- [/<\/script/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
167
- [/[^<]+/, ''],
168
- ],
169
-
170
- // -- END <script> tags handling
171
-
172
- // -- BEGIN <style> tags handling
173
-
174
- // After <style
175
- style: [
176
- [/type/, 'attribute.name', '@styleAfterType'],
177
- [/"([^"]*)"/, 'attribute.value'],
178
- [/'([^']*)'/, 'attribute.value'],
179
- [/[\w\-]+/, 'attribute.name'],
180
- [/=/, 'delimiter'],
181
- [/>/, { token: 'delimiter', next: '@styleEmbedded', nextEmbedded: 'text/css' }],
182
- [/[ \t\r\n]+/], // whitespace
183
- [/(<\/)(style\s*)(>)/, ['delimiter', 'tag', { token: 'delimiter', next: '@pop' }]],
184
- ],
185
-
186
- // After <style ... type
187
- styleAfterType: [
188
- [/=/, 'delimiter', '@styleAfterTypeEquals'],
189
- [/>/, { token: 'delimiter', next: '@styleEmbedded', nextEmbedded: 'text/css' }], // cover invalid e.g. <style type>
190
- [/[ \t\r\n]+/], // whitespace
191
- [/<\/style\s*>/, { token: '@rematch', next: '@pop' }],
192
- ],
193
-
194
- // After <style ... type =
195
- styleAfterTypeEquals: [
196
- [/"([^"]*)"/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
197
- [/'([^']*)'/, { token: 'attribute.value', switchTo: '@styleWithCustomType.$1' }],
198
- [/>/, { token: 'delimiter', next: '@styleEmbedded', nextEmbedded: 'text/css' }], // cover invalid e.g. <style type=>
199
- [/[ \t\r\n]+/], // whitespace
200
- [/<\/style\s*>/, { token: '@rematch', next: '@pop' }],
201
- ],
202
-
203
- // After <style ... type = $S2
204
- styleWithCustomType: [
205
- [/>/, { token: 'delimiter', next: '@styleEmbedded.$S2', nextEmbedded: '$S2' }],
206
- [/"([^"]*)"/, 'attribute.value'],
207
- [/'([^']*)'/, 'attribute.value'],
208
- [/[\w\-]+/, 'attribute.name'],
209
- [/=/, 'delimiter'],
210
- [/[ \t\r\n]+/], // whitespace
211
- [/<\/style\s*>/, { token: '@rematch', next: '@pop' }],
212
- ],
213
-
214
- styleEmbedded: [
215
- [/<\/style/, { token: '@rematch', next: '@pop', nextEmbedded: '@pop' }],
216
- [/[^<]+/, ''],
217
- ],
218
-
219
- // -- END <style> tags handling
220
- },
221
- },
222
- };
@@ -1,120 +0,0 @@
1
- export default {
2
- tokens: {
3
- // Set defaultToken to invalid to see what you do not tokenize yet
4
- // defaultToken: 'invalid',
5
-
6
- keywords: [
7
- 'import',
8
- 'export',
9
- 'from',
10
- 'as',
11
- 'fn',
12
- 'await',
13
- '[await]',
14
- 'if',
15
- 'else',
16
- 'true',
17
- 'false',
18
- 'and',
19
- 'or',
20
- 'not',
21
- 'type',
22
- 'list',
23
- ],
24
-
25
- typeKeywords: ['Number', 'String', 'Function', 'Array'],
26
-
27
- operators: ['>', '<', ':', '=', '<=', '>=', '!=', '+', '-', '*', '/', '//', '|', '**', '%'],
28
-
29
- // we include these common regular expressions
30
- symbols: /[=><!~?:&|+\-*\/\^%]+/,
31
-
32
- // C# style strings
33
- escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
34
-
35
- // The main tokenizer for our languages
36
- tokenizer: {
37
- root: [
38
- [/fn/, { token: 'keyword', next: '@function' }],
39
- [/->/, { token: 'operators', next: '@chain' }],
40
-
41
- // identifiers and keywords
42
- [
43
- /[a-zA-Z_$][\w$]*/i,
44
- {
45
- cases: {
46
- '@typeKeywords': 'keyword',
47
- '@keywords': 'keyword',
48
- '@default': 'identifier',
49
- },
50
- },
51
- ],
52
-
53
- // whitespace
54
- { include: '@whitespace' },
55
-
56
- // delimiters and operators
57
- [/[{}()\[\]]/, '@brackets'],
58
- [/[<>](?!@symbols)/, '@brackets'],
59
- [
60
- /@symbols/,
61
- {
62
- cases: {
63
- '@operators': 'operator',
64
- '@default': '',
65
- },
66
- },
67
- ],
68
-
69
- // @ annotations.
70
- // As an example, we emit a debugging log message on these tokens.
71
- // Note: message are supressed during the first load -- change some lines to see them.
72
- [/@\s*[a-zA-Z_\$][\w\$]*/, { token: 'annotation' }],
73
-
74
- // numbers
75
- [/\d*\.\d+([eE][\-+]?\d+)?/, 'number.float'],
76
- [/0[xX][0-9a-fA-F]+/, 'number.hex'],
77
- [/\d+/, 'number'],
78
-
79
- // delimiter: after number because of .\d floats
80
- [/[;,.]/, 'delimiter'],
81
-
82
- // strings
83
- [/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
84
- [/"/, { token: 'string.quote', bracket: '@open', next: '@string' }],
85
-
86
- // single-quote strings
87
- [/"([^'\\]|\\.)*$/, 'string.invalid'], // non-teminated string
88
- [/'/, { token: 'string.quote', bracket: '@open', next: '@stringSingle' }],
89
- ],
90
-
91
- // eslint-disable-next-line id-blacklist
92
- string: [
93
- [/[^\\"]+/, 'string'],
94
- [/@escapes/, 'string.escape'],
95
- [/\\./, 'string.escape.invalid'],
96
- [/"/, { token: 'string.quote', bracket: '@close', next: '@pop' }],
97
- ],
98
-
99
- stringSingle: [
100
- [/[^\\']+/, 'string'],
101
- [/@escapes/, 'string.escape'],
102
- [/\\./, 'string.escape.invalid'],
103
- [/'/, { token: 'string.quote', bracket: '@close', next: '@pop' }],
104
- ],
105
-
106
- whitespace: [
107
- [/[ \t\r\n]+/, 'white'],
108
- [/--.*$/, 'comment'],
109
- ],
110
-
111
- function: [[/[a-zA-Z0-9_]+/, { token: 'variable', next: '@pop' }]],
112
-
113
- chain: [
114
- [/\*/, 'operators'],
115
- [/\[?await\]?/, 'keyword'],
116
- [/[a-zA-Z]+/, { token: 'variable', next: '@pop' }],
117
- ],
118
- },
119
- },
120
- };