@yorun-ai/skel-highlight 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Skel Highlight
2
2
 
3
- Syntax highlighting definitions for the Skel contract language. The package currently provides the canonical TextMate grammar and a custom language registration for [Shiki](https://shiki.style/).
3
+ Frontend syntax-highlighting definitions for the Skel contract language. The package supports Shiki, PrismJS, Highlight.js, Monaco Editor, Starry Night, and CodeMirror 6. Its TextMate grammar is the canonical lexical definition shared with the VS Code extension.
4
+
5
+ Install the package with only the highlighter used by your application. All highlighter peer dependencies are optional.
4
6
 
5
7
  ## Shiki
6
8
 
@@ -8,21 +10,91 @@ Syntax highlighting definitions for the Skel contract language. The package curr
8
10
  npm install shiki @yorun-ai/skel-highlight
9
11
  ```
10
12
 
11
- Register Skel when creating a highlighter:
12
-
13
13
  ```js
14
14
  import { createHighlighter } from "shiki";
15
15
  import skel from "@yorun-ai/skel-highlight/shiki";
16
16
 
17
- const highlighter = await createHighlighter({
18
- langs: [skel],
19
- themes: ["github-dark"]
20
- });
17
+ const highlighter = await createHighlighter({ langs: [skel], themes: ["github-dark"] });
18
+ const html = highlighter.codeToHtml("domain demo.user", { lang: "skel", theme: "github-dark" });
19
+ ```
20
+
21
+ ## PrismJS
22
+
23
+ ```sh
24
+ npm install prismjs @yorun-ai/skel-highlight
25
+ ```
26
+
27
+ ```js
28
+ import Prism from "prismjs";
29
+ import skel, { registerSkelPrism } from "@yorun-ai/skel-highlight/prism";
30
+
31
+ registerSkelPrism(Prism);
32
+ const html = Prism.highlight("domain demo.user", skel, "skel");
33
+ ```
34
+
35
+ `registerSkelPrism` also carries the metadata expected by Refractor, so it can be passed to `refractor.register`.
36
+
37
+ ## Highlight.js
38
+
39
+ ```sh
40
+ npm install highlight.js @yorun-ai/skel-highlight
41
+ ```
42
+
43
+ ```js
44
+ import hljs from "highlight.js/lib/core";
45
+ import skel from "@yorun-ai/skel-highlight/highlightjs";
46
+
47
+ hljs.registerLanguage("skel", skel);
48
+ const html = hljs.highlight("domain demo.user", { language: "skel" }).value;
49
+ ```
50
+
51
+ The same language function can be registered with Lowlight.
52
+
53
+ ## Monaco Editor
54
+
55
+ ```sh
56
+ npm install monaco-editor @yorun-ai/skel-highlight
57
+ ```
58
+
59
+ ```js
60
+ import * as monaco from "monaco-editor";
61
+ import { registerSkelMonaco } from "@yorun-ai/skel-highlight/monaco";
62
+
63
+ registerSkelMonaco(monaco);
64
+ monaco.editor.create(element, { language: "skel", value: "domain demo.user" });
65
+ ```
21
66
 
22
- const html = highlighter.codeToHtml("domain demo.user", {
23
- lang: "skel",
24
- theme: "github-dark"
25
- });
67
+ The Monaco entrypoint also exports `skelMonarch` and `skelLanguageConfiguration` for applications that manage language registration themselves.
68
+
69
+ ## Starry Night
70
+
71
+ ```sh
72
+ npm install @wooorm/starry-night @yorun-ai/skel-highlight
26
73
  ```
27
74
 
28
- The raw TextMate grammar is also exported as `@yorun-ai/skel-highlight/textmate`.
75
+ ```js
76
+ import { createStarryNight } from "@wooorm/starry-night";
77
+ import skel from "@yorun-ai/skel-highlight/starry-night";
78
+
79
+ const highlighter = await createStarryNight([skel]);
80
+ const tree = highlighter.highlight("domain demo.user", "source.skel");
81
+ ```
82
+
83
+ ## CodeMirror 6
84
+
85
+ ```sh
86
+ npm install @codemirror/language @codemirror/view @yorun-ai/skel-highlight
87
+ ```
88
+
89
+ ```js
90
+ import { EditorView } from "@codemirror/view";
91
+ import { skel } from "@yorun-ai/skel-highlight/codemirror";
92
+
93
+ new EditorView({ parent: element, doc: "domain demo.user", extensions: [skel()] });
94
+ ```
95
+
96
+ The CodeMirror entrypoint provides stream-based syntax highlighting. Semantic completion, diagnostics, navigation, and rename remain the responsibility of `skelc lsp` integrations.
97
+
98
+ ## TextMate
99
+
100
+ The raw grammar is available as `@yorun-ai/skel-highlight/textmate` for TextMate-compatible consumers.
@@ -0,0 +1,122 @@
1
+ // src/codemirror.js
2
+ import { LanguageSupport, StreamLanguage } from "@codemirror/language";
3
+
4
+ // src/language.js
5
+ var entryKeywords = Object.freeze([
6
+ "enum",
7
+ "data",
8
+ "config",
9
+ "actor",
10
+ "resource",
11
+ "service",
12
+ "web",
13
+ "event",
14
+ "task"
15
+ ]);
16
+ var declarationKeywords = Object.freeze(["domain", "import", ...entryKeywords]);
17
+ var controlKeywords = Object.freeze([
18
+ "pub",
19
+ "as",
20
+ "via",
21
+ "for",
22
+ "auth",
23
+ "noauth",
24
+ "permission",
25
+ "credential",
26
+ "info",
27
+ "method",
28
+ "require",
29
+ "trigger",
30
+ "input",
31
+ "output",
32
+ "payload",
33
+ "action",
34
+ "check",
35
+ "all",
36
+ "any",
37
+ "client",
38
+ "agent",
39
+ "openapi",
40
+ "eternal",
41
+ "instant"
42
+ ]);
43
+ var builtinTypes = Object.freeze([
44
+ "int",
45
+ "float",
46
+ "bool",
47
+ "string",
48
+ "decimal",
49
+ "binary",
50
+ "timestamp",
51
+ "duration",
52
+ "localdate",
53
+ "localtime",
54
+ "localdatetime",
55
+ "uuid",
56
+ "json",
57
+ "PermissionCode",
58
+ "list",
59
+ "map"
60
+ ]);
61
+ var keywords = Object.freeze([...declarationKeywords, ...controlKeywords]);
62
+ var keywordSet = new Set(keywords);
63
+ var builtinTypeSet = new Set(builtinTypes);
64
+
65
+ // src/codemirror.js
66
+ function readDelimited(stream, state, delimiter, stateField, tokenType) {
67
+ if (stream.skipTo(delimiter)) {
68
+ stream.match(delimiter);
69
+ state[stateField] = false;
70
+ } else {
71
+ stream.skipToEnd();
72
+ }
73
+ return tokenType;
74
+ }
75
+ var skelStreamParser = {
76
+ name: "skel",
77
+ startState() {
78
+ return { blockComment: false, tripleString: false };
79
+ },
80
+ token(stream, state) {
81
+ if (state.blockComment) return readDelimited(stream, state, "*/", "blockComment", "comment");
82
+ if (state.tripleString) return readDelimited(stream, state, '"""', "tripleString", "string");
83
+ if (stream.eatSpace()) return null;
84
+ if (stream.match("//")) {
85
+ stream.skipToEnd();
86
+ return "comment";
87
+ }
88
+ if (stream.match("/*")) {
89
+ state.blockComment = true;
90
+ return readDelimited(stream, state, "*/", "blockComment", "comment");
91
+ }
92
+ if (stream.match('"""')) {
93
+ state.tripleString = true;
94
+ return readDelimited(stream, state, '"""', "tripleString", "string");
95
+ }
96
+ if (stream.match(/"(?:\\.|[^"\\])*(?:"|$)/)) return "string";
97
+ if (stream.match(/@[A-Za-z_][A-Za-z0-9_]*/)) return "meta";
98
+ if (stream.match(/\d+(?:\.\d+)?/)) return "number";
99
+ if (stream.match(/[A-Za-z_][A-Za-z0-9_]*/)) {
100
+ const word = stream.current();
101
+ if (keywordSet.has(word)) return "keyword";
102
+ if (builtinTypeSet.has(word)) return "typeName";
103
+ if (/^[A-Z]/.test(word)) return "className";
104
+ return "variableName";
105
+ }
106
+ if (stream.match(/[?=*]/)) return "operator";
107
+ if (stream.match(/[{}()[\]<>.,:;]/)) return "punctuation";
108
+ stream.next();
109
+ return null;
110
+ }
111
+ };
112
+ var skelLanguage = StreamLanguage.define(skelStreamParser);
113
+ function skel() {
114
+ return new LanguageSupport(skelLanguage);
115
+ }
116
+ var codemirror_default = skel;
117
+ export {
118
+ codemirror_default as default,
119
+ skel,
120
+ skelLanguage,
121
+ skelStreamParser
122
+ };
@@ -0,0 +1,86 @@
1
+ // src/language.js
2
+ var entryKeywords = Object.freeze([
3
+ "enum",
4
+ "data",
5
+ "config",
6
+ "actor",
7
+ "resource",
8
+ "service",
9
+ "web",
10
+ "event",
11
+ "task"
12
+ ]);
13
+ var declarationKeywords = Object.freeze(["domain", "import", ...entryKeywords]);
14
+ var controlKeywords = Object.freeze([
15
+ "pub",
16
+ "as",
17
+ "via",
18
+ "for",
19
+ "auth",
20
+ "noauth",
21
+ "permission",
22
+ "credential",
23
+ "info",
24
+ "method",
25
+ "require",
26
+ "trigger",
27
+ "input",
28
+ "output",
29
+ "payload",
30
+ "action",
31
+ "check",
32
+ "all",
33
+ "any",
34
+ "client",
35
+ "agent",
36
+ "openapi",
37
+ "eternal",
38
+ "instant"
39
+ ]);
40
+ var builtinTypes = Object.freeze([
41
+ "int",
42
+ "float",
43
+ "bool",
44
+ "string",
45
+ "decimal",
46
+ "binary",
47
+ "timestamp",
48
+ "duration",
49
+ "localdate",
50
+ "localtime",
51
+ "localdatetime",
52
+ "uuid",
53
+ "json",
54
+ "PermissionCode",
55
+ "list",
56
+ "map"
57
+ ]);
58
+ var keywords = Object.freeze([...declarationKeywords, ...controlKeywords]);
59
+ var keywordSet = new Set(keywords);
60
+ var builtinTypeSet = new Set(builtinTypes);
61
+
62
+ // src/highlightjs.js
63
+ function skelHighlightJs(hljs) {
64
+ return {
65
+ name: "Skel",
66
+ aliases: ["skel"],
67
+ keywords: {
68
+ keyword: keywords.join(" "),
69
+ type: builtinTypes.join(" ")
70
+ },
71
+ contains: [
72
+ hljs.COMMENT("//", "$"),
73
+ hljs.COMMENT("/\\*", "\\*/"),
74
+ { scope: "string", begin: /"""/, end: /"""/ },
75
+ { scope: "string", begin: /"/, end: /"/, contains: [hljs.BACKSLASH_ESCAPE] },
76
+ { scope: "meta", begin: /@[A-Za-z_][A-Za-z0-9_]*/ },
77
+ hljs.C_NUMBER_MODE,
78
+ { scope: "title.class", begin: /\b[A-Z][A-Za-z0-9_]*\b/ }
79
+ ]
80
+ };
81
+ }
82
+ var highlightjs_default = skelHighlightJs;
83
+ export {
84
+ highlightjs_default as default,
85
+ skelHighlightJs
86
+ };
package/dist/index.js CHANGED
@@ -186,7 +186,7 @@ var skel_tmLanguage_default = {
186
186
  name: "keyword.declaration.via.skel"
187
187
  },
188
188
  "2": {
189
- name: "entity.name.function.skel"
189
+ name: "constant.language.actor-via.skel"
190
190
  }
191
191
  }
192
192
  }
@@ -307,7 +307,7 @@ var skel_tmLanguage_default = {
307
307
  patterns: [
308
308
  {
309
309
  name: "keyword.control.skel",
310
- match: "\\b(pub|domain|import|as|via|for|auth|noauth|permission|credential|info|method|require|trigger|input|output|payload|resource|action|check|all|any)\\b"
310
+ match: "\\b(pub|domain|import|as|via|for|auth|noauth|permission|credential|info|method|require|trigger|input|output|payload|resource|action|check|all|any|client|agent|openapi|eternal|instant)\\b"
311
311
  }
312
312
  ]
313
313
  },
package/dist/monaco.js ADDED
@@ -0,0 +1,116 @@
1
+ // src/language.js
2
+ var entryKeywords = Object.freeze([
3
+ "enum",
4
+ "data",
5
+ "config",
6
+ "actor",
7
+ "resource",
8
+ "service",
9
+ "web",
10
+ "event",
11
+ "task"
12
+ ]);
13
+ var declarationKeywords = Object.freeze(["domain", "import", ...entryKeywords]);
14
+ var controlKeywords = Object.freeze([
15
+ "pub",
16
+ "as",
17
+ "via",
18
+ "for",
19
+ "auth",
20
+ "noauth",
21
+ "permission",
22
+ "credential",
23
+ "info",
24
+ "method",
25
+ "require",
26
+ "trigger",
27
+ "input",
28
+ "output",
29
+ "payload",
30
+ "action",
31
+ "check",
32
+ "all",
33
+ "any",
34
+ "client",
35
+ "agent",
36
+ "openapi",
37
+ "eternal",
38
+ "instant"
39
+ ]);
40
+ var builtinTypes = Object.freeze([
41
+ "int",
42
+ "float",
43
+ "bool",
44
+ "string",
45
+ "decimal",
46
+ "binary",
47
+ "timestamp",
48
+ "duration",
49
+ "localdate",
50
+ "localtime",
51
+ "localdatetime",
52
+ "uuid",
53
+ "json",
54
+ "PermissionCode",
55
+ "list",
56
+ "map"
57
+ ]);
58
+ var keywords = Object.freeze([...declarationKeywords, ...controlKeywords]);
59
+ var keywordSet = new Set(keywords);
60
+ var builtinTypeSet = new Set(builtinTypes);
61
+
62
+ // src/monaco.js
63
+ var skelLanguageConfiguration = Object.freeze({
64
+ comments: { lineComment: "//", blockComment: ["/*", "*/"] },
65
+ brackets: [["{", "}"], ["[", "]"], ["(", ")"], ["<", ">"]],
66
+ autoClosingPairs: [
67
+ { open: "{", close: "}" },
68
+ { open: "[", close: "]" },
69
+ { open: "(", close: ")" },
70
+ { open: "<", close: ">" },
71
+ { open: '"', close: '"' }
72
+ ],
73
+ surroundingPairs: [
74
+ { open: "{", close: "}" },
75
+ { open: "[", close: "]" },
76
+ { open: "(", close: ")" },
77
+ { open: "<", close: ">" },
78
+ { open: '"', close: '"' }
79
+ ]
80
+ });
81
+ var skelMonarch = {
82
+ defaultToken: "",
83
+ tokenPostfix: ".skel",
84
+ keywords,
85
+ builtinTypes,
86
+ tokenizer: {
87
+ root: [
88
+ [/\s+/, "white"],
89
+ [/\/\//, "comment", "@lineComment"],
90
+ [/\/\*/, "comment", "@blockComment"],
91
+ [/"""/, "string", "@tripleString"],
92
+ [/"(?:\\.|[^"\\])*"/, "string"],
93
+ [/@[A-Za-z_][A-Za-z0-9_]*/, "annotation"],
94
+ [/[A-Za-z_][A-Za-z0-9_]*/, { cases: { "@keywords": "keyword", "@builtinTypes": "type", "@default": "identifier" } }],
95
+ [/\d+(?:\.\d+)?/, "number"],
96
+ [/[?=*]/, "operator"],
97
+ [/[{}()[\]<>]/, "@brackets"],
98
+ [/[.,:;]/, "delimiter"]
99
+ ],
100
+ lineComment: [[/.*$/, "comment", "@pop"]],
101
+ blockComment: [[/[^*]+/, "comment"], [/\*\//, "comment", "@pop"], [/\*/, "comment"]],
102
+ tripleString: [[/[^\"]+/, "string"], [/"""/, "string", "@pop"], [/\"/, "string"]]
103
+ }
104
+ };
105
+ function registerSkelMonaco(monaco) {
106
+ monaco.languages.register({ id: "skel", extensions: [".skel"], aliases: ["Skel", "skel"] });
107
+ monaco.languages.setLanguageConfiguration("skel", skelLanguageConfiguration);
108
+ monaco.languages.setMonarchTokensProvider("skel", skelMonarch);
109
+ }
110
+ var monaco_default = skelMonarch;
111
+ export {
112
+ monaco_default as default,
113
+ registerSkelMonaco,
114
+ skelLanguageConfiguration,
115
+ skelMonarch
116
+ };
package/dist/prism.js ADDED
@@ -0,0 +1,110 @@
1
+ // src/language.js
2
+ var entryKeywords = Object.freeze([
3
+ "enum",
4
+ "data",
5
+ "config",
6
+ "actor",
7
+ "resource",
8
+ "service",
9
+ "web",
10
+ "event",
11
+ "task"
12
+ ]);
13
+ var declarationKeywords = Object.freeze(["domain", "import", ...entryKeywords]);
14
+ var controlKeywords = Object.freeze([
15
+ "pub",
16
+ "as",
17
+ "via",
18
+ "for",
19
+ "auth",
20
+ "noauth",
21
+ "permission",
22
+ "credential",
23
+ "info",
24
+ "method",
25
+ "require",
26
+ "trigger",
27
+ "input",
28
+ "output",
29
+ "payload",
30
+ "action",
31
+ "check",
32
+ "all",
33
+ "any",
34
+ "client",
35
+ "agent",
36
+ "openapi",
37
+ "eternal",
38
+ "instant"
39
+ ]);
40
+ var builtinTypes = Object.freeze([
41
+ "int",
42
+ "float",
43
+ "bool",
44
+ "string",
45
+ "decimal",
46
+ "binary",
47
+ "timestamp",
48
+ "duration",
49
+ "localdate",
50
+ "localtime",
51
+ "localdatetime",
52
+ "uuid",
53
+ "json",
54
+ "PermissionCode",
55
+ "list",
56
+ "map"
57
+ ]);
58
+ var keywords = Object.freeze([...declarationKeywords, ...controlKeywords]);
59
+ var keywordSet = new Set(keywords);
60
+ var builtinTypeSet = new Set(builtinTypes);
61
+ var identifierPattern = "[A-Za-z_][A-Za-z0-9_]*";
62
+
63
+ // src/prism.js
64
+ var keywordPattern = new RegExp(`\\b(?:${keywords.join("|")})\\b`);
65
+ var builtinPattern = new RegExp(`\\b(?:${builtinTypes.join("|")})\\b`);
66
+ var declarationNamePattern = new RegExp(`(\\b(?:${entryKeywords.join("|")})\\s+)${identifierPattern}`);
67
+ var functionNamePattern = new RegExp(`(\\b(?:method|action|check)\\s+)${identifierPattern}`);
68
+ var skelPrism = Object.freeze({
69
+ comment: [
70
+ { pattern: /\/\*(?:[\s\S]*?\*\/|[\s\S]*)/, greedy: true },
71
+ { pattern: /\/\/.*$/m, greedy: true }
72
+ ],
73
+ string: [
74
+ { pattern: /"""(?:[\s\S]*?"""|[\s\S]*)/, greedy: true },
75
+ { pattern: /"(?:\\.|[^"\\])*(?:"|$)/m, greedy: true }
76
+ ],
77
+ decorator: {
78
+ pattern: /@[A-Za-z_][A-Za-z0-9_]*/,
79
+ alias: "annotation"
80
+ },
81
+ "class-name": {
82
+ pattern: declarationNamePattern,
83
+ lookbehind: true
84
+ },
85
+ function: {
86
+ pattern: functionNamePattern,
87
+ lookbehind: true
88
+ },
89
+ keyword: keywordPattern,
90
+ builtin: builtinPattern,
91
+ number: /\b\d+(?:\.\d+)?\b/,
92
+ "type-reference": {
93
+ pattern: /\b[A-Z][A-Za-z0-9_]*\b/,
94
+ alias: "class-name"
95
+ },
96
+ operator: /[?=*]/,
97
+ punctuation: /[{}()[\]<>.,:;]/
98
+ });
99
+ function registerSkelPrism(Prism) {
100
+ Prism.languages.skel = skelPrism;
101
+ return skelPrism;
102
+ }
103
+ registerSkelPrism.displayName = "skel";
104
+ registerSkelPrism.aliases = [];
105
+ var prism_default = skelPrism;
106
+ export {
107
+ prism_default as default,
108
+ registerSkelPrism,
109
+ skelPrism
110
+ };
@@ -0,0 +1,351 @@
1
+ // src/skel.tmLanguage.json
2
+ var skel_tmLanguage_default = {
3
+ name: "Skel",
4
+ scopeName: "source.skel",
5
+ patterns: [
6
+ {
7
+ include: "#comments"
8
+ },
9
+ {
10
+ include: "#strings"
11
+ },
12
+ {
13
+ include: "#decorators"
14
+ },
15
+ {
16
+ include: "#domain"
17
+ },
18
+ {
19
+ include: "#imports"
20
+ },
21
+ {
22
+ include: "#entries"
23
+ },
24
+ {
25
+ include: "#members"
26
+ },
27
+ {
28
+ include: "#method-output"
29
+ },
30
+ {
31
+ include: "#methods"
32
+ },
33
+ {
34
+ include: "#keywords"
35
+ },
36
+ {
37
+ include: "#scalars"
38
+ },
39
+ {
40
+ include: "#type-references"
41
+ },
42
+ {
43
+ include: "#operators"
44
+ }
45
+ ],
46
+ repository: {
47
+ comments: {
48
+ patterns: [
49
+ {
50
+ name: "comment.line.double-slash.skel",
51
+ match: "//.*$"
52
+ },
53
+ {
54
+ name: "comment.block.skel",
55
+ begin: "/\\*",
56
+ end: "\\*/"
57
+ }
58
+ ]
59
+ },
60
+ strings: {
61
+ patterns: [
62
+ {
63
+ name: "string.quoted.triple.skel",
64
+ begin: '"""',
65
+ end: '"""',
66
+ patterns: [
67
+ {
68
+ name: "constant.character.escape.skel",
69
+ match: "\\\\."
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ name: "string.quoted.double.skel",
75
+ begin: '"',
76
+ end: '"',
77
+ patterns: [
78
+ {
79
+ name: "constant.character.escape.skel",
80
+ match: "\\\\."
81
+ }
82
+ ]
83
+ }
84
+ ]
85
+ },
86
+ decorators: {
87
+ patterns: [
88
+ {
89
+ name: "meta.annotation.skel",
90
+ match: "(@)([A-Za-z_][A-Za-z0-9_]*)",
91
+ captures: {
92
+ "1": {
93
+ name: "punctuation.definition.annotation.skel"
94
+ },
95
+ "2": {
96
+ name: "entity.name.function.decorator.skel"
97
+ }
98
+ }
99
+ }
100
+ ]
101
+ },
102
+ domain: {
103
+ patterns: [
104
+ {
105
+ name: "meta.domain.skel",
106
+ match: "^\\s*(domain)\\s+([A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*)",
107
+ captures: {
108
+ "1": {
109
+ name: "keyword.declaration.domain.skel"
110
+ },
111
+ "2": {
112
+ name: "entity.name.namespace.skel"
113
+ }
114
+ }
115
+ }
116
+ ]
117
+ },
118
+ imports: {
119
+ patterns: [
120
+ {
121
+ name: "meta.import.skel",
122
+ match: "^\\s*(import)\\s+([A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*)(?:\\s+(as)\\s+([A-Za-z_][A-Za-z0-9_]*))?",
123
+ captures: {
124
+ "1": {
125
+ name: "keyword.control.import.skel"
126
+ },
127
+ "2": {
128
+ name: "entity.name.namespace.skel"
129
+ },
130
+ "3": {
131
+ name: "keyword.control.as.skel"
132
+ },
133
+ "4": {
134
+ name: "variable.other.alias.skel"
135
+ }
136
+ }
137
+ }
138
+ ]
139
+ },
140
+ entries: {
141
+ patterns: [
142
+ {
143
+ name: "meta.definition.skel",
144
+ match: "^\\s*(?:(pub)\\s+)?(enum|data|config|actor|resource|service|web|event|task)\\s+([A-Za-z_][A-Za-z0-9_]*)",
145
+ captures: {
146
+ "1": {
147
+ name: "storage.modifier.public.skel"
148
+ },
149
+ "2": {
150
+ name: "keyword.declaration.skel"
151
+ },
152
+ "3": {
153
+ name: "entity.name.type.skel"
154
+ }
155
+ }
156
+ },
157
+ {
158
+ name: "meta.resource-check.skel",
159
+ match: "^\\s*(check)\\s+([A-Za-z_][A-Za-z0-9_]*)",
160
+ captures: {
161
+ "1": {
162
+ name: "keyword.declaration.check.skel"
163
+ },
164
+ "2": {
165
+ name: "entity.name.function.check.skel"
166
+ }
167
+ }
168
+ },
169
+ {
170
+ name: "meta.resource-action.skel",
171
+ match: "^\\s*(action)\\s+([A-Za-z_][A-Za-z0-9_]*)",
172
+ captures: {
173
+ "1": {
174
+ name: "keyword.declaration.action.skel"
175
+ },
176
+ "2": {
177
+ name: "entity.name.function.action.skel"
178
+ }
179
+ }
180
+ },
181
+ {
182
+ name: "meta.actor-access.skel",
183
+ match: "\\b(via)\\s+([A-Za-z_][A-Za-z0-9_]*)",
184
+ captures: {
185
+ "1": {
186
+ name: "keyword.declaration.via.skel"
187
+ },
188
+ "2": {
189
+ name: "constant.language.actor-via.skel"
190
+ }
191
+ }
192
+ }
193
+ ]
194
+ },
195
+ members: {
196
+ patterns: [
197
+ {
198
+ name: "meta.member.skel",
199
+ match: "^\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*(:)\\s*([A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)?)",
200
+ captures: {
201
+ "1": {
202
+ name: "variable.other.member.skel"
203
+ },
204
+ "2": {
205
+ name: "punctuation.separator.key-value.skel"
206
+ },
207
+ "3": {
208
+ name: "support.type.skel"
209
+ }
210
+ }
211
+ },
212
+ {
213
+ name: "meta.method-output.skel",
214
+ match: "\\b(output)\\s*([A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)?)",
215
+ captures: {
216
+ "1": {
217
+ name: "keyword.control.output.skel"
218
+ },
219
+ "2": {
220
+ name: "support.type.skel"
221
+ }
222
+ }
223
+ }
224
+ ]
225
+ },
226
+ "method-output": {
227
+ patterns: [
228
+ {
229
+ name: "meta.method-auth.skel",
230
+ match: "\\b(auth|noauth)\\b",
231
+ captures: {
232
+ "1": {
233
+ name: "keyword.control.auth.skel"
234
+ }
235
+ }
236
+ },
237
+ {
238
+ name: "meta.method-require.skel",
239
+ match: "\\b(require)\\s+",
240
+ captures: {
241
+ "1": {
242
+ name: "keyword.control.require.skel"
243
+ }
244
+ }
245
+ },
246
+ {
247
+ name: "keyword.control.require-mode.skel",
248
+ match: "\\b(all|any)\\b(?=\\s*\\()"
249
+ },
250
+ {
251
+ name: "meta.permission-target.skel",
252
+ match: "\\b([A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)?)(:)([A-Za-z_][A-Za-z0-9_]*)(?:(:)([A-Za-z_][A-Za-z0-9_]*))?",
253
+ captures: {
254
+ "1": {
255
+ name: "entity.name.type.resource.skel"
256
+ },
257
+ "2": {
258
+ name: "punctuation.separator.permission.skel"
259
+ },
260
+ "3": {
261
+ name: "entity.name.function.action.skel"
262
+ },
263
+ "4": {
264
+ name: "punctuation.separator.permission.skel"
265
+ },
266
+ "5": {
267
+ name: "entity.name.function.check.skel"
268
+ }
269
+ }
270
+ },
271
+ {
272
+ name: "meta.method-output.skel",
273
+ match: "\\b(output)(\\s*)",
274
+ captures: {
275
+ "1": {
276
+ name: "keyword.control.output.skel"
277
+ }
278
+ }
279
+ }
280
+ ]
281
+ },
282
+ methods: {
283
+ patterns: [
284
+ {
285
+ name: "meta.method.skel",
286
+ match: "^\\s*(method)\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*(?=\\{)",
287
+ captures: {
288
+ "1": {
289
+ name: "keyword.declaration.method.skel"
290
+ },
291
+ "2": {
292
+ name: "entity.name.function.method.skel"
293
+ }
294
+ }
295
+ }
296
+ ]
297
+ },
298
+ "type-references": {
299
+ patterns: [
300
+ {
301
+ name: "entity.name.type.reference.skel",
302
+ match: "\\b[A-Z][A-Za-z0-9_]*\\b"
303
+ }
304
+ ]
305
+ },
306
+ keywords: {
307
+ patterns: [
308
+ {
309
+ name: "keyword.control.skel",
310
+ match: "\\b(pub|domain|import|as|via|for|auth|noauth|permission|credential|info|method|require|trigger|input|output|payload|resource|action|check|all|any|client|agent|openapi|eternal|instant)\\b"
311
+ }
312
+ ]
313
+ },
314
+ scalars: {
315
+ patterns: [
316
+ {
317
+ name: "support.type.builtin.skel",
318
+ match: "\\b(int|float|bool|string|decimal|binary|timestamp|duration|localdate|localtime|localdatetime|uuid|json|PermissionCode|list|map)\\b"
319
+ }
320
+ ]
321
+ },
322
+ operators: {
323
+ patterns: [
324
+ {
325
+ name: "keyword.operator.nullable.skel",
326
+ match: "\\?"
327
+ },
328
+ {
329
+ name: "punctuation.separator.skel",
330
+ match: "[,.:;]"
331
+ },
332
+ {
333
+ name: "punctuation.bracket.skel",
334
+ match: "[{}()<>\\[\\]]"
335
+ }
336
+ ]
337
+ }
338
+ }
339
+ };
340
+
341
+ // src/starry-night.js
342
+ var skelStarryNight = Object.freeze({
343
+ ...skel_tmLanguage_default,
344
+ names: ["skel"],
345
+ extensions: [".skel"]
346
+ });
347
+ var starry_night_default = skelStarryNight;
348
+ export {
349
+ starry_night_default as default,
350
+ skelStarryNight
351
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorun-ai/skel-highlight",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Syntax highlighting definitions for the Skel contract language.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -9,19 +9,28 @@
9
9
  "url": "https://github.com/yorun-ai/skel-editor-support.git",
10
10
  "directory": "packages/highlight"
11
11
  },
12
- "homepage": "https://github.com/yorun-ai/skel-editor-support#shiki",
12
+ "homepage": "https://github.com/yorun-ai/skel-editor-support#syntax-highlighting",
13
13
  "bugs": {
14
14
  "url": "https://github.com/yorun-ai/skel-editor-support/issues"
15
15
  },
16
16
  "keywords": [
17
17
  "skel",
18
18
  "shiki",
19
+ "prismjs",
20
+ "highlight.js",
21
+ "monaco-editor",
22
+ "codemirror",
19
23
  "syntax-highlighting",
20
24
  "textmate"
21
25
  ],
22
26
  "files": [
23
27
  "dist",
24
28
  "src/index.d.ts",
29
+ "src/prism.d.ts",
30
+ "src/highlightjs.d.ts",
31
+ "src/monaco.d.ts",
32
+ "src/starry-night.d.ts",
33
+ "src/codemirror.d.ts",
25
34
  "src/skel.tmLanguage.json",
26
35
  "LICENSE",
27
36
  "README.md"
@@ -35,6 +44,26 @@
35
44
  "types": "./src/index.d.ts",
36
45
  "default": "./dist/index.js"
37
46
  },
47
+ "./prism": {
48
+ "types": "./src/prism.d.ts",
49
+ "default": "./dist/prism.js"
50
+ },
51
+ "./highlightjs": {
52
+ "types": "./src/highlightjs.d.ts",
53
+ "default": "./dist/highlightjs.js"
54
+ },
55
+ "./monaco": {
56
+ "types": "./src/monaco.d.ts",
57
+ "default": "./dist/monaco.js"
58
+ },
59
+ "./starry-night": {
60
+ "types": "./src/starry-night.d.ts",
61
+ "default": "./dist/starry-night.js"
62
+ },
63
+ "./codemirror": {
64
+ "types": "./src/codemirror.d.ts",
65
+ "default": "./dist/codemirror.js"
66
+ },
38
67
  "./textmate": "./src/skel.tmLanguage.json"
39
68
  },
40
69
  "types": "./src/index.d.ts",
@@ -44,20 +73,54 @@
44
73
  "node": ">=20"
45
74
  },
46
75
  "peerDependencies": {
76
+ "@codemirror/language": "^6.12.4",
77
+ "@wooorm/starry-night": "^3.10.0",
78
+ "highlight.js": "^11.11.1",
79
+ "monaco-editor": "^0.56.0",
80
+ "prismjs": "^1.30.0",
47
81
  "shiki": "^4.3.1"
48
82
  },
83
+ "peerDependenciesMeta": {
84
+ "@codemirror/language": {
85
+ "optional": true
86
+ },
87
+ "@wooorm/starry-night": {
88
+ "optional": true
89
+ },
90
+ "highlight.js": {
91
+ "optional": true
92
+ },
93
+ "monaco-editor": {
94
+ "optional": true
95
+ },
96
+ "prismjs": {
97
+ "optional": true
98
+ },
99
+ "shiki": {
100
+ "optional": true
101
+ }
102
+ },
49
103
  "publishConfig": {
50
104
  "access": "public"
51
105
  },
52
106
  "scripts": {
53
- "build": "node ../../scripts/prepare-assets.js && esbuild ./src/index.js --bundle --format=esm --platform=neutral --outfile=./dist/index.js",
107
+ "build": "node ../../scripts/prepare-assets.js && esbuild ./src/index.js ./src/prism.js ./src/highlightjs.js ./src/monaco.js ./src/starry-night.js ./src/codemirror.js --bundle --format=esm --platform=neutral --packages=external --outdir=./dist",
54
108
  "check": "npm run build && npm test && npm run typecheck",
55
109
  "prepack": "npm run build",
56
110
  "test": "node --test ./test/*.test.js ./test/*.test.cjs",
57
111
  "typecheck": "tsc --noEmit"
58
112
  },
59
113
  "devDependencies": {
114
+ "@codemirror/language": "6.12.4",
115
+ "@lezer/highlight": "1.2.3",
116
+ "@types/prismjs": "1.26.6",
117
+ "@wooorm/starry-night": "3.10.0",
60
118
  "esbuild": "^0.28.1",
119
+ "highlight.js": "11.11.1",
120
+ "lowlight": "3.3.0",
121
+ "monaco-editor": "0.56.0",
122
+ "prismjs": "1.30.0",
123
+ "refractor": "5.0.0",
61
124
  "shiki": "4.3.1",
62
125
  "typescript": "^7.0.2",
63
126
  "vscode-oniguruma": "^2.0.1",
@@ -0,0 +1,11 @@
1
+ import type { LanguageSupport, StreamLanguage, StreamParser } from "@codemirror/language";
2
+
3
+ type SkelState = {
4
+ blockComment: boolean;
5
+ tripleString: boolean;
6
+ };
7
+
8
+ export declare const skelStreamParser: StreamParser<SkelState>;
9
+ export declare const skelLanguage: StreamLanguage<SkelState>;
10
+ export declare function skel(): LanguageSupport;
11
+ export default skel;
@@ -0,0 +1,4 @@
1
+ import type { LanguageFn } from "highlight.js";
2
+
3
+ export declare const skelHighlightJs: LanguageFn;
4
+ export default skelHighlightJs;
@@ -0,0 +1,6 @@
1
+ import type * as Monaco from "monaco-editor";
2
+
3
+ export declare const skelLanguageConfiguration: Monaco.languages.LanguageConfiguration;
4
+ export declare const skelMonarch: Monaco.languages.IMonarchLanguage;
5
+ export declare function registerSkelMonaco(monaco: typeof Monaco): void;
6
+ export default skelMonarch;
package/src/prism.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import type Prism from "prismjs";
2
+
3
+ export declare const skelPrism: Prism.Grammar;
4
+ export declare const registerSkelPrism: ((prism: typeof Prism) => Prism.Grammar) & {
5
+ displayName: "skel";
6
+ aliases: string[];
7
+ };
8
+ export default skelPrism;
@@ -185,7 +185,7 @@
185
185
  "name": "keyword.declaration.via.skel"
186
186
  },
187
187
  "2": {
188
- "name": "entity.name.function.skel"
188
+ "name": "constant.language.actor-via.skel"
189
189
  }
190
190
  }
191
191
  }
@@ -306,7 +306,7 @@
306
306
  "patterns": [
307
307
  {
308
308
  "name": "keyword.control.skel",
309
- "match": "\\b(pub|domain|import|as|via|for|auth|noauth|permission|credential|info|method|require|trigger|input|output|payload|resource|action|check|all|any)\\b"
309
+ "match": "\\b(pub|domain|import|as|via|for|auth|noauth|permission|credential|info|method|require|trigger|input|output|payload|resource|action|check|all|any|client|agent|openapi|eternal|instant)\\b"
310
310
  }
311
311
  ]
312
312
  },
@@ -0,0 +1,4 @@
1
+ import type { Grammar } from "@wooorm/starry-night";
2
+
3
+ export declare const skelStarryNight: Grammar;
4
+ export default skelStarryNight;