wesl-fetch 0.0.9 → 0.0.10

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
@@ -405,6 +405,7 @@ async function fetchDependencies(rootModuleSource, options) {
405
405
  const shaderRoot = options?.shaderRoot ?? "/shaders";
406
406
  const currentPath = options?.currentPath;
407
407
  const existingSources = options?.existingSources;
408
+ const skipExternal = options?.skipExternal ?? false;
408
409
  const rootModuleName = currentPath ? urlToModulePath(currentPath, shaderRoot) : "package::main";
409
410
  const resolver = new FetchingResolver({
410
411
  ...existingSources,
@@ -421,8 +422,11 @@ async function fetchDependencies(rootModuleSource, options) {
421
422
  if (unresolved.length === 0) break;
422
423
  const [internal, external] = partition(unresolved, isInternal);
423
424
  await Promise.all(internal.map((p) => resolver.resolveModuleAsync(p)));
424
- const newLibs = await fetchExternalBundles(external, fetched);
425
- libs.push(...newLibs);
425
+ if (skipExternal) for (const p of external) fetched.add(p.split("::")[0]);
426
+ else {
427
+ const newLibs = await fetchExternalBundles(external, fetched);
428
+ libs.push(...newLibs);
429
+ }
426
430
  }
427
431
  return {
428
432
  libs,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wesl-fetch",
3
3
  "description": "Browser-based HTTP fetching for WESL packages from npm",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "type": "module",
6
6
  "repository": "github:wgsl-tooling-wg/wesl-js",
7
7
  "exports": {
@@ -11,7 +11,7 @@
11
11
  "fflate": "^0.8.2",
12
12
  "nanotar": "^0.2.0",
13
13
  "resolve.exports": "^2.0.3",
14
- "wesl": "0.7.21"
14
+ "wesl": "0.7.22"
15
15
  },
16
16
  "scripts": {
17
17
  "build": "tsdown",
@@ -47,6 +47,8 @@ export interface FetchOptions {
47
47
  currentPath?: string;
48
48
  /** Pre-existing sources to include. */
49
49
  existingSources?: Record<string, string>;
50
+ /** Skip fetching external packages from npm (default: false). */
51
+ skipExternal?: boolean;
50
52
  }
51
53
 
52
54
  const virtualModules = ["constants", "test"];
@@ -59,6 +61,7 @@ export async function fetchDependencies(
59
61
  const shaderRoot = options?.shaderRoot ?? "/shaders";
60
62
  const currentPath = options?.currentPath;
61
63
  const existingSources = options?.existingSources;
64
+ const skipExternal = options?.skipExternal ?? false;
62
65
 
63
66
  const rootModuleName = currentPath
64
67
  ? urlToModulePath(currentPath, shaderRoot)
@@ -83,8 +86,12 @@ export async function fetchDependencies(
83
86
  const [internal, external] = partition(unresolved, isInternal);
84
87
  await Promise.all(internal.map(p => resolver.resolveModuleAsync(p)));
85
88
 
86
- const newLibs = await fetchExternalBundles(external, fetched);
87
- libs.push(...newLibs);
89
+ if (skipExternal) {
90
+ for (const p of external) fetched.add(p.split("::")[0]);
91
+ } else {
92
+ const newLibs = await fetchExternalBundles(external, fetched);
93
+ libs.push(...newLibs);
94
+ }
88
95
  }
89
96
 
90
97
  const weslSrc = extractWeslSrc(resolver);