@hyperfixi/core 2.7.2 → 2.8.0

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 (64) hide show
  1. package/dist/api/hyperscript-api.d.ts +1 -0
  2. package/dist/ast-utils/index.js +1910 -233
  3. package/dist/ast-utils/index.mjs +1910 -233
  4. package/dist/bundle-generator/index.d.ts +1 -1
  5. package/dist/bundle-generator/index.js +77 -68
  6. package/dist/bundle-generator/index.mjs +76 -69
  7. package/dist/bundle-generator/template-capabilities.d.ts +2 -0
  8. package/dist/chunks/bridge-DHj-SYm2.js +2 -0
  9. package/dist/chunks/browser-modular-D1m0Eikh.js +2 -0
  10. package/dist/chunks/{index-D2WUNSCR.js → index-CuPeasRm.js} +2 -2
  11. package/dist/commands/index.js +117 -5
  12. package/dist/commands/index.mjs +117 -5
  13. package/dist/compatibility/browser-modular.d.ts +2 -2
  14. package/dist/expressions/index.d.ts +1 -1
  15. package/dist/htmx/hcon.d.ts +9 -0
  16. package/dist/htmx/htmx-translator.d.ts +1 -0
  17. package/dist/hyperfixi-browser-classic-i18n.js +1 -1
  18. package/dist/hyperfixi-browser-minimal.js +1 -1
  19. package/dist/hyperfixi-browser-standard.js +1 -1
  20. package/dist/hyperfixi-browser.js +1 -1
  21. package/dist/hyperfixi-classic-i18n.js +1 -1
  22. package/dist/hyperfixi-hx-v4.js +1 -1
  23. package/dist/hyperfixi-hx.js +1 -1
  24. package/dist/hyperfixi-hybrid-complete.js +1 -1
  25. package/dist/hyperfixi-hybrid-hx.js +1 -1
  26. package/dist/hyperfixi-minimal.js +1 -1
  27. package/dist/hyperfixi-multilingual.js +1 -1
  28. package/dist/hyperfixi-standard.js +1 -1
  29. package/dist/hyperfixi.js +1 -1
  30. package/dist/hyperfixi.mjs +1 -1
  31. package/dist/index.js +4517 -535
  32. package/dist/index.min.js +1 -1
  33. package/dist/index.mjs +4517 -535
  34. package/dist/lokascript-browser-classic-i18n.js +1 -1
  35. package/dist/lokascript-browser-minimal.js +1 -1
  36. package/dist/lokascript-browser-standard.js +1 -1
  37. package/dist/lokascript-browser.js +1 -1
  38. package/dist/lokascript-hybrid-complete.js +1 -1
  39. package/dist/lokascript-hybrid-hx.js +1 -1
  40. package/dist/lokascript-multilingual.js +1 -1
  41. package/dist/lse/index.d.ts +7 -7
  42. package/dist/metadata.d.ts +1 -1
  43. package/dist/metadata.js +31 -14
  44. package/dist/metadata.mjs +31 -14
  45. package/dist/multilingual/index.js +8 -1
  46. package/dist/multilingual/index.mjs +8 -1
  47. package/dist/parser/command-parsers/animation-commands.d.ts +2 -2
  48. package/dist/parser/command-parsers/async-commands.d.ts +2 -2
  49. package/dist/parser/command-parsers/dom-commands.d.ts +5 -5
  50. package/dist/parser/command-parsers/navigation-commands.d.ts +4 -0
  51. package/dist/parser/command-parsers/utility-commands.d.ts +2 -1
  52. package/dist/parser/command-parsers/variable-commands.d.ts +2 -2
  53. package/dist/parser/full-parser.js +117 -5
  54. package/dist/parser/full-parser.mjs +117 -5
  55. package/dist/parser/semantic-integration.d.ts +1 -0
  56. package/dist/performance/integration.d.ts +1 -1
  57. package/dist/registry/index.js +117 -5
  58. package/dist/registry/index.mjs +117 -5
  59. package/package.json +12 -19
  60. package/dist/chunks/bridge-DuveK8T4.js +0 -2
  61. package/dist/chunks/browser-modular-DW4nC6lH.js +0 -2
  62. package/dist/compatibility/browser-bundle-animation-generated.d.ts +0 -16
  63. package/dist/compatibility/browser-bundle-forms-generated.d.ts +0 -16
  64. package/dist/compatibility/browser-bundle-minimal-generated.d.ts +0 -16
@@ -1,15 +1,15 @@
1
1
  export type { SemanticNode, CommandSemanticNode, EventHandlerSemanticNode, ConditionalSemanticNode, CompoundSemanticNode, LoopSemanticNode, SemanticValue, LiteralValue, SelectorValue, ReferenceValue, PropertyPathValue, ExpressionValue, FlagValue, SemanticMetadata, ActionType, SemanticRoleType, Annotation, ProtocolDiagnostic, LSEEnvelope, Diagnostic, DiagnosticSeverity, DiagnosticResult, } from '@lokascript/framework';
2
2
  export type { SemanticJSON, SchemaLookup, ParseExplicitOptions, IRDiagnostic, ProtocolNodeJSON, ProtocolValueJSON, ProtocolDiagnosticJSON, AnnotationJSON, MatchArmJSON, LSEEnvelopeJSON, RuntimeASTNode, RuntimeCommandNode, RuntimeEventNode, } from '@lokascript/framework';
3
3
  export declare function isLSEAvailable(): boolean;
4
- export declare function parseExplicit(input: string, options?: import('@lokascript/framework').ParseExplicitOptions): Promise<import("@lokascript/framework").SemanticNode>;
4
+ export declare function parseExplicit(input: string, options?: import('@lokascript/framework').ParseExplicitOptions): Promise<import("@lokascript/intent").SemanticNode>;
5
5
  export declare function isExplicitSyntax(input: string): Promise<boolean>;
6
6
  export declare function renderExplicit(node: import('@lokascript/framework').SemanticNode): Promise<string>;
7
- export declare function fromInterchangeNode(node: unknown): Promise<import("@lokascript/framework").SemanticNode>;
8
- export declare function toProtocolJSON(node: import('@lokascript/framework').SemanticNode): Promise<import("@lokascript/framework").ProtocolNodeJSON>;
9
- export declare function fromProtocolJSON(json: import('@lokascript/framework').ProtocolNodeJSON): Promise<import("@lokascript/framework").SemanticNode>;
10
- export declare function validateProtocolJSON(json: unknown): Promise<import("@lokascript/framework").IRDiagnostic[]>;
11
- export declare function toEnvelopeJSON(envelope: import('@lokascript/framework').LSEEnvelope): Promise<import("@lokascript/framework").LSEEnvelopeJSON>;
12
- export declare function fromEnvelopeJSON(json: import('@lokascript/framework').LSEEnvelopeJSON): Promise<import("@lokascript/framework").LSEEnvelope>;
7
+ export declare function fromInterchangeNode(node: unknown): Promise<import("@lokascript/intent").SemanticNode>;
8
+ export declare function toProtocolJSON(node: import('@lokascript/framework').SemanticNode): Promise<import("@lokascript/intent").ProtocolNodeJSON>;
9
+ export declare function fromProtocolJSON(json: import('@lokascript/framework').ProtocolNodeJSON): Promise<import("@lokascript/intent").SemanticNode>;
10
+ export declare function validateProtocolJSON(json: unknown): Promise<import("@lokascript/intent").IRDiagnostic[]>;
11
+ export declare function toEnvelopeJSON(envelope: import('@lokascript/framework').LSEEnvelope): Promise<import("@lokascript/intent").LSEEnvelopeJSON>;
12
+ export declare function fromEnvelopeJSON(json: import('@lokascript/framework').LSEEnvelopeJSON): Promise<import("@lokascript/intent").LSEEnvelope>;
13
13
  export declare function isEnvelope(json: unknown): Promise<boolean>;
14
14
  export declare function semanticNodeToRuntimeAST(node: import('@lokascript/framework').SemanticNode): Promise<import("@lokascript/framework").RuntimeASTNode>;
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  export declare const packageInfo: {
2
2
  readonly name: "@hyperfixi/core";
3
- readonly version: "2.0.0";
3
+ readonly version: "2.7.2";
4
4
  readonly description: "Modern hyperscript engine with fixi/htmx integration";
5
5
  readonly compatibility: "~85% official _hyperscript";
6
6
  readonly languages: 24;
package/dist/metadata.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const packageInfo = {
4
4
  name: '@hyperfixi/core',
5
- version: '2.0.0',
5
+ version: '2.7.2',
6
6
  description: 'Modern hyperscript engine with fixi/htmx integration',
7
7
  compatibility: '~85% official _hyperscript',
8
8
  languages: 24,
@@ -33,7 +33,7 @@ const bundleInfo = [
33
33
  name: 'Lite Plus',
34
34
  filename: 'hyperfixi-lite-plus.js',
35
35
  gzipSize: '2.6 KB',
36
- rawSize: '7 KB',
36
+ rawSize: '8 KB',
37
37
  commandCount: 14,
38
38
  parser: 'regex',
39
39
  hasBlocks: false,
@@ -49,8 +49,8 @@ const bundleInfo = [
49
49
  id: 'hybrid-complete',
50
50
  name: 'Hybrid Complete',
51
51
  filename: 'hyperfixi-hybrid-complete.js',
52
- gzipSize: '7.2 KB',
53
- rawSize: '28 KB',
52
+ gzipSize: '7.7 KB',
53
+ rawSize: '30 KB',
54
54
  commandCount: 21,
55
55
  parser: 'hybrid',
56
56
  hasBlocks: true,
@@ -66,8 +66,8 @@ const bundleInfo = [
66
66
  id: 'hybrid-hx',
67
67
  name: 'Hybrid HX',
68
68
  filename: 'hyperfixi-hx.js',
69
- gzipSize: '9.7 KB',
70
- rawSize: '28 KB',
69
+ gzipSize: '18.1 KB',
70
+ rawSize: '68 KB',
71
71
  commandCount: 21,
72
72
  parser: 'hybrid',
73
73
  hasBlocks: true,
@@ -79,12 +79,29 @@ const bundleInfo = [
79
79
  cdnUrl: 'https://unpkg.com/@hyperfixi/core/dist/hyperfixi-hx.js',
80
80
  useCase: 'htmx/fixi drop-in replacement with hx-get, hx-post, hx-target',
81
81
  },
82
+ {
83
+ id: 'hybrid-hx-v4',
84
+ name: 'Hybrid HX v4',
85
+ filename: 'hyperfixi-hx-v4.js',
86
+ gzipSize: '320.6 KB',
87
+ rawSize: '1424 KB',
88
+ commandCount: 58,
89
+ parser: 'full',
90
+ hasBlocks: true,
91
+ hasEventModifiers: true,
92
+ hasPositional: true,
93
+ hasFetch: true,
94
+ hasHtmxCompat: true,
95
+ importPath: '@hyperfixi/core/browser/hybrid-hx-v4',
96
+ cdnUrl: 'https://unpkg.com/@hyperfixi/core/dist/hyperfixi-hx-v4.js',
97
+ useCase: 'htmx v4 compat: hx-live reactivity, SSE/WebSocket streaming, full runtime',
98
+ },
82
99
  {
83
100
  id: 'minimal',
84
101
  name: 'Minimal',
85
102
  filename: 'hyperfixi-minimal.js',
86
- gzipSize: '63.4 KB',
87
- rawSize: '271 KB',
103
+ gzipSize: '76.2 KB',
104
+ rawSize: '314 KB',
88
105
  commandCount: 30,
89
106
  parser: 'full',
90
107
  hasBlocks: true,
@@ -100,8 +117,8 @@ const bundleInfo = [
100
117
  id: 'standard',
101
118
  name: 'Standard',
102
119
  filename: 'hyperfixi-standard.js',
103
- gzipSize: '63 KB',
104
- rawSize: '195 KB',
120
+ gzipSize: '82.7 KB',
121
+ rawSize: '341 KB',
105
122
  commandCount: 35,
106
123
  parser: 'full',
107
124
  hasBlocks: true,
@@ -117,8 +134,8 @@ const bundleInfo = [
117
134
  id: 'browser',
118
135
  name: 'Full Browser',
119
136
  filename: 'hyperfixi.js',
120
- gzipSize: '199.6 KB',
121
- rawSize: '943 KB',
137
+ gzipSize: '309.0 KB',
138
+ rawSize: '1388 KB',
122
139
  commandCount: 58,
123
140
  parser: 'full',
124
141
  hasBlocks: true,
@@ -134,8 +151,8 @@ const bundleInfo = [
134
151
  id: 'multilingual',
135
152
  name: 'Multilingual',
136
153
  filename: 'hyperfixi-multilingual.js',
137
- gzipSize: '64 KB',
138
- rawSize: '200 KB',
154
+ gzipSize: '97.1 KB',
155
+ rawSize: '401 KB',
139
156
  commandCount: 58,
140
157
  parser: 'full',
141
158
  hasBlocks: true,
package/dist/metadata.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  const packageInfo = {
2
2
  name: '@hyperfixi/core',
3
- version: '2.0.0',
3
+ version: '2.7.2',
4
4
  description: 'Modern hyperscript engine with fixi/htmx integration',
5
5
  compatibility: '~85% official _hyperscript',
6
6
  languages: 24,
@@ -31,7 +31,7 @@ const bundleInfo = [
31
31
  name: 'Lite Plus',
32
32
  filename: 'hyperfixi-lite-plus.js',
33
33
  gzipSize: '2.6 KB',
34
- rawSize: '7 KB',
34
+ rawSize: '8 KB',
35
35
  commandCount: 14,
36
36
  parser: 'regex',
37
37
  hasBlocks: false,
@@ -47,8 +47,8 @@ const bundleInfo = [
47
47
  id: 'hybrid-complete',
48
48
  name: 'Hybrid Complete',
49
49
  filename: 'hyperfixi-hybrid-complete.js',
50
- gzipSize: '7.2 KB',
51
- rawSize: '28 KB',
50
+ gzipSize: '7.7 KB',
51
+ rawSize: '30 KB',
52
52
  commandCount: 21,
53
53
  parser: 'hybrid',
54
54
  hasBlocks: true,
@@ -64,8 +64,8 @@ const bundleInfo = [
64
64
  id: 'hybrid-hx',
65
65
  name: 'Hybrid HX',
66
66
  filename: 'hyperfixi-hx.js',
67
- gzipSize: '9.7 KB',
68
- rawSize: '28 KB',
67
+ gzipSize: '18.1 KB',
68
+ rawSize: '68 KB',
69
69
  commandCount: 21,
70
70
  parser: 'hybrid',
71
71
  hasBlocks: true,
@@ -77,12 +77,29 @@ const bundleInfo = [
77
77
  cdnUrl: 'https://unpkg.com/@hyperfixi/core/dist/hyperfixi-hx.js',
78
78
  useCase: 'htmx/fixi drop-in replacement with hx-get, hx-post, hx-target',
79
79
  },
80
+ {
81
+ id: 'hybrid-hx-v4',
82
+ name: 'Hybrid HX v4',
83
+ filename: 'hyperfixi-hx-v4.js',
84
+ gzipSize: '320.6 KB',
85
+ rawSize: '1424 KB',
86
+ commandCount: 58,
87
+ parser: 'full',
88
+ hasBlocks: true,
89
+ hasEventModifiers: true,
90
+ hasPositional: true,
91
+ hasFetch: true,
92
+ hasHtmxCompat: true,
93
+ importPath: '@hyperfixi/core/browser/hybrid-hx-v4',
94
+ cdnUrl: 'https://unpkg.com/@hyperfixi/core/dist/hyperfixi-hx-v4.js',
95
+ useCase: 'htmx v4 compat: hx-live reactivity, SSE/WebSocket streaming, full runtime',
96
+ },
80
97
  {
81
98
  id: 'minimal',
82
99
  name: 'Minimal',
83
100
  filename: 'hyperfixi-minimal.js',
84
- gzipSize: '63.4 KB',
85
- rawSize: '271 KB',
101
+ gzipSize: '76.2 KB',
102
+ rawSize: '314 KB',
86
103
  commandCount: 30,
87
104
  parser: 'full',
88
105
  hasBlocks: true,
@@ -98,8 +115,8 @@ const bundleInfo = [
98
115
  id: 'standard',
99
116
  name: 'Standard',
100
117
  filename: 'hyperfixi-standard.js',
101
- gzipSize: '63 KB',
102
- rawSize: '195 KB',
118
+ gzipSize: '82.7 KB',
119
+ rawSize: '341 KB',
103
120
  commandCount: 35,
104
121
  parser: 'full',
105
122
  hasBlocks: true,
@@ -115,8 +132,8 @@ const bundleInfo = [
115
132
  id: 'browser',
116
133
  name: 'Full Browser',
117
134
  filename: 'hyperfixi.js',
118
- gzipSize: '199.6 KB',
119
- rawSize: '943 KB',
135
+ gzipSize: '309.0 KB',
136
+ rawSize: '1388 KB',
120
137
  commandCount: 58,
121
138
  parser: 'full',
122
139
  hasBlocks: true,
@@ -132,8 +149,8 @@ const bundleInfo = [
132
149
  id: 'multilingual',
133
150
  name: 'Multilingual',
134
151
  filename: 'hyperfixi-multilingual.js',
135
- gzipSize: '64 KB',
136
- rawSize: '200 KB',
152
+ gzipSize: '97.1 KB',
153
+ rawSize: '401 KB',
137
154
  commandCount: 58,
138
155
  parser: 'full',
139
156
  hasBlocks: true,
@@ -71,6 +71,13 @@ const debug = {
71
71
  },
72
72
  };
73
73
 
74
+ function unconsumedInputWarnings(node) {
75
+ const diagnostics = node
76
+ .diagnostics;
77
+ if (!diagnostics?.length)
78
+ return [];
79
+ return diagnostics.filter(d => d.code === 'unconsumed-input').map(d => d.message);
80
+ }
74
81
  let _semanticModule = null;
75
82
  async function getSemanticModule() {
76
83
  if (!_semanticModule) {
@@ -173,7 +180,7 @@ class SemanticGrammarBridge {
173
180
  confidence: result.confidence,
174
181
  lang,
175
182
  fallbackText: null,
176
- warnings: buildResult.warnings,
183
+ warnings: [...(buildResult.warnings ?? []), ...unconsumedInputWarnings(result.node)],
177
184
  };
178
185
  }
179
186
  catch {
@@ -69,6 +69,13 @@ const debug = {
69
69
  },
70
70
  };
71
71
 
72
+ function unconsumedInputWarnings(node) {
73
+ const diagnostics = node
74
+ .diagnostics;
75
+ if (!diagnostics?.length)
76
+ return [];
77
+ return diagnostics.filter(d => d.code === 'unconsumed-input').map(d => d.message);
78
+ }
72
79
  let _semanticModule = null;
73
80
  async function getSemanticModule() {
74
81
  if (!_semanticModule) {
@@ -171,7 +178,7 @@ class SemanticGrammarBridge {
171
178
  confidence: result.confidence,
172
179
  lang,
173
180
  fallbackText: null,
174
- warnings: buildResult.warnings,
181
+ warnings: [...(buildResult.warnings ?? []), ...unconsumedInputWarnings(result.node)],
175
182
  };
176
183
  }
177
184
  catch {
@@ -1,6 +1,6 @@
1
1
  import type { ParserContext, IdentifierNode } from '../parser-types';
2
2
  import type { Token } from '../../types/core';
3
- export declare function parseMeasureCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../../types/core").CommandNode;
4
- export declare function parseTransitionCommand(ctx: ParserContext, commandToken: Token): import("../../types/core").CommandNode;
3
+ export declare function parseMeasureCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
4
+ export declare function parseTransitionCommand(ctx: ParserContext, commandToken: Token): import("../..").CommandNode;
5
5
  export declare function parseStartCommand(ctx: ParserContext, identifierNode: IdentifierNode): import('../../types/core').CommandNode;
6
6
  //# sourceMappingURL=animation-commands.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ParserContext } from '../parser-types';
2
2
  import type { Token } from '../../types/core';
3
- export declare function parseWaitCommand(ctx: ParserContext, commandToken: Token): import("../../types/core").CommandNode;
4
- export declare function parseInstallCommand(ctx: ParserContext, commandToken: Token): import("../../types/core").CommandNode;
3
+ export declare function parseWaitCommand(ctx: ParserContext, commandToken: Token): import("../..").CommandNode;
4
+ export declare function parseInstallCommand(ctx: ParserContext, commandToken: Token): import("../..").CommandNode;
5
5
  //# sourceMappingURL=async-commands.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import type { ParserContext, IdentifierNode } from '../parser-types';
2
2
  import type { Token } from '../../types/core';
3
- export declare function parseRemoveCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../../types/core").CommandNode;
4
- export declare function parseToggleCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../../types/core").CommandNode;
5
- export declare function parseAddCommand(ctx: ParserContext, commandToken: Token): import("../../types/core").CommandNode;
6
- export declare function parsePutCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../../types/core").CommandNode | null;
7
- export declare function parseSwapCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../../types/core").CommandNode;
3
+ export declare function parseRemoveCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
4
+ export declare function parseToggleCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
5
+ export declare function parseAddCommand(ctx: ParserContext, commandToken: Token): import("../..").CommandNode;
6
+ export declare function parsePutCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode | null;
7
+ export declare function parseSwapCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
8
8
  //# sourceMappingURL=dom-commands.d.ts.map
@@ -0,0 +1,4 @@
1
+ import type { ParserContext, IdentifierNode } from '../parser-types';
2
+ import type { CommandNode } from '../../types/core';
3
+ export declare function parseGoCommand(ctx: ParserContext, identifierNode: IdentifierNode): CommandNode | null;
4
+ //# sourceMappingURL=navigation-commands.d.ts.map
@@ -1,8 +1,9 @@
1
1
  import type { ParserContext, IdentifierNode } from '../parser-types';
2
- import type { Token, CommandNode } from '../../types/core';
2
+ import type { ASTNode, Token, CommandNode } from '../../types/core';
3
3
  export declare function parseCompoundCommand(ctx: ParserContext, identifierNode: IdentifierNode): CommandNode | null;
4
4
  export declare function parseRegularCommand(ctx: ParserContext, identifierNode: IdentifierNode): CommandNode;
5
5
  export declare function parseMultiWordCommand(ctx: ParserContext, commandToken: Token, commandName: string): CommandNode | null;
6
+ export declare function parseBareURLPath(ctx: ParserContext, isTerminator?: (ctx: ParserContext) => boolean): ASTNode | null;
6
7
  export declare function parseFetchCommand(ctx: ParserContext, commandToken: Token): CommandNode;
7
8
  export declare function parseJsCommand(ctx: ParserContext, identifierNode: IdentifierNode): CommandNode;
8
9
  export declare function parseTellCommand(ctx: ParserContext, identifierNode: IdentifierNode): CommandNode;
@@ -7,6 +7,6 @@ export declare function parseTargetFallback(ctx: ParserContext): {
7
7
  expression: ASTNode | null;
8
8
  tokens: ASTNode[];
9
9
  };
10
- export declare function parseSetCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../../types/core").CommandNode;
11
- export declare function parseIncrementDecrementCommand(ctx: ParserContext, commandToken: Token): import("../../types/core").CommandNode;
10
+ export declare function parseSetCommand(ctx: ParserContext, identifierNode: IdentifierNode): import("../..").CommandNode;
11
+ export declare function parseIncrementDecrementCommand(ctx: ParserContext, commandToken: Token): import("../..").CommandNode;
12
12
  //# sourceMappingURL=variable-commands.d.ts.map
@@ -109,6 +109,7 @@ const COMPOUND_COMMANDS = new Set([
109
109
  'halt',
110
110
  'measure',
111
111
  'js',
112
+ 'go',
112
113
  'tell',
113
114
  'pick',
114
115
  'start',
@@ -1571,9 +1572,6 @@ class SemanticIntegrationAdapter {
1571
1572
  case 'responseType':
1572
1573
  modifiers['as'] = exprNode;
1573
1574
  break;
1574
- case 'method':
1575
- modifiers['method'] = exprNode;
1576
- break;
1577
1575
  case 'style':
1578
1576
  modifiers['with'] = exprNode;
1579
1577
  break;
@@ -4228,6 +4226,117 @@ function parseIncrementDecrementCommand(ctx, commandToken) {
4228
4226
  .build();
4229
4227
  }
4230
4228
 
4229
+ const GO_KEYWORDS = new Set([
4230
+ 'to',
4231
+ 'the',
4232
+ 'url',
4233
+ 'of',
4234
+ 'in',
4235
+ 'new',
4236
+ 'window',
4237
+ 'top',
4238
+ 'middle',
4239
+ 'bottom',
4240
+ 'left',
4241
+ 'center',
4242
+ 'right',
4243
+ 'smoothly',
4244
+ 'instantly',
4245
+ 'back',
4246
+ 'forward',
4247
+ ]);
4248
+ const GO_URL_STOP = new Set([
4249
+ 'in',
4250
+ 'then',
4251
+ 'and',
4252
+ 'else',
4253
+ 'end',
4254
+ 'otherwise',
4255
+ 'when',
4256
+ 'where',
4257
+ 'catch',
4258
+ 'finally',
4259
+ ]);
4260
+ function isGoURLTerminator(ctx) {
4261
+ return ctx.isAtEnd() || GO_URL_STOP.has(ctx.peek().value);
4262
+ }
4263
+ function stringNode(value, tok) {
4264
+ return {
4265
+ type: 'string',
4266
+ value,
4267
+ start: tok.start,
4268
+ end: tok.end,
4269
+ line: tok.line,
4270
+ column: tok.column,
4271
+ };
4272
+ }
4273
+ function isNakedURLStart(ctx) {
4274
+ const tok = ctx.peek();
4275
+ if (tok.value === '/')
4276
+ return true;
4277
+ if (ctx.checkIdentifierLike()) {
4278
+ const next = ctx.peekAt(1);
4279
+ return !!next && next.value === ':' && next.start === tok.end;
4280
+ }
4281
+ return false;
4282
+ }
4283
+ function parseGoCommand(ctx, identifierNode) {
4284
+ const args = [];
4285
+ while (!isCommandBoundary(ctx, ['when', 'where', 'catch', 'finally'])) {
4286
+ const tok = ctx.peek();
4287
+ const canonical = ctx.resolveKeyword(tok.value).toLowerCase();
4288
+ if (GO_KEYWORDS.has(canonical)) {
4289
+ ctx.advance();
4290
+ args.push(stringNode(canonical, tok));
4291
+ continue;
4292
+ }
4293
+ if (isNakedURLStart(ctx)) {
4294
+ const url = parseBareURLPath(ctx, isGoURLTerminator);
4295
+ if (url) {
4296
+ args.push(url);
4297
+ continue;
4298
+ }
4299
+ ctx.advance();
4300
+ args.push(stringNode(tok.value, tok));
4301
+ continue;
4302
+ }
4303
+ if (tok.value === '+' || tok.value === '-') {
4304
+ ctx.advance();
4305
+ args.push(stringNode(tok.value, tok));
4306
+ continue;
4307
+ }
4308
+ if (tok.kind === 'number') {
4309
+ ctx.advance();
4310
+ const next = ctx.peek();
4311
+ if (!ctx.isAtEnd() && next.value === 'px' && next.start === tok.end) {
4312
+ const px = ctx.advance();
4313
+ args.push(stringNode(`${tok.value}px`, { ...tok, end: px.end }));
4314
+ }
4315
+ else {
4316
+ args.push({
4317
+ type: 'literal',
4318
+ value: Number(tok.value),
4319
+ raw: tok.value,
4320
+ start: tok.start,
4321
+ end: tok.end,
4322
+ line: tok.line,
4323
+ column: tok.column,
4324
+ });
4325
+ }
4326
+ continue;
4327
+ }
4328
+ const before = ctx.current;
4329
+ args.push(ctx.parsePrimary());
4330
+ if (ctx.current === before) {
4331
+ break;
4332
+ }
4333
+ }
4334
+ return CommandNodeBuilder.fromIdentifier(identifierNode)
4335
+ .withArgs(...args)
4336
+ .endingAt(ctx.getPosition())
4337
+ .build();
4338
+ }
4339
+
4231
4340
  function parseCompoundCommand(ctx, identifierNode) {
4232
4341
  const commandName = identifierNode.name.toLowerCase();
4233
4342
  switch (commandName) {
@@ -4248,6 +4357,8 @@ function parseCompoundCommand(ctx, identifierNode) {
4248
4357
  return parseMeasureCommand(ctx, identifierNode);
4249
4358
  case 'js':
4250
4359
  return parseJsCommand(ctx, identifierNode);
4360
+ case 'go':
4361
+ return parseGoCommand(ctx, identifierNode);
4251
4362
  case 'tell':
4252
4363
  return parseTellCommand(ctx, identifierNode);
4253
4364
  case 'pick':
@@ -4327,10 +4438,10 @@ function isFetchURLTerminator(ctx) {
4327
4438
  return (['as', 'with', '{', 'then', 'end', 'else', 'otherwise', ')'].includes(val) ||
4328
4439
  isCommandBoundary(ctx));
4329
4440
  }
4330
- function parseBareURLPath(ctx) {
4441
+ function parseBareURLPath(ctx, isTerminator = isFetchURLTerminator) {
4331
4442
  const startPos = ctx.savePosition();
4332
4443
  let path = '';
4333
- while (!ctx.isAtEnd() && !isFetchURLTerminator(ctx)) {
4444
+ while (!ctx.isAtEnd() && !isTerminator(ctx)) {
4334
4445
  path += ctx.advance().value;
4335
4446
  }
4336
4447
  if (!path || path === '/') {
@@ -6860,6 +6971,7 @@ class Parser {
6860
6971
  'closest',
6861
6972
  'js',
6862
6973
  'tell',
6974
+ 'fetch',
6863
6975
  ];
6864
6976
  if (this.semanticAdapter && !skipSemanticParsing.includes(commandName.toLowerCase())) {
6865
6977
  const remainingInput = this.getRemainingInput();