codemirror-lang-glimmer 0.0.0-beta.2 → 0.0.0-beta.4
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +13 -0
- package/dev/node_modules/.bin/eslint +4 -4
- package/dev/node_modules/.bin/vite +4 -4
- package/dev/package.json +10 -10
- package/dist/index.cjs +91 -91
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +93 -93
- package/package.json +15 -15
- package/src/index.ts +96 -118
- package/tests/node_modules/.bin/eslint +4 -4
- package/tests/package.json +7 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
> codemirror-lang-glimmer@0.0.0-beta.
|
|
2
|
+
> codemirror-lang-glimmer@0.0.0-beta.4 build /home/runner/work/glimdown/glimdown/packages/codemirror/glimmer
|
|
3
3
|
> rollup -c
|
|
4
4
|
|
|
5
|
-
(node:
|
|
5
|
+
(node:1942) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
|
|
6
6
|
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
7
7
|
[36m
|
|
8
8
|
[1msrc/index.ts[22m → [1mdist/index.cjs, ./dist[22m...[39m
|
|
9
|
-
(node:
|
|
9
|
+
(node:1942) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
|
10
10
|
[1m[33m(!) Plugin rollup-plugin-lezer: Unused rule 'Text' (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 102:2)[39m[22m
|
|
11
11
|
[1m[33m(!) Plugin rollup-plugin-lezer: Unused rule 'space' (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 103:2)[39m[22m
|
|
12
12
|
[1m[33m(!) Plugin rollup-plugin-lezer: Unused rule 'attributeValueContentCharDouble' (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 122:2)[39m[22m
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
[1m[33m(!) Plugin rollup-plugin-lezer: Unused rule 'attributeValueContentEntity' (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 64:0)[39m[22m
|
|
19
19
|
[1m[33m(!) Plugin rollup-plugin-lezer: Precedence specified for unknown token attributeValueContentCharDouble (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 125:16)[39m[22m
|
|
20
20
|
[1m[33m(!) Plugin rollup-plugin-lezer: Precedence specified for unknown token attributeValueContentCharSingle (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 126:16)[39m[22m
|
|
21
|
-
[32mcreated [1mdist/index.cjs, ./dist[22m in [1m1.
|
|
21
|
+
[32mcreated [1mdist/index.cjs, ./dist[22m in [1m1.7s[22m[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# codemirror-lang-glimmer
|
|
2
2
|
|
|
3
|
+
## 0.0.0-beta.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 77ad072: Add and consume glimdown package, split gjs into gjs and gts
|
|
8
|
+
- 0071216: Dependency updates
|
|
9
|
+
|
|
10
|
+
## 0.0.0-beta.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 20dab8a: Initial development pre-release
|
|
15
|
+
|
|
3
16
|
## 0.0.0-beta.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -6,12 +6,12 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.
|
|
9
|
+
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.
|
|
11
|
+
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../../node_modules/.pnpm/eslint@8.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../../node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/eslint.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../../node_modules/.pnpm/eslint@8.
|
|
16
|
+
exec node "$basedir/../../../../../../node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/eslint.js" "$@"
|
|
17
17
|
fi
|
|
@@ -6,12 +6,12 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.
|
|
9
|
+
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.9/node_modules/vite/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.9/node_modules/vite/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.9/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.
|
|
11
|
+
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.9/node_modules/vite/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.9/node_modules/vite/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.9/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../../node_modules/.pnpm/vite@4.3.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../../node_modules/.pnpm/vite@4.3.9/node_modules/vite/bin/vite.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../../node_modules/.pnpm/vite@4.3.
|
|
16
|
+
exec node "$basedir/../../../../../../node_modules/.pnpm/vite@4.3.9/node_modules/vite/bin/vite.js" "$@"
|
|
17
17
|
fi
|
package/dev/package.json
CHANGED
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
"lint:prettier": "pnpm -w exec lint prettier"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@
|
|
16
|
-
"@
|
|
17
|
-
"@codemirror/
|
|
15
|
+
"@babel/core": "^7.22.5",
|
|
16
|
+
"@babel/eslint-parser": "^7.22.5",
|
|
17
|
+
"@codemirror/language": "^6.8.0",
|
|
18
|
+
"@codemirror/state": "^6.2.1",
|
|
18
19
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
19
|
-
"@codemirror/view": "^6.
|
|
20
|
-
"
|
|
21
|
-
"@babel/eslint-parser": "^7.21.8",
|
|
20
|
+
"@codemirror/view": "^6.14.0",
|
|
21
|
+
"@glimdown/codemirror-dev-preview": "workspace:*",
|
|
22
22
|
"@nullvoxpopuli/eslint-configs": "^3.1.3",
|
|
23
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
24
|
-
"@typescript-eslint/parser": "^5.
|
|
25
|
-
"eslint": "^8.
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
24
|
+
"@typescript-eslint/parser": "^5.60.0",
|
|
25
|
+
"eslint": "^8.43.0",
|
|
26
26
|
"prettier": "^2.8.8",
|
|
27
27
|
"typescript": "^5.0.4",
|
|
28
|
-
"
|
|
28
|
+
"vite": "^4.3.9"
|
|
29
29
|
},
|
|
30
30
|
"volta": {
|
|
31
31
|
"extends": "../../../../package.json"
|
package/dist/index.cjs
CHANGED
|
@@ -286,6 +286,7 @@ const parser = lr.LRParser.deserialize({
|
|
|
286
286
|
tokenPrec: 398
|
|
287
287
|
});
|
|
288
288
|
|
|
289
|
+
// import type { SyntaxNode } from '@lezer/common';
|
|
289
290
|
const glimmerParser = parser;
|
|
290
291
|
const glimmerLanguage = language.LRLanguage.define({
|
|
291
292
|
parser: parser.configure({
|
|
@@ -304,99 +305,98 @@ const glimmerLanguage = language.LRLanguage.define({
|
|
|
304
305
|
return { parser: html.parser };
|
|
305
306
|
}),
|
|
306
307
|
props: [
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}),
|
|
308
|
+
// indentNodeProp.add({
|
|
309
|
+
// Element: (context) => {
|
|
310
|
+
// let after = /^(\s*)(<\/)?/.exec(context.textAfter);
|
|
311
|
+
// if (context.node.to <= context.pos + (after?.[0].length || 0)) return context.continue();
|
|
312
|
+
// return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
|
|
313
|
+
// },
|
|
314
|
+
// Block: (context) => {
|
|
315
|
+
// const node = context.node;
|
|
316
|
+
// const text = context.textAfter.trim();
|
|
317
|
+
// if (text.startsWith('{/')) {
|
|
318
|
+
// const name = node.name;
|
|
319
|
+
// if (
|
|
320
|
+
// (name === 'IfBlock' && text.startsWith('{/if')) ||
|
|
321
|
+
// (name === 'EachBlock' && text.startsWith('{/each')) ||
|
|
322
|
+
// (name === 'KeyBlock' && text.startsWith('{/key'))
|
|
323
|
+
// ) {
|
|
324
|
+
// return context.lineIndent(context.node.from);
|
|
325
|
+
// }
|
|
326
|
+
// return null;
|
|
327
|
+
// }
|
|
328
|
+
// if (node.name === 'IfBlock' || node.name === 'EachBlock') {
|
|
329
|
+
// if (text.startsWith('{{:else')) return context.lineIndent(node.from);
|
|
330
|
+
// if (text.startsWith('{{else')) return context.lineIndent(node.from);
|
|
331
|
+
// }
|
|
332
|
+
// // not sure if this needed to be duplicated
|
|
333
|
+
// let after = /^(\s*)(<\/)?/.exec(context.textAfter);
|
|
334
|
+
// if (context.node.to <= context.pos + (after?.[0].length || 0)) return context.continue();
|
|
335
|
+
// return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
|
|
336
|
+
// },
|
|
337
|
+
// 'BlockOpen BlockClose BlockInline': (context) => {
|
|
338
|
+
// return context.column(context.node.from) + context.unit;
|
|
339
|
+
// },
|
|
340
|
+
// 'OpenTag CloseTag SelfClosingTag': (context) => {
|
|
341
|
+
// return context.column(context.node.from) + context.unit;
|
|
342
|
+
// },
|
|
343
|
+
// Document: (context) => {
|
|
344
|
+
// if (context.pos + (/\s*/.exec(context.textAfter)?.[0].length || 0) < context.node.to) {
|
|
345
|
+
// return context.continue();
|
|
346
|
+
// }
|
|
347
|
+
// let endElt: SyntaxNode | null = null;
|
|
348
|
+
// let close: SyntaxNode;
|
|
349
|
+
// for (let cur = context.node; ; ) {
|
|
350
|
+
// let last = cur.lastChild;
|
|
351
|
+
// if (!last || last.name != 'Element' || last.to != cur.to) break;
|
|
352
|
+
// endElt = cur = last;
|
|
353
|
+
// }
|
|
354
|
+
// if (
|
|
355
|
+
// endElt?.lastChild &&
|
|
356
|
+
// !(
|
|
357
|
+
// (close = endElt.lastChild) &&
|
|
358
|
+
// (close.name === 'CloseTag' || close.name === 'SelfClosingTag')
|
|
359
|
+
// )
|
|
360
|
+
// ) {
|
|
361
|
+
// return context.lineIndent(endElt.from) + context.unit;
|
|
362
|
+
// }
|
|
363
|
+
// return null;
|
|
364
|
+
// },
|
|
365
|
+
// }),
|
|
366
|
+
// foldNodeProp.add({
|
|
367
|
+
// Block: (node) => {
|
|
368
|
+
// const open = `${node.name}Open`;
|
|
369
|
+
// const close = `${node.name}Close`;
|
|
370
|
+
// const first = node.firstChild;
|
|
371
|
+
// const last = node.lastChild;
|
|
372
|
+
// if (!first || first.name !== open) return null;
|
|
373
|
+
// return {
|
|
374
|
+
// from: first.to,
|
|
375
|
+
// to: last?.name === close ? last.from : node.to,
|
|
376
|
+
// };
|
|
377
|
+
// },
|
|
378
|
+
// Element: (node) => {
|
|
379
|
+
// let first = node.firstChild;
|
|
380
|
+
// let last = node.lastChild;
|
|
381
|
+
// if (!first || first.name != 'OpenTag') return null;
|
|
382
|
+
// return {
|
|
383
|
+
// from: first.to,
|
|
384
|
+
// to: last?.name === 'CloseTag' ? last.from : node.to,
|
|
385
|
+
// };
|
|
386
|
+
// },
|
|
387
|
+
// }),
|
|
388
388
|
],
|
|
389
389
|
}),
|
|
390
|
-
languageData: {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
},
|
|
390
|
+
// languageData: {
|
|
391
|
+
// commentTokens: {
|
|
392
|
+
// block: { open: '<!--', close: '-->' },
|
|
393
|
+
// devBlock: { open: '{{!--', close: '--}}' },
|
|
394
|
+
// devBlockShort: { open: '{{!', close: '}}' },
|
|
395
|
+
// },
|
|
396
|
+
// indentOnInput: /^\s*((<\/\w+\W)|(\{:(else|then|catch))|(\{\/(if|unless|each|await|key)))$/,
|
|
397
|
+
// wordChars: '-._',
|
|
398
|
+
// autocomplete: htmlCompletionSource,
|
|
399
|
+
// },
|
|
400
400
|
});
|
|
401
401
|
function glimmer() {
|
|
402
402
|
return new language.LanguageSupport(glimmerLanguage, [langHtml.html().support]);
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts","../src/tokens.ts","../src/highlight.ts"],"names":[],"mappings":"AACA,OAAO,+
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts","../src/tokens.ts","../src/highlight.ts"],"names":[],"mappings":"AACA,OAAO,+BAGN,MAAM,sBAAsB,CAAC;AAQ9B,QAAO,MAAM,aAAa,8BAAS,CAAC;AAEpC,QAAO,MAAM,eAAe,YAiH1B,CAAC;AAEH,iBAAgB,OAAO,oBAEtB"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts","../src/tokens.ts","../src/highlight.ts"],"names":[],"mappings":"AACA,OAAO,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts","../src/tokens.ts","../src/highlight.ts"],"names":[],"mappings":"AACA,OAAO,+BAGN,MAAM,sBAAsB,CAAC;AAQ9B,QAAO,MAAM,aAAa,8BAAS,CAAC;AAEpC,QAAO,MAAM,eAAe,YAiH1B,CAAC;AAEH,iBAAgB,OAAO,oBAEtB"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LRLanguage,
|
|
1
|
+
import { html } from '@codemirror/lang-html';
|
|
2
|
+
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
3
3
|
import { parseMixed } from '@lezer/common';
|
|
4
4
|
import { parser as parser$1 } from '@lezer/html';
|
|
5
5
|
import { ExternalTokenizer, LRParser } from '@lezer/lr';
|
|
@@ -284,6 +284,7 @@ const parser = LRParser.deserialize({
|
|
|
284
284
|
tokenPrec: 398
|
|
285
285
|
});
|
|
286
286
|
|
|
287
|
+
// import type { SyntaxNode } from '@lezer/common';
|
|
287
288
|
const glimmerParser = parser;
|
|
288
289
|
const glimmerLanguage = LRLanguage.define({
|
|
289
290
|
parser: parser.configure({
|
|
@@ -302,99 +303,98 @@ const glimmerLanguage = LRLanguage.define({
|
|
|
302
303
|
return { parser: parser$1 };
|
|
303
304
|
}),
|
|
304
305
|
props: [
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}),
|
|
306
|
+
// indentNodeProp.add({
|
|
307
|
+
// Element: (context) => {
|
|
308
|
+
// let after = /^(\s*)(<\/)?/.exec(context.textAfter);
|
|
309
|
+
// if (context.node.to <= context.pos + (after?.[0].length || 0)) return context.continue();
|
|
310
|
+
// return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
|
|
311
|
+
// },
|
|
312
|
+
// Block: (context) => {
|
|
313
|
+
// const node = context.node;
|
|
314
|
+
// const text = context.textAfter.trim();
|
|
315
|
+
// if (text.startsWith('{/')) {
|
|
316
|
+
// const name = node.name;
|
|
317
|
+
// if (
|
|
318
|
+
// (name === 'IfBlock' && text.startsWith('{/if')) ||
|
|
319
|
+
// (name === 'EachBlock' && text.startsWith('{/each')) ||
|
|
320
|
+
// (name === 'KeyBlock' && text.startsWith('{/key'))
|
|
321
|
+
// ) {
|
|
322
|
+
// return context.lineIndent(context.node.from);
|
|
323
|
+
// }
|
|
324
|
+
// return null;
|
|
325
|
+
// }
|
|
326
|
+
// if (node.name === 'IfBlock' || node.name === 'EachBlock') {
|
|
327
|
+
// if (text.startsWith('{{:else')) return context.lineIndent(node.from);
|
|
328
|
+
// if (text.startsWith('{{else')) return context.lineIndent(node.from);
|
|
329
|
+
// }
|
|
330
|
+
// // not sure if this needed to be duplicated
|
|
331
|
+
// let after = /^(\s*)(<\/)?/.exec(context.textAfter);
|
|
332
|
+
// if (context.node.to <= context.pos + (after?.[0].length || 0)) return context.continue();
|
|
333
|
+
// return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
|
|
334
|
+
// },
|
|
335
|
+
// 'BlockOpen BlockClose BlockInline': (context) => {
|
|
336
|
+
// return context.column(context.node.from) + context.unit;
|
|
337
|
+
// },
|
|
338
|
+
// 'OpenTag CloseTag SelfClosingTag': (context) => {
|
|
339
|
+
// return context.column(context.node.from) + context.unit;
|
|
340
|
+
// },
|
|
341
|
+
// Document: (context) => {
|
|
342
|
+
// if (context.pos + (/\s*/.exec(context.textAfter)?.[0].length || 0) < context.node.to) {
|
|
343
|
+
// return context.continue();
|
|
344
|
+
// }
|
|
345
|
+
// let endElt: SyntaxNode | null = null;
|
|
346
|
+
// let close: SyntaxNode;
|
|
347
|
+
// for (let cur = context.node; ; ) {
|
|
348
|
+
// let last = cur.lastChild;
|
|
349
|
+
// if (!last || last.name != 'Element' || last.to != cur.to) break;
|
|
350
|
+
// endElt = cur = last;
|
|
351
|
+
// }
|
|
352
|
+
// if (
|
|
353
|
+
// endElt?.lastChild &&
|
|
354
|
+
// !(
|
|
355
|
+
// (close = endElt.lastChild) &&
|
|
356
|
+
// (close.name === 'CloseTag' || close.name === 'SelfClosingTag')
|
|
357
|
+
// )
|
|
358
|
+
// ) {
|
|
359
|
+
// return context.lineIndent(endElt.from) + context.unit;
|
|
360
|
+
// }
|
|
361
|
+
// return null;
|
|
362
|
+
// },
|
|
363
|
+
// }),
|
|
364
|
+
// foldNodeProp.add({
|
|
365
|
+
// Block: (node) => {
|
|
366
|
+
// const open = `${node.name}Open`;
|
|
367
|
+
// const close = `${node.name}Close`;
|
|
368
|
+
// const first = node.firstChild;
|
|
369
|
+
// const last = node.lastChild;
|
|
370
|
+
// if (!first || first.name !== open) return null;
|
|
371
|
+
// return {
|
|
372
|
+
// from: first.to,
|
|
373
|
+
// to: last?.name === close ? last.from : node.to,
|
|
374
|
+
// };
|
|
375
|
+
// },
|
|
376
|
+
// Element: (node) => {
|
|
377
|
+
// let first = node.firstChild;
|
|
378
|
+
// let last = node.lastChild;
|
|
379
|
+
// if (!first || first.name != 'OpenTag') return null;
|
|
380
|
+
// return {
|
|
381
|
+
// from: first.to,
|
|
382
|
+
// to: last?.name === 'CloseTag' ? last.from : node.to,
|
|
383
|
+
// };
|
|
384
|
+
// },
|
|
385
|
+
// }),
|
|
386
386
|
],
|
|
387
387
|
}),
|
|
388
|
-
languageData: {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
},
|
|
388
|
+
// languageData: {
|
|
389
|
+
// commentTokens: {
|
|
390
|
+
// block: { open: '<!--', close: '-->' },
|
|
391
|
+
// devBlock: { open: '{{!--', close: '--}}' },
|
|
392
|
+
// devBlockShort: { open: '{{!', close: '}}' },
|
|
393
|
+
// },
|
|
394
|
+
// indentOnInput: /^\s*((<\/\w+\W)|(\{:(else|then|catch))|(\{\/(if|unless|each|await|key)))$/,
|
|
395
|
+
// wordChars: '-._',
|
|
396
|
+
// autocomplete: htmlCompletionSource,
|
|
397
|
+
// },
|
|
398
398
|
});
|
|
399
399
|
function glimmer() {
|
|
400
400
|
return new LanguageSupport(glimmerLanguage, [html().support]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codemirror-lang-glimmer",
|
|
3
|
-
"version": "0.0.0-beta.
|
|
3
|
+
"version": "0.0.0-beta.4",
|
|
4
4
|
"author": "NullVoxPopuli",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,30 +17,30 @@
|
|
|
17
17
|
"path": "packages/lezer/glimmer"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@babel/core": "^7.
|
|
21
|
-
"@babel/eslint-parser": "^7.
|
|
22
|
-
"@codemirror/buildhelper": "^0.
|
|
23
|
-
"@codemirror/language": "^6.
|
|
24
|
-
"@lezer/generator": "^1.
|
|
20
|
+
"@babel/core": "^7.22.5",
|
|
21
|
+
"@babel/eslint-parser": "^7.22.5",
|
|
22
|
+
"@codemirror/buildhelper": "^1.0.0",
|
|
23
|
+
"@codemirror/language": "^6.8.0",
|
|
24
|
+
"@lezer/generator": "^1.3.0",
|
|
25
25
|
"@nullvoxpopuli/eslint-configs": "^3.1.3",
|
|
26
26
|
"@tsconfig/ember": "^2.0.0",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
28
|
-
"@typescript-eslint/parser": "^5.
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
28
|
+
"@typescript-eslint/parser": "^5.60.0",
|
|
29
29
|
"codemirror": "^6.0.1",
|
|
30
|
-
"concurrently": "^8.0
|
|
31
|
-
"eslint": "^8.
|
|
30
|
+
"concurrently": "^8.2.0",
|
|
31
|
+
"eslint": "^8.43.0",
|
|
32
32
|
"prettier": "^2.8.8",
|
|
33
|
-
"rollup": "^3.21.
|
|
33
|
+
"rollup": "^3.21.7",
|
|
34
34
|
"rollup-plugin-ts": "^3.2.0",
|
|
35
35
|
"typescript": "^5.0.4"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@codemirror/lang-html": "^6.4.
|
|
39
|
-
"@lezer/common": "^1.0.
|
|
40
|
-
"@lezer/highlight": "^1.1.
|
|
38
|
+
"@codemirror/lang-html": "^6.4.5",
|
|
39
|
+
"@lezer/common": "^1.0.3",
|
|
40
|
+
"@lezer/highlight": "^1.1.6",
|
|
41
41
|
"@lezer/html": "^1.3.4",
|
|
42
42
|
"@lezer/javascript": "^1.4.3",
|
|
43
|
-
"@lezer/lr": "^1.3.
|
|
43
|
+
"@lezer/lr": "^1.3.7"
|
|
44
44
|
},
|
|
45
45
|
"volta": {
|
|
46
46
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { html
|
|
2
|
-
import {
|
|
1
|
+
import { html /*, htmlCompletionSource */ } from '@codemirror/lang-html';
|
|
2
|
+
import {
|
|
3
|
+
/* foldNodeProp, indentNodeProp, */ LanguageSupport,
|
|
4
|
+
LRLanguage,
|
|
5
|
+
} from '@codemirror/language';
|
|
3
6
|
import { parseMixed } from '@lezer/common';
|
|
4
7
|
import { parser as htmlParser } from '@lezer/html';
|
|
5
8
|
|
|
6
9
|
import { parser } from './syntax.grammar';
|
|
7
10
|
|
|
8
|
-
import type { SyntaxNode } from '@lezer/common';
|
|
11
|
+
// import type { SyntaxNode } from '@lezer/common';
|
|
9
12
|
|
|
10
13
|
export const glimmerParser = parser;
|
|
11
14
|
|
|
@@ -29,124 +32,99 @@ export const glimmerLanguage = LRLanguage.define({
|
|
|
29
32
|
}),
|
|
30
33
|
|
|
31
34
|
props: [
|
|
32
|
-
indentNodeProp.add({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const close = `${node.name}Close`;
|
|
113
|
-
|
|
114
|
-
const first = node.firstChild;
|
|
115
|
-
const last = node.lastChild;
|
|
116
|
-
|
|
117
|
-
if (!first || first.name !== open) return null;
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
from: first.to,
|
|
121
|
-
to: last?.name === close ? last.from : node.to,
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
Element: (node) => {
|
|
126
|
-
let first = node.firstChild;
|
|
127
|
-
let last = node.lastChild;
|
|
128
|
-
|
|
129
|
-
if (!first || first.name != 'OpenTag') return null;
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
from: first.to,
|
|
133
|
-
to: last?.name === 'CloseTag' ? last.from : node.to,
|
|
134
|
-
};
|
|
135
|
-
},
|
|
136
|
-
}),
|
|
35
|
+
// indentNodeProp.add({
|
|
36
|
+
// Element: (context) => {
|
|
37
|
+
// let after = /^(\s*)(<\/)?/.exec(context.textAfter);
|
|
38
|
+
// if (context.node.to <= context.pos + (after?.[0].length || 0)) return context.continue();
|
|
39
|
+
// return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
|
|
40
|
+
// },
|
|
41
|
+
// Block: (context) => {
|
|
42
|
+
// const node = context.node;
|
|
43
|
+
// const text = context.textAfter.trim();
|
|
44
|
+
// if (text.startsWith('{/')) {
|
|
45
|
+
// const name = node.name;
|
|
46
|
+
// if (
|
|
47
|
+
// (name === 'IfBlock' && text.startsWith('{/if')) ||
|
|
48
|
+
// (name === 'EachBlock' && text.startsWith('{/each')) ||
|
|
49
|
+
// (name === 'KeyBlock' && text.startsWith('{/key'))
|
|
50
|
+
// ) {
|
|
51
|
+
// return context.lineIndent(context.node.from);
|
|
52
|
+
// }
|
|
53
|
+
// return null;
|
|
54
|
+
// }
|
|
55
|
+
// if (node.name === 'IfBlock' || node.name === 'EachBlock') {
|
|
56
|
+
// if (text.startsWith('{{:else')) return context.lineIndent(node.from);
|
|
57
|
+
// if (text.startsWith('{{else')) return context.lineIndent(node.from);
|
|
58
|
+
// }
|
|
59
|
+
// // not sure if this needed to be duplicated
|
|
60
|
+
// let after = /^(\s*)(<\/)?/.exec(context.textAfter);
|
|
61
|
+
// if (context.node.to <= context.pos + (after?.[0].length || 0)) return context.continue();
|
|
62
|
+
// return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
|
|
63
|
+
// },
|
|
64
|
+
// 'BlockOpen BlockClose BlockInline': (context) => {
|
|
65
|
+
// return context.column(context.node.from) + context.unit;
|
|
66
|
+
// },
|
|
67
|
+
// 'OpenTag CloseTag SelfClosingTag': (context) => {
|
|
68
|
+
// return context.column(context.node.from) + context.unit;
|
|
69
|
+
// },
|
|
70
|
+
// Document: (context) => {
|
|
71
|
+
// if (context.pos + (/\s*/.exec(context.textAfter)?.[0].length || 0) < context.node.to) {
|
|
72
|
+
// return context.continue();
|
|
73
|
+
// }
|
|
74
|
+
// let endElt: SyntaxNode | null = null;
|
|
75
|
+
// let close: SyntaxNode;
|
|
76
|
+
// for (let cur = context.node; ; ) {
|
|
77
|
+
// let last = cur.lastChild;
|
|
78
|
+
// if (!last || last.name != 'Element' || last.to != cur.to) break;
|
|
79
|
+
// endElt = cur = last;
|
|
80
|
+
// }
|
|
81
|
+
// if (
|
|
82
|
+
// endElt?.lastChild &&
|
|
83
|
+
// !(
|
|
84
|
+
// (close = endElt.lastChild) &&
|
|
85
|
+
// (close.name === 'CloseTag' || close.name === 'SelfClosingTag')
|
|
86
|
+
// )
|
|
87
|
+
// ) {
|
|
88
|
+
// return context.lineIndent(endElt.from) + context.unit;
|
|
89
|
+
// }
|
|
90
|
+
// return null;
|
|
91
|
+
// },
|
|
92
|
+
// }),
|
|
93
|
+
// foldNodeProp.add({
|
|
94
|
+
// Block: (node) => {
|
|
95
|
+
// const open = `${node.name}Open`;
|
|
96
|
+
// const close = `${node.name}Close`;
|
|
97
|
+
// const first = node.firstChild;
|
|
98
|
+
// const last = node.lastChild;
|
|
99
|
+
// if (!first || first.name !== open) return null;
|
|
100
|
+
// return {
|
|
101
|
+
// from: first.to,
|
|
102
|
+
// to: last?.name === close ? last.from : node.to,
|
|
103
|
+
// };
|
|
104
|
+
// },
|
|
105
|
+
// Element: (node) => {
|
|
106
|
+
// let first = node.firstChild;
|
|
107
|
+
// let last = node.lastChild;
|
|
108
|
+
// if (!first || first.name != 'OpenTag') return null;
|
|
109
|
+
// return {
|
|
110
|
+
// from: first.to,
|
|
111
|
+
// to: last?.name === 'CloseTag' ? last.from : node.to,
|
|
112
|
+
// };
|
|
113
|
+
// },
|
|
114
|
+
// }),
|
|
137
115
|
],
|
|
138
116
|
}),
|
|
139
117
|
|
|
140
|
-
languageData: {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
118
|
+
// languageData: {
|
|
119
|
+
// commentTokens: {
|
|
120
|
+
// block: { open: '<!--', close: '-->' },
|
|
121
|
+
// devBlock: { open: '{{!--', close: '--}}' },
|
|
122
|
+
// devBlockShort: { open: '{{!', close: '}}' },
|
|
123
|
+
// },
|
|
124
|
+
// indentOnInput: /^\s*((<\/\w+\W)|(\{:(else|then|catch))|(\{\/(if|unless|each|await|key)))$/,
|
|
125
|
+
// wordChars: '-._',
|
|
126
|
+
// autocomplete: htmlCompletionSource,
|
|
127
|
+
// },
|
|
150
128
|
});
|
|
151
129
|
|
|
152
130
|
export function glimmer() {
|
|
@@ -6,12 +6,12 @@ case `uname` in
|
|
|
6
6
|
esac
|
|
7
7
|
|
|
8
8
|
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.
|
|
9
|
+
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules"
|
|
10
10
|
else
|
|
11
|
-
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.
|
|
11
|
+
export NODE_PATH="/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.43.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../../node_modules/.pnpm/eslint@8.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../../node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/eslint.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../../node_modules/.pnpm/eslint@8.
|
|
16
|
+
exec node "$basedir/../../../../../../node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/eslint.js" "$@"
|
|
17
17
|
fi
|
package/tests/package.json
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
"extends": "../../../../package.json"
|
|
6
6
|
},
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@
|
|
9
|
-
"@
|
|
10
|
-
"eslint": "^8.40.0",
|
|
11
|
-
"prettier": "^2.8.8",
|
|
12
|
-
"typescript": "^5.0.4",
|
|
8
|
+
"@babel/core": "^7.22.5",
|
|
9
|
+
"@babel/eslint-parser": "^7.22.5",
|
|
13
10
|
"@nullvoxpopuli/eslint-configs": "^3.1.3",
|
|
14
|
-
"@
|
|
15
|
-
"@
|
|
11
|
+
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
|
12
|
+
"@typescript-eslint/parser": "^5.60.0",
|
|
13
|
+
"eslint": "^8.43.0",
|
|
14
|
+
"prettier": "^2.8.8",
|
|
15
|
+
"typescript": "^5.0.4"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"lint": "pnpm -w exec lint",
|