wesl-plugin 0.6.0-pre10

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 (41) hide show
  1. package/README.md +102 -0
  2. package/dist/PluginExtension-Bvr6MzG5.d.ts +43 -0
  3. package/dist/chunk-6WJP7I7R.js +6754 -0
  4. package/dist/chunk-7ZBFDM3F.js +11 -0
  5. package/dist/chunk-JSBRDJBE.js +30 -0
  6. package/dist/chunk-U52VQTCR.js +11 -0
  7. package/dist/pluginIndex.d.ts +7 -0
  8. package/dist/pluginIndex.js +43 -0
  9. package/dist/plugins/astro.d.ts +7 -0
  10. package/dist/plugins/astro.js +18 -0
  11. package/dist/plugins/esbuild.d.ts +8 -0
  12. package/dist/plugins/esbuild.js +11 -0
  13. package/dist/plugins/farm.d.ts +8 -0
  14. package/dist/plugins/farm.js +11 -0
  15. package/dist/plugins/nuxt.d.ts +10 -0
  16. package/dist/plugins/nuxt.js +28 -0
  17. package/dist/plugins/rollup.d.ts +8 -0
  18. package/dist/plugins/rollup.js +11 -0
  19. package/dist/plugins/rspack.d.ts +7 -0
  20. package/dist/plugins/rspack.js +11 -0
  21. package/dist/plugins/vite.d.ts +8 -0
  22. package/dist/plugins/vite.js +8 -0
  23. package/dist/plugins/webpack.d.ts +8 -0
  24. package/dist/plugins/webpack.js +8 -0
  25. package/dist/weslPluginOptions-DAx0E_JK.d.ts +8 -0
  26. package/package.json +100 -0
  27. package/src/BindingLayoutExtension.ts +35 -0
  28. package/src/LinkExtension.ts +58 -0
  29. package/src/PluginExtension.ts +26 -0
  30. package/src/defaultSuffixTypes.d.ts +14 -0
  31. package/src/pluginIndex.ts +2 -0
  32. package/src/plugins/astro.ts +13 -0
  33. package/src/plugins/esbuild.ts +4 -0
  34. package/src/plugins/farm.ts +4 -0
  35. package/src/plugins/nuxt.ts +25 -0
  36. package/src/plugins/rollup.ts +4 -0
  37. package/src/plugins/rspack.ts +4 -0
  38. package/src/plugins/vite.ts +4 -0
  39. package/src/plugins/webpack.ts +4 -0
  40. package/src/weslPlugin.ts +335 -0
  41. package/src/weslPluginOptions.ts +6 -0
@@ -0,0 +1,11 @@
1
+ import {
2
+ weslPlugin
3
+ } from "./chunk-6WJP7I7R.js";
4
+
5
+ // src/plugins/webpack.ts
6
+ import { createWebpackPlugin } from "unplugin";
7
+ var webpack_default = createWebpackPlugin(weslPlugin);
8
+
9
+ export {
10
+ webpack_default
11
+ };
@@ -0,0 +1,30 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ export {
28
+ __commonJS,
29
+ __toESM
30
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ weslPlugin
3
+ } from "./chunk-6WJP7I7R.js";
4
+
5
+ // src/plugins/vite.ts
6
+ import { createVitePlugin } from "unplugin";
7
+ var vite_default = createVitePlugin(weslPlugin);
8
+
9
+ export {
10
+ vite_default
11
+ };
@@ -0,0 +1,7 @@
1
+ import { P as PluginExtension } from './PluginExtension-Bvr6MzG5.js';
2
+ export { E as ExtensionEmitFn, a as PluginExtensionApi } from './PluginExtension-Bvr6MzG5.js';
3
+ import 'wesl';
4
+
5
+ declare const linkBuildPlugin: PluginExtension;
6
+
7
+ export { PluginExtension, linkBuildPlugin };
@@ -0,0 +1,43 @@
1
+ import "./chunk-JSBRDJBE.js";
2
+
3
+ // src/LinkExtension.ts
4
+ import path from "node:path";
5
+ import { noSuffix } from "wesl";
6
+ var linkBuildPlugin = {
7
+ extensionName: "link",
8
+ emitFn: emitLinkJs
9
+ };
10
+ async function emitLinkJs(baseId, api) {
11
+ const { resolvedWeslRoot, toml, tomlDir } = await api.weslToml();
12
+ const { dependencies = [] } = toml;
13
+ const weslSrc = await api.weslSrc();
14
+ const rootModule = await api.weslMain(baseId);
15
+ const rootModuleName = noSuffix(rootModule);
16
+ const tomlRelative = path.relative(tomlDir, resolvedWeslRoot);
17
+ const debugWeslRoot = tomlRelative.replaceAll(path.sep, "/");
18
+ const bundleImports = dependencies.map((p) => `import ${p} from "${p}";`).join("\n");
19
+ const rootName = path.basename(rootModuleName);
20
+ const paramsName = `link${rootName}Config`;
21
+ const linkParams = {
22
+ rootModuleName,
23
+ weslSrc,
24
+ debugWeslRoot
25
+ };
26
+ const libsStr = `libs: [${dependencies.join(", ")}]`;
27
+ const linkParamsStr = `{
28
+ ${serializeFields(linkParams)},
29
+ ${libsStr},
30
+ }`;
31
+ const src = `
32
+ ${bundleImports}
33
+ export const ${paramsName} = ${linkParamsStr};
34
+ export default ${paramsName};
35
+ `;
36
+ return src;
37
+ }
38
+ function serializeFields(record) {
39
+ return Object.entries(record).map(([k, v]) => ` ${k}: ${JSON.stringify(v, null, 2)}`).join(",\n");
40
+ }
41
+ export {
42
+ linkBuildPlugin
43
+ };
@@ -0,0 +1,7 @@
1
+ import { W as WeslPluginOptions } from '../weslPluginOptions-DAx0E_JK.js';
2
+ import '../PluginExtension-Bvr6MzG5.js';
3
+ import 'wesl';
4
+
5
+ declare const _default: (options: WeslPluginOptions) => any;
6
+
7
+ export { _default as default };
@@ -0,0 +1,18 @@
1
+ import {
2
+ weslPlugin_default
3
+ } from "../chunk-6WJP7I7R.js";
4
+ import "../chunk-JSBRDJBE.js";
5
+
6
+ // src/plugins/astro.ts
7
+ var astro_default = (options) => ({
8
+ name: "wesl-plugin",
9
+ hooks: {
10
+ "astro:config:setup": async (astro) => {
11
+ astro.config.vite.plugins ||= [];
12
+ astro.config.vite.plugins.push(weslPlugin_default.vite(options));
13
+ }
14
+ }
15
+ });
16
+ export {
17
+ astro_default as default
18
+ };
@@ -0,0 +1,8 @@
1
+ import * as esbuild from 'esbuild';
2
+ import { W as WeslPluginOptions } from '../weslPluginOptions-DAx0E_JK.js';
3
+ import '../PluginExtension-Bvr6MzG5.js';
4
+ import 'wesl';
5
+
6
+ declare const _default: (options?: WeslPluginOptions | undefined) => esbuild.Plugin;
7
+
8
+ export { _default as default };
@@ -0,0 +1,11 @@
1
+ import {
2
+ weslPlugin
3
+ } from "../chunk-6WJP7I7R.js";
4
+ import "../chunk-JSBRDJBE.js";
5
+
6
+ // src/plugins/esbuild.ts
7
+ import { createEsbuildPlugin } from "unplugin";
8
+ var esbuild_default = createEsbuildPlugin(weslPlugin);
9
+ export {
10
+ esbuild_default as default
11
+ };
@@ -0,0 +1,8 @@
1
+ import * as _farmfe_core from '@farmfe/core';
2
+ import { W as WeslPluginOptions } from '../weslPluginOptions-DAx0E_JK.js';
3
+ import '../PluginExtension-Bvr6MzG5.js';
4
+ import 'wesl';
5
+
6
+ declare const _default: (options?: WeslPluginOptions | undefined) => _farmfe_core.JsPlugin;
7
+
8
+ export { _default as default };
@@ -0,0 +1,11 @@
1
+ import {
2
+ weslPlugin
3
+ } from "../chunk-6WJP7I7R.js";
4
+ import "../chunk-JSBRDJBE.js";
5
+
6
+ // src/plugins/farm.ts
7
+ import { createFarmPlugin } from "unplugin";
8
+ var farm_default = createFarmPlugin(weslPlugin);
9
+ export {
10
+ farm_default as default
11
+ };
@@ -0,0 +1,10 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+ import { W as WeslPluginOptions } from '../weslPluginOptions-DAx0E_JK.js';
3
+ import '../PluginExtension-Bvr6MzG5.js';
4
+ import 'wesl';
5
+
6
+ interface ModuleOptions extends WeslPluginOptions {
7
+ }
8
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
9
+
10
+ export { type ModuleOptions, _default as default };
@@ -0,0 +1,28 @@
1
+ import {
2
+ webpack_default
3
+ } from "../chunk-7ZBFDM3F.js";
4
+ import {
5
+ vite_default
6
+ } from "../chunk-U52VQTCR.js";
7
+ import "../chunk-6WJP7I7R.js";
8
+ import "../chunk-JSBRDJBE.js";
9
+
10
+ // src/plugins/nuxt.ts
11
+ import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
12
+ import "@nuxt/schema";
13
+ var nuxt_default = defineNuxtModule({
14
+ meta: {
15
+ name: "nuxt-wesl-plugin",
16
+ configKey: "unpluginStarter"
17
+ },
18
+ defaults: {
19
+ // ...default options
20
+ },
21
+ setup(options, _nuxt) {
22
+ addVitePlugin(() => vite_default(options));
23
+ addWebpackPlugin(() => webpack_default(options));
24
+ }
25
+ });
26
+ export {
27
+ nuxt_default as default
28
+ };
@@ -0,0 +1,8 @@
1
+ import * as rollup from 'rollup';
2
+ import { W as WeslPluginOptions } from '../weslPluginOptions-DAx0E_JK.js';
3
+ import '../PluginExtension-Bvr6MzG5.js';
4
+ import 'wesl';
5
+
6
+ declare const _default: (options?: WeslPluginOptions | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
7
+
8
+ export { _default as default };
@@ -0,0 +1,11 @@
1
+ import {
2
+ weslPlugin
3
+ } from "../chunk-6WJP7I7R.js";
4
+ import "../chunk-JSBRDJBE.js";
5
+
6
+ // src/plugins/rollup.ts
7
+ import { createRollupPlugin } from "unplugin";
8
+ var rollup_default = createRollupPlugin(weslPlugin);
9
+ export {
10
+ rollup_default as default
11
+ };
@@ -0,0 +1,7 @@
1
+ import { W as WeslPluginOptions } from '../weslPluginOptions-DAx0E_JK.js';
2
+ import '../PluginExtension-Bvr6MzG5.js';
3
+ import 'wesl';
4
+
5
+ declare const _default: (options?: WeslPluginOptions | undefined) => RspackPluginInstance;
6
+
7
+ export { _default as default };
@@ -0,0 +1,11 @@
1
+ import {
2
+ weslPlugin
3
+ } from "../chunk-6WJP7I7R.js";
4
+ import "../chunk-JSBRDJBE.js";
5
+
6
+ // src/plugins/rspack.ts
7
+ import { createRspackPlugin } from "unplugin";
8
+ var rspack_default = createRspackPlugin(weslPlugin);
9
+ export {
10
+ rspack_default as default
11
+ };
@@ -0,0 +1,8 @@
1
+ import * as vite from 'vite';
2
+ import { W as WeslPluginOptions } from '../weslPluginOptions-DAx0E_JK.js';
3
+ import '../PluginExtension-Bvr6MzG5.js';
4
+ import 'wesl';
5
+
6
+ declare const _default: (options?: WeslPluginOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
7
+
8
+ export { _default as default };
@@ -0,0 +1,8 @@
1
+ import {
2
+ vite_default
3
+ } from "../chunk-U52VQTCR.js";
4
+ import "../chunk-6WJP7I7R.js";
5
+ import "../chunk-JSBRDJBE.js";
6
+ export {
7
+ vite_default as default
8
+ };
@@ -0,0 +1,8 @@
1
+ import * as webpack from 'webpack';
2
+ import { W as WeslPluginOptions } from '../weslPluginOptions-DAx0E_JK.js';
3
+ import '../PluginExtension-Bvr6MzG5.js';
4
+ import 'wesl';
5
+
6
+ declare const _default: (options?: WeslPluginOptions | undefined) => webpack.WebpackPluginInstance;
7
+
8
+ export { _default as default };
@@ -0,0 +1,8 @@
1
+ import {
2
+ webpack_default
3
+ } from "../chunk-7ZBFDM3F.js";
4
+ import "../chunk-6WJP7I7R.js";
5
+ import "../chunk-JSBRDJBE.js";
6
+ export {
7
+ webpack_default as default
8
+ };
@@ -0,0 +1,8 @@
1
+ import { P as PluginExtension } from './PluginExtension-Bvr6MzG5.js';
2
+
3
+ interface WeslPluginOptions {
4
+ weslToml?: string;
5
+ extensions?: PluginExtension[];
6
+ }
7
+
8
+ export type { WeslPluginOptions as W };
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "wesl-plugin",
3
+ "type": "module",
4
+ "version": "0.6.0-pre10",
5
+ "dependencies": {
6
+ "toml": "^3.0.0",
7
+ "unplugin": "^2.1.2",
8
+ "wesl": "0.6.0-pre10"
9
+ },
10
+ "devDependencies": {
11
+ "@nuxt/kit": "^3.15.2",
12
+ "@nuxt/schema": "^3.15.2",
13
+ "bumpp": "^9.10.1",
14
+ "chalk": "^5.4.1",
15
+ "nodemon": "^3.1.9",
16
+ "rollup": "^4.31.0",
17
+ "tsup": "^8.3.5",
18
+ "webpack": "^5.97.1"
19
+ },
20
+ "description": "",
21
+ "repository": "github:wgsl-tooling-wg/wesl-js",
22
+ "keywords": [
23
+ "wesl",
24
+ "wgsl",
25
+ "webgpu",
26
+ "vite",
27
+ "webpack",
28
+ "rollup",
29
+ "unplugin"
30
+ ],
31
+ "exports": {
32
+ ".": "./dist/pluginIndex.js",
33
+ "./suffixes": {
34
+ "types": "./src/defaultSuffixTypes.d.ts"
35
+ },
36
+ "./astro": "./dist/plugins/astro.js",
37
+ "./rspack": "./dist/plugins/rspack.js",
38
+ "./vite": "./dist/plugins/vite.js",
39
+ "./webpack": "./dist/plugins/webpack.js",
40
+ "./rollup": "./dist/plugins/rollup.js",
41
+ "./esbuild": "./dist/plugins/esbuild.js",
42
+ "./nuxt": "./dist/plugins/nuxt.js",
43
+ "./farm": "./dist/plugins/farm.js",
44
+ "./types": "./dist/plugins/types.js",
45
+ "./*": "./*"
46
+ },
47
+ "typesVersions": {
48
+ "*": {
49
+ "*": [
50
+ "./dist/plugins/*",
51
+ "./dist/*",
52
+ "./*"
53
+ ]
54
+ }
55
+ },
56
+ "files": [
57
+ "src",
58
+ "dist"
59
+ ],
60
+ "peerDependencies": {
61
+ "@farmfe/core": ">=1",
62
+ "@nuxt/kit": "^3",
63
+ "@nuxt/schema": "^3",
64
+ "esbuild": "*",
65
+ "rollup": "^3",
66
+ "vite": ">=3",
67
+ "webpack": "^4 || ^5"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "@farmfe/core": {
71
+ "optional": true
72
+ },
73
+ "@nuxt/kit": {
74
+ "optional": true
75
+ },
76
+ "@nuxt/schema": {
77
+ "optional": true
78
+ },
79
+ "esbuild": {
80
+ "optional": true
81
+ },
82
+ "rollup": {
83
+ "optional": true
84
+ },
85
+ "vite": {
86
+ "optional": true
87
+ },
88
+ "webpack": {
89
+ "optional": true
90
+ }
91
+ },
92
+ "scripts": {
93
+ "echo": "echo",
94
+ "build": "tsup",
95
+ "dev": "tsup --watch src --watch ../wesl/dist",
96
+ "lint": "eslint .",
97
+ "play": "npm -C playground run dev",
98
+ "typecheck": "tsc"
99
+ }
100
+ }
@@ -0,0 +1,35 @@
1
+ import { bindAndTransform, bindingStructsPlugin, LinkConfig } from "wesl";
2
+ import {
3
+ bindingGroupLayoutTs,
4
+ reportBindingStructsPlugin
5
+ } from "../../wesl/src/Reflection.ts"; // TODO fix import
6
+ import { PluginExtension, PluginExtensionApi } from "./PluginExtension.ts";
7
+
8
+ export const bindingLayoutExtension: PluginExtension = {
9
+ extensionName: "bindingLayout",
10
+ emitFn: bindingLayoutJs,
11
+ };
12
+
13
+ /** Produce JavaScript objects for gpu layout by partially linking the wesl
14
+ * with the binding struct plugins installed */
15
+ async function bindingLayoutJs(
16
+ baseId: string,
17
+ api: PluginExtensionApi,
18
+ ): Promise<string> {
19
+ const registry = await api.weslRegistry();
20
+ const main = await api.weslMain(baseId);
21
+
22
+ // partially link so we can reflect the translated binding structs
23
+ let structsJs = "??";
24
+ const config: LinkConfig = {
25
+ plugins: [
26
+ bindingStructsPlugin(),
27
+ reportBindingStructsPlugin(structs => {
28
+ structsJs = bindingGroupLayoutTs(structs[0], false);
29
+ }),
30
+ ],
31
+ };
32
+ bindAndTransform({ registry, rootModuleName: main, config });
33
+
34
+ return structsJs;
35
+ }
@@ -0,0 +1,58 @@
1
+ import path from "node:path";
2
+ import { LinkParams, noSuffix } from "wesl";
3
+ import { PluginExtension, PluginExtensionApi } from "./PluginExtension.ts";
4
+
5
+ export const linkBuildPlugin: PluginExtension = {
6
+ extensionName: "link",
7
+ emitFn: emitLinkJs,
8
+ };
9
+
10
+ /** Emit a JavaScript LinkParams structure, ready for linking at runtime. */
11
+ async function emitLinkJs(
12
+ baseId: string,
13
+ api: PluginExtensionApi,
14
+ ): Promise<string> {
15
+ const { resolvedWeslRoot, toml, tomlDir } = await api.weslToml();
16
+ const { dependencies = [] } = toml;
17
+
18
+ const weslSrc = await api.weslSrc();
19
+
20
+ const rootModule = await api.weslMain(baseId);
21
+ const rootModuleName = noSuffix(rootModule);
22
+
23
+ const tomlRelative = path.relative(tomlDir, resolvedWeslRoot);
24
+ const debugWeslRoot = tomlRelative.replaceAll(path.sep, "/");
25
+
26
+ const bundleImports = dependencies
27
+ .map(p => `import ${p} from "${p}";`)
28
+ .join("\n");
29
+
30
+ const rootName = path.basename(rootModuleName);
31
+ const paramsName = `link${rootName}Config`;
32
+
33
+ const linkParams: LinkParams = {
34
+ rootModuleName,
35
+ weslSrc,
36
+ debugWeslRoot,
37
+ };
38
+
39
+ const libsStr = `libs: [${dependencies.join(", ")}]`;
40
+ const linkParamsStr = `{
41
+ ${serializeFields(linkParams)},
42
+ ${libsStr},
43
+ }`;
44
+
45
+ const src = `
46
+ ${bundleImports}
47
+ export const ${paramsName} = ${linkParamsStr};
48
+ export default ${paramsName};
49
+ `;
50
+
51
+ return src;
52
+ }
53
+
54
+ function serializeFields(record: Record<string, any>) {
55
+ return Object.entries(record)
56
+ .map(([k, v]) => ` ${k}: ${JSON.stringify(v, null, 2)}`)
57
+ .join(",\n");
58
+ }
@@ -0,0 +1,26 @@
1
+ import { ParsedRegistry, WeslJsPlugin } from "wesl";
2
+ import { WeslTomlInfo } from "./weslPlugin.ts";
3
+
4
+ /** function type required for for emit extensions */
5
+ export type ExtensionEmitFn = (
6
+ id: string,
7
+ pluginApi: PluginExtensionApi,
8
+ ) => Promise<string>;
9
+
10
+ /** an extension that runs inside the wesl-js build plugin */
11
+ export interface PluginExtension extends WeslJsPlugin {
12
+ /** javascript imports with this suffix will trigger the plugin */
13
+ extensionName: string;
14
+
15
+ /** generate javascript text for js/ts importers to use.
16
+ * e.g. import myPluginJs from "./foo.wesl?myPlugin"; */
17
+ emitFn: ExtensionEmitFn;
18
+ }
19
+
20
+ /** api supplied to plugin extensions */
21
+ export interface PluginExtensionApi {
22
+ weslToml: () => Promise<WeslTomlInfo>;
23
+ weslSrc: () => Promise<Record<string, string>>;
24
+ weslRegistry: () => Promise<ParsedRegistry>;
25
+ weslMain: (baseId: string) => Promise<string>;
26
+ }
@@ -0,0 +1,14 @@
1
+ /** @hidden */
2
+ declare module "*?link" {
3
+ const linkParams: LinkParams;
4
+ export default linkParams;
5
+ }
6
+
7
+ /** @hidden */ // TODO move to separate package
8
+ declare module "*?bindingLayout" {
9
+ export const layoutEntries: Record<string, GPUBindGroupLayoutEntry[]>;
10
+ export const layoutFunctions: Record<
11
+ string,
12
+ (device: GPUDevice) => GPUBindGroupLayout
13
+ >;
14
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./LinkExtension.js";
2
+ export * from "./PluginExtension.js";
@@ -0,0 +1,13 @@
1
+ import type { WeslPluginOptions } from "../weslPluginOptions.js";
2
+
3
+ import unplugin from "../weslPlugin.js";
4
+
5
+ export default (options: WeslPluginOptions): any => ({
6
+ name: "wesl-plugin",
7
+ hooks: {
8
+ "astro:config:setup": async (astro: any) => {
9
+ astro.config.vite.plugins ||= [];
10
+ astro.config.vite.plugins.push(unplugin.vite(options));
11
+ },
12
+ },
13
+ });
@@ -0,0 +1,4 @@
1
+ import { createEsbuildPlugin } from "unplugin";
2
+ import { weslPlugin } from "../weslPlugin.js";
3
+
4
+ export default createEsbuildPlugin(weslPlugin);
@@ -0,0 +1,4 @@
1
+ import { createFarmPlugin } from 'unplugin'
2
+ import { weslPlugin } from '../weslPlugin'
3
+
4
+ export default createFarmPlugin(weslPlugin)
@@ -0,0 +1,25 @@
1
+ import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'
2
+ import vite from './vite'
3
+ import webpack from './webpack'
4
+ import type { WeslPluginOptions } from '../weslPluginOptions'
5
+ import '@nuxt/schema'
6
+
7
+ export interface ModuleOptions extends WeslPluginOptions {
8
+
9
+ }
10
+
11
+ export default defineNuxtModule<ModuleOptions>({
12
+ meta: {
13
+ name: 'nuxt-wesl-plugin',
14
+ configKey: 'unpluginStarter',
15
+ },
16
+ defaults: {
17
+ // ...default options
18
+ },
19
+ setup(options, _nuxt) {
20
+ addVitePlugin(() => vite(options))
21
+ addWebpackPlugin(() => webpack(options))
22
+
23
+ // ...
24
+ },
25
+ })
@@ -0,0 +1,4 @@
1
+ import { createRollupPlugin } from "unplugin";
2
+ import { weslPlugin } from "../weslPlugin.js";
3
+
4
+ export default createRollupPlugin(weslPlugin);
@@ -0,0 +1,4 @@
1
+ import { createRspackPlugin } from "unplugin";
2
+ import { weslPlugin } from "../weslPlugin.js";
3
+
4
+ export default createRspackPlugin(weslPlugin);
@@ -0,0 +1,4 @@
1
+ import { createVitePlugin } from "unplugin";
2
+ import { weslPlugin } from "../weslPlugin";
3
+
4
+ export default createVitePlugin(weslPlugin);
@@ -0,0 +1,4 @@
1
+ import { createWebpackPlugin } from "unplugin";
2
+ import { weslPlugin } from "../weslPlugin.js";
3
+
4
+ export default createWebpackPlugin(weslPlugin);