@vscode/tree-sitter-wasm 0.1.0 → 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/package.json +1 -1
- package/wasm/tree-sitter.js +10 -20
- package/wasm/web-tree-sitter.d.ts +1 -1
package/package.json
CHANGED
package/wasm/tree-sitter.js
CHANGED
@@ -6,28 +6,18 @@
|
|
6
6
|
|
7
7
|
// Helper to replace import.meta.url
|
8
8
|
function getCurrentScriptUrl() {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
// Browser environment
|
15
|
-
if (typeof document !== 'undefined' && document.currentScript) {
|
16
|
-
return document.currentScript.src;
|
17
|
-
}
|
9
|
+
if (typeof __filename !== 'undefined') {
|
10
|
+
// Node.js environment
|
11
|
+
return require('url').pathToFileURL(__filename).href;
|
12
|
+
}
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
define('__temp', null);
|
25
|
-
});
|
26
|
-
require(['__temp']);
|
27
|
-
return scriptUrl;
|
28
|
-
}
|
14
|
+
if (typeof document !== 'undefined') {
|
15
|
+
// Browser environment
|
16
|
+
const script = document.currentScript;
|
17
|
+
return script ? script.src : undefined;
|
18
|
+
}
|
29
19
|
|
30
|
-
|
20
|
+
throw new Error('Unable to determine script URL');
|
31
21
|
}
|
32
22
|
|
33
23
|
var __defProp = Object.defineProperty;
|
@@ -133,7 +133,7 @@
|
|
133
133
|
* You can optionally pass in options to configure the WASM module, the most common
|
134
134
|
* one being `locateFile` to help the module find the `.wasm` file.
|
135
135
|
*/
|
136
|
-
static init(moduleOptions?:
|
136
|
+
static init(moduleOptions?: { locateFile: (_file: string, _folder: string) => string; }): Promise<void>;
|
137
137
|
/**
|
138
138
|
* Create a new parser.
|
139
139
|
*/
|