commit 920f088ff8776f4b138c623ae5867d36f778883b Author: rowan Date: Mon Apr 21 23:32:48 2025 -0500 initial commit diff --git a/package.json b/package.json new file mode 100644 index 0000000..7f8ead7 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "esbuild-plugin-wgsl", + "version": "1.0.0", + "main": "src/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": { + "name": "Rowan", + "email": "rowan@kitsu.cafe" + }, + "license": "ISC", + "description": "", + "peerDependencies": { + "esbuild": "0.x.x" + }, + "devDependencies": { + "esbuild": "0.x.x" + } +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..616a392 --- /dev/null +++ b/src/index.js @@ -0,0 +1,15 @@ +import fs from 'node:fs/promises' + +export const wgsl = () => ({ + name: 'esbuild-plugin-wgsl', + setup(build) { + build.onLoad({ filter: /\.wgsl$/ }, async args => { + const contents = await fs.readFile(args.path, 'utf8') + + return { contents } + }) + } +}) + +export default wgsl +