@kerebron/wasm 0.4.9 → 0.4.11

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.
@@ -0,0 +1,2 @@
1
+ export declare function denoCdn(): string;
2
+ //# sourceMappingURL=deno.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deno.d.ts","sourceRoot":"","sources":["../../src/src/deno.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,WAEtB"}
@@ -0,0 +1,3 @@
1
+ export function denoCdn() {
2
+ return globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).resolve('../files');
3
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/src/mod.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAIlC,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,CAWpE;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAapE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
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 CHANGED
@@ -1,6 +1,4 @@
1
- import * as dntShim from "../_dnt.shims.js";
2
1
  import manifest from '../wasm.js';
3
- const __dirname = globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).dirname;
4
2
  export function getLangsList() {
5
3
  return manifest
6
4
  .map((item) => item.repo.split('-').pop())
@@ -26,9 +24,6 @@ export function getLangTreeSitter(lang, cdnUrl = 'http://localhost:8000/wasm/')
26
24
  };
27
25
  }
28
26
  export async function fetchWasm(wasmUrl) {
29
- if ('Deno' in dntShim.dntGlobalThis) { // Test or server-side
30
- return globalThis.Deno.readFileSync(__dirname + '/../files' + wasmUrl);
31
- }
32
27
  const response = await fetch(wasmUrl);
33
28
  if (response.status >= 400) {
34
29
  throw new Error(`Error fetching ${response.status}`);
@@ -36,9 +31,6 @@ export async function fetchWasm(wasmUrl) {
36
31
  return new Uint8Array(await response.arrayBuffer());
37
32
  }
38
33
  export async function fetchTextResource(url) {
39
- if ('Deno' in dntShim.dntGlobalThis) {
40
- return new TextDecoder().decode(globalThis.Deno.readFileSync(__dirname + '/../files' + url));
41
- }
42
34
  const responseScm = await fetch(url);
43
35
  if (responseScm.status >= 400) {
44
36
  throw new Error(`Error fetching ${responseScm.status}`);
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@kerebron/wasm",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "Mirror of https://github.com/tree-sitter-grammars and other wasm files",
5
5
  "license": "MIT",
6
6
  "module": "./esm/src/mod.js",
7
7
  "exports": {
8
8
  ".": {
9
9
  "import": "./esm/src/mod.js"
10
+ },
11
+ "./deno": {
12
+ "import": "./esm/src/deno.js"
10
13
  }
11
14
  },
12
15
  "scripts": {},
@@ -1,2 +0,0 @@
1
- export declare const dntGlobalThis: Omit<typeof globalThis, never>;
2
- //# sourceMappingURL=_dnt.shims.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
package/esm/_dnt.shims.js DELETED
@@ -1,57 +0,0 @@
1
- const dntGlobals = {};
2
- export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
3
- function createMergeProxy(baseObj, extObj) {
4
- return new Proxy(baseObj, {
5
- get(_target, prop, _receiver) {
6
- if (prop in extObj) {
7
- return extObj[prop];
8
- }
9
- else {
10
- return baseObj[prop];
11
- }
12
- },
13
- set(_target, prop, value) {
14
- if (prop in extObj) {
15
- delete extObj[prop];
16
- }
17
- baseObj[prop] = value;
18
- return true;
19
- },
20
- deleteProperty(_target, prop) {
21
- let success = false;
22
- if (prop in extObj) {
23
- delete extObj[prop];
24
- success = true;
25
- }
26
- if (prop in baseObj) {
27
- delete baseObj[prop];
28
- success = true;
29
- }
30
- return success;
31
- },
32
- ownKeys(_target) {
33
- const baseKeys = Reflect.ownKeys(baseObj);
34
- const extKeys = Reflect.ownKeys(extObj);
35
- const extKeysSet = new Set(extKeys);
36
- return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
37
- },
38
- defineProperty(_target, prop, desc) {
39
- if (prop in extObj) {
40
- delete extObj[prop];
41
- }
42
- Reflect.defineProperty(baseObj, prop, desc);
43
- return true;
44
- },
45
- getOwnPropertyDescriptor(_target, prop) {
46
- if (prop in extObj) {
47
- return Reflect.getOwnPropertyDescriptor(extObj, prop);
48
- }
49
- else {
50
- return Reflect.getOwnPropertyDescriptor(baseObj, prop);
51
- }
52
- },
53
- has(_target, prop) {
54
- return prop in extObj || prop in baseObj;
55
- },
56
- });
57
- }