unplugin-typegpu 0.10.2 → 0.11.1

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 (88) hide show
  1. package/README.md +14 -4
  2. package/babel-C8UzthFd.d.cts +13 -0
  3. package/babel-CbManzjz.js +128 -0
  4. package/babel-CmCnq-43.d.ts +13 -0
  5. package/babel-Dis-Pwfu.cjs +140 -0
  6. package/babel.cjs +4 -160
  7. package/babel.d.cts +3 -10
  8. package/babel.d.ts +3 -0
  9. package/babel.js +4 -0
  10. package/bun-CDECNeIU.js +134 -0
  11. package/bun-DCACcaN2.cjs +154 -0
  12. package/bun-cwXs2EDP.d.cts +6 -0
  13. package/bun-ovScJ4Es.d.ts +6 -0
  14. package/bun.cjs +4 -38
  15. package/bun.d.cts +2 -4
  16. package/bun.d.ts +3 -0
  17. package/bun.js +4 -0
  18. package/common-BlvLUwEz.d.ts +85 -0
  19. package/common-BoeQmwpt.cjs +340 -0
  20. package/common-CElmMmuq.js +279 -0
  21. package/common-DZ2cLtbe.d.cts +84 -0
  22. package/esbuild.cjs +6 -3
  23. package/esbuild.d.cts +4 -1
  24. package/esbuild.d.ts +5 -0
  25. package/esbuild.js +10 -0
  26. package/farm.cjs +6 -3
  27. package/farm.d.cts +4 -1
  28. package/farm.d.ts +5 -0
  29. package/farm.js +10 -0
  30. package/index-COIv1oYx.d.cts +48 -0
  31. package/index-PPreQbn5.d.ts +48 -0
  32. package/index.cjs +17 -28
  33. package/index.d.cts +5 -17
  34. package/index.d.ts +5 -0
  35. package/index.js +6 -0
  36. package/package.json +11 -9
  37. package/rolldown.cjs +6 -3
  38. package/rolldown.d.cts +4 -1
  39. package/rolldown.d.ts +5 -0
  40. package/rolldown.js +10 -0
  41. package/rollup.cjs +6 -3
  42. package/rollup.d.cts +4 -1
  43. package/rollup.d.ts +5 -0
  44. package/rollup.js +10 -0
  45. package/rspack.cjs +6 -3
  46. package/rspack.d.cts +4 -1
  47. package/rspack.d.ts +5 -0
  48. package/rspack.js +10 -0
  49. package/src-D84rmPxv.js +21 -0
  50. package/src-bIj7OBnd.cjs +82 -0
  51. package/vite.cjs +6 -3
  52. package/vite.d.cts +4 -1
  53. package/vite.d.ts +5 -0
  54. package/vite.js +10 -0
  55. package/webpack.cjs +6 -3
  56. package/webpack.d.cts +4 -1
  57. package/webpack.d.ts +5 -0
  58. package/webpack.js +10 -0
  59. package/babel.d.mts +0 -11
  60. package/babel.mjs +0 -158
  61. package/bun.d.mts +0 -6
  62. package/bun.mjs +0 -36
  63. package/common-CRPQ2KE6.d.mts +0 -25
  64. package/common-Dpl8jppn.d.cts +0 -25
  65. package/esbuild.d.mts +0 -2
  66. package/esbuild.mjs +0 -7
  67. package/farm.d.mts +0 -2
  68. package/farm.mjs +0 -7
  69. package/filter-6T-5w4kG.mjs +0 -234
  70. package/filter-CKmD4HRk.cjs +0 -327
  71. package/index-legacy-DRI9LQiG.d.mts +0 -1488
  72. package/index-legacy-xKi5C2ga.d.cts +0 -1488
  73. package/index.d.mts +0 -17
  74. package/index.mjs +0 -17
  75. package/rolldown-browser-DKeiFM_e.mjs +0 -129
  76. package/rolldown-browser-DUanNY-R.cjs +0 -141
  77. package/rolldown-browser-JYqfNLQ8.d.mts +0 -1247
  78. package/rolldown.d.mts +0 -2
  79. package/rolldown.mjs +0 -7
  80. package/rollup-impl-DqC_d-_W.d.cts +0 -1246
  81. package/rollup.d.mts +0 -2
  82. package/rollup.mjs +0 -7
  83. package/rspack.d.mts +0 -2
  84. package/rspack.mjs +0 -7
  85. package/vite.d.mts +0 -2
  86. package/vite.mjs +0 -7
  87. package/webpack.d.mts +0 -2
  88. package/webpack.mjs +0 -7
@@ -0,0 +1,279 @@
1
+ import { transpileFn } from "tinyest-for-wgsl";
2
+ import * as t from "@babel/types";
3
+ import { MagicStringAST } from "magic-string-ast";
4
+
5
+ //#region src/core/polyfill-process.ts
6
+ if (typeof globalThis.process === "undefined") globalThis.process = {};
7
+ if (typeof globalThis.process.env === "undefined") globalThis.process.env = {};
8
+
9
+ //#endregion
10
+ //#region src/core/common.ts
11
+ function initPluginState(state, methods) {
12
+ var _state$opts$autoNamin;
13
+ state.tgpuAliases = new Set(state.opts.forceTgpuAlias ? [state.opts.forceTgpuAlias] : []);
14
+ state.autoNamingEnabled = (_state$opts$autoNamin = state.opts.autoNamingEnabled) !== null && _state$opts$autoNamin !== void 0 ? _state$opts$autoNamin : true;
15
+ state.inUseGpuScope = false;
16
+ state.alreadyTransformed = /* @__PURE__ */ new WeakSet();
17
+ Object.assign(state, methods);
18
+ }
19
+ /** Regular expressions used for early pruning (to avoid unnecessary parsing, which is expensive) */
20
+ const earlyPruneRegex = [/["']use gpu["']/, /t(ype)?gpu/];
21
+ const defaultOptions = {
22
+ include: /\.m?[jt]sx?(?:\?.*)?$/,
23
+ autoNamingEnabled: true,
24
+ earlyPruning: true
25
+ };
26
+ /**
27
+ * Returns the block scope of a function declaration, if one exists.
28
+ * Used to hoist a function declaration to the top of the scope it's visible in.
29
+ */
30
+ function getBlockScope(path) {
31
+ if (!path.node.id) return;
32
+ const binding = path.scope.getBinding(path.node.id.name);
33
+ if (!binding) return;
34
+ let scopePath = binding.scope.path;
35
+ if (t.isNode(scopePath.node.body)) scopePath = scopePath.get("body");
36
+ if (t.isBlockStatement(scopePath.node) || t.isProgram(scopePath.node)) return scopePath;
37
+ }
38
+ /**
39
+ * Checks if `node` is an alias for the 'tgpu' object, traditionally
40
+ * available via `import tgpu from 'typegpu'`.
41
+ */
42
+ function isTgpu(state, node) {
43
+ let path = "";
44
+ let tail = node;
45
+ while (true) if (tail.type === "MemberExpression") {
46
+ if (tail.property.type === "StringLiteral" && tail.property.value === "~unstable") {
47
+ tail = tail.object;
48
+ continue;
49
+ }
50
+ if (tail.property.type !== "Identifier") break;
51
+ path = path ? `${tail.property.name}.${path}` : tail.property.name;
52
+ tail = tail.object;
53
+ } else if (tail.type === "Identifier") {
54
+ path = path ? `${tail.name}.${path}` : tail.name;
55
+ break;
56
+ } else break;
57
+ return state.tgpuAliases.has(path);
58
+ }
59
+ function gatherTgpuAliases(state, node) {
60
+ if (node.source.value !== "typegpu") return;
61
+ for (const spec of node.specifiers) if (spec.type === "ImportDefaultSpecifier" || spec.type === "ImportSpecifier" && spec.imported.type === "Identifier" && spec.imported.name === "tgpu") state.tgpuAliases.add(spec.local.name);
62
+ else if (spec.type === "ImportNamespaceSpecifier") state.tgpuAliases.add(`${spec.local.name}.tgpu`);
63
+ }
64
+ const fnShellFunctionNames = [
65
+ "fn",
66
+ "vertexFn",
67
+ "fragmentFn",
68
+ "computeFn"
69
+ ];
70
+ function isShellImplementationCall(node, state) {
71
+ return node.callee.type === "CallExpression" && node.callee.callee.type === "MemberExpression" && node.callee.callee.property.type === "Identifier" && fnShellFunctionNames.includes(node.callee.callee.property.name) && node.arguments.length === 1 && isTgpu(state, node.callee.callee.object);
72
+ }
73
+ /**
74
+ * Extracts a name and expression from nodes that contain a label and an expression,
75
+ * such as VariableDeclarator or PropertyDefinition.
76
+ * Returns a tuple of [name, expression] if found, otherwise undefined.
77
+ *
78
+ * @example
79
+ * extractLabelledExpression(node`let name = tgpu.bindGroupLayout({});`)
80
+ * // ["name", node`tgpu.bindGroupLayout({})`]
81
+ */
82
+ function extractLabelledExpression(path) {
83
+ if (path.node.type === "VariableDeclarator" && path.node.id.type === "Identifier" && path.node.init) return [path.node.id.name, path.get("init")];
84
+ else if (path.node.type === "AssignmentExpression") {
85
+ const maybeName = tryFindIdentifier(path.node.left);
86
+ if (maybeName) return [maybeName, path.get("right")];
87
+ } else if (path.node.type === "ObjectProperty" && path.node.key.type === "Identifier") return [path.node.key.name, path.get("value")];
88
+ else if (path.node.type === "ClassProperty" && path.node.value && path.node.key.type === "Identifier") return [path.node.key.name, path.get("value")];
89
+ }
90
+ function getFunctionName(path) {
91
+ var _extractLabelledExpre, _path$node$id;
92
+ const maybeName = path.parentPath ? (_extractLabelledExpre = extractLabelledExpression(path.parentPath)) === null || _extractLabelledExpre === void 0 ? void 0 : _extractLabelledExpre[0] : void 0;
93
+ return maybeName !== null && maybeName !== void 0 ? maybeName : path.node.type === "FunctionDeclaration" || path.node.type === "FunctionExpression" ? (_path$node$id = path.node.id) === null || _path$node$id === void 0 ? void 0 : _path$node$id.name : void 0;
94
+ }
95
+ const resourceConstructors = [
96
+ "bindGroupLayout",
97
+ "vertexLayout",
98
+ "privateVar",
99
+ "workgroupVar",
100
+ "const",
101
+ "slot",
102
+ "accessor",
103
+ "mutableAccessor",
104
+ "comptime",
105
+ ...fnShellFunctionNames,
106
+ "createBuffer",
107
+ "createMutable",
108
+ "createReadonly",
109
+ "createUniform",
110
+ "createQuerySet",
111
+ "createPipeline",
112
+ "createComputePipeline",
113
+ "createGuardedComputePipeline",
114
+ "createRenderPipeline",
115
+ "createTexture",
116
+ "createSampler",
117
+ "createComparisonSampler",
118
+ "struct",
119
+ "unstruct",
120
+ "createView"
121
+ ];
122
+ /**
123
+ * Checks if `node` should be wrapped in an autoname function.
124
+ * Since it is mostly for debugging and clean WGSL generation,
125
+ * some false positives and false negatives are admissible.
126
+ */
127
+ function containsResourceConstructorCall(node, state) {
128
+ if (node.type === "CallExpression") {
129
+ if (isShellImplementationCall(node, state)) return true;
130
+ if (node.callee.type === "Identifier" && resourceConstructors.includes(node.callee.name)) return true;
131
+ if (node.callee.type === "MemberExpression") {
132
+ if (node.callee.property.type === "Identifier") {
133
+ if (resourceConstructors.includes(node.callee.property.name)) return true;
134
+ if (node.callee.property.name === "$name") return false;
135
+ }
136
+ return containsResourceConstructorCall(node.callee.object, state);
137
+ }
138
+ }
139
+ if (node.type === "TaggedTemplateExpression") return containsResourceConstructorCall(node.tag, state);
140
+ return false;
141
+ }
142
+ /**
143
+ * Tries to find an identifier in a node.
144
+ *
145
+ * @example
146
+ * // syntax is simplified, imagine the arguments are appropriate nodes instead
147
+ * tryFindIdentifier('myBuffer'); // 'myBuffer'
148
+ * tryFindIdentifier('buffers.myBuffer'); // 'myBuffer'
149
+ * tryFindIdentifier('this.myBuffer'); // 'myBuffer'
150
+ * tryFindIdentifier('[a, b]'); // undefined
151
+ */
152
+ function tryFindIdentifier(node) {
153
+ if (node.type === "Identifier") return node.name;
154
+ if (node.type === "PrivateName") return tryFindIdentifier(node.id);
155
+ if (node.type === "MemberExpression") return tryFindIdentifier(node.property);
156
+ }
157
+ /**
158
+ * Checks if `node` contains a label and a tgpu expression that could be named.
159
+ * If so, it calls the provided callback. Nodes selected for naming include:
160
+ *
161
+ * `let name = tgpu.bindGroupLayout({});` (VariableDeclarator)
162
+ *
163
+ * `name = tgpu.bindGroupLayout({});` (AssignmentExpression)
164
+ *
165
+ * `property: tgpu.bindGroupLayout({})` (Property/ObjectProperty)
166
+ *
167
+ * Since it is mostly for debugging and clean WGSL generation,
168
+ * some false positives and false negatives are admissible.
169
+ *
170
+ * This function is NOT used for auto-naming shell-less functions.
171
+ * Those are handled separately.
172
+ *
173
+ * @privateRemarks
174
+ * When adding new checks, you need to call this method in the corresponding node in Babel.
175
+ */
176
+ function performExpressionNaming(state, path, namingCallback) {
177
+ if (!state.autoNamingEnabled) return;
178
+ const labelledExpression = extractLabelledExpression(path);
179
+ if (labelledExpression) {
180
+ const [label, expressionPath] = labelledExpression;
181
+ if (containsResourceConstructorCall(expressionPath.node, state)) namingCallback(expressionPath, label);
182
+ }
183
+ }
184
+ const operators = {
185
+ "+": "__tsover_add",
186
+ "-": "__tsover_sub",
187
+ "*": "__tsover_mul",
188
+ "/": "__tsover_div",
189
+ "%": "__tsover_mod",
190
+ "+=": "__tsover_add",
191
+ "-=": "__tsover_sub",
192
+ "*=": "__tsover_mul",
193
+ "/=": "__tsover_div",
194
+ "%=": "__tsover_mod"
195
+ };
196
+ function containsUseGpuDirective(node) {
197
+ var _node$body$directives, _node$body;
198
+ return ("directives" in node.body ? (_node$body$directives = (_node$body = node.body) === null || _node$body === void 0 ? void 0 : _node$body.directives) !== null && _node$body$directives !== void 0 ? _node$body$directives : [] : []).map((directive) => directive.value.value).includes("use gpu");
199
+ }
200
+ const fnNodeToTranspiledMap = /* @__PURE__ */ new WeakMap();
201
+ function functionOnExit(path, state) {
202
+ const node = path.node;
203
+ if (!containsUseGpuDirective(node)) return;
204
+ state.inUseGpuScope = false;
205
+ if (state.alreadyTransformed.has(node)) return;
206
+ const ast = fnNodeToTranspiledMap.get(path.node);
207
+ const maybeName = getFunctionName(path);
208
+ if (!ast) throw new Error(`No metadata found for function ${maybeName !== null && maybeName !== void 0 ? maybeName : "<unnamed>"}`);
209
+ state.assignMetadata(path, maybeName, ast);
210
+ state.alreadyTransformed.add(node);
211
+ path.skip();
212
+ }
213
+ const functionVisitor = {
214
+ ImportDeclaration(path, state) {
215
+ gatherTgpuAliases(state, path.node);
216
+ },
217
+ VariableDeclarator(path, state) {
218
+ performExpressionNaming(state, path, (pathToName, name) => {
219
+ state.wrapInAutoName(pathToName, name);
220
+ });
221
+ },
222
+ ObjectProperty(path, state) {
223
+ performExpressionNaming(state, path, (pathToName, name) => state.wrapInAutoName(pathToName, name));
224
+ },
225
+ ClassProperty(path, state) {
226
+ performExpressionNaming(state, path, (pathToName, name) => state.wrapInAutoName(pathToName, name));
227
+ },
228
+ AssignmentExpression: { exit(path, state) {
229
+ const runtimeFn = operators[path.node.operator];
230
+ if (state.inUseGpuScope && runtimeFn) state.replaceWithAssignmentOverload(path, runtimeFn);
231
+ performExpressionNaming(state, path, (pathToName, name) => state.wrapInAutoName(pathToName, name));
232
+ path.skip();
233
+ } },
234
+ BinaryExpression: { exit(path, state) {
235
+ const runtimeFn = operators[path.node.operator];
236
+ if (state.inUseGpuScope && runtimeFn) state.replaceWithBinaryOverload(path, runtimeFn);
237
+ path.skip();
238
+ } },
239
+ ArrowFunctionExpression: {
240
+ enter(path, state) {
241
+ if (containsUseGpuDirective(path.node)) {
242
+ fnNodeToTranspiledMap.set(path.node, transpileFn(path.node));
243
+ if (state.inUseGpuScope) throw new Error(`Nesting 'use gpu' functions is not allowed`);
244
+ state.inUseGpuScope = true;
245
+ }
246
+ },
247
+ exit: functionOnExit
248
+ },
249
+ FunctionExpression: {
250
+ enter(path, state) {
251
+ if (containsUseGpuDirective(path.node)) {
252
+ fnNodeToTranspiledMap.set(path.node, transpileFn(path.node));
253
+ if (state.inUseGpuScope) throw new Error(`Nesting 'use gpu' functions is not allowed`);
254
+ state.inUseGpuScope = true;
255
+ }
256
+ },
257
+ exit: functionOnExit
258
+ },
259
+ FunctionDeclaration: {
260
+ enter(path, state) {
261
+ if (containsUseGpuDirective(path.node)) {
262
+ fnNodeToTranspiledMap.set(path.node, transpileFn(path.node));
263
+ if (state.inUseGpuScope) throw new Error(`Nesting 'use gpu' functions is not allowed`);
264
+ state.inUseGpuScope = true;
265
+ }
266
+ },
267
+ exit: functionOnExit
268
+ },
269
+ CallExpression: { exit(path, state) {
270
+ const node = path.node;
271
+ if (isShellImplementationCall(node, state)) {
272
+ const implementation = node.arguments[0];
273
+ if (implementation && (implementation.type === "FunctionExpression" || implementation.type === "ArrowFunctionExpression") && !containsUseGpuDirective(implementation)) state.assignMetadata(path.get("arguments.0"), getFunctionName(path.get("arguments.0")), transpileFn(implementation));
274
+ }
275
+ } }
276
+ };
277
+
278
+ //#endregion
279
+ export { initPluginState as a, getBlockScope as i, earlyPruneRegex as n, t as o, functionVisitor as r, defaultOptions as t };
@@ -0,0 +1,84 @@
1
+ import { NodePath } from "@babel/traverse";
2
+ import * as t from "@babel/types";
3
+ import { FilterPattern } from "unplugin";
4
+ import { transpileFn } from "tinyest-for-wgsl";
5
+
6
+ //#region src/core/common.d.ts
7
+ interface Options {
8
+ /** @default [/\.m?[jt]sx?$/] */
9
+ include?: FilterPattern;
10
+ /** @default undefined */
11
+ exclude?: FilterPattern;
12
+ /** @default undefined */
13
+ enforce?: 'post' | 'pre' | undefined;
14
+ /** @default undefined */
15
+ forceTgpuAlias?: string | undefined;
16
+ /** @default true */
17
+ autoNamingEnabled?: boolean | undefined;
18
+ /**
19
+ * Skipping files that don't contain "typegpu", "tgpu" or "use gpu".
20
+ * In case this early pruning hinders transformation, you
21
+ * can disable it.
22
+ *
23
+ * @default true
24
+ */
25
+ earlyPruning?: boolean | undefined;
26
+ }
27
+ type MetadatableFunction = t.FunctionDeclaration | t.FunctionExpression | t.ArrowFunctionExpression;
28
+ interface TransformMethods {
29
+ warn(message: string): void;
30
+ /**
31
+ * For function statements to have metadata assigned, they first have to be manually hoisted
32
+ * to the top of their scope, then replaced with a variable declaration.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const value = mod(13, 10);
37
+ * function mod(a: number, b: number): number {
38
+ * 'use gpu';
39
+ * return a % b;
40
+ * }
41
+ * ```
42
+ *
43
+ * Should be transformed to:
44
+ *
45
+ * ```ts
46
+ * const mod = (a: number, b: number): number => {
47
+ * 'use gpu';
48
+ * return a % b;
49
+ * };
50
+ * const value = mod(13, 10);
51
+ * ```
52
+ *
53
+ * Note that named function expressions aren't hoisted, so they don't pose a problem.
54
+ * ```ts
55
+ * double(2); // Uncaught ReferenceError: double is not defined
56
+ * console.log(function double(a) { return a * 2; });
57
+ * ```
58
+ */
59
+ assignMetadata(this: PluginState, path: NodePath<MetadatableFunction>, name: string | undefined, ast: ReturnType<typeof transpileFn>): void;
60
+ wrapInAutoName(this: PluginState, path: NodePath<t.Expression>, name: string): void;
61
+ replaceWithAssignmentOverload(path: NodePath<t.AssignmentExpression>, runtimeFn: string): void;
62
+ replaceWithBinaryOverload(path: NodePath<t.BinaryExpression>, runtimeFn: string): void;
63
+ }
64
+ interface PluginState extends TransformMethods {
65
+ /**
66
+ * How the `tgpu` object is used in code. Since it can be aliased, we
67
+ * need to catch that and act accordingly.
68
+ */
69
+ tgpuAliases: Set<string>;
70
+ autoNamingEnabled: boolean;
71
+ /**
72
+ * Populated by Babel
73
+ */
74
+ filename?: string | undefined;
75
+ /**
76
+ * In Babel, options are assigned to the property `opts` on the plugin state.
77
+ * We use this pattern everywhere for consistency.
78
+ */
79
+ opts: Options;
80
+ inUseGpuScope: boolean;
81
+ alreadyTransformed: WeakSet<t.Node>;
82
+ }
83
+ //#endregion
84
+ export { PluginState as n, t as r, Options as t };
package/esbuild.cjs CHANGED
@@ -1,8 +1,11 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_index = require('./index.cjs');
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ require('./common-BoeQmwpt.cjs');
3
+ require('./babel-Dis-Pwfu.cjs');
4
+ require('./bun-DCACcaN2.cjs');
5
+ const require_src = require('./src-bIj7OBnd.cjs');
3
6
 
4
7
  //#region src/esbuild.ts
5
- var esbuild_default = require_index.esbuildPlugin;
8
+ var esbuild_default = require_src.esbuildPlugin;
6
9
 
7
10
  //#endregion
8
11
  exports.default = esbuild_default;
package/esbuild.d.cts CHANGED
@@ -1,2 +1,5 @@
1
- import { esbuildPlugin } from "./index.cjs";
1
+ import "./common-DZ2cLtbe.cjs";
2
+ import "./babel-C8UzthFd.cjs";
3
+ import "./bun-cwXs2EDP.cjs";
4
+ import { t as esbuildPlugin } from "./index-COIv1oYx.cjs";
2
5
  export = esbuildPlugin;
package/esbuild.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import "./common-BlvLUwEz.js";
2
+ import "./babel-CmCnq-43.js";
3
+ import "./bun-ovScJ4Es.js";
4
+ import { t as esbuildPlugin } from "./index-PPreQbn5.js";
5
+ export { esbuildPlugin as default };
package/esbuild.js ADDED
@@ -0,0 +1,10 @@
1
+ import "./common-CElmMmuq.js";
2
+ import "./babel-CbManzjz.js";
3
+ import "./bun-CDECNeIU.js";
4
+ import { t as esbuildPlugin } from "./src-D84rmPxv.js";
5
+
6
+ //#region src/esbuild.ts
7
+ var esbuild_default = esbuildPlugin;
8
+
9
+ //#endregion
10
+ export { esbuild_default as default };
package/farm.cjs CHANGED
@@ -1,8 +1,11 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_index = require('./index.cjs');
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ require('./common-BoeQmwpt.cjs');
3
+ require('./babel-Dis-Pwfu.cjs');
4
+ require('./bun-DCACcaN2.cjs');
5
+ const require_src = require('./src-bIj7OBnd.cjs');
3
6
 
4
7
  //#region src/farm.ts
5
- var farm_default = require_index.farmPlugin;
8
+ var farm_default = require_src.farmPlugin;
6
9
 
7
10
  //#endregion
8
11
  exports.default = farm_default;
package/farm.d.cts CHANGED
@@ -1,2 +1,5 @@
1
- import { farmPlugin } from "./index.cjs";
1
+ import "./common-DZ2cLtbe.cjs";
2
+ import "./babel-C8UzthFd.cjs";
3
+ import "./bun-cwXs2EDP.cjs";
4
+ import { n as farmPlugin } from "./index-COIv1oYx.cjs";
2
5
  export = farmPlugin;
package/farm.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import "./common-BlvLUwEz.js";
2
+ import "./babel-CmCnq-43.js";
3
+ import "./bun-ovScJ4Es.js";
4
+ import { n as farmPlugin } from "./index-PPreQbn5.js";
5
+ export { farmPlugin as default };
package/farm.js ADDED
@@ -0,0 +1,10 @@
1
+ import "./common-CElmMmuq.js";
2
+ import "./babel-CbManzjz.js";
3
+ import "./bun-CDECNeIU.js";
4
+ import { n as farmPlugin } from "./src-D84rmPxv.js";
5
+
6
+ //#region src/farm.ts
7
+ var farm_default = farmPlugin;
8
+
9
+ //#endregion
10
+ export { farm_default as default };
@@ -0,0 +1,48 @@
1
+ import { t as Options } from "./common-DZ2cLtbe.cjs";
2
+ import * as unplugin8 from "unplugin";
3
+ import * as magic_string_ast0 from "magic-string-ast";
4
+
5
+ //#region src/rolldown-browser.d.ts
6
+ declare const _default$1: (options?: Options) => {
7
+ name: "unplugin-typegpu";
8
+ enforce: "post" | "pre" | undefined;
9
+ transform: {
10
+ filter: {
11
+ id: Omit<Options, "include" | "autoNamingEnabled" | "earlyPruning"> & Omit<{
12
+ include: RegExp;
13
+ autoNamingEnabled: boolean;
14
+ earlyPruning: boolean;
15
+ }, "include" | "autoNamingEnabled" | "earlyPruning"> & {
16
+ include: string | RegExp | unplugin8.StringOrRegExp[];
17
+ autoNamingEnabled: boolean;
18
+ earlyPruning: boolean;
19
+ };
20
+ code: RegExp[];
21
+ } | {
22
+ id: Omit<Options, "include" | "autoNamingEnabled" | "earlyPruning"> & Omit<{
23
+ include: RegExp;
24
+ autoNamingEnabled: boolean;
25
+ earlyPruning: boolean;
26
+ }, "include" | "autoNamingEnabled" | "earlyPruning"> & {
27
+ include: string | RegExp | unplugin8.StringOrRegExp[];
28
+ autoNamingEnabled: boolean;
29
+ earlyPruning: boolean;
30
+ };
31
+ code?: never;
32
+ };
33
+ handler(this: unplugin8.UnpluginBuildContext & unplugin8.UnpluginContext, code: string, id: string): magic_string_ast0.CodeTransform | undefined;
34
+ };
35
+ };
36
+ //#endregion
37
+ //#region src/index.d.ts
38
+ declare const typegpu: unplugin8.UnpluginInstance<Options | undefined, boolean>;
39
+ declare const vitePlugin: (options?: Options | undefined) => unplugin8.VitePlugin<any> | unplugin8.VitePlugin<any>[];
40
+ declare const rollupPlugin: (options?: Options | undefined) => unplugin8.RollupPlugin<any> | unplugin8.RollupPlugin<any>[];
41
+ declare const rolldownPlugin: (options?: Options | undefined) => unplugin8.RolldownPlugin<any> | unplugin8.RolldownPlugin<any>[];
42
+ declare const webpackPlugin: (options?: Options | undefined) => unplugin8.WebpackPluginInstance;
43
+ declare const rspackPlugin: (options?: Options | undefined) => RspackPluginInstance;
44
+ declare const esbuildPlugin: (options?: Options | undefined) => unplugin8.EsbuildPlugin;
45
+ declare const farmPlugin: (options?: Options | undefined) => JsPlugin;
46
+ declare const unloaderPlugin: (options?: Options | undefined) => any;
47
+ //#endregion
48
+ export { rspackPlugin as a, vitePlugin as c, rollupPlugin as i, webpackPlugin as l, farmPlugin as n, typegpu as o, rolldownPlugin as r, unloaderPlugin as s, esbuildPlugin as t, _default$1 as u };
@@ -0,0 +1,48 @@
1
+ import { t as Options } from "./common-BlvLUwEz.js";
2
+ import * as magic_string_ast0 from "magic-string-ast";
3
+ import * as unplugin8 from "unplugin";
4
+
5
+ //#region src/rolldown-browser.d.ts
6
+ declare const _default$1: (options?: Options) => {
7
+ name: "unplugin-typegpu";
8
+ enforce: "post" | "pre" | undefined;
9
+ transform: {
10
+ filter: {
11
+ id: Omit<Options, "include" | "autoNamingEnabled" | "earlyPruning"> & Omit<{
12
+ include: RegExp;
13
+ autoNamingEnabled: boolean;
14
+ earlyPruning: boolean;
15
+ }, "include" | "autoNamingEnabled" | "earlyPruning"> & {
16
+ include: string | RegExp | unplugin8.StringOrRegExp[];
17
+ autoNamingEnabled: boolean;
18
+ earlyPruning: boolean;
19
+ };
20
+ code: RegExp[];
21
+ } | {
22
+ id: Omit<Options, "include" | "autoNamingEnabled" | "earlyPruning"> & Omit<{
23
+ include: RegExp;
24
+ autoNamingEnabled: boolean;
25
+ earlyPruning: boolean;
26
+ }, "include" | "autoNamingEnabled" | "earlyPruning"> & {
27
+ include: string | RegExp | unplugin8.StringOrRegExp[];
28
+ autoNamingEnabled: boolean;
29
+ earlyPruning: boolean;
30
+ };
31
+ code?: never;
32
+ };
33
+ handler(this: unplugin8.UnpluginBuildContext & unplugin8.UnpluginContext, code: string, id: string): magic_string_ast0.CodeTransform | undefined;
34
+ };
35
+ };
36
+ //#endregion
37
+ //#region src/index.d.ts
38
+ declare const typegpu: unplugin8.UnpluginInstance<Options | undefined, boolean>;
39
+ declare const vitePlugin: (options?: Options | undefined) => unplugin8.VitePlugin<any> | unplugin8.VitePlugin<any>[];
40
+ declare const rollupPlugin: (options?: Options | undefined) => unplugin8.RollupPlugin<any> | unplugin8.RollupPlugin<any>[];
41
+ declare const rolldownPlugin: (options?: Options | undefined) => unplugin8.RolldownPlugin<any> | unplugin8.RolldownPlugin<any>[];
42
+ declare const webpackPlugin: (options?: Options | undefined) => unplugin8.WebpackPluginInstance;
43
+ declare const rspackPlugin: (options?: Options | undefined) => RspackPluginInstance;
44
+ declare const esbuildPlugin: (options?: Options | undefined) => unplugin8.EsbuildPlugin;
45
+ declare const farmPlugin: (options?: Options | undefined) => JsPlugin;
46
+ declare const unloaderPlugin: (options?: Options | undefined) => any;
47
+ //#endregion
48
+ export { rspackPlugin as a, vitePlugin as c, rollupPlugin as i, webpackPlugin as l, farmPlugin as n, typegpu as o, rolldownPlugin as r, unloaderPlugin as s, esbuildPlugin as t, _default$1 as u };
package/index.cjs CHANGED
@@ -1,29 +1,18 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_filter = require('./filter-CKmD4HRk.cjs');
3
- const require_rolldown_browser = require('./rolldown-browser-DUanNY-R.cjs');
4
- const require_babel = require('./babel.cjs');
5
- const require_bun = require('./bun.cjs');
6
- let unplugin = require("unplugin");
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ require('./common-BoeQmwpt.cjs');
3
+ const require_babel = require('./babel-Dis-Pwfu.cjs');
4
+ const require_bun = require('./bun-DCACcaN2.cjs');
5
+ const require_src = require('./src-bIj7OBnd.cjs');
7
6
 
8
- //#region src/index.ts
9
- const typegpu = (0, unplugin.createUnplugin)(require_rolldown_browser.rollUpImpl);
10
- const vitePlugin = typegpu.vite;
11
- const rollupPlugin = typegpu.rollup;
12
- const rolldownPlugin = typegpu.rolldown;
13
- const webpackPlugin = typegpu.webpack;
14
- const rspackPlugin = typegpu.rspack;
15
- const esbuildPlugin = typegpu.esbuild;
16
- const farmPlugin = typegpu.farm;
17
-
18
- //#endregion
19
- exports.babelPlugin = require_babel.default;
20
- exports.bunPlugin = require_bun.default;
21
- exports.default = typegpu;
22
- exports.esbuildPlugin = esbuildPlugin;
23
- exports.farmPlugin = farmPlugin;
24
- exports.rolldownBrowserPlugin = require_rolldown_browser.rolldown_browser_default;
25
- exports.rolldownPlugin = rolldownPlugin;
26
- exports.rollupPlugin = rollupPlugin;
27
- exports.rspackPlugin = rspackPlugin;
28
- exports.vitePlugin = vitePlugin;
29
- exports.webpackPlugin = webpackPlugin;
7
+ exports.babelPlugin = require_babel.TypeGPUPlugin;
8
+ exports.bunPlugin = require_bun.bun_default;
9
+ exports.default = require_src.src_default;
10
+ exports.esbuildPlugin = require_src.esbuildPlugin;
11
+ exports.farmPlugin = require_src.farmPlugin;
12
+ exports.rolldownBrowserPlugin = require_src.rolldown_browser_default;
13
+ exports.rolldownPlugin = require_src.rolldownPlugin;
14
+ exports.rollupPlugin = require_src.rollupPlugin;
15
+ exports.rspackPlugin = require_src.rspackPlugin;
16
+ exports.unloaderPlugin = require_src.unloaderPlugin;
17
+ exports.vitePlugin = require_src.vitePlugin;
18
+ exports.webpackPlugin = require_src.webpackPlugin;
package/index.d.cts CHANGED
@@ -1,17 +1,5 @@
1
- import export_default from "./babel.cjs";
2
- import { t as Options } from "./common-Dpl8jppn.cjs";
3
- import _default from "./bun.cjs";
4
- import { n as Plugin, t as rollUpImpl } from "./rollup-impl-DqC_d-_W.cjs";
5
- import * as unplugin from "unplugin";
6
-
7
- //#region src/index.d.ts
8
- declare const typegpu: unplugin.UnpluginInstance<Options, boolean>;
9
- declare const vitePlugin: (options: Options) => unplugin.VitePlugin<any> | unplugin.VitePlugin<any>[];
10
- declare const rollupPlugin: (options: Options) => Plugin<any> | Plugin<any>[];
11
- declare const rolldownPlugin: (options: Options) => unplugin.RolldownPlugin<any> | unplugin.RolldownPlugin<any>[];
12
- declare const webpackPlugin: (options: Options) => unplugin.WebpackPluginInstance;
13
- declare const rspackPlugin: (options: Options) => RspackPluginInstance;
14
- declare const esbuildPlugin: (options: Options) => unplugin.EsbuildPlugin;
15
- declare const farmPlugin: (options: Options) => JsPlugin;
16
- //#endregion
17
- export { type Options, export_default as babelPlugin, _default as bunPlugin, typegpu as default, esbuildPlugin, farmPlugin, rollUpImpl as rolldownBrowserPlugin, rolldownPlugin, rollupPlugin, rspackPlugin, vitePlugin, webpackPlugin };
1
+ import { t as Options } from "./common-DZ2cLtbe.cjs";
2
+ import { t as TypeGPUPlugin } from "./babel-C8UzthFd.cjs";
3
+ import { t as _default } from "./bun-cwXs2EDP.cjs";
4
+ import { a as rspackPlugin, c as vitePlugin, i as rollupPlugin, l as webpackPlugin, n as farmPlugin, o as typegpu, r as rolldownPlugin, s as unloaderPlugin, t as esbuildPlugin, u as _default$1 } from "./index-COIv1oYx.cjs";
5
+ export { Options, TypeGPUPlugin as babelPlugin, _default as bunPlugin, typegpu as default, esbuildPlugin, farmPlugin, _default$1 as rolldownBrowserPlugin, rolldownPlugin, rollupPlugin, rspackPlugin, unloaderPlugin, vitePlugin, webpackPlugin };
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { t as Options } from "./common-BlvLUwEz.js";
2
+ import { t as TypeGPUPlugin } from "./babel-CmCnq-43.js";
3
+ import { t as _default } from "./bun-ovScJ4Es.js";
4
+ import { a as rspackPlugin, c as vitePlugin, i as rollupPlugin, l as webpackPlugin, n as farmPlugin, o as typegpu, r as rolldownPlugin, s as unloaderPlugin, t as esbuildPlugin, u as _default$1 } from "./index-PPreQbn5.js";
5
+ export { Options, TypeGPUPlugin as babelPlugin, _default as bunPlugin, typegpu as default, esbuildPlugin, farmPlugin, _default$1 as rolldownBrowserPlugin, rolldownPlugin, rollupPlugin, rspackPlugin, unloaderPlugin, vitePlugin, webpackPlugin };
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import "./common-CElmMmuq.js";
2
+ import { t as TypeGPUPlugin } from "./babel-CbManzjz.js";
3
+ import { t as bun_default } from "./bun-CDECNeIU.js";
4
+ import { a as rspackPlugin, c as vitePlugin, i as rollupPlugin, l as webpackPlugin, n as farmPlugin, o as src_default, r as rolldownPlugin, s as unloaderPlugin, t as esbuildPlugin, u as rolldown_browser_default } from "./src-D84rmPxv.js";
5
+
6
+ export { TypeGPUPlugin as babelPlugin, bun_default as bunPlugin, src_default as default, esbuildPlugin, farmPlugin, rolldown_browser_default as rolldownBrowserPlugin, rolldownPlugin, rollupPlugin, rspackPlugin, unloaderPlugin, vitePlugin, webpackPlugin };