@kerebron/wasm 0.4.26 → 0.4.27

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/package.json CHANGED
@@ -1,21 +1,24 @@
1
1
  {
2
2
  "name": "@kerebron/wasm",
3
- "version": "0.4.26",
3
+ "version": "0.4.27",
4
4
  "description": "Mirror of https://github.com/tree-sitter-grammars and other wasm files",
5
5
  "license": "MIT",
6
- "module": "./esm/src/mod.js",
6
+ "module": "./esm/mod.js",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./esm/src/mod.js"
9
+ "import": "./esm/mod.js"
10
10
  },
11
11
  "./deno": {
12
- "import": "./esm/src/deno.js"
12
+ "import": "./esm/deno.js"
13
13
  },
14
14
  "./assets/*.css": {
15
15
  "import": "./assets/*.css"
16
16
  }
17
17
  },
18
18
  "scripts": {},
19
+ "files": [
20
+ "./assets/tree-sitter-*/*"
21
+ ],
19
22
  "devDependencies": {
20
23
  "@types/node": "^20.9.0"
21
24
  },
package/esm/package.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
package/esm/src/deno.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function denoCdn(): string;
2
- //# sourceMappingURL=deno.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deno.d.ts","sourceRoot":"","sources":["../../src/src/deno.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,WAEtB"}
package/esm/src/deno.js DELETED
@@ -1,3 +0,0 @@
1
- export function denoCdn() {
2
- return globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).resolve('../assets');
3
- }
package/esm/src/mod.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import manifest from '../wasm.js';
2
- export declare function getLangsList(): string[];
3
- export declare function getLangTreeSitter(lang: string, cdnUrl?: string): {
4
- lang: string;
5
- repo: string;
6
- files: string[];
7
- queries: any;
8
- };
9
- export declare function fetchWasm(wasmUrl: string): Promise<Uint8Array>;
10
- export declare function fetchTextResource(url: string): Promise<string>;
11
- export { manifest };
12
- //# sourceMappingURL=mod.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAMvC;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,SAAgC;;;;;EAuBvC;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAOpE;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOpE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/esm/src/mod.js DELETED
@@ -1,40 +0,0 @@
1
- import manifest from '../wasm.js';
2
- export function getLangsList() {
3
- return manifest
4
- .map((item) => item.repo.split('-').pop())
5
- .filter((item) => 'string' === typeof item);
6
- }
7
- export function getLangTreeSitter(lang, cdnUrl = 'http://localhost:8000/wasm/') {
8
- const langManifest = manifest.find((item) => item.repo.endsWith('-' + lang));
9
- if (!langManifest) {
10
- throw new Error('No grammar for: ' + lang);
11
- }
12
- if (!cdnUrl.endsWith('/')) {
13
- cdnUrl += '/';
14
- }
15
- const dir = langManifest.repo.split('/')[1];
16
- cdnUrl += dir + '/';
17
- const queries = Object.entries(langManifest.queries)
18
- .map((entry) => [entry[0], cdnUrl + entry[0]]);
19
- return {
20
- lang,
21
- repo: langManifest.repo,
22
- files: langManifest.files.map((file) => cdnUrl + file),
23
- queries: Object.fromEntries(queries),
24
- };
25
- }
26
- export async function fetchWasm(wasmUrl) {
27
- const response = await fetch(wasmUrl);
28
- if (response.status >= 400) {
29
- throw new Error(`Error fetching ${response.status}`);
30
- }
31
- return new Uint8Array(await response.arrayBuffer());
32
- }
33
- export async function fetchTextResource(url) {
34
- const responseScm = await fetch(url);
35
- if (responseScm.status >= 400) {
36
- throw new Error(`Error fetching ${responseScm.status}`);
37
- }
38
- return await responseScm.text();
39
- }
40
- export { manifest };
package/esm/wasm.d.ts DELETED
@@ -1,138 +0,0 @@
1
- declare const _default: ({
2
- repo: string;
3
- version: string;
4
- files: string[];
5
- queries: {
6
- "highlights.scm": string;
7
- "injections.scm": string;
8
- "highlights-inline.scm": string;
9
- "injections-inline.scm": string;
10
- "highlights-dtd.scm"?: undefined;
11
- "tags.scm"?: undefined;
12
- "locals.scm"?: undefined;
13
- "highlights-jsx.scm"?: undefined;
14
- "highlights-params.scm"?: undefined;
15
- };
16
- } | {
17
- repo: string;
18
- version: string;
19
- files: string[];
20
- queries: {
21
- "highlights.scm": string;
22
- "injections.scm"?: undefined;
23
- "highlights-inline.scm"?: undefined;
24
- "injections-inline.scm"?: undefined;
25
- "highlights-dtd.scm"?: undefined;
26
- "tags.scm"?: undefined;
27
- "locals.scm"?: undefined;
28
- "highlights-jsx.scm"?: undefined;
29
- "highlights-params.scm"?: undefined;
30
- };
31
- } | {
32
- repo: string;
33
- version: string;
34
- files: string[];
35
- queries: {
36
- "highlights.scm": string;
37
- "highlights-dtd.scm": string;
38
- "injections.scm"?: undefined;
39
- "highlights-inline.scm"?: undefined;
40
- "injections-inline.scm"?: undefined;
41
- "tags.scm"?: undefined;
42
- "locals.scm"?: undefined;
43
- "highlights-jsx.scm"?: undefined;
44
- "highlights-params.scm"?: undefined;
45
- };
46
- } | {
47
- repo: string;
48
- version: string;
49
- files: string[];
50
- queries: {
51
- "highlights.scm": string;
52
- "injections.scm": string;
53
- "highlights-inline.scm"?: undefined;
54
- "injections-inline.scm"?: undefined;
55
- "highlights-dtd.scm"?: undefined;
56
- "tags.scm"?: undefined;
57
- "locals.scm"?: undefined;
58
- "highlights-jsx.scm"?: undefined;
59
- "highlights-params.scm"?: undefined;
60
- };
61
- } | {
62
- repo: string;
63
- version: string;
64
- files: string[];
65
- queries: {
66
- "highlights.scm": string;
67
- "injections.scm": string;
68
- "tags.scm": string;
69
- "highlights-inline.scm"?: undefined;
70
- "injections-inline.scm"?: undefined;
71
- "highlights-dtd.scm"?: undefined;
72
- "locals.scm"?: undefined;
73
- "highlights-jsx.scm"?: undefined;
74
- "highlights-params.scm"?: undefined;
75
- };
76
- } | {
77
- repo: string;
78
- version: string;
79
- files: string[];
80
- queries: {
81
- "highlights.scm": string;
82
- "locals.scm": string;
83
- "tags.scm": string;
84
- "injections.scm"?: undefined;
85
- "highlights-inline.scm"?: undefined;
86
- "injections-inline.scm"?: undefined;
87
- "highlights-dtd.scm"?: undefined;
88
- "highlights-jsx.scm"?: undefined;
89
- "highlights-params.scm"?: undefined;
90
- };
91
- } | {
92
- repo: string;
93
- version: string;
94
- files: string[];
95
- queries: {
96
- "highlights.scm": string;
97
- "tags.scm": string;
98
- "injections.scm"?: undefined;
99
- "highlights-inline.scm"?: undefined;
100
- "injections-inline.scm"?: undefined;
101
- "highlights-dtd.scm"?: undefined;
102
- "locals.scm"?: undefined;
103
- "highlights-jsx.scm"?: undefined;
104
- "highlights-params.scm"?: undefined;
105
- };
106
- } | {
107
- repo: string;
108
- version: string;
109
- files: string[];
110
- queries: {
111
- "highlights.scm": string;
112
- "highlights-jsx.scm": string;
113
- "highlights-params.scm": string;
114
- "injections.scm": string;
115
- "locals.scm": string;
116
- "tags.scm": string;
117
- "highlights-inline.scm"?: undefined;
118
- "injections-inline.scm"?: undefined;
119
- "highlights-dtd.scm"?: undefined;
120
- };
121
- } | {
122
- repo: string;
123
- files: string[];
124
- queries: {
125
- "highlights.scm": string;
126
- "injections.scm"?: undefined;
127
- "highlights-inline.scm"?: undefined;
128
- "injections-inline.scm"?: undefined;
129
- "highlights-dtd.scm"?: undefined;
130
- "tags.scm"?: undefined;
131
- "locals.scm"?: undefined;
132
- "highlights-jsx.scm"?: undefined;
133
- "highlights-params.scm"?: undefined;
134
- };
135
- version?: undefined;
136
- })[];
137
- export default _default;
138
- //# sourceMappingURL=wasm.d.ts.map
package/esm/wasm.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.js"],"names":[],"mappings":""}
package/esm/wasm.js DELETED
@@ -1,120 +0,0 @@
1
- export default [
2
- {
3
- "repo": "tree-sitter-grammars/tree-sitter-markdown",
4
- "version": "latest",
5
- "files": ["tree-sitter-markdown.wasm", "tree-sitter-markdown_inline.wasm"],
6
- "queries": {
7
- "highlights.scm": "split_parser/tree-sitter-markdown/queries/highlights.scm",
8
- "injections.scm": "split_parser/tree-sitter-markdown/queries/injections.scm",
9
- "highlights-inline.scm": "split_parser/tree-sitter-markdown-inline/queries/highlights.scm",
10
- "injections-inline.scm": "split_parser/tree-sitter-markdown-inline/queries/injections.scm"
11
- }
12
- },
13
- {
14
- "repo": "tree-sitter-grammars/tree-sitter-diff",
15
- "version": "latest",
16
- "files": ["tree-sitter-diff.wasm"],
17
- "queries": {
18
- "highlights.scm": "main/queries/highlights.scm"
19
- }
20
- },
21
- {
22
- "repo": "tree-sitter-grammars/tree-sitter-xml",
23
- "version": "latest",
24
- "files": ["tree-sitter-xml.wasm", "tree-sitter-dtd.wasm"],
25
- "queries": {
26
- "highlights.scm": "master/queries/xml/highlights.scm",
27
- "highlights-dtd.scm": "master/queries/dtd/highlights.scm"
28
- }
29
- },
30
- {
31
- "repo": "tree-sitter/tree-sitter-html",
32
- "version": "latest",
33
- "files": ["tree-sitter-html.wasm"],
34
- "queries": {
35
- "highlights.scm": "master/queries/highlights.scm",
36
- "injections.scm": "master/queries/injections.scm"
37
- }
38
- },
39
- {
40
- "repo": "tree-sitter/tree-sitter-css",
41
- "version": "latest",
42
- "files": ["tree-sitter-css.wasm"],
43
- "queries": {
44
- "highlights.scm": "master/queries/highlights.scm"
45
- }
46
- },
47
- {
48
- "repo": "tree-sitter-grammars/tree-sitter-toml",
49
- "version": "latest",
50
- "files": ["tree-sitter-toml.wasm"],
51
- "queries": {
52
- "highlights.scm": "master/queries/highlights.scm"
53
- }
54
- },
55
- {
56
- "repo": "tree-sitter/tree-sitter-json",
57
- "version": "latest",
58
- "files": ["tree-sitter-json.wasm"],
59
- "queries": {
60
- "highlights.scm": "master/queries/highlights.scm"
61
- }
62
- },
63
- {
64
- "repo": "tree-sitter/tree-sitter-regex",
65
- "version": "latest",
66
- "files": ["tree-sitter-regex.wasm"],
67
- "queries": {
68
- "highlights.scm": "master/queries/highlights.scm"
69
- }
70
- },
71
- {
72
- "repo": "tree-sitter/tree-sitter-rust",
73
- "version": "latest",
74
- "files": ["tree-sitter-rust.wasm"],
75
- "queries": {
76
- "highlights.scm": "master/queries/highlights.scm",
77
- "injections.scm": "master/queries/injections.scm",
78
- "tags.scm": "master/queries/tags.scm"
79
- }
80
- },
81
- {
82
- "repo": "tree-sitter/tree-sitter-typescript",
83
- "version": "latest",
84
- "files": ["tree-sitter-typescript.wasm", "tree-sitter-tsx.wasm"],
85
- "queries": {
86
- "highlights.scm": "master/queries/highlights.scm",
87
- "locals.scm": "master/queries/locals.scm",
88
- "tags.scm": "master/queries/tags.scm"
89
- }
90
- },
91
- {
92
- "repo": "tree-sitter/tree-sitter-java",
93
- "version": "latest",
94
- "files": ["tree-sitter-java.wasm"],
95
- "queries": {
96
- "highlights.scm": "master/queries/highlights.scm",
97
- "tags.scm": "master/queries/tags.scm"
98
- }
99
- },
100
- {
101
- "repo": "tree-sitter/tree-sitter-javascript",
102
- "version": "latest",
103
- "files": ["tree-sitter-javascript.wasm"],
104
- "queries": {
105
- "highlights.scm": "master/queries/highlights.scm",
106
- "highlights-jsx.scm": "master/queries/highlights-jsx.scm",
107
- "highlights-params.scm": "master/queries/highlights-params.scm",
108
- "injections.scm": "master/queries/injections.scm",
109
- "locals.scm": "master/queries/locals.scm",
110
- "tags.scm": "master/queries/tags.scm"
111
- }
112
- },
113
- {
114
- "repo": "tree-sitter-grammars/tree-sitter-yaml",
115
- "files": ["tree-sitter-yaml.wasm"],
116
- "queries": {
117
- "highlights.scm": "master/queries/highlights.scm"
118
- }
119
- }
120
- ];