wesl-plugin 0.6.73 → 0.6.75
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/README.md +1 -1
- package/dist/{StaticExtension-CDqA2teq.mjs → StaticExtension-q_mP-ool.mjs} +14 -8
- package/dist/{WeslPlugin-B91dE_tA.mjs → WeslPlugin-BIolevHn.mjs} +7 -8
- package/dist/WeslPluginOptions-B84JB1bv.d.mts +13 -0
- package/dist/pluginIndex.d.mts +1 -0
- package/dist/pluginIndex.mjs +1 -1
- package/dist/plugins/astro.d.mts +1 -1
- package/dist/plugins/astro.mjs +2 -2
- package/dist/plugins/esbuild.d.mts +1 -1
- package/dist/plugins/esbuild.mjs +2 -2
- package/dist/plugins/farm.mjs +2 -2
- package/dist/plugins/nuxt.d.mts +1 -1
- package/dist/plugins/nuxt.mjs +2 -2
- package/dist/plugins/rollup.d.mts +1 -1
- package/dist/plugins/rollup.mjs +2 -2
- package/dist/plugins/rspack.d.mts +1 -1
- package/dist/plugins/rspack.mjs +2 -2
- package/dist/plugins/vite.d.mts +1 -1
- package/dist/plugins/vite.mjs +2 -2
- package/dist/plugins/webpack.d.mts +1 -1
- package/dist/plugins/webpack.mjs +2 -2
- package/package.json +4 -4
- package/src/PluginApi.ts +14 -10
- package/src/WeslPluginOptions.ts +4 -1
- package/src/extensions/LinkExtension.ts +10 -3
- package/src/extensions/StaticExtension.ts +3 -5
- package/dist/WeslPluginOptions-D81oyynl.d.mts +0 -11
package/README.md
CHANGED
|
@@ -132,4 +132,4 @@ const myExtension: PluginExtension = {
|
|
|
132
132
|
};
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
See [PluginExtension.ts](https://github.com/
|
|
135
|
+
See [PluginExtension.ts](https://github.com/webgpu-tools/wesl-js/blob/main/packages/wesl-plugin/src/PluginExtension.ts) for the full API.
|
|
@@ -8,13 +8,14 @@ import process from "node:process";
|
|
|
8
8
|
import v8 from "node:v8";
|
|
9
9
|
import { format, inspect } from "node:util";
|
|
10
10
|
//#region src/extensions/LinkExtension.ts
|
|
11
|
+
/** Extension that emits a JavaScript LinkParams object for runtime linking. */
|
|
11
12
|
const linkBuildExtension = {
|
|
12
13
|
extensionName: "link",
|
|
13
14
|
emitFn: emitLinkJs
|
|
14
15
|
};
|
|
15
16
|
/** Emit a JavaScript LinkParams structure, ready for linking at runtime. */
|
|
16
|
-
async function emitLinkJs(
|
|
17
|
-
const rootModuleName = noSuffix(await api.weslMain(
|
|
17
|
+
async function emitLinkJs(shaderPath, api, _conditions, options) {
|
|
18
|
+
const rootModuleName = noSuffix(await api.weslMain(shaderPath));
|
|
18
19
|
const [{ weslSrc, dependencies: autoDeps }, debugWeslRoot] = await Promise.all([api.fetchProject(rootModuleName, options), api.debugWeslRoot()]);
|
|
19
20
|
const sanitizedDeps = autoDeps.map((dep) => dep.replaceAll("/", "_"));
|
|
20
21
|
const bundleImports = autoDeps.map((p, i) => `import ${sanitizedDeps[i]} from "${p}";`).join("\n");
|
|
@@ -22,7 +23,8 @@ async function emitLinkJs(baseId, api, _conditions, options) {
|
|
|
22
23
|
const linkParams = {
|
|
23
24
|
rootModuleName,
|
|
24
25
|
weslSrc,
|
|
25
|
-
debugWeslRoot
|
|
26
|
+
debugWeslRoot,
|
|
27
|
+
shaderRoot: debugWeslRoot
|
|
26
28
|
};
|
|
27
29
|
const libsStr = `libs: [${sanitizedDeps.join(", ")}]`;
|
|
28
30
|
return `
|
|
@@ -34,6 +36,7 @@ async function emitLinkJs(baseId, api, _conditions, options) {
|
|
|
34
36
|
export default ${paramsName};
|
|
35
37
|
`;
|
|
36
38
|
}
|
|
39
|
+
/** Serialize an object's fields as `key: value` pairs for embedding in generated JS. */
|
|
37
40
|
function serializeFields(record) {
|
|
38
41
|
return Object.entries(record).map(([k, v]) => ` ${k}: ${JSON.stringify(v, null, 2)}`).join(",\n");
|
|
39
42
|
}
|
|
@@ -1297,17 +1300,20 @@ const staticBuildExtension = {
|
|
|
1297
1300
|
};
|
|
1298
1301
|
/** Emit a JS module exporting the statically linked WGSL string. */
|
|
1299
1302
|
async function emitStaticJs(baseId, api, conditions, _options) {
|
|
1300
|
-
const {
|
|
1303
|
+
const { tomlDir } = await api.weslToml();
|
|
1301
1304
|
const parentModule = url.pathToFileURL(path.join(tomlDir, "wesl.toml")).toString();
|
|
1302
1305
|
const rootModuleName = noSuffix(await api.weslMain(baseId));
|
|
1303
|
-
const [weslSrc, dependencies] = await Promise.all([
|
|
1306
|
+
const [weslSrc, dependencies, debugWeslRoot] = await Promise.all([
|
|
1307
|
+
api.weslSrc(),
|
|
1308
|
+
api.weslDependencies(),
|
|
1309
|
+
api.debugWeslRoot()
|
|
1310
|
+
]);
|
|
1304
1311
|
const libFileUrls = dependencies.map((d) => resolve(d, parentModule));
|
|
1305
|
-
const libs = (await Promise.all(libFileUrls.map((f) => import(f)))).map((m) => m.default);
|
|
1306
1312
|
const { dest: wgsl } = await link({
|
|
1307
1313
|
weslSrc,
|
|
1308
1314
|
rootModuleName,
|
|
1309
|
-
debugWeslRoot
|
|
1310
|
-
libs,
|
|
1315
|
+
debugWeslRoot,
|
|
1316
|
+
libs: (await Promise.all(libFileUrls.map((f) => import(f)))).map((m) => m.default),
|
|
1311
1317
|
conditions
|
|
1312
1318
|
});
|
|
1313
1319
|
return `
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolve, r as linkBuildExtension, t as staticBuildExtension } from "./StaticExtension-
|
|
1
|
+
import { n as resolve, r as linkBuildExtension, t as staticBuildExtension } from "./StaticExtension-q_mP-ool.mjs";
|
|
2
2
|
import path, { posix, win32 } from "node:path";
|
|
3
3
|
import { RecordResolver, WeslParseError, discoverModules, fileToModulePath, filterMap, findUnboundIdents, freshResolver, npmNameVariations } from "wesl";
|
|
4
4
|
import fs, { lstat, readdir, readlink, realpath } from "node:fs/promises";
|
|
@@ -7093,11 +7093,7 @@ async function getScopedProject(rootModuleName, context, unpluginCtx) {
|
|
|
7093
7093
|
}
|
|
7094
7094
|
/** Resolve dependencies using pre-computed unbound refs (avoids re-parsing). */
|
|
7095
7095
|
function resolveDepsFromUnbound(dependencies, unbound, projectDir) {
|
|
7096
|
-
|
|
7097
|
-
if (!depsArray.includes("auto")) return depsArray;
|
|
7098
|
-
const base = depsArray.filter((dep) => dep !== "auto");
|
|
7099
|
-
const discovered = resolvePkgDeps(unbound, projectDir);
|
|
7100
|
-
return [...new Set([...base, ...discovered])];
|
|
7096
|
+
return resolveDepsWithDiscovery(dependencies, () => resolvePkgDeps(unbound, projectDir));
|
|
7101
7097
|
}
|
|
7102
7098
|
/** Load and cache the wesl.toml configuration. */
|
|
7103
7099
|
async function getWeslToml(context, unpluginCtx) {
|
|
@@ -7148,11 +7144,14 @@ async function findDependencies(context, unpluginCtx) {
|
|
|
7148
7144
|
}
|
|
7149
7145
|
/** Resolve the dependency list, replacing "auto" entries with discovered deps. */
|
|
7150
7146
|
function resolveDeps(dependencies, weslSrc, projectDir) {
|
|
7147
|
+
return resolveDepsWithDiscovery(dependencies, () => parseDependencies(weslSrc, projectDir));
|
|
7148
|
+
}
|
|
7149
|
+
/** Normalize deps array, replace "auto" with discovered deps, deduplicate. */
|
|
7150
|
+
function resolveDepsWithDiscovery(dependencies, discover) {
|
|
7151
7151
|
const depsArray = Array.isArray(dependencies) ? dependencies : [dependencies ?? "auto"];
|
|
7152
7152
|
if (!depsArray.includes("auto")) return depsArray;
|
|
7153
7153
|
const base = depsArray.filter((dep) => dep !== "auto");
|
|
7154
|
-
|
|
7155
|
-
return [...new Set([...base, ...discovered])];
|
|
7154
|
+
return [...new Set([...base, ...discover()])];
|
|
7156
7155
|
}
|
|
7157
7156
|
/** @return a function that resolves a shader path to a weslRoot-relative module path. */
|
|
7158
7157
|
function makeGetWeslMain(context, unpluginContext) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { n as PluginExtension } from "./PluginExtension-DTjKL6rt.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/WeslPluginOptions.d.ts
|
|
4
|
+
interface WeslPluginOptions {
|
|
5
|
+
/** Path to wesl.toml config file (default: auto-detected from project root). */
|
|
6
|
+
weslToml?: string;
|
|
7
|
+
/** Custom plugin extensions for additional import suffixes or code generation. */
|
|
8
|
+
extensions?: PluginExtension[];
|
|
9
|
+
/** Log plugin activity to stderr for debugging. */
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { WeslPluginOptions as t };
|
package/dist/pluginIndex.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { i as ProjectSources, n as PluginExtension, r as PluginExtensionApi, t as ExtensionEmitFn } from "./PluginExtension-DTjKL6rt.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/extensions/LinkExtension.d.ts
|
|
4
|
+
/** Extension that emits a JavaScript LinkParams object for runtime linking. */
|
|
4
5
|
declare const linkBuildExtension: PluginExtension;
|
|
5
6
|
//#endregion
|
|
6
7
|
//#region src/extensions/ReflectExtension.d.ts
|
package/dist/pluginIndex.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as linkBuildExtension, t as staticBuildExtension } from "./StaticExtension-
|
|
1
|
+
import { r as linkBuildExtension, t as staticBuildExtension } from "./StaticExtension-q_mP-ool.mjs";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import { originalTypeName, weslStructs, wgslTypeToTs } from "wesl-reflect";
|
|
4
4
|
//#region src/extensions/ReflectExtension.ts
|
package/dist/plugins/astro.d.mts
CHANGED
package/dist/plugins/astro.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as unplugin } from "../WeslPlugin-
|
|
2
|
-
import "../StaticExtension-
|
|
1
|
+
import { t as unplugin } from "../WeslPlugin-BIolevHn.mjs";
|
|
2
|
+
import "../StaticExtension-q_mP-ool.mjs";
|
|
3
3
|
//#region src/plugins/astro.ts
|
|
4
4
|
var astro_default = (options) => ({
|
|
5
5
|
name: "wesl-plugin",
|
package/dist/plugins/esbuild.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as weslPlugin } from "../WeslPlugin-
|
|
2
|
-
import "../StaticExtension-
|
|
1
|
+
import { n as weslPlugin } from "../WeslPlugin-BIolevHn.mjs";
|
|
2
|
+
import "../StaticExtension-q_mP-ool.mjs";
|
|
3
3
|
import { createEsbuildPlugin } from "unplugin";
|
|
4
4
|
//#region src/plugins/esbuild.ts
|
|
5
5
|
var esbuild_default = createEsbuildPlugin(weslPlugin);
|
package/dist/plugins/farm.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as weslPlugin } from "../WeslPlugin-
|
|
2
|
-
import "../StaticExtension-
|
|
1
|
+
import { n as weslPlugin } from "../WeslPlugin-BIolevHn.mjs";
|
|
2
|
+
import "../StaticExtension-q_mP-ool.mjs";
|
|
3
3
|
import { createFarmPlugin } from "unplugin";
|
|
4
4
|
//#region src/plugins/farm.ts
|
|
5
5
|
var farm_default = createFarmPlugin(weslPlugin);
|
package/dist/plugins/nuxt.d.mts
CHANGED
package/dist/plugins/nuxt.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../WeslPlugin-
|
|
2
|
-
import "../StaticExtension-
|
|
1
|
+
import "../WeslPlugin-BIolevHn.mjs";
|
|
2
|
+
import "../StaticExtension-q_mP-ool.mjs";
|
|
3
3
|
import vite_default from "./vite.mjs";
|
|
4
4
|
import webpack_default from "./webpack.mjs";
|
|
5
5
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
package/dist/plugins/rollup.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as weslPlugin } from "../WeslPlugin-
|
|
2
|
-
import "../StaticExtension-
|
|
1
|
+
import { n as weslPlugin } from "../WeslPlugin-BIolevHn.mjs";
|
|
2
|
+
import "../StaticExtension-q_mP-ool.mjs";
|
|
3
3
|
import { createRollupPlugin } from "unplugin";
|
|
4
4
|
//#region src/plugins/rollup.ts
|
|
5
5
|
var rollup_default = createRollupPlugin(weslPlugin);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as WeslPluginOptions } from "../WeslPluginOptions-
|
|
1
|
+
import { t as WeslPluginOptions } from "../WeslPluginOptions-B84JB1bv.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/rspack.d.ts
|
|
4
4
|
declare const _default: (options?: WeslPluginOptions | undefined) => RspackPluginInstance;
|
package/dist/plugins/rspack.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as weslPlugin } from "../WeslPlugin-
|
|
2
|
-
import "../StaticExtension-
|
|
1
|
+
import { n as weslPlugin } from "../WeslPlugin-BIolevHn.mjs";
|
|
2
|
+
import "../StaticExtension-q_mP-ool.mjs";
|
|
3
3
|
import { createRspackPlugin } from "unplugin";
|
|
4
4
|
//#region src/plugins/rspack.ts
|
|
5
5
|
var rspack_default = createRspackPlugin(weslPlugin);
|
package/dist/plugins/vite.d.mts
CHANGED
package/dist/plugins/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as weslPlugin } from "../WeslPlugin-
|
|
2
|
-
import "../StaticExtension-
|
|
1
|
+
import { n as weslPlugin } from "../WeslPlugin-BIolevHn.mjs";
|
|
2
|
+
import "../StaticExtension-q_mP-ool.mjs";
|
|
3
3
|
import { createVitePlugin } from "unplugin";
|
|
4
4
|
//#region src/plugins/vite.ts
|
|
5
5
|
var vite_default = createVitePlugin(weslPlugin);
|
package/dist/plugins/webpack.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as weslPlugin } from "../WeslPlugin-
|
|
2
|
-
import "../StaticExtension-
|
|
1
|
+
import { n as weslPlugin } from "../WeslPlugin-BIolevHn.mjs";
|
|
2
|
+
import "../StaticExtension-q_mP-ool.mjs";
|
|
3
3
|
import { createWebpackPlugin } from "unplugin";
|
|
4
4
|
//#region src/plugins/webpack.ts
|
|
5
5
|
var webpack_default = createWebpackPlugin(weslPlugin);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wesl-plugin",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.75",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
|
-
"repository": "github:
|
|
10
|
+
"repository": "github:webgpu-tools/wesl-js",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": "./dist/pluginIndex.mjs",
|
|
13
13
|
"./suffixes": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"unplugin": "^2.3.5",
|
|
28
|
-
"wesl": "0.7.
|
|
29
|
-
"wesl-reflect": "0.0.
|
|
28
|
+
"wesl": "0.7.27",
|
|
29
|
+
"wesl-reflect": "0.0.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@nuxt/kit": "^3.17.6",
|
package/src/PluginApi.ts
CHANGED
|
@@ -64,14 +64,9 @@ function resolveDepsFromUnbound(
|
|
|
64
64
|
unbound: string[][],
|
|
65
65
|
projectDir: string,
|
|
66
66
|
): string[] {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (!depsArray.includes("auto")) return depsArray;
|
|
71
|
-
|
|
72
|
-
const base = depsArray.filter(dep => dep !== "auto");
|
|
73
|
-
const discovered = resolvePkgDeps(unbound, projectDir);
|
|
74
|
-
return [...new Set([...base, ...discovered])];
|
|
67
|
+
return resolveDepsWithDiscovery(dependencies, () =>
|
|
68
|
+
resolvePkgDeps(unbound, projectDir),
|
|
69
|
+
);
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
/** Load and cache the wesl.toml configuration. */
|
|
@@ -156,6 +151,16 @@ function resolveDeps(
|
|
|
156
151
|
dependencies: string | string[] | undefined,
|
|
157
152
|
weslSrc: Record<string, string>,
|
|
158
153
|
projectDir: string,
|
|
154
|
+
): string[] {
|
|
155
|
+
return resolveDepsWithDiscovery(dependencies, () =>
|
|
156
|
+
parseDependencies(weslSrc, projectDir),
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Normalize deps array, replace "auto" with discovered deps, deduplicate. */
|
|
161
|
+
function resolveDepsWithDiscovery(
|
|
162
|
+
dependencies: string | string[] | undefined,
|
|
163
|
+
discover: () => string[],
|
|
159
164
|
): string[] {
|
|
160
165
|
const depsArray = Array.isArray(dependencies)
|
|
161
166
|
? dependencies
|
|
@@ -163,8 +168,7 @@ function resolveDeps(
|
|
|
163
168
|
if (!depsArray.includes("auto")) return depsArray;
|
|
164
169
|
|
|
165
170
|
const base = depsArray.filter(dep => dep !== "auto");
|
|
166
|
-
|
|
167
|
-
return [...new Set([...base, ...discovered])];
|
|
171
|
+
return [...new Set([...base, ...discover()])];
|
|
168
172
|
}
|
|
169
173
|
|
|
170
174
|
/** @return a function that resolves a shader path to a weslRoot-relative module path. */
|
package/src/WeslPluginOptions.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { PluginExtension } from "./PluginExtension.ts";
|
|
2
2
|
|
|
3
3
|
export interface WeslPluginOptions {
|
|
4
|
+
/** Path to wesl.toml config file (default: auto-detected from project root). */
|
|
4
5
|
weslToml?: string;
|
|
6
|
+
|
|
7
|
+
/** Custom plugin extensions for additional import suffixes or code generation. */
|
|
5
8
|
extensions?: PluginExtension[];
|
|
6
9
|
|
|
7
|
-
/** Log plugin activity to stderr for debugging */
|
|
10
|
+
/** Log plugin activity to stderr for debugging. */
|
|
8
11
|
debug?: boolean;
|
|
9
12
|
}
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
PluginExtensionApi,
|
|
6
6
|
} from "../PluginExtension.ts";
|
|
7
7
|
|
|
8
|
+
/** Extension that emits a JavaScript LinkParams object for runtime linking. */
|
|
8
9
|
export const linkBuildExtension: PluginExtension = {
|
|
9
10
|
extensionName: "link",
|
|
10
11
|
emitFn: emitLinkJs,
|
|
@@ -12,12 +13,12 @@ export const linkBuildExtension: PluginExtension = {
|
|
|
12
13
|
|
|
13
14
|
/** Emit a JavaScript LinkParams structure, ready for linking at runtime. */
|
|
14
15
|
async function emitLinkJs(
|
|
15
|
-
|
|
16
|
+
shaderPath: string,
|
|
16
17
|
api: PluginExtensionApi,
|
|
17
18
|
_conditions?: Record<string, boolean>,
|
|
18
19
|
options?: Record<string, string>,
|
|
19
20
|
): Promise<string> {
|
|
20
|
-
const rootModule = await api.weslMain(
|
|
21
|
+
const rootModule = await api.weslMain(shaderPath);
|
|
21
22
|
const rootModuleName = noSuffix(rootModule);
|
|
22
23
|
|
|
23
24
|
const [{ weslSrc, dependencies: autoDeps }, debugWeslRoot] =
|
|
@@ -35,7 +36,12 @@ async function emitLinkJs(
|
|
|
35
36
|
const rootName = path.basename(rootModuleName).replace(/\W/g, "_");
|
|
36
37
|
const paramsName = `link${rootName}Config`;
|
|
37
38
|
|
|
38
|
-
const linkParams: LinkParams
|
|
39
|
+
const linkParams: LinkParams & { shaderRoot?: string } = {
|
|
40
|
+
rootModuleName,
|
|
41
|
+
weslSrc,
|
|
42
|
+
debugWeslRoot,
|
|
43
|
+
shaderRoot: debugWeslRoot,
|
|
44
|
+
};
|
|
39
45
|
const libsStr = `libs: [${sanitizedDeps.join(", ")}]`;
|
|
40
46
|
const linkParamsStr = `{
|
|
41
47
|
${serializeFields(linkParams)},
|
|
@@ -49,6 +55,7 @@ async function emitLinkJs(
|
|
|
49
55
|
`;
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
/** Serialize an object's fields as `key: value` pairs for embedding in generated JS. */
|
|
52
59
|
function serializeFields(record: Record<string, any>) {
|
|
53
60
|
return Object.entries(record)
|
|
54
61
|
.map(([k, v]) => ` ${k}: ${JSON.stringify(v, null, 2)}`)
|
|
@@ -20,7 +20,7 @@ async function emitStaticJs(
|
|
|
20
20
|
conditions?: Conditions,
|
|
21
21
|
_options?: Record<string, string>,
|
|
22
22
|
): Promise<string> {
|
|
23
|
-
const {
|
|
23
|
+
const { tomlDir } = await api.weslToml();
|
|
24
24
|
|
|
25
25
|
const tomlUrl = url.pathToFileURL(path.join(tomlDir, "wesl.toml"));
|
|
26
26
|
const parentModule = tomlUrl.toString();
|
|
@@ -28,9 +28,10 @@ async function emitStaticJs(
|
|
|
28
28
|
const rootModule = await api.weslMain(baseId);
|
|
29
29
|
const rootModuleName = noSuffix(rootModule);
|
|
30
30
|
|
|
31
|
-
const [weslSrc, dependencies] = await Promise.all([
|
|
31
|
+
const [weslSrc, dependencies, debugWeslRoot] = await Promise.all([
|
|
32
32
|
api.weslSrc(),
|
|
33
33
|
api.weslDependencies(),
|
|
34
|
+
api.debugWeslRoot(),
|
|
34
35
|
]);
|
|
35
36
|
|
|
36
37
|
const libFileUrls = dependencies.map(d => resolve(d, parentModule));
|
|
@@ -38,9 +39,6 @@ async function emitStaticJs(
|
|
|
38
39
|
const libModules = await Promise.all(libFileUrls.map(f => import(f)));
|
|
39
40
|
const libs = libModules.map(m => m.default);
|
|
40
41
|
|
|
41
|
-
const tomlRelative = path.relative(tomlDir, resolvedRoot);
|
|
42
|
-
const debugWeslRoot = tomlRelative.replaceAll(path.sep, "/");
|
|
43
|
-
|
|
44
42
|
const { dest: wgsl } = await link({
|
|
45
43
|
weslSrc,
|
|
46
44
|
rootModuleName,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { n as PluginExtension } from "./PluginExtension-DTjKL6rt.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/WeslPluginOptions.d.ts
|
|
4
|
-
interface WeslPluginOptions {
|
|
5
|
-
weslToml?: string;
|
|
6
|
-
extensions?: PluginExtension[];
|
|
7
|
-
/** Log plugin activity to stderr for debugging */
|
|
8
|
-
debug?: boolean;
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { WeslPluginOptions as t };
|