wesl-plugin 0.6.9 → 0.6.16

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.
Files changed (39) hide show
  1. package/dist/PluginExtension-DlhUTOLC.d.ts +55 -0
  2. package/dist/{WeslPlugin-DMbyxIJT.js → WeslPlugin-C5v2QWgI.js} +4167 -279
  3. package/dist/WeslPluginOptions-BXvD7dWh.d.ts +9 -0
  4. package/dist/import-meta-resolve-CUFqnZwT.js +1232 -0
  5. package/dist/pluginIndex.d.ts +1 -4
  6. package/dist/pluginIndex.js +18 -34
  7. package/dist/plugins/astro.d.ts +2 -2
  8. package/dist/plugins/astro.js +2 -1
  9. package/dist/plugins/esbuild.d.ts +4 -4
  10. package/dist/plugins/esbuild.js +2 -1
  11. package/dist/plugins/farm.d.ts +4 -4
  12. package/dist/plugins/farm.js +2 -1
  13. package/dist/plugins/nuxt.d.ts +4 -4
  14. package/dist/plugins/nuxt.js +4 -3
  15. package/dist/plugins/rollup.d.ts +4 -4
  16. package/dist/plugins/rollup.js +2 -1
  17. package/dist/plugins/rspack.d.ts +2 -2
  18. package/dist/plugins/rspack.js +2 -1
  19. package/dist/plugins/vite.d.ts +4 -4
  20. package/dist/plugins/vite.js +3 -2
  21. package/dist/plugins/webpack.d.ts +4 -4
  22. package/dist/plugins/webpack.js +3 -2
  23. package/dist/{vite-Zu9pr_hH.js → vite-DIETRAJZ.js} +2 -2
  24. package/dist/{webpack-x3TCDaWe.js → webpack-CKpSvDUR.js} +2 -2
  25. package/package.json +39 -41
  26. package/src/BindingLayoutExtension.ts +3 -2
  27. package/src/PluginApi.ts +31 -67
  28. package/src/PluginExtension.ts +3 -3
  29. package/src/WeslPlugin.ts +8 -33
  30. package/src/extensions/LinkExtension.ts +2 -2
  31. package/src/extensions/StaticExtension.ts +2 -2
  32. package/src/pluginIndex.ts +3 -3
  33. package/src/plugins/astro.ts +2 -3
  34. package/src/plugins/esbuild.ts +1 -1
  35. package/src/plugins/rollup.ts +1 -1
  36. package/src/plugins/rspack.ts +1 -1
  37. package/src/plugins/vite.ts +1 -1
  38. package/src/plugins/webpack.ts +1 -1
  39. package/dist/PluginExtension-B9OlwcsY.d.ts +0 -511
@@ -0,0 +1,55 @@
1
+ import { BatchModuleResolver, WeslJsPlugin } from "wesl";
2
+
3
+ //#region ../wesl-tooling/src/LoadWeslToml.d.ts
4
+ /** Configuration from wesl.toml */
5
+ interface WeslToml {
6
+ /** WESL edition (e.g. "unstable_2025") */
7
+ edition: string;
8
+ /** glob patterns to find .wesl/.wgsl files. Relative to the toml directory. */
9
+ include: string[];
10
+ /** base directory for wesl files. Relative to the toml directory. */
11
+ root: string;
12
+ /** glob patterns to exclude directories. */
13
+ exclude?: string[];
14
+ /** package manager ("npm" or "cargo") */
15
+ "package-manager"?: string;
16
+ /** names of directly referenced wesl shader packages (e.g. npm package names), or "auto" for auto-detection */
17
+ dependencies?: string[] | string;
18
+ }
19
+ /** Information about the loaded wesl.toml file and its location */
20
+ interface WeslTomlInfo {
21
+ /** The path to the toml file, relative to the cwd, undefined if no toml file */
22
+ tomlFile: string | undefined;
23
+ /** The absolute path to the directory that contains the toml.
24
+ * Paths inside the toml are relative to this. */
25
+ tomlDir: string;
26
+ /** The wesl root, relative to the projectDir.
27
+ * This lets loadModules do `path.resolve(projectDir, resolvedRoot)` */
28
+ resolvedRoot: string;
29
+ /** The underlying toml file */
30
+ toml: WeslToml;
31
+ }
32
+ //#endregion
33
+ //#region src/PluginExtension.d.ts
34
+ /** function type required for for emit extensions */
35
+ type ExtensionEmitFn = (/** absolute path to the shader to which the extension is attached */
36
+ shaderPath: string, /** support functions available to plugin extensions */
37
+ pluginApi: PluginExtensionApi, /** static conditions specified on the js import */conditions?: Record<string, boolean>) => Promise<string>;
38
+ /** an extension that runs inside the wesl-js build plugin */
39
+ interface PluginExtension extends WeslJsPlugin {
40
+ /** javascript imports with this suffix will trigger the plugin */
41
+ extensionName: string;
42
+ /** generate javascript text for js/ts importers to use.
43
+ * e.g. import myPluginJs from "./foo.wesl?myPlugin"; */
44
+ emitFn: ExtensionEmitFn;
45
+ }
46
+ /** api supplied to plugin extensions */
47
+ interface PluginExtensionApi {
48
+ weslToml: () => Promise<WeslTomlInfo>;
49
+ weslSrc: () => Promise<Record<string, string>>;
50
+ weslRegistry: () => Promise<BatchModuleResolver>;
51
+ weslMain: (baseId: string) => Promise<string>;
52
+ weslDependencies: () => Promise<string[]>;
53
+ }
54
+ //#endregion
55
+ export { PluginExtension as n, PluginExtensionApi as r, ExtensionEmitFn as t };