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.
@@ -1,12 +1,12 @@
1
1
 
2
- > codemirror-lang-glimmer@0.0.0-beta.2 build /home/runner/work/glimdown/glimdown/packages/codemirror/glimmer
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:1869) 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.
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
  
8
8
  src/index.ts → dist/index.cjs, ./dist...
9
- (node:1869) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
9
+ (node:1942) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
10
10
  (!) Plugin rollup-plugin-lezer: Unused rule 'Text' (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 102:2)
11
11
  (!) Plugin rollup-plugin-lezer: Unused rule 'space' (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 103:2)
12
12
  (!) Plugin rollup-plugin-lezer: Unused rule 'attributeValueContentCharDouble' (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 122:2)
@@ -18,4 +18,4 @@
18
18
  (!) Plugin rollup-plugin-lezer: Unused rule 'attributeValueContentEntity' (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 64:0)
19
19
  (!) Plugin rollup-plugin-lezer: Precedence specified for unknown token attributeValueContentCharDouble (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 125:16)
20
20
  (!) Plugin rollup-plugin-lezer: Precedence specified for unknown token attributeValueContentCharSingle (/home/runner/work/glimdown/glimdown/packages/codemirror/glimmer/src/syntax.grammar 126:16)
21
- created dist/index.cjs, ./dist in 1.8s
21
+ created dist/index.cjs, ./dist in 1.7s
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.40.0/node_modules/eslint/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.40.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules"
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.40.0/node_modules/eslint/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.40.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules:$NODE_PATH"
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.40.0/node_modules/eslint/bin/eslint.js" "$@"
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.40.0/node_modules/eslint/bin/eslint.js" "$@"
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.5_@types+node@20.1.0/node_modules/vite/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.5_@types+node@20.1.0/node_modules/vite/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.5_@types+node@20.1.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules"
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.5_@types+node@20.1.0/node_modules/vite/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.5_@types+node@20.1.0/node_modules/vite/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/vite@4.3.5_@types+node@20.1.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules:$NODE_PATH"
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.5_@types+node@20.1.0/node_modules/vite/bin/vite.js" "$@"
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.5_@types+node@20.1.0/node_modules/vite/bin/vite.js" "$@"
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
- "@glimdown/codemirror-dev-preview": "workspace:*",
16
- "@codemirror/language": "^6.6.0",
17
- "@codemirror/state": "^6.2.0",
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.11.0",
20
- "vite": "^4.3.5",
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.59.5",
24
- "@typescript-eslint/parser": "^5.59.5",
25
- "eslint": "^8.40.0",
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
- "@babel/core": "^7.21.8"
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
- language.indentNodeProp.add({
308
- Element: (context) => {
309
- let after = /^(\s*)(<\/)?/.exec(context.textAfter);
310
- if (context.node.to <= context.pos + (after?.[0].length || 0))
311
- 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 ((name === 'IfBlock' && text.startsWith('{/if')) ||
320
- (name === 'EachBlock' && text.startsWith('{/each')) ||
321
- (name === 'KeyBlock' && text.startsWith('{/key'))) {
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'))
328
- return context.lineIndent(node.from);
329
- if (text.startsWith('{{else'))
330
- 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))
335
- return context.continue();
336
- return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
337
- },
338
- 'BlockOpen BlockClose BlockInline': (context) => {
339
- return context.column(context.node.from) + context.unit;
340
- },
341
- 'OpenTag CloseTag SelfClosingTag': (context) => {
342
- return context.column(context.node.from) + context.unit;
343
- },
344
- Document: (context) => {
345
- if (context.pos + (/\s*/.exec(context.textAfter)?.[0].length || 0) < context.node.to) {
346
- return context.continue();
347
- }
348
- let endElt = null;
349
- let close;
350
- for (let cur = context.node;;) {
351
- let last = cur.lastChild;
352
- if (!last || last.name != 'Element' || last.to != cur.to)
353
- break;
354
- endElt = cur = last;
355
- }
356
- if (endElt?.lastChild &&
357
- !((close = endElt.lastChild) &&
358
- (close.name === 'CloseTag' || close.name === 'SelfClosingTag'))) {
359
- return context.lineIndent(endElt.from) + context.unit;
360
- }
361
- return null;
362
- },
363
- }),
364
- language.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)
371
- return null;
372
- return {
373
- from: first.to,
374
- to: last?.name === close ? last.from : node.to,
375
- };
376
- },
377
- Element: (node) => {
378
- let first = node.firstChild;
379
- let last = node.lastChild;
380
- if (!first || first.name != 'OpenTag')
381
- return null;
382
- return {
383
- from: first.to,
384
- to: last?.name === 'CloseTag' ? last.from : node.to,
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
- 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: langHtml.htmlCompletionSource,
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]);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts","../src/tokens.ts","../src/highlight.ts"],"names":[],"mappings":"AACA,OAAO,+BAA6D,MAAM,sBAAsB,CAAC;AAQjG,QAAO,MAAM,aAAa,8BAAS,CAAC;AAEpC,QAAO,MAAM,eAAe,YA0I1B,CAAC;AAEH,iBAAgB,OAAO,oBAEtB"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts","../src/tokens.ts","../src/highlight.ts"],"names":[],"mappings":"AACA,OAAO,+BAA6D,MAAM,sBAAsB,CAAC;AAQjG,QAAO,MAAM,aAAa,8BAAS,CAAC;AAEpC,QAAO,MAAM,eAAe,YA0I1B,CAAC;AAEH,iBAAgB,OAAO,oBAEtB"}
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 { htmlCompletionSource, html } from '@codemirror/lang-html';
2
- import { LRLanguage, indentNodeProp, foldNodeProp, LanguageSupport } from '@codemirror/language';
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
- indentNodeProp.add({
306
- Element: (context) => {
307
- let after = /^(\s*)(<\/)?/.exec(context.textAfter);
308
- if (context.node.to <= context.pos + (after?.[0].length || 0))
309
- 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 ((name === 'IfBlock' && text.startsWith('{/if')) ||
318
- (name === 'EachBlock' && text.startsWith('{/each')) ||
319
- (name === 'KeyBlock' && text.startsWith('{/key'))) {
320
- return context.lineIndent(context.node.from);
321
- }
322
- return null;
323
- }
324
- if (node.name === 'IfBlock' || node.name === 'EachBlock') {
325
- if (text.startsWith('{{:else'))
326
- return context.lineIndent(node.from);
327
- if (text.startsWith('{{else'))
328
- 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))
333
- return context.continue();
334
- return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
335
- },
336
- 'BlockOpen BlockClose BlockInline': (context) => {
337
- return context.column(context.node.from) + context.unit;
338
- },
339
- 'OpenTag CloseTag SelfClosingTag': (context) => {
340
- return context.column(context.node.from) + context.unit;
341
- },
342
- Document: (context) => {
343
- if (context.pos + (/\s*/.exec(context.textAfter)?.[0].length || 0) < context.node.to) {
344
- return context.continue();
345
- }
346
- let endElt = null;
347
- let close;
348
- for (let cur = context.node;;) {
349
- let last = cur.lastChild;
350
- if (!last || last.name != 'Element' || last.to != cur.to)
351
- break;
352
- endElt = cur = last;
353
- }
354
- if (endElt?.lastChild &&
355
- !((close = endElt.lastChild) &&
356
- (close.name === 'CloseTag' || close.name === 'SelfClosingTag'))) {
357
- return context.lineIndent(endElt.from) + context.unit;
358
- }
359
- return null;
360
- },
361
- }),
362
- foldNodeProp.add({
363
- Block: (node) => {
364
- const open = `${node.name}Open`;
365
- const close = `${node.name}Close`;
366
- const first = node.firstChild;
367
- const last = node.lastChild;
368
- if (!first || first.name !== open)
369
- return null;
370
- return {
371
- from: first.to,
372
- to: last?.name === close ? last.from : node.to,
373
- };
374
- },
375
- Element: (node) => {
376
- let first = node.firstChild;
377
- let last = node.lastChild;
378
- if (!first || first.name != 'OpenTag')
379
- return null;
380
- return {
381
- from: first.to,
382
- to: last?.name === 'CloseTag' ? last.from : node.to,
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
- 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
- },
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.2",
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.8",
21
- "@babel/eslint-parser": "^7.21.8",
22
- "@codemirror/buildhelper": "^0.1.16",
23
- "@codemirror/language": "^6.6.0",
24
- "@lezer/generator": "^1.2.3",
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.59.5",
28
- "@typescript-eslint/parser": "^5.59.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.1",
31
- "eslint": "^8.40.0",
30
+ "concurrently": "^8.2.0",
31
+ "eslint": "^8.43.0",
32
32
  "prettier": "^2.8.8",
33
- "rollup": "^3.21.5",
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.3",
39
- "@lezer/common": "^1.0.2",
40
- "@lezer/highlight": "^1.1.4",
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.4"
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, htmlCompletionSource } from '@codemirror/lang-html';
2
- import { foldNodeProp, indentNodeProp, LanguageSupport, LRLanguage } from '@codemirror/language';
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
- Element: (context) => {
34
- let after = /^(\s*)(<\/)?/.exec(context.textAfter);
35
-
36
- if (context.node.to <= context.pos + (after?.[0].length || 0)) return context.continue();
37
-
38
- return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
39
- },
40
-
41
- Block: (context) => {
42
- const node = context.node;
43
- const text = context.textAfter.trim();
44
-
45
- if (text.startsWith('{/')) {
46
- const name = node.name;
47
-
48
- if (
49
- (name === 'IfBlock' && text.startsWith('{/if')) ||
50
- (name === 'EachBlock' && text.startsWith('{/each')) ||
51
- (name === 'KeyBlock' && text.startsWith('{/key'))
52
- ) {
53
- return context.lineIndent(context.node.from);
54
- }
55
-
56
- return null;
57
- }
58
-
59
- if (node.name === 'IfBlock' || node.name === 'EachBlock') {
60
- if (text.startsWith('{{:else')) return context.lineIndent(node.from);
61
- if (text.startsWith('{{else')) return context.lineIndent(node.from);
62
- }
63
-
64
- // not sure if this needed to be duplicated
65
- let after = /^(\s*)(<\/)?/.exec(context.textAfter);
66
-
67
- if (context.node.to <= context.pos + (after?.[0].length || 0)) return context.continue();
68
-
69
- return context.lineIndent(context.node.from) + (after?.[2] ? 0 : context.unit);
70
- },
71
-
72
- 'BlockOpen BlockClose BlockInline': (context) => {
73
- return context.column(context.node.from) + context.unit;
74
- },
75
-
76
- 'OpenTag CloseTag SelfClosingTag': (context) => {
77
- return context.column(context.node.from) + context.unit;
78
- },
79
-
80
- Document: (context) => {
81
- if (context.pos + (/\s*/.exec(context.textAfter)?.[0].length || 0) < context.node.to) {
82
- return context.continue();
83
- }
84
-
85
- let endElt: SyntaxNode | null = null;
86
- let close: SyntaxNode;
87
-
88
- for (let cur = context.node; ; ) {
89
- let last = cur.lastChild;
90
-
91
- if (!last || last.name != 'Element' || last.to != cur.to) break;
92
- endElt = cur = last;
93
- }
94
-
95
- if (
96
- endElt?.lastChild &&
97
- !(
98
- (close = endElt.lastChild) &&
99
- (close.name === 'CloseTag' || close.name === 'SelfClosingTag')
100
- )
101
- ) {
102
- return context.lineIndent(endElt.from) + context.unit;
103
- }
104
-
105
- return null;
106
- },
107
- }),
108
-
109
- foldNodeProp.add({
110
- Block: (node) => {
111
- const open = `${node.name}Open`;
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
- commentTokens: {
142
- block: { open: '<!--', close: '-->' },
143
- devBlock: { open: '{{!--', close: '--}}' },
144
- devBlockShort: { open: '{{!', close: '}}' },
145
- },
146
- indentOnInput: /^\s*((<\/\w+\W)|(\{:(else|then|catch))|(\{\/(if|unless|each|await|key)))$/,
147
- wordChars: '-._',
148
- autocomplete: htmlCompletionSource,
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.40.0/node_modules/eslint/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.40.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules"
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.40.0/node_modules/eslint/bin/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.40.0/node_modules/eslint/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/eslint@8.40.0/node_modules:/home/runner/work/glimdown/glimdown/node_modules/.pnpm/node_modules:$NODE_PATH"
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.40.0/node_modules/eslint/bin/eslint.js" "$@"
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.40.0/node_modules/eslint/bin/eslint.js" "$@"
16
+ exec node "$basedir/../../../../../../node_modules/.pnpm/eslint@8.43.0/node_modules/eslint/bin/eslint.js" "$@"
17
17
  fi
@@ -5,14 +5,14 @@
5
5
  "extends": "../../../../package.json"
6
6
  },
7
7
  "devDependencies": {
8
- "@typescript-eslint/eslint-plugin": "^5.59.5",
9
- "@typescript-eslint/parser": "^5.59.5",
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
- "@babel/eslint-parser": "^7.21.8",
15
- "@babel/core": "^7.21.8"
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",