@vscode/tree-sitter-wasm 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/tree-sitter-wasm",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Pre-built WASM files for Tree-Sitter and Tree-Sitter languages that VS Code uses",
5
5
  "scripts": {
6
6
  "build-wasm": "ts-node ./build/main.ts",
@@ -6,28 +6,18 @@
6
6
 
7
7
  // Helper to replace import.meta.url
8
8
  function getCurrentScriptUrl() {
9
- // Node.js environment
10
- if (typeof process !== 'undefined' && process.versions && process.versions.node) {
11
- return require('url').pathToFileURL(__filename).href;
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
- // AMD environment
20
- if (typeof define === 'function' && define.amd) {
21
- let scriptUrl;
22
- define('__temp', [], function() {
23
- scriptUrl = module.uri;
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
- throw new Error('Unable to determine script URL');
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?: EmscriptenModule): Promise<void>;
136
+ static init(moduleOptions?: { locateFile: (_file: string, _folder: string) => string; }): Promise<void>;
137
137
  /**
138
138
  * Create a new parser.
139
139
  */