@tolgee/cli 1.0.2 → 1.1.1

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.
Files changed (48) hide show
  1. package/README.md +11 -8
  2. package/dist/client/errors.js +1 -5
  3. package/dist/client/export.js +1 -4
  4. package/dist/client/import.js +5 -11
  5. package/dist/client/index.js +17 -23
  6. package/dist/client/internal/requester.js +14 -20
  7. package/dist/client/internal/schema.generated.js +1 -2
  8. package/dist/client/internal/schema.utils.js +1 -2
  9. package/dist/client/languages.js +1 -4
  10. package/dist/client/project.js +1 -4
  11. package/dist/commands/extract/check.js +11 -13
  12. package/dist/commands/extract/print.js +10 -12
  13. package/dist/commands/extract.js +8 -13
  14. package/dist/commands/login.js +16 -22
  15. package/dist/commands/pull.js +12 -14
  16. package/dist/commands/push.js +28 -30
  17. package/dist/commands/sync/compare.js +18 -23
  18. package/dist/commands/sync/sync.js +34 -39
  19. package/dist/commands/sync/syncUtils.js +10 -18
  20. package/dist/config/credentials.js +16 -25
  21. package/dist/config/tolgeerc.js +11 -14
  22. package/dist/constants.js +11 -18
  23. package/dist/extractor/extractor.js +59 -0
  24. package/dist/extractor/index.js +1 -2
  25. package/dist/extractor/machines/comments.js +78 -0
  26. package/dist/extractor/machines/react.js +37 -42
  27. package/dist/extractor/machines/shared/comments.js +3 -6
  28. package/dist/extractor/machines/shared/properties.js +60 -17
  29. package/dist/extractor/machines/svelte.js +490 -0
  30. package/dist/extractor/runner.js +8 -16
  31. package/dist/extractor/tokenizer.js +24 -20
  32. package/dist/extractor/warnings.js +9 -16
  33. package/dist/extractor/worker.js +23 -29
  34. package/dist/index.js +53 -58
  35. package/dist/options.js +14 -17
  36. package/dist/utils/ask.js +4 -12
  37. package/dist/utils/configPath.js +10 -10
  38. package/dist/utils/deferred.js +1 -5
  39. package/dist/utils/logger.js +8 -19
  40. package/dist/utils/moduleLoader.js +7 -14
  41. package/dist/utils/overwriteDir.js +13 -17
  42. package/dist/utils/zip.js +11 -16
  43. package/package.json +37 -28
  44. package/textmate/Svelte.tmLanguage +1084 -0
  45. package/textmate/THIRD_PARTY_NOTICE +13 -0
  46. package/textmate/TypeScript.tmLanguage +98 -90
  47. package/textmate/TypeScriptReact.tmLanguage +80 -72
  48. package/dist/extractor/presets/react.js +0 -29
@@ -0,0 +1,59 @@
1
+ import { extname } from 'path';
2
+ import { interpret } from 'xstate';
3
+ import reactExtractorMachine from './machines/react.js';
4
+ import svelteExtractorMachine from './machines/svelte.js';
5
+ import commentsExtractorMachine from './machines/comments.js';
6
+ import tokenizer from './tokenizer.js';
7
+ const REACT_EXTS = [
8
+ '.js',
9
+ '.mjs',
10
+ '.cjs',
11
+ '.ts',
12
+ '.mts',
13
+ '.cts',
14
+ '.jsx',
15
+ '.tsx',
16
+ ];
17
+ const ALL_EXTS = [
18
+ '.js',
19
+ '.mjs',
20
+ '.cjs',
21
+ '.ts',
22
+ '.mts',
23
+ '.cts',
24
+ '.jsx',
25
+ '.tsx',
26
+ '.svelte',
27
+ ];
28
+ function pickMachine(code, fileName) {
29
+ const ext = extname(fileName);
30
+ if (REACT_EXTS.includes(ext) && code.includes('@tolgee/react')) {
31
+ return reactExtractorMachine;
32
+ }
33
+ if (ext === '.svelte' && code.includes('@tolgee/svelte')) {
34
+ return svelteExtractorMachine;
35
+ }
36
+ if (ALL_EXTS.includes(ext) &&
37
+ (code.includes('@tolgee-key') || code.includes('@tolgee-ignore'))) {
38
+ return commentsExtractorMachine;
39
+ }
40
+ return null;
41
+ }
42
+ export default async function extractor(code, fileName) {
43
+ const machineSpec = pickMachine(code, fileName);
44
+ if (!machineSpec) {
45
+ return { warnings: [], keys: [] };
46
+ }
47
+ const tokens = await tokenizer(code, fileName);
48
+ // @ts-ignore -- Types are whacky, complains about withConfig but it's not a problem here.
49
+ const machine = interpret(machineSpec);
50
+ machine.start();
51
+ for (const token of tokens) {
52
+ machine.send(token);
53
+ }
54
+ const snapshot = machine.getSnapshot();
55
+ return {
56
+ warnings: snapshot.context.warnings,
57
+ keys: snapshot.context.keys,
58
+ };
59
+ }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -0,0 +1,78 @@
1
+ import { createMachine, assign, send } from 'xstate';
2
+ import commentsService from './shared/comments.js';
3
+ export default createMachine({
4
+ predictableActionArguments: true,
5
+ id: 'commentsExtractor',
6
+ context: {
7
+ keys: [],
8
+ warnings: [],
9
+ },
10
+ invoke: {
11
+ id: 'comments',
12
+ src: () => commentsService,
13
+ },
14
+ on: {
15
+ // Service messages
16
+ MAGIC_COMMENT: [
17
+ {
18
+ actions: 'warnUnusedIgnore',
19
+ cond: (_ctx, evt) => evt.kind === 'ignore',
20
+ },
21
+ {
22
+ actions: 'pushKey',
23
+ cond: (_ctx, evt) => evt.kind === 'key',
24
+ },
25
+ ],
26
+ WARNING: {
27
+ actions: 'pushWarning',
28
+ },
29
+ // Code messages
30
+ 'comment.line.double-slash.ts': {
31
+ actions: send((_ctx, evt) => ({
32
+ type: 'COMMENT',
33
+ data: evt.token,
34
+ line: evt.line,
35
+ }), { to: 'comments' }),
36
+ },
37
+ 'comment.block.ts': {
38
+ actions: send((_ctx, evt) => ({
39
+ type: 'COMMENT',
40
+ data: evt.token,
41
+ line: evt.line,
42
+ }), { to: 'comments' }),
43
+ },
44
+ 'comment.block.svelte': {
45
+ actions: send((_ctx, evt) => ({
46
+ type: 'COMMENT',
47
+ data: evt.token,
48
+ line: evt.line,
49
+ }), { to: 'comments' }),
50
+ },
51
+ },
52
+ }, {
53
+ actions: {
54
+ warnUnusedIgnore: assign({
55
+ warnings: (ctx, evt) => [
56
+ ...ctx.warnings,
57
+ { warning: 'W_UNUSED_IGNORE', line: evt.line },
58
+ ],
59
+ }),
60
+ pushKey: assign({
61
+ keys: (ctx, evt) => [
62
+ ...ctx.keys,
63
+ {
64
+ keyName: evt.keyName,
65
+ namespace: evt.namespace,
66
+ defaultValue: evt.defaultValue,
67
+ line: evt.line,
68
+ },
69
+ ],
70
+ }),
71
+ pushWarning: assign({
72
+ warnings: (ctx, evt) => [
73
+ ...ctx.warnings,
74
+ { warning: evt.kind, line: evt.line },
75
+ ],
76
+ }),
77
+ },
78
+ });
@@ -1,13 +1,8 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const xstate_1 = require("xstate");
7
- const properties_1 = __importDefault(require("./shared/properties"));
8
- const comments_1 = __importDefault(require("./shared/comments"));
1
+ import { createMachine, assign, send, forwardTo } from 'xstate';
2
+ import propertiesMachine from './shared/properties.js';
3
+ import commentsService from './shared/comments.js';
9
4
  const VOID_KEY = { keyName: '', line: -1 };
10
- exports.default = (0, xstate_1.createMachine)({
5
+ export default createMachine({
11
6
  predictableActionArguments: true,
12
7
  id: 'reactExtractor',
13
8
  type: 'parallel',
@@ -25,7 +20,7 @@ exports.default = (0, xstate_1.createMachine)({
25
20
  comments: {
26
21
  invoke: {
27
22
  id: 'comments',
28
- src: () => comments_1.default,
23
+ src: () => commentsService,
29
24
  },
30
25
  on: {
31
26
  // Service messages
@@ -44,14 +39,14 @@ exports.default = (0, xstate_1.createMachine)({
44
39
  },
45
40
  // Code messages
46
41
  'comment.line.double-slash.ts': {
47
- actions: (0, xstate_1.send)((_ctx, evt) => ({
42
+ actions: send((_ctx, evt) => ({
48
43
  type: 'COMMENT',
49
44
  data: evt.token,
50
45
  line: evt.line,
51
46
  }), { to: 'comments' }),
52
47
  },
53
48
  'comment.block.ts': {
54
- actions: (0, xstate_1.send)((_ctx, evt) => ({
49
+ actions: send((_ctx, evt) => ({
55
50
  type: 'COMMENT',
56
51
  data: evt.token,
57
52
  line: evt.line,
@@ -221,7 +216,7 @@ exports.default = (0, xstate_1.createMachine)({
221
216
  props_object: {
222
217
  invoke: {
223
218
  id: 'propertiesMachine',
224
- src: properties_1.default,
219
+ src: propertiesMachine,
225
220
  data: {
226
221
  depth: 1,
227
222
  },
@@ -245,7 +240,7 @@ exports.default = (0, xstate_1.createMachine)({
245
240
  },
246
241
  on: {
247
242
  '*': {
248
- actions: (0, xstate_1.forwardTo)('propertiesMachine'),
243
+ actions: forwardTo('propertiesMachine'),
249
244
  },
250
245
  },
251
246
  },
@@ -345,7 +340,7 @@ exports.default = (0, xstate_1.createMachine)({
345
340
  props: {
346
341
  invoke: {
347
342
  id: 'propertiesMachine',
348
- src: properties_1.default,
343
+ src: propertiesMachine,
349
344
  onDone: [
350
345
  {
351
346
  target: 'idle',
@@ -367,7 +362,7 @@ exports.default = (0, xstate_1.createMachine)({
367
362
  },
368
363
  on: {
369
364
  '*': {
370
- actions: (0, xstate_1.forwardTo)('propertiesMachine'),
365
+ actions: forwardTo('propertiesMachine'),
371
366
  },
372
367
  },
373
368
  },
@@ -547,7 +542,7 @@ exports.default = (0, xstate_1.createMachine)({
547
542
  param_object: {
548
543
  invoke: {
549
544
  id: 'propertiesMachine',
550
- src: properties_1.default,
545
+ src: propertiesMachine,
551
546
  data: {
552
547
  depth: 1,
553
548
  },
@@ -565,7 +560,7 @@ exports.default = (0, xstate_1.createMachine)({
565
560
  },
566
561
  on: {
567
562
  '*': {
568
- actions: (0, xstate_1.forwardTo)('propertiesMachine'),
563
+ actions: forwardTo('propertiesMachine'),
569
564
  },
570
565
  },
571
566
  },
@@ -577,38 +572,38 @@ exports.default = (0, xstate_1.createMachine)({
577
572
  isPropertiesDataDynamic: (_ctx, evt) => evt.data.keyName === false || evt.data.namespace === false,
578
573
  },
579
574
  actions: {
580
- incrementDepth: (0, xstate_1.assign)({
575
+ incrementDepth: assign({
581
576
  blockDepth: (ctx) => ctx.blockDepth + 1,
582
577
  }),
583
- decrementDepth: (0, xstate_1.assign)({
578
+ decrementDepth: assign({
584
579
  blockDepth: (ctx) => ctx.blockDepth - 1,
585
580
  hooks: (ctx) => ctx.hooks.filter((n) => n.depth !== ctx.blockDepth),
586
581
  }),
587
- storeLine: (0, xstate_1.assign)({
582
+ storeLine: assign({
588
583
  line: (_ctx, evt) => evt.line,
589
584
  }),
590
- ignoreNextLine: (0, xstate_1.assign)({
585
+ ignoreNextLine: assign({
591
586
  ignore: (_ctx, evt) => ({ type: 'ignore', line: evt.line + 1 }),
592
587
  }),
593
- consumeIgnoredLine: (0, xstate_1.assign)({
588
+ consumeIgnoredLine: assign({
594
589
  ignore: (_ctx, _evt) => null,
595
590
  }),
596
- warnUnusedIgnore: (0, xstate_1.assign)({
591
+ warnUnusedIgnore: assign({
597
592
  warnings: (ctx, evt) => [
598
593
  ...ctx.warnings,
599
594
  { warning: 'W_UNUSED_IGNORE', line: evt.line - 1 },
600
595
  ],
601
596
  }),
602
- pushHook: (0, xstate_1.assign)({
597
+ pushHook: assign({
603
598
  hooks: (ctx) => [...ctx.hooks, { depth: ctx.blockDepth }],
604
599
  }),
605
- pushNamespacedHook: (0, xstate_1.assign)({
600
+ pushNamespacedHook: assign({
606
601
  hooks: (ctx, evt) => [
607
602
  ...ctx.hooks,
608
603
  { namespace: evt.token, depth: ctx.blockDepth },
609
604
  ],
610
605
  }),
611
- markHookAsDynamic: (0, xstate_1.assign)({
606
+ markHookAsDynamic: assign({
612
607
  hooks: (ctx, _evt) => [
613
608
  ...ctx.hooks.slice(0, -1),
614
609
  { namespace: false, depth: ctx.blockDepth },
@@ -618,7 +613,7 @@ exports.default = (0, xstate_1.createMachine)({
618
613
  { warning: 'W_DYNAMIC_NAMESPACE', line: ctx.line },
619
614
  ],
620
615
  }),
621
- consumeParameters: (0, xstate_1.assign)({
616
+ consumeParameters: assign({
622
617
  key: (ctx, evt) => ({
623
618
  // We don't want the key and default value to be overridable
624
619
  // But we DO want the namespace to be overridable
@@ -638,7 +633,7 @@ exports.default = (0, xstate_1.createMachine)({
638
633
  ];
639
634
  },
640
635
  }),
641
- emitWarningFromParameters: (0, xstate_1.assign)({
636
+ emitWarningFromParameters: assign({
642
637
  warnings: (ctx, evt) => [
643
638
  ...ctx.warnings,
644
639
  {
@@ -650,10 +645,10 @@ exports.default = (0, xstate_1.createMachine)({
650
645
  ],
651
646
  key: (_ctx, _evt) => VOID_KEY,
652
647
  }),
653
- appendChildren: (0, xstate_1.assign)({
648
+ appendChildren: assign({
654
649
  children: (ctx, evt) => (ctx.children ?? '') + evt.token,
655
650
  }),
656
- consumeChildren: (0, xstate_1.assign)({
651
+ consumeChildren: assign({
657
652
  key: (ctx, _evt) => ({
658
653
  ...ctx.key,
659
654
  keyName: ctx.key.keyName ? ctx.key.keyName : ctx.children,
@@ -661,42 +656,42 @@ exports.default = (0, xstate_1.createMachine)({
661
656
  }),
662
657
  children: (_ctx, _evt) => '',
663
658
  }),
664
- storeKeyName: (0, xstate_1.assign)({
659
+ storeKeyName: assign({
665
660
  key: (ctx, evt) => ({ ...ctx.key, keyName: evt.token }),
666
661
  }),
667
- storeKeyDefault: (0, xstate_1.assign)({
662
+ storeKeyDefault: assign({
668
663
  key: (ctx, evt) => ({ ...ctx.key, defaultValue: evt.token }),
669
664
  }),
670
- storeKeyCurrentNamespace: (0, xstate_1.assign)({
665
+ storeKeyCurrentNamespace: assign({
671
666
  key: (ctx, _evt) => ({
672
667
  ...ctx.key,
673
668
  namespace: ctx.hooks.length
674
669
  ? ctx.hooks[ctx.hooks.length - 1].namespace
675
- : void 0,
670
+ : undefined,
676
671
  }),
677
672
  }),
678
- dynamicKeyName: (0, xstate_1.assign)({
673
+ dynamicKeyName: assign({
679
674
  warnings: (ctx, _evt) => [
680
675
  ...ctx.warnings,
681
676
  { warning: 'W_DYNAMIC_KEY', line: ctx.line },
682
677
  ],
683
678
  key: (_ctx, _evt) => VOID_KEY,
684
679
  }),
685
- dynamicKeyDefault: (0, xstate_1.assign)({
680
+ dynamicKeyDefault: assign({
686
681
  key: (ctx, _evt) => ({ ...ctx.key, defaultValue: undefined }),
687
682
  warnings: (ctx, _evt) => [
688
683
  ...ctx.warnings,
689
684
  { warning: 'W_DYNAMIC_DEFAULT_VALUE', line: ctx.line },
690
685
  ],
691
686
  }),
692
- dynamicOptions: (0, xstate_1.assign)({
687
+ dynamicOptions: assign({
693
688
  key: (ctx, _evt) => VOID_KEY,
694
689
  warnings: (ctx, _evt) => [
695
690
  ...ctx.warnings,
696
691
  { warning: 'W_DYNAMIC_OPTIONS', line: ctx.line },
697
692
  ],
698
693
  }),
699
- dynamicChildren: (0, xstate_1.assign)({
694
+ dynamicChildren: assign({
700
695
  key: (ctx, _evt) => ctx.key.keyName ? { ...ctx.key, defaultValue: undefined } : VOID_KEY,
701
696
  warnings: (ctx, _evt) => [
702
697
  ...ctx.warnings,
@@ -708,7 +703,7 @@ exports.default = (0, xstate_1.createMachine)({
708
703
  },
709
704
  ],
710
705
  }),
711
- pushKey: (0, xstate_1.assign)({
706
+ pushKey: assign({
712
707
  warnings: (ctx, _evt) => {
713
708
  if (!ctx.key.keyName || ctx.key.namespace !== false)
714
709
  return ctx.warnings;
@@ -732,7 +727,7 @@ exports.default = (0, xstate_1.createMachine)({
732
727
  },
733
728
  key: (_ctx, _evt) => ({ keyName: '', line: 0 }),
734
729
  }),
735
- pushImmediateKey: (0, xstate_1.assign)({
730
+ pushImmediateKey: assign({
736
731
  ignore: (_ctx, evt) => ({ type: 'key', line: evt.line + 1 }),
737
732
  keys: (ctx, evt) => [
738
733
  ...ctx.keys,
@@ -744,7 +739,7 @@ exports.default = (0, xstate_1.createMachine)({
744
739
  },
745
740
  ],
746
741
  }),
747
- pushWarning: (0, xstate_1.assign)({
742
+ pushWarning: assign({
748
743
  warnings: (ctx, evt) => [
749
744
  ...ctx.warnings,
750
745
  { warning: evt.kind, line: evt.line },
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const json5_1 = require("json5");
1
+ import JSON5 from 'json5';
4
2
  function isValidKeyOverride(data) {
5
3
  if (!('key' in data)) {
6
4
  return false;
@@ -17,7 +15,7 @@ function isValidKeyOverride(data) {
17
15
  return true;
18
16
  }
19
17
  // This service is responsible for emitting events when magic comments are encountered
20
- function default_1(callback, onReceive) {
18
+ export default function (callback, onReceive) {
21
19
  onReceive((evt) => {
22
20
  const comment = evt.data.trim();
23
21
  if (comment.startsWith('@tolgee-ignore')) {
@@ -41,7 +39,7 @@ function default_1(callback, onReceive) {
41
39
  // Data is a json5 struct
42
40
  if (data.startsWith('{')) {
43
41
  try {
44
- const key = (0, json5_1.parse)(data);
42
+ const key = JSON5.parse(data);
45
43
  if (!isValidKeyOverride(key)) {
46
44
  // No key in the struct; invalid override
47
45
  callback({
@@ -79,4 +77,3 @@ function default_1(callback, onReceive) {
79
77
  }
80
78
  });
81
79
  }
82
- exports.default = default_1;
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const xstate_1 = require("xstate");
1
+ import { createMachine, send, assign } from 'xstate';
4
2
  // This state machine is responsible for extracting translation key properties from an object/props
5
- exports.default = (0, xstate_1.createMachine)({
3
+ export default createMachine({
6
4
  predictableActionArguments: true,
7
5
  id: 'properties',
8
6
  initial: 'idle',
@@ -42,6 +40,13 @@ exports.default = (0, xstate_1.createMachine)({
42
40
  target: 'value',
43
41
  actions: 'markAsStatic',
44
42
  },
43
+ // Svelte
44
+ 'entity.other.attribute-name.svelte': {
45
+ actions: ['markPropertyAsDynamic', 'storePropertyType'],
46
+ },
47
+ 'punctuation.separator.key-value.svelte': {
48
+ target: 'value',
49
+ },
45
50
  },
46
51
  },
47
52
  complex_key: {
@@ -69,6 +74,8 @@ exports.default = (0, xstate_1.createMachine)({
69
74
  // Extract strings
70
75
  'punctuation.definition.string.begin.ts': 'value_string',
71
76
  'punctuation.definition.string.template.begin.ts': 'value_string',
77
+ 'punctuation.definition.string.begin.svelte': 'value_string',
78
+ 'punctuation.definition.string.template.begin.svelte': 'value_string',
72
79
  // Variable
73
80
  'variable.other.readwrite.ts': {
74
81
  target: 'idle',
@@ -82,6 +89,15 @@ exports.default = (0, xstate_1.createMachine)({
82
89
  'punctuation.section.embedded.begin.tsx': {
83
90
  actions: 'unmarkAsStatic',
84
91
  },
92
+ // Svelte
93
+ 'string.unquoted.svelte': {
94
+ target: 'idle',
95
+ actions: [
96
+ 'storePropertyValue',
97
+ 'clearPropertyType',
98
+ 'unmarkAsStatic',
99
+ ],
100
+ },
85
101
  // Value end
86
102
  'punctuation.separator.comma.ts': {
87
103
  target: 'idle',
@@ -98,7 +114,7 @@ exports.default = (0, xstate_1.createMachine)({
98
114
  'unmarkAsStatic',
99
115
  'markPropertyAsDynamic',
100
116
  'clearPropertyType',
101
- (0, xstate_1.send)((_ctx, evt) => evt),
117
+ send((_ctx, evt) => evt),
102
118
  ],
103
119
  },
104
120
  },
@@ -113,6 +129,14 @@ exports.default = (0, xstate_1.createMachine)({
113
129
  target: 'idle',
114
130
  actions: ['storeEmptyPropertyValue', 'clearPropertyType'],
115
131
  },
132
+ 'punctuation.definition.string.end.svelte': {
133
+ target: 'idle',
134
+ actions: ['storeEmptyPropertyValue', 'clearPropertyType'],
135
+ },
136
+ 'punctuation.definition.string.template.end.svelte': {
137
+ target: 'idle',
138
+ actions: ['storeEmptyPropertyValue', 'clearPropertyType'],
139
+ },
116
140
  '*': [
117
141
  {
118
142
  target: 'idle',
@@ -149,6 +173,19 @@ exports.default = (0, xstate_1.createMachine)({
149
173
  target: 'idle',
150
174
  actions: 'clearPropertyType',
151
175
  },
176
+ // Svelte
177
+ 'punctuation.section.embedded.begin.svelte': {
178
+ target: 'idle',
179
+ actions: ['markPropertyAsDynamic', 'clearPropertyType'],
180
+ },
181
+ 'punctuation.definition.string.end.svelte': {
182
+ target: 'idle',
183
+ actions: 'clearPropertyType',
184
+ },
185
+ 'punctuation.section.embedded.end.svelte': {
186
+ target: 'idle',
187
+ actions: 'clearPropertyType',
188
+ },
152
189
  },
153
190
  },
154
191
  end: {
@@ -180,61 +217,67 @@ exports.default = (0, xstate_1.createMachine)({
180
217
  target: 'end',
181
218
  actions: 'markPropertyAsDynamic',
182
219
  },
220
+ 'punctuation.definition.tag.end.svelte': {
221
+ target: 'end',
222
+ actions: 'markPropertyAsDynamic',
223
+ },
183
224
  },
184
225
  }, {
185
226
  guards: {
186
227
  isOpenCurly: (_ctx, evt) => evt.token === '{' &&
187
- !evt.scopes.includes('meta.embedded.expression.tsx'),
228
+ !evt.scopes.includes('meta.embedded.expression.tsx') &&
229
+ !evt.scopes.includes('meta.embedded.expression.svelte'),
188
230
  isCloseCurly: (_ctx, evt) => evt.token === '}' &&
189
- !evt.scopes.includes('meta.embedded.expression.tsx'),
231
+ !evt.scopes.includes('meta.embedded.expression.tsx') &&
232
+ !evt.scopes.includes('meta.embedded.expression.svelte'),
190
233
  isFinalCloseCurly: (ctx, evt) => evt.token === '}' && ctx.depth === 1,
191
234
  isOpenSquare: (_ctx, evt) => evt.token === '[',
192
235
  isCloseSquare: (_ctx, evt) => evt.token === ']',
193
236
  isRootLevel: (ctx) => ctx.depth === 1,
194
237
  },
195
238
  actions: {
196
- storePropertyType: (0, xstate_1.assign)({
239
+ storePropertyType: assign({
197
240
  property: (_ctx, evt) => evt.token,
198
241
  }),
199
- clearPropertyType: (0, xstate_1.assign)({
242
+ clearPropertyType: assign({
200
243
  property: (_ctx, _evt) => null,
201
244
  }),
202
- storePropertyValue: (0, xstate_1.assign)({
245
+ storePropertyValue: assign({
203
246
  keyName: (ctx, evt) => ctx.property === 'key' || ctx.property === 'keyName'
204
247
  ? evt.token
205
248
  : ctx.keyName,
206
249
  defaultValue: (ctx, evt) => ctx.property === 'defaultValue' ? evt.token : ctx.defaultValue,
207
250
  namespace: (ctx, evt) => ctx.property === 'ns' ? evt.token : ctx.namespace,
208
251
  }),
209
- storeEmptyPropertyValue: (0, xstate_1.assign)({
252
+ storeEmptyPropertyValue: assign({
210
253
  keyName: (ctx) => ctx.property === 'key' || ctx.property === 'keyName'
211
254
  ? ''
212
255
  : ctx.keyName,
213
256
  defaultValue: (ctx) => ctx.property === 'defaultValue' ? '' : ctx.defaultValue,
214
257
  namespace: (ctx) => (ctx.property === 'ns' ? '' : ctx.namespace),
215
258
  }),
216
- markPropertyAsDynamic: (0, xstate_1.assign)({
259
+ markPropertyAsDynamic: assign({
217
260
  keyName: (ctx, _evt) => ctx.property === 'key' || ctx.property === 'keyName'
218
261
  ? false
219
262
  : ctx.keyName,
220
263
  defaultValue: (ctx, _evt) => ctx.property === 'defaultValue' ? false : ctx.defaultValue,
221
264
  namespace: (ctx, _evt) => ctx.property === 'ns' ? false : ctx.namespace,
222
265
  }),
223
- markImmediatePropertyAsDynamic: (0, xstate_1.assign)({
266
+ markImmediatePropertyAsDynamic: assign({
224
267
  keyName: (ctx, evt) => evt.token === 'key' || evt.token === 'keyName' ? false : ctx.keyName,
225
268
  defaultValue: (ctx, evt) => evt.token === 'defaultValue' ? false : ctx.defaultValue,
226
269
  namespace: (ctx, evt) => (evt.token === 'ns' ? false : ctx.namespace),
227
270
  }),
228
- incrementDepth: (0, xstate_1.assign)({
271
+ incrementDepth: assign({
229
272
  depth: (ctx, _evt) => ctx.depth + 1,
230
273
  }),
231
- decrementDepth: (0, xstate_1.assign)({
274
+ decrementDepth: assign({
232
275
  depth: (ctx, _evt) => ctx.depth - 1,
233
276
  }),
234
- markAsStatic: (0, xstate_1.assign)({
277
+ markAsStatic: assign({
235
278
  static: (_ctx, _evt) => true,
236
279
  }),
237
- unmarkAsStatic: (0, xstate_1.assign)({
280
+ unmarkAsStatic: assign({
238
281
  static: (_ctx, _evt) => false,
239
282
  }),
240
283
  },