wesl-fetch 0.0.14 → 0.0.15

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/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
- import { gunzipSync } from "fflate";
2
- import { parseTar } from "nanotar";
1
+ import { parseTarGzip } from "nanotar";
3
2
  import { RecordResolver, fileToModulePath, findUnboundIdents, modulePartsToRelativePath, npmNameVariations, parseSrcModule, partition } from "wesl";
4
3
  import { resolve } from "resolve.exports";
5
4
  //#region src/BundleHydrator.ts
@@ -130,7 +129,7 @@ function memoAsync(fn) {
130
129
  async function fetchAndExtractTgzRaw(tgzUrl) {
131
130
  const response = await fetch(tgzUrl);
132
131
  if (!response.ok) throw new Error(`Failed to fetch package: HTTP ${response.status}`);
133
- return parseTar(gunzipSync(new Uint8Array(await response.arrayBuffer())));
132
+ return parseTarGzip(new Uint8Array(await response.arrayBuffer()));
134
133
  }
135
134
  async function npmPackageToUrlRaw(packageName) {
136
135
  const metadataUrl = `https://registry.npmjs.org/${packageName}`;
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "wesl-fetch",
3
3
  "description": "Browser-based HTTP fetching for WESL packages from npm",
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "type": "module",
6
- "repository": "github:wgsl-tooling-wg/wesl-js",
6
+ "repository": "github:webgpu-tools/wesl-js",
7
7
  "exports": {
8
8
  ".": "./src/index.ts"
9
9
  },
10
10
  "dependencies": {
11
- "fflate": "^0.8.2",
12
11
  "nanotar": "^0.2.0",
13
12
  "resolve.exports": "^2.0.3",
14
- "wesl": "0.7.26"
13
+ "wesl": "0.7.27"
15
14
  },
16
15
  "scripts": {
17
16
  "build": "tsdown",
17
+ "test": "vitest",
18
18
  "typecheck": "tsgo"
19
19
  }
20
20
  }
@@ -1,5 +1,4 @@
1
- import { gunzipSync } from "fflate";
2
- import { type ParsedTarFileItem, parseTar } from "nanotar";
1
+ import { type ParsedTarFileItem, parseTarGzip } from "nanotar";
3
2
  import type { WeslBundle } from "wesl";
4
3
  import { loadBundlesFromFiles, type WeslBundleFile } from "./BundleHydrator.ts";
5
4
 
@@ -77,9 +76,7 @@ async function fetchAndExtractTgzRaw(
77
76
  if (!response.ok) {
78
77
  throw new Error(`Failed to fetch package: HTTP ${response.status}`);
79
78
  }
80
- const gzipData = new Uint8Array(await response.arrayBuffer());
81
- const tarData = gunzipSync(gzipData);
82
- return parseTar(tarData);
79
+ return parseTarGzip(new Uint8Array(await response.arrayBuffer()));
83
80
  }
84
81
 
85
82
  async function npmPackageToUrlRaw(packageName: string): Promise<string> {
@@ -0,0 +1,14 @@
1
+ import { test } from "vitest";
2
+
3
+ // /* Live network test: fetches the real `lygia` tarball from npm and exercises
4
+ // * the full fetch + DecompressionStream + parseTar path. */
5
+ // test("fetch lygia from npm and extract bundle files", async () => {
6
+ // const files = await fetchBundleFilesFromNpm("lygia");
7
+ // expect(files.length).toBeGreaterThan(0);
8
+ // for (const f of files) {
9
+ // expect(f.packagePath).toMatch(/weslBundle\.js$/);
10
+ // expect(f.packageName).toBeTruthy();
11
+ // }
12
+ // }, 30_000);
13
+
14
+ test("skipped", () => {});
@@ -0,0 +1,8 @@
1
+ /// <reference types="vitest/config" />
2
+ import { defineConfig } from "vitest/config";
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ include: ["src/**/*.test.ts"],
7
+ },
8
+ });