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