@singapore-editor/tree-sitter-languages 0.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.
- package/NOTICE +515 -0
- package/README.md +127 -0
- package/dist/catalog.generated.d.ts +3 -0
- package/dist/catalog.generated.d.ts.map +1 -0
- package/dist/catalog.generated.js +493 -0
- package/dist/catalog.generated.js.map +1 -0
- package/dist/grammars/tree-sitter-astro.js +6 -0
- package/dist/grammars/tree-sitter-astro.js.map +1 -0
- package/dist/grammars/tree-sitter-mdx.js +6 -0
- package/dist/grammars/tree-sitter-mdx.js.map +1 -0
- package/dist/grammars/tree-sitter-sql.js +6 -0
- package/dist/grammars/tree-sitter-sql.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +138 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata.d.ts +278 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +335 -0
- package/dist/metadata.js.map +1 -0
- package/dist/queries/astro-folds.js +6 -0
- package/dist/queries/astro-folds.js.map +1 -0
- package/dist/queries/astro-highlights.js +6 -0
- package/dist/queries/astro-highlights.js.map +1 -0
- package/dist/queries/astro-injections.js +6 -0
- package/dist/queries/astro-injections.js.map +1 -0
- package/dist/queries/css-folds.js +6 -0
- package/dist/queries/css-folds.js.map +1 -0
- package/dist/queries/html-folds.js +6 -0
- package/dist/queries/html-folds.js.map +1 -0
- package/dist/queries/javascript-folds.js +6 -0
- package/dist/queries/javascript-folds.js.map +1 -0
- package/dist/queries/javascript-highlights.js +6 -0
- package/dist/queries/javascript-highlights.js.map +1 -0
- package/dist/queries/javascript-injections.js +6 -0
- package/dist/queries/javascript-injections.js.map +1 -0
- package/dist/queries/json-folds.js +6 -0
- package/dist/queries/json-folds.js.map +1 -0
- package/dist/queries/jsx-folds.js +6 -0
- package/dist/queries/jsx-folds.js.map +1 -0
- package/dist/queries/mdx-highlights.js +6 -0
- package/dist/queries/mdx-highlights.js.map +1 -0
- package/dist/queries/mdx-injections.js +6 -0
- package/dist/queries/mdx-injections.js.map +1 -0
- package/dist/queries/sql-highlights.js +6 -0
- package/dist/queries/sql-highlights.js.map +1 -0
- package/dist/queries/svelte-injections.js +6 -0
- package/dist/queries/svelte-injections.js.map +1 -0
- package/dist/queries/typescript-folds.js +6 -0
- package/dist/queries/typescript-folds.js.map +1 -0
- package/dist/queries/typescript-highlights.js +6 -0
- package/dist/queries/typescript-highlights.js.map +1 -0
- package/dist/query-captures.d.ts +2 -0
- package/dist/query-captures.d.ts.map +1 -0
- package/dist/query-captures.js +12 -0
- package/dist/query-captures.js.map +1 -0
- package/package.json +77 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { EditorPlugin } from '@singapore-editor/core/extensions';
|
|
2
|
+
import type { TreeSitterLanguageContribution, TreeSitterLanguagePluginOptions } from '@singapore-editor/tree-sitter';
|
|
3
|
+
export type JavaScriptTreeSitterLanguageOptions = TreeSitterLanguagePluginOptions & {
|
|
4
|
+
readonly jsx?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type TypeScriptTreeSitterLanguageOptions = TreeSitterLanguagePluginOptions & {
|
|
7
|
+
readonly tsx?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const JAVASCRIPT_TREE_SITTER_LANGUAGE: TreeSitterLanguageContribution;
|
|
10
|
+
export declare const TYPESCRIPT_TREE_SITTER_LANGUAGE: TreeSitterLanguageContribution;
|
|
11
|
+
export { TREE_SITTER_LANGUAGE_CONTRIBUTIONS } from './catalog.generated';
|
|
12
|
+
export { TREE_SITTER_LANGUAGE_METADATA } from './metadata';
|
|
13
|
+
export declare const TSX_TREE_SITTER_LANGUAGE: TreeSitterLanguageContribution;
|
|
14
|
+
export declare const HTML_TREE_SITTER_LANGUAGE: TreeSitterLanguageContribution;
|
|
15
|
+
export declare const CSS_TREE_SITTER_LANGUAGE: TreeSitterLanguageContribution;
|
|
16
|
+
export declare const JSON_TREE_SITTER_LANGUAGE: TreeSitterLanguageContribution;
|
|
17
|
+
export declare const MARKDOWN_TREE_SITTER_LANGUAGE: TreeSitterLanguageContribution;
|
|
18
|
+
export declare const ASTRO_TREE_SITTER_LANGUAGE: TreeSitterLanguageContribution;
|
|
19
|
+
export declare function javaScript(options?: JavaScriptTreeSitterLanguageOptions): EditorPlugin;
|
|
20
|
+
export declare function typeScript(options?: TypeScriptTreeSitterLanguageOptions): EditorPlugin;
|
|
21
|
+
export declare function html(options?: TreeSitterLanguagePluginOptions): EditorPlugin;
|
|
22
|
+
export declare function css(options?: TreeSitterLanguagePluginOptions): EditorPlugin;
|
|
23
|
+
export declare function json(options?: TreeSitterLanguagePluginOptions): EditorPlugin;
|
|
24
|
+
export declare function markdown(options?: TreeSitterLanguagePluginOptions): EditorPlugin;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,KAAK,EAEV,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,+BAA+B,CAAA;AAItC,MAAM,MAAM,mCAAmC,GAAG,+BAA+B,GAAG;IAClF,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,mCAAmC,GAAG,+BAA+B,GAAG;IAClF,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,+BAA+B,gCAAsC,CAAA;AAElF,eAAO,MAAM,+BAA+B,gCAAsC,CAAA;AAElF,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAA;AAE1D,eAAO,MAAM,wBAAwB,gCAAsB,CAAA;AAC3D,eAAO,MAAM,yBAAyB,gCAAuB,CAAA;AAC7D,eAAO,MAAM,wBAAwB,gCAAsB,CAAA;AAC3D,eAAO,MAAM,yBAAyB,gCAAuB,CAAA;AAC7D,eAAO,MAAM,6BAA6B,gCAA2B,CAAA;AACrE,eAAO,MAAM,0BAA0B,gCAAwB,CAAA;AAM/D,wBAAgB,UAAU,CAAC,OAAO,GAAE,mCAAwC,GAAG,YAAY,CAO1F;AAED,wBAAgB,UAAU,CAAC,OAAO,GAAE,mCAAwC,GAAG,YAAY,CAO1F;AAED,wBAAgB,IAAI,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,YAAY,CAE5E;AAED,wBAAgB,GAAG,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,YAAY,CAE3E;AAED,wBAAgB,IAAI,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,YAAY,CAE5E;AAED,wBAAgB,QAAQ,CAAC,OAAO,GAAE,+BAAoC,GAAG,YAAY,CAKpF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { TREE_SITTER_LANGUAGE_CONTRIBUTIONS } from "./catalog.generated.js";
|
|
2
|
+
import { TREE_SITTER_LANGUAGE_METADATA } from "./metadata.js";
|
|
3
|
+
import { createTreeSitterLanguagePlugin } from "@singapore-editor/tree-sitter";
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
var JAVASCRIPT_TREE_SITTER_LANGUAGE = createJavaScriptContribution(false);
|
|
6
|
+
var TYPESCRIPT_TREE_SITTER_LANGUAGE = createTypeScriptContribution(false);
|
|
7
|
+
var TSX_TREE_SITTER_LANGUAGE = contribution("tsx");
|
|
8
|
+
var HTML_TREE_SITTER_LANGUAGE = contribution("html");
|
|
9
|
+
var CSS_TREE_SITTER_LANGUAGE = contribution("css");
|
|
10
|
+
var JSON_TREE_SITTER_LANGUAGE = contribution("json");
|
|
11
|
+
var MARKDOWN_TREE_SITTER_LANGUAGE = contribution("markdown");
|
|
12
|
+
var ASTRO_TREE_SITTER_LANGUAGE = contribution("astro");
|
|
13
|
+
function contribution(id) {
|
|
14
|
+
return TREE_SITTER_LANGUAGE_CONTRIBUTIONS.find((language) => language.id === id);
|
|
15
|
+
}
|
|
16
|
+
function javaScript(options = {}) {
|
|
17
|
+
const { jsx = false, ...pluginOptions } = options;
|
|
18
|
+
return createLanguagePlugin(createJavaScriptContribution(jsx), "tree-sitter-javascript", pluginOptions);
|
|
19
|
+
}
|
|
20
|
+
function typeScript(options = {}) {
|
|
21
|
+
const { tsx = false, ...pluginOptions } = options;
|
|
22
|
+
return createLanguagePlugin(createTypeScriptContribution(tsx), "tree-sitter-typescript", pluginOptions);
|
|
23
|
+
}
|
|
24
|
+
function html(options) {
|
|
25
|
+
return createLanguagePlugin(HTML_TREE_SITTER_LANGUAGE, "tree-sitter-html", options);
|
|
26
|
+
}
|
|
27
|
+
function css(options) {
|
|
28
|
+
return createLanguagePlugin(CSS_TREE_SITTER_LANGUAGE, "tree-sitter-css", options);
|
|
29
|
+
}
|
|
30
|
+
function json(options) {
|
|
31
|
+
return createLanguagePlugin(JSON_TREE_SITTER_LANGUAGE, "tree-sitter-json", options);
|
|
32
|
+
}
|
|
33
|
+
function markdown(options = {}) {
|
|
34
|
+
return createTreeSitterLanguagePlugin([MARKDOWN_TREE_SITTER_LANGUAGE], {
|
|
35
|
+
...options,
|
|
36
|
+
name: options.name ?? "tree-sitter-markdown"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function createLanguagePlugin(contribution, name, options = {}) {
|
|
40
|
+
return createTreeSitterLanguagePlugin([contribution], {
|
|
41
|
+
...options,
|
|
42
|
+
name: options.name ?? name
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function createJavaScriptContribution(jsx) {
|
|
46
|
+
return {
|
|
47
|
+
id: "javascript",
|
|
48
|
+
extensions: jsx ? [
|
|
49
|
+
".cjs",
|
|
50
|
+
".js",
|
|
51
|
+
".jsx",
|
|
52
|
+
".mjs"
|
|
53
|
+
] : [
|
|
54
|
+
".cjs",
|
|
55
|
+
".js",
|
|
56
|
+
".mjs"
|
|
57
|
+
],
|
|
58
|
+
aliases: jsx ? [
|
|
59
|
+
"javascript",
|
|
60
|
+
"js",
|
|
61
|
+
"jsx",
|
|
62
|
+
"node"
|
|
63
|
+
] : [
|
|
64
|
+
"javascript",
|
|
65
|
+
"js",
|
|
66
|
+
"node"
|
|
67
|
+
],
|
|
68
|
+
injectionDependencies: ["regex", "jsdoc"],
|
|
69
|
+
load: () => loadJavaScriptAssets(jsx)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function createTypeScriptContribution(tsx) {
|
|
73
|
+
return {
|
|
74
|
+
id: tsx ? "tsx" : "typescript",
|
|
75
|
+
extensions: tsx ? [".tsx"] : [
|
|
76
|
+
".cts",
|
|
77
|
+
".mts",
|
|
78
|
+
".ts"
|
|
79
|
+
],
|
|
80
|
+
aliases: tsx ? ["tsx", "typescriptreact"] : ["typescript", "ts"],
|
|
81
|
+
injectionDependencies: ["regex", "jsdoc"],
|
|
82
|
+
load: () => loadTypeScriptAssets(tsx)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async function loadJavaScriptAssets(jsx) {
|
|
86
|
+
const [wasmUrl, highlightQuerySource, foldQuerySource, injectionQuerySource] = await Promise.all([
|
|
87
|
+
loadDefault(import("./node_modules/.bun/tree-sitter-javascript@0.25.0/node_modules/tree-sitter-javascript/tree-sitter-javascript.js")),
|
|
88
|
+
loadDefault(import("./queries/javascript-highlights.js")),
|
|
89
|
+
loadDefault(import("./queries/javascript-folds.js")),
|
|
90
|
+
loadDefault(import("./queries/javascript-injections.js"))
|
|
91
|
+
]);
|
|
92
|
+
if (!jsx) return {
|
|
93
|
+
wasmUrl,
|
|
94
|
+
highlightQuerySource,
|
|
95
|
+
foldQuerySource,
|
|
96
|
+
injectionQuerySource
|
|
97
|
+
};
|
|
98
|
+
const [jsxHighlightQuerySource, jsxFoldQuerySource] = await Promise.all([loadDefault(import("./node_modules/.bun/tree-sitter-javascript@0.25.0/node_modules/tree-sitter-javascript/queries/highlights-jsx.js")), loadDefault(import("./queries/jsx-folds.js"))]);
|
|
99
|
+
return {
|
|
100
|
+
wasmUrl,
|
|
101
|
+
highlightQuerySource: [highlightQuerySource, jsxHighlightQuerySource].join("\n"),
|
|
102
|
+
foldQuerySource: [foldQuerySource, jsxFoldQuerySource].join("\n"),
|
|
103
|
+
injectionQuerySource
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async function loadTypeScriptAssets(tsx) {
|
|
107
|
+
const [wasmUrl, tsHighlightQuerySource, jsHighlightQuerySource, tsFoldQuerySource, jsFoldQuerySource, injectionQuerySource] = await Promise.all([
|
|
108
|
+
loadDefault(tsx ? import("./node_modules/.bun/tree-sitter-typescript@0.23.2/node_modules/tree-sitter-typescript/tree-sitter-tsx.js") : import("./node_modules/.bun/tree-sitter-typescript@0.23.2/node_modules/tree-sitter-typescript/tree-sitter-typescript.js")),
|
|
109
|
+
loadDefault(import("./queries/typescript-highlights.js")),
|
|
110
|
+
loadDefault(import("./queries/javascript-highlights.js")),
|
|
111
|
+
loadDefault(import("./queries/typescript-folds.js")),
|
|
112
|
+
loadDefault(import("./queries/javascript-folds.js")),
|
|
113
|
+
loadDefault(import("./queries/javascript-injections.js"))
|
|
114
|
+
]);
|
|
115
|
+
return {
|
|
116
|
+
wasmUrl,
|
|
117
|
+
highlightQuerySource: await typeScriptHighlightQuerySource(tsx, [tsHighlightQuerySource, jsHighlightQuerySource]),
|
|
118
|
+
foldQuerySource: await typeScriptFoldQuerySource(tsx, [tsFoldQuerySource, jsFoldQuerySource]),
|
|
119
|
+
injectionQuerySource
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function typeScriptHighlightQuerySource(tsx, sources) {
|
|
123
|
+
if (!tsx) return sources.join("\n");
|
|
124
|
+
const jsxHighlightQuerySource = await loadDefault(import("./node_modules/.bun/tree-sitter-javascript@0.25.0/node_modules/tree-sitter-javascript/queries/highlights-jsx.js"));
|
|
125
|
+
return [...sources, jsxHighlightQuerySource].join("\n");
|
|
126
|
+
}
|
|
127
|
+
async function typeScriptFoldQuerySource(tsx, sources) {
|
|
128
|
+
if (!tsx) return sources.join("\n");
|
|
129
|
+
const jsxFoldQuerySource = await loadDefault(import("./queries/jsx-folds.js"));
|
|
130
|
+
return [...sources, jsxFoldQuerySource].join("\n");
|
|
131
|
+
}
|
|
132
|
+
async function loadDefault(module) {
|
|
133
|
+
return (await module).default;
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { ASTRO_TREE_SITTER_LANGUAGE, CSS_TREE_SITTER_LANGUAGE, HTML_TREE_SITTER_LANGUAGE, JAVASCRIPT_TREE_SITTER_LANGUAGE, JSON_TREE_SITTER_LANGUAGE, MARKDOWN_TREE_SITTER_LANGUAGE, TREE_SITTER_LANGUAGE_CONTRIBUTIONS, TREE_SITTER_LANGUAGE_METADATA, TSX_TREE_SITTER_LANGUAGE, TYPESCRIPT_TREE_SITTER_LANGUAGE, css, html, javaScript, json, markdown, typeScript };
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// oxlint-disable-next-line typescript-eslint/triple-slash-reference\n/// <reference path=\"./vite-assets.d.ts\" />\nimport { createTreeSitterLanguagePlugin } from '@singapore-editor/tree-sitter'\nimport type { EditorPlugin } from '@singapore-editor/core/extensions'\nimport type {\n TreeSitterLanguageAssets,\n TreeSitterLanguageContribution,\n TreeSitterLanguagePluginOptions,\n} from '@singapore-editor/tree-sitter'\n\nimport { TREE_SITTER_LANGUAGE_CONTRIBUTIONS } from './catalog.generated'\n\nexport type JavaScriptTreeSitterLanguageOptions = TreeSitterLanguagePluginOptions & {\n readonly jsx?: boolean\n}\n\nexport type TypeScriptTreeSitterLanguageOptions = TreeSitterLanguagePluginOptions & {\n readonly tsx?: boolean\n}\n\nexport const JAVASCRIPT_TREE_SITTER_LANGUAGE = createJavaScriptContribution(false)\n\nexport const TYPESCRIPT_TREE_SITTER_LANGUAGE = createTypeScriptContribution(false)\n\nexport { TREE_SITTER_LANGUAGE_CONTRIBUTIONS } from './catalog.generated'\nexport { TREE_SITTER_LANGUAGE_METADATA } from './metadata'\n\nexport const TSX_TREE_SITTER_LANGUAGE = contribution('tsx')\nexport const HTML_TREE_SITTER_LANGUAGE = contribution('html')\nexport const CSS_TREE_SITTER_LANGUAGE = contribution('css')\nexport const JSON_TREE_SITTER_LANGUAGE = contribution('json')\nexport const MARKDOWN_TREE_SITTER_LANGUAGE = contribution('markdown')\nexport const ASTRO_TREE_SITTER_LANGUAGE = contribution('astro')\n\nfunction contribution(id: string): TreeSitterLanguageContribution {\n return TREE_SITTER_LANGUAGE_CONTRIBUTIONS.find((language) => language.id === id)!\n}\n\nexport function javaScript(options: JavaScriptTreeSitterLanguageOptions = {}): EditorPlugin {\n const { jsx = false, ...pluginOptions } = options\n return createLanguagePlugin(\n createJavaScriptContribution(jsx),\n 'tree-sitter-javascript',\n pluginOptions,\n )\n}\n\nexport function typeScript(options: TypeScriptTreeSitterLanguageOptions = {}): EditorPlugin {\n const { tsx = false, ...pluginOptions } = options\n return createLanguagePlugin(\n createTypeScriptContribution(tsx),\n 'tree-sitter-typescript',\n pluginOptions,\n )\n}\n\nexport function html(options?: TreeSitterLanguagePluginOptions): EditorPlugin {\n return createLanguagePlugin(HTML_TREE_SITTER_LANGUAGE, 'tree-sitter-html', options)\n}\n\nexport function css(options?: TreeSitterLanguagePluginOptions): EditorPlugin {\n return createLanguagePlugin(CSS_TREE_SITTER_LANGUAGE, 'tree-sitter-css', options)\n}\n\nexport function json(options?: TreeSitterLanguagePluginOptions): EditorPlugin {\n return createLanguagePlugin(JSON_TREE_SITTER_LANGUAGE, 'tree-sitter-json', options)\n}\n\nexport function markdown(options: TreeSitterLanguagePluginOptions = {}): EditorPlugin {\n return createTreeSitterLanguagePlugin([MARKDOWN_TREE_SITTER_LANGUAGE], {\n ...options,\n name: options.name ?? 'tree-sitter-markdown',\n })\n}\n\nfunction createLanguagePlugin(\n contribution: TreeSitterLanguageContribution,\n name: string,\n options: TreeSitterLanguagePluginOptions = {},\n): EditorPlugin {\n return createTreeSitterLanguagePlugin([contribution], {\n ...options,\n name: options.name ?? name,\n })\n}\n\nfunction createJavaScriptContribution(jsx: boolean): TreeSitterLanguageContribution {\n return {\n id: 'javascript',\n extensions: jsx ? ['.cjs', '.js', '.jsx', '.mjs'] : ['.cjs', '.js', '.mjs'],\n aliases: jsx ? ['javascript', 'js', 'jsx', 'node'] : ['javascript', 'js', 'node'],\n injectionDependencies: ['regex', 'jsdoc'],\n load: () => loadJavaScriptAssets(jsx),\n }\n}\n\nfunction createTypeScriptContribution(tsx: boolean): TreeSitterLanguageContribution {\n return {\n id: tsx ? 'tsx' : 'typescript',\n extensions: tsx ? ['.tsx'] : ['.cts', '.mts', '.ts'],\n aliases: tsx ? ['tsx', 'typescriptreact'] : ['typescript', 'ts'],\n injectionDependencies: ['regex', 'jsdoc'],\n load: () => loadTypeScriptAssets(tsx),\n }\n}\n\nasync function loadJavaScriptAssets(jsx: boolean): Promise<TreeSitterLanguageAssets> {\n const [wasmUrl, highlightQuerySource, foldQuerySource, injectionQuerySource] = await Promise.all([\n loadDefault(import('tree-sitter-javascript/tree-sitter-javascript.wasm?url')),\n loadDefault(import('./queries/javascript-highlights.scm?raw')),\n loadDefault(import('./queries/javascript-folds.scm?raw')),\n loadDefault(import('./queries/javascript-injections.scm?raw')),\n ])\n if (!jsx) return { wasmUrl, highlightQuerySource, foldQuerySource, injectionQuerySource }\n\n const [jsxHighlightQuerySource, jsxFoldQuerySource] = await Promise.all([\n loadDefault(import('tree-sitter-javascript/queries/highlights-jsx.scm?raw')),\n loadDefault(import('./queries/jsx-folds.scm?raw')),\n ])\n return {\n wasmUrl,\n highlightQuerySource: [highlightQuerySource, jsxHighlightQuerySource].join('\\n'),\n foldQuerySource: [foldQuerySource, jsxFoldQuerySource].join('\\n'),\n injectionQuerySource,\n }\n}\n\nasync function loadTypeScriptAssets(tsx: boolean): Promise<TreeSitterLanguageAssets> {\n const [\n wasmUrl,\n tsHighlightQuerySource,\n jsHighlightQuerySource,\n tsFoldQuerySource,\n jsFoldQuerySource,\n injectionQuerySource,\n ] = await Promise.all([\n loadDefault(\n tsx\n ? import('tree-sitter-typescript/tree-sitter-tsx.wasm?url')\n : import('tree-sitter-typescript/tree-sitter-typescript.wasm?url'),\n ),\n loadDefault(import('./queries/typescript-highlights.scm?raw')),\n loadDefault(import('./queries/javascript-highlights.scm?raw')),\n loadDefault(import('./queries/typescript-folds.scm?raw')),\n loadDefault(import('./queries/javascript-folds.scm?raw')),\n loadDefault(import('./queries/javascript-injections.scm?raw')),\n ])\n const highlightQuerySource = await typeScriptHighlightQuerySource(tsx, [\n tsHighlightQuerySource,\n jsHighlightQuerySource,\n ])\n const foldQuerySource = await typeScriptFoldQuerySource(tsx, [\n tsFoldQuerySource,\n jsFoldQuerySource,\n ])\n return {\n wasmUrl,\n highlightQuerySource,\n foldQuerySource,\n injectionQuerySource,\n }\n}\n\nasync function typeScriptHighlightQuerySource(\n tsx: boolean,\n sources: readonly string[],\n): Promise<string> {\n if (!tsx) return sources.join('\\n')\n\n const jsxHighlightQuerySource = await loadDefault(\n import('tree-sitter-javascript/queries/highlights-jsx.scm?raw'),\n )\n return [...sources, jsxHighlightQuerySource].join('\\n')\n}\n\nasync function typeScriptFoldQuerySource(\n tsx: boolean,\n sources: readonly string[],\n): Promise<string> {\n if (!tsx) return sources.join('\\n')\n\n const jsxFoldQuerySource = await loadDefault(import('./queries/jsx-folds.scm?raw'))\n return [...sources, jsxFoldQuerySource].join('\\n')\n}\n\nasync function loadDefault(module: Promise<{ readonly default: string }>): Promise<string> {\n return (await module).default\n}\n"],"mappings":";;;;AAoBA,IAAa,kCAAkC,6BAA6B,KAAK;AAEjF,IAAa,k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AC/D,CAAC;CASD,OAAO;EACL;EACA,sBAAA,MAViC,+BAA+B,KAAK,CACrE,wBACA,sBACF,CAAC;EAQC,iBAAA,MAP4B,0BAA0B,KAAK,CAC3D,mBACA,iBACF,CAAC;EAKC;CACF;AACF;AAEA,eAAe,+BACb,KACA,SACiB;CACjB,IAAI,CAAC,KAAK,OAAO,QAAQ,KAAK,IAAI;CAElC,MAAM,0BAA0B,MAAM,YACpC,OAAO,kHACT;CACA,OAAO,CAAC,GAAG,SAAS,uBAAuB,CAAC,CAAC,KAAK,IAAI;AACxD;AAEA,eAAe,0BACb,KACA,SACiB;CACjB,IAAI,CAAC,KAAK,OAAO,QAAQ,KAAK,IAAI;CAElC,MAAM,qBAAqB,MAAM,YAAY,OAAO,yBAA8B;CAClF,OAAO,CAAC,GAAG,SAAS,kBAAkB,CAAC,CAAC,KAAK,IAAI;AACnD;AAEA,eAAe,YAAY,QAAgE;CACzF,QAAQ,MAAM,OAAA,CAAQ;AACxB"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
export declare const TREE_SITTER_LANGUAGE_METADATA: readonly [{
|
|
2
|
+
readonly id: "javascript";
|
|
3
|
+
readonly extensions: readonly [".cjs", ".js", ".jsx", ".mjs"];
|
|
4
|
+
readonly filenames: readonly [];
|
|
5
|
+
readonly aliases: readonly ["js", "jsx", "node"];
|
|
6
|
+
readonly injectionDependencies: readonly ["regex", "jsdoc"];
|
|
7
|
+
readonly capabilities: {
|
|
8
|
+
readonly highlighting: "partial";
|
|
9
|
+
readonly injections: "partial";
|
|
10
|
+
readonly detection: "verified";
|
|
11
|
+
readonly folds: "partial";
|
|
12
|
+
};
|
|
13
|
+
}, {
|
|
14
|
+
readonly id: "typescript";
|
|
15
|
+
readonly extensions: readonly [".cts", ".mts", ".ts"];
|
|
16
|
+
readonly filenames: readonly [];
|
|
17
|
+
readonly aliases: readonly ["ts"];
|
|
18
|
+
readonly injectionDependencies: readonly ["regex", "jsdoc"];
|
|
19
|
+
readonly capabilities: {
|
|
20
|
+
readonly highlighting: "partial";
|
|
21
|
+
readonly injections: "partial";
|
|
22
|
+
readonly detection: "verified";
|
|
23
|
+
readonly folds: "partial";
|
|
24
|
+
};
|
|
25
|
+
}, {
|
|
26
|
+
readonly id: "tsx";
|
|
27
|
+
readonly extensions: readonly [".tsx"];
|
|
28
|
+
readonly filenames: readonly [];
|
|
29
|
+
readonly aliases: readonly ["typescriptreact"];
|
|
30
|
+
readonly injectionDependencies: readonly ["regex", "jsdoc"];
|
|
31
|
+
readonly capabilities: {
|
|
32
|
+
readonly highlighting: "partial";
|
|
33
|
+
readonly injections: "partial";
|
|
34
|
+
readonly detection: "verified";
|
|
35
|
+
readonly folds: "partial";
|
|
36
|
+
};
|
|
37
|
+
}, {
|
|
38
|
+
readonly id: "html";
|
|
39
|
+
readonly extensions: readonly [".htm", ".html"];
|
|
40
|
+
readonly filenames: readonly [];
|
|
41
|
+
readonly aliases: readonly [];
|
|
42
|
+
readonly injectionDependencies: readonly ["javascript", "css"];
|
|
43
|
+
readonly capabilities: {
|
|
44
|
+
readonly highlighting: "partial";
|
|
45
|
+
readonly injections: "partial";
|
|
46
|
+
readonly detection: "verified";
|
|
47
|
+
readonly folds: "partial";
|
|
48
|
+
};
|
|
49
|
+
}, {
|
|
50
|
+
readonly id: "css";
|
|
51
|
+
readonly extensions: readonly [".css"];
|
|
52
|
+
readonly filenames: readonly [];
|
|
53
|
+
readonly aliases: readonly [];
|
|
54
|
+
readonly injectionDependencies: readonly [];
|
|
55
|
+
readonly capabilities: {
|
|
56
|
+
readonly highlighting: "partial";
|
|
57
|
+
readonly injections: "none";
|
|
58
|
+
readonly detection: "verified";
|
|
59
|
+
readonly folds: "partial";
|
|
60
|
+
};
|
|
61
|
+
}, {
|
|
62
|
+
readonly id: "json";
|
|
63
|
+
readonly extensions: readonly [".json"];
|
|
64
|
+
readonly filenames: readonly [];
|
|
65
|
+
readonly aliases: readonly [];
|
|
66
|
+
readonly injectionDependencies: readonly [];
|
|
67
|
+
readonly capabilities: {
|
|
68
|
+
readonly highlighting: "partial";
|
|
69
|
+
readonly injections: "none";
|
|
70
|
+
readonly detection: "verified";
|
|
71
|
+
readonly folds: "partial";
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
readonly id: "markdown";
|
|
75
|
+
readonly extensions: readonly [".md", ".markdown"];
|
|
76
|
+
readonly filenames: readonly [];
|
|
77
|
+
readonly aliases: readonly ["md", "gfm"];
|
|
78
|
+
readonly injectionDependencies: readonly [];
|
|
79
|
+
readonly capabilities: {
|
|
80
|
+
readonly highlighting: "partial";
|
|
81
|
+
readonly injections: "partial";
|
|
82
|
+
readonly detection: "verified";
|
|
83
|
+
readonly folds: "partial";
|
|
84
|
+
};
|
|
85
|
+
}, {
|
|
86
|
+
readonly id: "astro";
|
|
87
|
+
readonly extensions: readonly [".astro"];
|
|
88
|
+
readonly filenames: readonly [];
|
|
89
|
+
readonly aliases: readonly [];
|
|
90
|
+
readonly injectionDependencies: readonly ["typescript", "css"];
|
|
91
|
+
readonly capabilities: {
|
|
92
|
+
readonly highlighting: "partial";
|
|
93
|
+
readonly injections: "partial";
|
|
94
|
+
readonly detection: "verified";
|
|
95
|
+
readonly folds: "partial";
|
|
96
|
+
};
|
|
97
|
+
}, {
|
|
98
|
+
readonly id: "python";
|
|
99
|
+
readonly extensions: readonly [".py", ".pyi"];
|
|
100
|
+
readonly filenames: readonly [];
|
|
101
|
+
readonly aliases: readonly ["py"];
|
|
102
|
+
readonly injectionDependencies: readonly [];
|
|
103
|
+
readonly capabilities: {
|
|
104
|
+
readonly highlighting: "partial";
|
|
105
|
+
readonly injections: "none";
|
|
106
|
+
readonly detection: "verified";
|
|
107
|
+
readonly folds: "none";
|
|
108
|
+
};
|
|
109
|
+
}, {
|
|
110
|
+
readonly id: "shellscript";
|
|
111
|
+
readonly extensions: readonly [".sh", ".bash", ".zsh", ".ksh"];
|
|
112
|
+
readonly filenames: readonly [".bashrc", ".zshrc"];
|
|
113
|
+
readonly aliases: readonly ["bash", "sh", "zsh"];
|
|
114
|
+
readonly injectionDependencies: readonly [];
|
|
115
|
+
readonly capabilities: {
|
|
116
|
+
readonly highlighting: "partial";
|
|
117
|
+
readonly injections: "none";
|
|
118
|
+
readonly detection: "verified";
|
|
119
|
+
readonly folds: "none";
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
readonly id: "rust";
|
|
123
|
+
readonly extensions: readonly [".rs"];
|
|
124
|
+
readonly filenames: readonly [];
|
|
125
|
+
readonly aliases: readonly ["rs"];
|
|
126
|
+
readonly injectionDependencies: readonly [];
|
|
127
|
+
readonly capabilities: {
|
|
128
|
+
readonly highlighting: "partial";
|
|
129
|
+
readonly injections: "none";
|
|
130
|
+
readonly detection: "verified";
|
|
131
|
+
readonly folds: "none";
|
|
132
|
+
};
|
|
133
|
+
}, {
|
|
134
|
+
readonly id: "go";
|
|
135
|
+
readonly extensions: readonly [".go"];
|
|
136
|
+
readonly filenames: readonly [];
|
|
137
|
+
readonly aliases: readonly ["golang"];
|
|
138
|
+
readonly injectionDependencies: readonly [];
|
|
139
|
+
readonly capabilities: {
|
|
140
|
+
readonly highlighting: "partial";
|
|
141
|
+
readonly injections: "none";
|
|
142
|
+
readonly detection: "verified";
|
|
143
|
+
readonly folds: "none";
|
|
144
|
+
};
|
|
145
|
+
}, {
|
|
146
|
+
readonly id: "yaml";
|
|
147
|
+
readonly extensions: readonly [".yml", ".yaml"];
|
|
148
|
+
readonly filenames: readonly [];
|
|
149
|
+
readonly aliases: readonly ["yml"];
|
|
150
|
+
readonly injectionDependencies: readonly [];
|
|
151
|
+
readonly capabilities: {
|
|
152
|
+
readonly highlighting: "partial";
|
|
153
|
+
readonly injections: "none";
|
|
154
|
+
readonly detection: "verified";
|
|
155
|
+
readonly folds: "none";
|
|
156
|
+
};
|
|
157
|
+
}, {
|
|
158
|
+
readonly id: "toml";
|
|
159
|
+
readonly extensions: readonly [".toml"];
|
|
160
|
+
readonly filenames: readonly ["Cargo.lock"];
|
|
161
|
+
readonly aliases: readonly [];
|
|
162
|
+
readonly injectionDependencies: readonly [];
|
|
163
|
+
readonly capabilities: {
|
|
164
|
+
readonly highlighting: "partial";
|
|
165
|
+
readonly injections: "none";
|
|
166
|
+
readonly detection: "verified";
|
|
167
|
+
readonly folds: "none";
|
|
168
|
+
};
|
|
169
|
+
}, {
|
|
170
|
+
readonly id: "c";
|
|
171
|
+
readonly extensions: readonly [".c", ".h"];
|
|
172
|
+
readonly filenames: readonly [];
|
|
173
|
+
readonly aliases: readonly [];
|
|
174
|
+
readonly injectionDependencies: readonly [];
|
|
175
|
+
readonly capabilities: {
|
|
176
|
+
readonly highlighting: "partial";
|
|
177
|
+
readonly injections: "none";
|
|
178
|
+
readonly detection: "verified";
|
|
179
|
+
readonly folds: "none";
|
|
180
|
+
};
|
|
181
|
+
}, {
|
|
182
|
+
readonly id: "cpp";
|
|
183
|
+
readonly extensions: readonly [".cpp", ".cc", ".cxx", ".hpp", ".hh", ".hxx"];
|
|
184
|
+
readonly filenames: readonly [];
|
|
185
|
+
readonly aliases: readonly ["c++"];
|
|
186
|
+
readonly injectionDependencies: readonly [];
|
|
187
|
+
readonly capabilities: {
|
|
188
|
+
readonly highlighting: "partial";
|
|
189
|
+
readonly injections: "none";
|
|
190
|
+
readonly detection: "verified";
|
|
191
|
+
readonly folds: "none";
|
|
192
|
+
};
|
|
193
|
+
}, {
|
|
194
|
+
readonly id: "csharp";
|
|
195
|
+
readonly extensions: readonly [".cs"];
|
|
196
|
+
readonly filenames: readonly [];
|
|
197
|
+
readonly aliases: readonly ["c-sharp", "cs"];
|
|
198
|
+
readonly injectionDependencies: readonly [];
|
|
199
|
+
readonly capabilities: {
|
|
200
|
+
readonly highlighting: "partial";
|
|
201
|
+
readonly injections: "none";
|
|
202
|
+
readonly detection: "verified";
|
|
203
|
+
readonly folds: "none";
|
|
204
|
+
};
|
|
205
|
+
}, {
|
|
206
|
+
readonly id: "java";
|
|
207
|
+
readonly extensions: readonly [".java"];
|
|
208
|
+
readonly filenames: readonly [];
|
|
209
|
+
readonly aliases: readonly [];
|
|
210
|
+
readonly injectionDependencies: readonly [];
|
|
211
|
+
readonly capabilities: {
|
|
212
|
+
readonly highlighting: "partial";
|
|
213
|
+
readonly injections: "none";
|
|
214
|
+
readonly detection: "verified";
|
|
215
|
+
readonly folds: "none";
|
|
216
|
+
};
|
|
217
|
+
}, {
|
|
218
|
+
readonly id: "php";
|
|
219
|
+
readonly extensions: readonly [".php"];
|
|
220
|
+
readonly filenames: readonly [];
|
|
221
|
+
readonly aliases: readonly [];
|
|
222
|
+
readonly injectionDependencies: readonly ["phpdoc"];
|
|
223
|
+
readonly capabilities: {
|
|
224
|
+
readonly highlighting: "partial";
|
|
225
|
+
readonly injections: "partial";
|
|
226
|
+
readonly detection: "verified";
|
|
227
|
+
readonly folds: "none";
|
|
228
|
+
};
|
|
229
|
+
}, {
|
|
230
|
+
readonly id: "lua";
|
|
231
|
+
readonly extensions: readonly [".lua"];
|
|
232
|
+
readonly filenames: readonly [];
|
|
233
|
+
readonly aliases: readonly [];
|
|
234
|
+
readonly injectionDependencies: readonly ["c"];
|
|
235
|
+
readonly capabilities: {
|
|
236
|
+
readonly highlighting: "partial";
|
|
237
|
+
readonly injections: "partial";
|
|
238
|
+
readonly detection: "verified";
|
|
239
|
+
readonly folds: "none";
|
|
240
|
+
};
|
|
241
|
+
}, {
|
|
242
|
+
readonly id: "svelte";
|
|
243
|
+
readonly extensions: readonly [".svelte"];
|
|
244
|
+
readonly filenames: readonly [];
|
|
245
|
+
readonly aliases: readonly [];
|
|
246
|
+
readonly injectionDependencies: readonly ["typescript", "css"];
|
|
247
|
+
readonly capabilities: {
|
|
248
|
+
readonly highlighting: "partial";
|
|
249
|
+
readonly injections: "partial";
|
|
250
|
+
readonly detection: "verified";
|
|
251
|
+
readonly folds: "partial";
|
|
252
|
+
};
|
|
253
|
+
}, {
|
|
254
|
+
readonly id: "sql";
|
|
255
|
+
readonly extensions: readonly [".sql"];
|
|
256
|
+
readonly filenames: readonly [];
|
|
257
|
+
readonly aliases: readonly [];
|
|
258
|
+
readonly injectionDependencies: readonly [];
|
|
259
|
+
readonly capabilities: {
|
|
260
|
+
readonly highlighting: "partial";
|
|
261
|
+
readonly injections: "none";
|
|
262
|
+
readonly detection: "verified";
|
|
263
|
+
readonly folds: "none";
|
|
264
|
+
};
|
|
265
|
+
}, {
|
|
266
|
+
readonly id: "mdx";
|
|
267
|
+
readonly extensions: readonly [".mdx"];
|
|
268
|
+
readonly filenames: readonly [];
|
|
269
|
+
readonly aliases: readonly [];
|
|
270
|
+
readonly injectionDependencies: readonly ["markdown"];
|
|
271
|
+
readonly capabilities: {
|
|
272
|
+
readonly highlighting: "partial";
|
|
273
|
+
readonly injections: "partial";
|
|
274
|
+
readonly detection: "verified";
|
|
275
|
+
readonly folds: "none";
|
|
276
|
+
};
|
|
277
|
+
}];
|
|
278
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4ShC,CAAA"}
|