@elastic/monaco-esql 3.1.8 → 3.1.10

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,3 +1,4 @@
1
+ export declare const headerCommands: string[];
1
2
  export declare const sourceCommands: string[];
2
3
  export declare const processingCommands: string[];
3
4
  export declare const options: string[];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.temporalUnits = exports.operators = exports.delimiters = exports.functions = exports.literals = exports.options = exports.processingCommands = exports.sourceCommands = void 0;
3
+ exports.temporalUnits = exports.operators = exports.delimiters = exports.functions = exports.literals = exports.options = exports.processingCommands = exports.sourceCommands = exports.headerCommands = void 0;
4
+ exports.headerCommands = ["SET"];
4
5
  exports.sourceCommands = [
5
6
  "FROM",
6
7
  "ROW",
@@ -18,6 +19,7 @@ exports.processingCommands = [
18
19
  "EVAL",
19
20
  "FORK",
20
21
  "FULL JOIN",
22
+ "FUSE",
21
23
  "GROK",
22
24
  "INFO",
23
25
  "INLINESTATS",
@@ -35,13 +37,21 @@ exports.processingCommands = [
35
37
  "RERANK",
36
38
  "RIGHT JOIN",
37
39
  "RIGHT",
38
- "RRF",
39
40
  "SAMPLE",
40
41
  "SORT",
41
42
  "STATS",
42
- "WHERE"
43
+ "WHERE",
44
+ ];
45
+ exports.options = [
46
+ "BY",
47
+ "ON",
48
+ "WITH",
49
+ "METADATA",
50
+ "WHERE",
51
+ "SCORE",
52
+ "KEY",
53
+ "GROUP",
43
54
  ];
44
- exports.options = ["BY", "ON", "WITH", "METADATA", "WHERE"];
45
55
  exports.literals = ["TRUE", "FALSE", "NULL"];
46
56
  exports.functions = [
47
57
  "ABS",
package/lib/monarch.js CHANGED
@@ -2,14 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.create = void 0;
4
4
  const create = (deps = {}) => {
5
- const { sourceCommands = [], processingCommands = [], options = [], literals = [], functions = [], delimiters = [], temporalUnits = [], } = deps;
6
- const timeUnits = withLowercaseVariants(temporalUnits.flat()).sort((a, b) => (a > b ? -1 : 1));
5
+ const { headerCommands = [], sourceCommands = [], processingCommands = [], options = [], literals = [], functions = [], delimiters = [], temporalUnits = [], } = deps;
6
+ const timeUnits = withLowercaseVariants(temporalUnits.flat()).sort((a, b) => a > b ? -1 : 1);
7
7
  return {
8
8
  // Uncomment when developing.
9
9
  // defaultToken: "invalid",
10
10
  // ES|QL is case-insensitive.
11
11
  ignoreCase: false,
12
12
  // Lists of known language keywords and built-ins.
13
+ headerCommands: withLowercaseVariants(headerCommands),
13
14
  sourceCommands: withLowercaseVariants(sourceCommands),
14
15
  processingCommands: withLowercaseVariants(processingCommands),
15
16
  processingCommandsOnlyUppercase: processingCommands,
@@ -24,8 +25,8 @@ const create = (deps = {}) => {
24
25
  // Pre-defined regular expressions.
25
26
  escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
26
27
  digits: /\d+(_+\d+)*/,
27
- symbols: /[=><!~:&|+\-*\/\^%\.,]+/,
28
- columnIdentifier: /[a-zA-Z0-9_\*\-]+/,
28
+ symbols: /[=><!~:&|+\-*/^%.,]+/,
29
+ columnIdentifier: /[a-zA-Z0-9_*-]+/,
29
30
  brackets: [
30
31
  { open: "[", close: "]", token: "delimiter.square" },
31
32
  { open: "(", close: ")", token: "delimiter.parenthesis" },
@@ -37,11 +38,14 @@ const create = (deps = {}) => {
37
38
  { include: "@whitespace" },
38
39
  // Keywords
39
40
  [
40
- /@?[a-zA-Z_$][\w$]*(?![\.\-:a-zA-Z_0-9])/,
41
+ /@?[a-zA-Z_$][\w$]*(?![.\-:a-zA-Z_0-9])/,
41
42
  {
42
43
  cases: {
44
+ "@headerCommands": { token: "keyword.command.header.$0" },
43
45
  "@sourceCommands": { token: "keyword.command.source.$0" },
44
- "@processingCommandsOnlyUppercase": { token: "keyword.command.processing.$0" },
46
+ "@processingCommandsOnlyUppercase": {
47
+ token: "keyword.command.processing.$0",
48
+ },
45
49
  "@options": { token: "keyword.option.$0" },
46
50
  "@literals": { token: "keyword.literal.$0" },
47
51
  "@functions": { token: "identifier.function.$0" },
@@ -72,14 +76,14 @@ const create = (deps = {}) => {
72
76
  [/\/\/.*$/, "comment"],
73
77
  ],
74
78
  comment: [
75
- [/[^\/*]+/, "comment"],
79
+ [/[^/*]+/, "comment"],
76
80
  [/\*\//, "comment", "@pop"],
77
- [/[\/*]/, "comment"],
81
+ [/[/*]/, "comment"],
78
82
  ],
79
83
  doc: [
80
- [/[^\/*]+/, "comment.doc"],
84
+ [/[^/*]+/, "comment.doc"],
81
85
  [/\*\//, "comment.doc", "@pop"],
82
- [/[\/*]/, "comment.doc"],
86
+ [/[/*]/, "comment.doc"],
83
87
  ],
84
88
  // ---------------------------------------------------------------- Commands
85
89
  // This code block allows to color commands when they are followed by a pipe
@@ -92,7 +96,10 @@ const create = (deps = {}) => {
92
96
  ],
93
97
  [
94
98
  /\(/,
95
- { token: "delimiter.parenthesis", switchTo: "@firstCommandNameInSubQuery" },
99
+ {
100
+ token: "delimiter.parenthesis",
101
+ switchTo: "@firstCommandNameInSubQuery",
102
+ },
96
103
  ],
97
104
  ],
98
105
  beforeMnemonicWhitespace: [
@@ -100,6 +107,10 @@ const create = (deps = {}) => {
100
107
  ["", { token: "", switchTo: "@commandName" }],
101
108
  ],
102
109
  exactCommandName: [
110
+ [
111
+ withLowercaseVariants(headerCommands).join("|"),
112
+ { token: "keyword.command.header.$0", switchTo: "@root" },
113
+ ],
103
114
  [
104
115
  withLowercaseVariants(sourceCommands).join("|"),
105
116
  { token: "keyword.command.source.$0", switchTo: "@root" },
@@ -114,7 +125,7 @@ const create = (deps = {}) => {
114
125
  // Try to match an exact command name
115
126
  { include: "@exactCommandName" },
116
127
  // If not matched, go to root
117
- { include: "@root" }
128
+ { include: "@root" },
118
129
  ],
119
130
  // Matches *command name*, i.e. the mnemonic.
120
131
  commandName: [
@@ -159,8 +170,8 @@ const create = (deps = {}) => {
159
170
  ],
160
171
  timeInterval: [[`(@digits)\\s*(${timeUnits.join("|")})`, "number.time"]],
161
172
  number: [
162
- [/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
163
- [/(@digits)?\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
173
+ [/(@digits)[eE]([-+]?(@digits))?/, "number.float"],
174
+ [/(@digits)?\.(@digits)([eE][-+]?(@digits))?/, "number.float"],
164
175
  [/(@digits)/, "number"],
165
176
  ],
166
177
  // Single double-quote strings: "str"
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@elastic/monaco-esql",
3
- "version": "3.1.8",
3
+ "version": "3.1.10",
4
4
  "private": false,
5
5
  "publishConfig": {
6
- "access": "public"
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org"
7
8
  },
8
9
  "description": "Monaco editor Monarch language syntax definitions for ES|QL",
9
10
  "main": "lib/index.js",
@@ -15,18 +16,19 @@
15
16
  "format": "biome format ./src",
16
17
  "format:fix": "biome format --write ./src",
17
18
  "lint": "biome lint ./src",
18
- "lint:fix": "biome lint --apply ./src",
19
+ "lint:fix": "biome lint --write ./src",
19
20
  "test": "echo \"no tests...\"",
20
21
  "clean": "npx rimraf@5.0.5 lib",
21
22
  "build:es2020": "tsc --project tsconfig.build.json --module commonjs --target es2020 --outDir lib",
22
23
  "build": "yarn build:es2020",
23
24
  "storybook": "storybook dev -p 6006",
24
- "build-storybook": "storybook build"
25
+ "build-storybook": "storybook build",
26
+ "release": "npx release-it --ci"
25
27
  },
26
28
  "license": "MIT",
27
29
  "repository": {
28
30
  "type": "git",
29
- "url": "https://github.com/elastic/highlightjs-esql.git"
31
+ "url": "git+https://github.com/elastic/monaco-esql.git"
30
32
  },
31
33
  "keywords": [
32
34
  "esql",
@@ -51,19 +53,20 @@
51
53
  "@biomejs/biome": "2.2.4",
52
54
  "@chromatic-com/storybook": "4.1.1",
53
55
  "@monaco-editor/react": "4.7.0",
54
- "@storybook/addon-onboarding": "9.1.5",
55
- "@storybook/react-vite": "9.1.5",
56
+ "@storybook/addon-onboarding": "9.1.10",
57
+ "@storybook/react-vite": "9.1.10",
56
58
  "@types/react": "19.1.13",
57
59
  "@vitest/browser": "3.2.4",
58
60
  "@vitest/coverage-v8": "3.2.4",
59
61
  "monaco-editor": "0.53.0",
60
- "playwright": "1.55.0",
62
+ "playwright": "1.55.1",
61
63
  "react": "19.1.1",
62
64
  "react-dom": "19.1.1",
63
- "storybook": "9.1.5",
65
+ "storybook": "9.1.10",
64
66
  "typescript": "5.9.2",
65
67
  "vitest": "3.2.4",
66
- "@storybook/addon-vitest": "9.1.5",
67
- "@storybook/addon-docs": "9.1.5"
68
+ "@storybook/addon-vitest": "9.1.10",
69
+ "@storybook/addon-docs": "9.1.10",
70
+ "release-it": "19.0.5"
68
71
  }
69
72
  }