unplugin-typegpu 0.10.0 → 0.10.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 (76) hide show
  1. package/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/babel.cjs +17 -15
  3. package/babel.d.cts +2 -3
  4. package/babel.d.mts +2 -3
  5. package/babel.mjs +3 -3
  6. package/bun.cjs +6 -5
  7. package/bun.d.cts +2 -3
  8. package/bun.d.mts +2 -3
  9. package/bun.mjs +2 -3
  10. package/{filter-6T-5w4kG.mjs → common.cjs} +9 -61
  11. package/{common-CRPQ2KE6.d.mts → common.d.cts} +1 -2
  12. package/{common-Dpl8jppn.d.cts → common.d.mts} +1 -2
  13. package/{filter-CKmD4HRk.cjs → common.mjs} +1 -154
  14. package/esbuild.d.cts +0 -1
  15. package/esbuild.d.mts +0 -2
  16. package/esbuild.mjs +1 -2
  17. package/farm.d.cts +0 -1
  18. package/farm.d.mts +0 -2
  19. package/farm.mjs +1 -2
  20. package/filter.cjs +63 -0
  21. package/filter.mjs +61 -0
  22. package/index.cjs +5 -4
  23. package/index.d.cts +4 -4
  24. package/index.d.mts +5 -4
  25. package/index.mjs +3 -3
  26. package/package.json +18 -18
  27. package/rolldown-browser.cjs +7 -0
  28. package/rolldown-browser.d.mts +1 -0
  29. package/rolldown-browser.mjs +7 -0
  30. package/rolldown.d.cts +0 -1
  31. package/rolldown.d.mts +0 -2
  32. package/rolldown.mjs +1 -2
  33. package/{rolldown-browser-DUanNY-R.cjs → rollup-impl.cjs} +15 -29
  34. package/rollup-impl.d.cts +38 -0
  35. package/rollup-impl.d.mts +39 -0
  36. package/{rolldown-browser-DKeiFM_e.mjs → rollup-impl.mjs} +2 -7
  37. package/rollup.d.cts +0 -1
  38. package/rollup.d.mts +0 -2
  39. package/rollup.mjs +1 -2
  40. package/rspack.d.cts +0 -1
  41. package/rspack.d.mts +0 -2
  42. package/rspack.mjs +1 -2
  43. package/vite.d.cts +0 -1
  44. package/vite.d.mts +0 -2
  45. package/vite.mjs +1 -2
  46. package/webpack.d.cts +0 -1
  47. package/webpack.d.mts +0 -2
  48. package/webpack.mjs +1 -2
  49. package/babel.d.cts.map +0 -1
  50. package/babel.d.mts.map +0 -1
  51. package/babel.mjs.map +0 -1
  52. package/bun.d.cts.map +0 -1
  53. package/bun.d.mts.map +0 -1
  54. package/bun.mjs.map +0 -1
  55. package/common-CRPQ2KE6.d.mts.map +0 -1
  56. package/common-Dpl8jppn.d.cts.map +0 -1
  57. package/esbuild.mjs.map +0 -1
  58. package/farm.mjs.map +0 -1
  59. package/filter-6T-5w4kG.mjs.map +0 -1
  60. package/index-legacy-DRI9LQiG.d.mts +0 -1489
  61. package/index-legacy-DRI9LQiG.d.mts.map +0 -1
  62. package/index-legacy-xKi5C2ga.d.cts +0 -1489
  63. package/index-legacy-xKi5C2ga.d.cts.map +0 -1
  64. package/index.d.cts.map +0 -1
  65. package/index.d.mts.map +0 -1
  66. package/index.mjs.map +0 -1
  67. package/rolldown-browser-DKeiFM_e.mjs.map +0 -1
  68. package/rolldown-browser-JYqfNLQ8.d.mts +0 -1248
  69. package/rolldown-browser-JYqfNLQ8.d.mts.map +0 -1
  70. package/rolldown.mjs.map +0 -1
  71. package/rollup-impl-DqC_d-_W.d.cts +0 -1247
  72. package/rollup-impl-DqC_d-_W.d.cts.map +0 -1
  73. package/rollup.mjs.map +0 -1
  74. package/rspack.mjs.map +0 -1
  75. package/vite.mjs.map +0 -1
  76. package/webpack.mjs.map +0 -1
package/index.cjs CHANGED
@@ -1,12 +1,13 @@
1
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');
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_rollup_impl = require('./rollup-impl.cjs');
4
4
  const require_babel = require('./babel.cjs');
5
5
  const require_bun = require('./bun.cjs');
6
+ const require_rolldown_browser = require('./rolldown-browser.cjs');
6
7
  let unplugin = require("unplugin");
7
8
 
8
9
  //#region src/index.ts
9
- const typegpu = (0, unplugin.createUnplugin)(require_rolldown_browser.rollUpImpl);
10
+ const typegpu = (0, unplugin.createUnplugin)(require_rollup_impl.rollUpImpl);
10
11
  const vitePlugin = typegpu.vite;
11
12
  const rollupPlugin = typegpu.rollup;
12
13
  const rolldownPlugin = typegpu.rolldown;
@@ -21,7 +22,7 @@ exports.bunPlugin = require_bun.default;
21
22
  exports.default = typegpu;
22
23
  exports.esbuildPlugin = esbuildPlugin;
23
24
  exports.farmPlugin = farmPlugin;
24
- exports.rolldownBrowserPlugin = require_rolldown_browser.rolldown_browser_default;
25
+ exports.rolldownBrowserPlugin = require_rolldown_browser.default;
25
26
  exports.rolldownPlugin = rolldownPlugin;
26
27
  exports.rollupPlugin = rollupPlugin;
27
28
  exports.rspackPlugin = rspackPlugin;
package/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  import export_default from "./babel.cjs";
2
- import { t as Options } from "./common-Dpl8jppn.cjs";
2
+ import { Options } from "./common.cjs";
3
3
  import _default from "./bun.cjs";
4
- import { n as Plugin, t as rollUpImpl } from "./rollup-impl-DqC_d-_W.cjs";
4
+ import { Plugin } from "./node_modules/.pnpm/rollup@4.34.8/node_modules/rollup/dist/rollup.cjs";
5
+ import { rollUpImpl } from "./rollup-impl.cjs";
5
6
  import * as unplugin from "unplugin";
6
7
 
7
8
  //#region src/index.d.ts
@@ -14,5 +15,4 @@ declare const rspackPlugin: (options: Options) => RspackPluginInstance;
14
15
  declare const esbuildPlugin: (options: Options) => unplugin.EsbuildPlugin;
15
16
  declare const farmPlugin: (options: Options) => JsPlugin;
16
17
  //#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 };
18
- //# sourceMappingURL=index.d.cts.map
18
+ export { type Options, export_default as babelPlugin, _default as bunPlugin, typegpu as default, esbuildPlugin, farmPlugin, rollUpImpl as rolldownBrowserPlugin, rolldownPlugin, rollupPlugin, rspackPlugin, vitePlugin, webpackPlugin };
package/index.d.mts CHANGED
@@ -1,7 +1,9 @@
1
1
  import export_default from "./babel.mjs";
2
- import { t as Options } from "./common-CRPQ2KE6.mjs";
2
+ import { Options } from "./common.mjs";
3
3
  import _default from "./bun.mjs";
4
- import { n as Plugin, t as rollUpImpl } from "./rolldown-browser-JYqfNLQ8.mjs";
4
+ import { Plugin } from "./node_modules/.pnpm/rollup@4.34.8/node_modules/rollup/dist/rollup.mjs";
5
+ import { rollUpImpl } from "./rollup-impl.mjs";
6
+ import "./rolldown-browser.mjs";
5
7
  import * as unplugin from "unplugin";
6
8
 
7
9
  //#region src/index.d.ts
@@ -14,5 +16,4 @@ declare const rspackPlugin: (options: Options) => RspackPluginInstance;
14
16
  declare const esbuildPlugin: (options: Options) => unplugin.EsbuildPlugin;
15
17
  declare const farmPlugin: (options: Options) => JsPlugin;
16
18
  //#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 };
18
- //# sourceMappingURL=index.d.mts.map
19
+ export { type Options, export_default as babelPlugin, _default as bunPlugin, typegpu as default, esbuildPlugin, farmPlugin, rollUpImpl as rolldownBrowserPlugin, rolldownPlugin, rollupPlugin, rspackPlugin, vitePlugin, webpackPlugin };
package/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
- import { n as rollUpImpl, t as rolldown_browser_default } from "./rolldown-browser-DKeiFM_e.mjs";
1
+ import { rollUpImpl } from "./rollup-impl.mjs";
2
2
  import babel_default from "./babel.mjs";
3
3
  import bun_default from "./bun.mjs";
4
+ import rolldown_browser_default from "./rolldown-browser.mjs";
4
5
  import { createUnplugin } from "unplugin";
5
6
 
6
7
  //#region src/index.ts
@@ -14,5 +15,4 @@ const esbuildPlugin = typegpu.esbuild;
14
15
  const farmPlugin = typegpu.farm;
15
16
 
16
17
  //#endregion
17
- export { babel_default as babelPlugin, bun_default as bunPlugin, typegpu as default, esbuildPlugin, farmPlugin, rolldown_browser_default as rolldownBrowserPlugin, rolldownPlugin, rollupPlugin, rspackPlugin, vitePlugin, webpackPlugin };
18
- //# sourceMappingURL=index.mjs.map
18
+ export { babel_default as babelPlugin, bun_default as bunPlugin, typegpu as default, esbuildPlugin, farmPlugin, rolldown_browser_default as rolldownBrowserPlugin, rolldownPlugin, rollupPlugin, rspackPlugin, vitePlugin, webpackPlugin };
package/package.json CHANGED
@@ -1,22 +1,31 @@
1
1
  {
2
2
  "name": "unplugin-typegpu",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Build plugins for TypeGPU, enabling seamless JavaScript -> WGSL transpilation and improved debugging.",
5
5
  "keywords": [
6
+ "babel-plugin",
7
+ "gpgpu",
6
8
  "rollup-plugin",
9
+ "shaders",
10
+ "typegpu",
11
+ "typescript",
7
12
  "unplugin",
8
- "babel-plugin",
9
13
  "vite-plugin",
10
- "typegpu",
11
- "gpgpu",
12
14
  "webgpu",
13
15
  "wgpu",
14
- "wgsl",
15
- "typescript",
16
- "shaders"
16
+ "wgsl"
17
17
  ],
18
+ "homepage": "https://typegpu.com",
19
+ "bugs": {
20
+ "url": "https://github.com/software-mansion/TypeGPU/issues"
21
+ },
18
22
  "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/software-mansion/TypeGPU.git"
26
+ },
19
27
  "type": "module",
28
+ "sideEffects": false,
20
29
  "exports": {
21
30
  "./package.json": "./package.json",
22
31
  ".": {
@@ -130,15 +139,6 @@
130
139
  }
131
140
  }
132
141
  },
133
- "sideEffects": false,
134
- "repository": {
135
- "type": "git",
136
- "url": "git+https://github.com/software-mansion/TypeGPU.git"
137
- },
138
- "bugs": {
139
- "url": "https://github.com/software-mansion/TypeGPU/issues"
140
- },
141
- "homepage": "https://typegpu.com",
142
142
  "dependencies": {
143
143
  "@babel/standalone": "^7.28.6",
144
144
  "defu": "^6.1.4",
@@ -147,11 +147,11 @@
147
147
  "pathe": "^2.0.3",
148
148
  "picomatch": "^4.0.3",
149
149
  "tinyest": "~0.3.0",
150
- "tinyest-for-wgsl": "~0.3.0",
150
+ "tinyest-for-wgsl": "~0.3.1",
151
151
  "unplugin": "^2.3.5"
152
152
  },
153
153
  "peerDependencies": {
154
- "typegpu": "^0.10.0"
154
+ "typegpu": "^0.10.2"
155
155
  },
156
156
  "main": "./index.mjs",
157
157
  "types": "./index.d.mts",
@@ -0,0 +1,7 @@
1
+ const require_rollup_impl = require('./rollup-impl.cjs');
2
+
3
+ //#region src/rolldown-browser.ts
4
+ var rolldown_browser_default = require_rollup_impl.rollUpImpl;
5
+
6
+ //#endregion
7
+ exports.default = rolldown_browser_default;
@@ -0,0 +1 @@
1
+ import { rollUpImpl } from "./rollup-impl.mjs";
@@ -0,0 +1,7 @@
1
+ import { rollUpImpl } from "./rollup-impl.mjs";
2
+
3
+ //#region src/rolldown-browser.ts
4
+ var rolldown_browser_default = rollUpImpl;
5
+
6
+ //#endregion
7
+ export { rolldown_browser_default as default };
package/rolldown.d.cts CHANGED
@@ -1,3 +1,2 @@
1
- import "./rollup-impl-DqC_d-_W.cjs";
2
1
  import { rolldownPlugin } from "./index.cjs";
3
2
  export = rolldownPlugin;
package/rolldown.d.mts CHANGED
@@ -1,4 +1,2 @@
1
- import "./common-CRPQ2KE6.mjs";
2
- import "./rolldown-browser-JYqfNLQ8.mjs";
3
1
  import { rolldownPlugin } from "./index.mjs";
4
2
  export { rolldownPlugin as default };
package/rolldown.mjs CHANGED
@@ -4,5 +4,4 @@ import { rolldownPlugin } from "./index.mjs";
4
4
  var rolldown_default = rolldownPlugin;
5
5
 
6
6
  //#endregion
7
- export { rolldown_default as default };
8
- //# sourceMappingURL=rolldown.mjs.map
7
+ export { rolldown_default as default };
@@ -1,6 +1,7 @@
1
- const require_filter = require('./filter-CKmD4HRk.cjs');
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ const require_common = require('./common.cjs');
2
3
  let defu = require("defu");
3
- defu = require_filter.__toESM(defu);
4
+ defu = require_runtime.__toESM(defu);
4
5
  let magic_string_ast = require("magic-string-ast");
5
6
  let estree_walker = require("estree-walker");
6
7
  let tinyest_for_wgsl = require("tinyest-for-wgsl");
@@ -9,13 +10,13 @@ let tinyest = require("tinyest");
9
10
  //#region src/rollup-impl.ts
10
11
  function containsUseGpuDirective(node) {
11
12
  if (node.body.type === "BlockStatement") {
12
- for (const statement of node.body.body) if (statement.type === "ExpressionStatement" && statement.directive === require_filter.useGpuDirective) return true;
13
+ for (const statement of node.body.body) if (statement.type === "ExpressionStatement" && statement.directive === require_common.useGpuDirective) return true;
13
14
  }
14
15
  return false;
15
16
  }
16
17
  function removeUseGpuDirective(node) {
17
18
  const cloned = structuredClone(node);
18
- if (cloned.body.type === "BlockStatement") cloned.body.body = cloned.body.body.filter((statement) => !(statement.type === "ExpressionStatement" && statement.directive === require_filter.useGpuDirective));
19
+ if (cloned.body.type === "BlockStatement") cloned.body.body = cloned.body.body.filter((statement) => !(statement.type === "ExpressionStatement" && statement.directive === require_common.useGpuDirective));
19
20
  return cloned;
20
21
  }
21
22
  function assignMetadata(magicString, node, metadata) {
@@ -25,14 +26,14 @@ function wrapInAutoName(magicString, node, name) {
25
26
  magicString.prependLeft(node.start, "((globalThis.__TYPEGPU_AUTONAME__ ?? (a => a))(").appendRight(node.end, `, "${name}"))`);
26
27
  }
27
28
  const rollUpImpl = (rawOptions) => {
28
- const options = (0, defu.default)(rawOptions, require_filter.defaultOptions);
29
+ const options = (0, defu.default)(rawOptions, require_common.defaultOptions);
29
30
  return {
30
31
  name: "unplugin-typegpu",
31
32
  enforce: options.enforce,
32
33
  transform: {
33
34
  filter: options.earlyPruning ? {
34
35
  id: options,
35
- code: require_filter.earlyPruneRegex
36
+ code: require_common.earlyPruneRegex
36
37
  } : { id: options },
37
38
  handler(code, id) {
38
39
  const ctx = {
@@ -55,12 +56,12 @@ const rollUpImpl = (rawOptions) => {
55
56
  (0, estree_walker.walk)(ast, { enter(_node, _parent) {
56
57
  const node = _node;
57
58
  const parent = _parent;
58
- require_filter.performExpressionNaming(ctx, node, (node, name) => {
59
+ require_common.performExpressionNaming(ctx, node, (node, name) => {
59
60
  wrapInAutoName(magicString, node, name);
60
61
  });
61
- if (node.type === "ImportDeclaration") require_filter.gatherTgpuAliases(node, ctx);
62
+ if (node.type === "ImportDeclaration") require_common.gatherTgpuAliases(node, ctx);
62
63
  if (node.type === "CallExpression") {
63
- if (require_filter.isShellImplementationCall(node, ctx)) {
64
+ if (require_common.isShellImplementationCall(node, ctx)) {
64
65
  const implementation = node.arguments[0];
65
66
  if (implementation && (implementation.type === "FunctionExpression" || implementation.type === "ArrowFunctionExpression")) {
66
67
  tgslFunctionDefs.push({ def: removeUseGpuDirective(implementation) });
@@ -72,7 +73,7 @@ const rollUpImpl = (rawOptions) => {
72
73
  if (containsUseGpuDirective(node)) {
73
74
  tgslFunctionDefs.push({
74
75
  def: removeUseGpuDirective(node),
75
- name: require_filter.getFunctionName(node, parent)
76
+ name: require_common.getFunctionName(node, parent)
76
77
  });
77
78
  this.skip();
78
79
  }
@@ -84,7 +85,7 @@ const rollUpImpl = (rawOptions) => {
84
85
  (0, estree_walker.walk)(def, { leave(_node) {
85
86
  const node = _node;
86
87
  if (node.type === "AssignmentExpression") {
87
- const runtimeFn = require_filter.operators[node.operator];
88
+ const runtimeFn = require_common.operators[node.operator];
88
89
  if (runtimeFn) {
89
90
  const left = node.left;
90
91
  const right = node.right;
@@ -93,7 +94,7 @@ const rollUpImpl = (rawOptions) => {
93
94
  magicString.overwriteNode(node, `${lhs} = ${runtimeFn}(${lhs}, ${rhs})`);
94
95
  }
95
96
  } else if (node.type === "BinaryExpression") {
96
- const runtimeFn = require_filter.operators[node.operator];
97
+ const runtimeFn = require_common.operators[node.operator];
97
98
  if (runtimeFn) {
98
99
  const left = node.left;
99
100
  const right = node.right;
@@ -107,7 +108,7 @@ const rollUpImpl = (rawOptions) => {
107
108
  assignMetadata(magicString, def, `{
108
109
  v: ${tinyest.FORMAT_VERSION},
109
110
  name: ${name ? `"${name}"` : "undefined"},
110
- ast: ${require_filter.embedJSON({
111
+ ast: ${require_common.embedJSON({
111
112
  params,
112
113
  body,
113
114
  externalNames
@@ -123,19 +124,4 @@ const rollUpImpl = (rawOptions) => {
123
124
  };
124
125
 
125
126
  //#endregion
126
- //#region src/rolldown-browser.ts
127
- var rolldown_browser_default = rollUpImpl;
128
-
129
- //#endregion
130
- Object.defineProperty(exports, 'rollUpImpl', {
131
- enumerable: true,
132
- get: function () {
133
- return rollUpImpl;
134
- }
135
- });
136
- Object.defineProperty(exports, 'rolldown_browser_default', {
137
- enumerable: true,
138
- get: function () {
139
- return rolldown_browser_default;
140
- }
141
- });
127
+ exports.rollUpImpl = rollUpImpl;
@@ -0,0 +1,38 @@
1
+ import { Options } from "./common.cjs";
2
+ import * as unplugin from "unplugin";
3
+ import { UnpluginBuildContext, UnpluginContext } from "unplugin";
4
+ import * as magic_string_ast0 from "magic-string-ast";
5
+
6
+ //#region src/rollup-impl.d.ts
7
+ declare const rollUpImpl: (rawOptions: Options) => {
8
+ name: "unplugin-typegpu";
9
+ enforce: "post" | "pre" | undefined;
10
+ transform: {
11
+ filter: {
12
+ id: Omit<Options, "include" | "autoNamingEnabled" | "earlyPruning"> & Omit<{
13
+ include: RegExp;
14
+ autoNamingEnabled: boolean;
15
+ earlyPruning: boolean;
16
+ }, "include" | "autoNamingEnabled" | "earlyPruning"> & {
17
+ include: string | RegExp | unplugin.StringOrRegExp[];
18
+ autoNamingEnabled: boolean;
19
+ earlyPruning: boolean;
20
+ };
21
+ code: RegExp[];
22
+ } | {
23
+ id: Omit<Options, "include" | "autoNamingEnabled" | "earlyPruning"> & Omit<{
24
+ include: RegExp;
25
+ autoNamingEnabled: boolean;
26
+ earlyPruning: boolean;
27
+ }, "include" | "autoNamingEnabled" | "earlyPruning"> & {
28
+ include: string | RegExp | unplugin.StringOrRegExp[];
29
+ autoNamingEnabled: boolean;
30
+ earlyPruning: boolean;
31
+ };
32
+ code?: never;
33
+ };
34
+ handler(this: UnpluginBuildContext & UnpluginContext, code: string, id: string): magic_string_ast0.CodeTransform | undefined;
35
+ };
36
+ };
37
+ //#endregion
38
+ export { rollUpImpl };
@@ -0,0 +1,39 @@
1
+ import { Options } from "./common.mjs";
2
+ import * as unplugin from "unplugin";
3
+ import { UnpluginBuildContext, UnpluginContext } from "unplugin";
4
+ import * as magic_string_ast0 from "magic-string-ast";
5
+ import { MagicStringAST } from "magic-string-ast";
6
+
7
+ //#region src/rollup-impl.d.ts
8
+ declare const rollUpImpl: (rawOptions: Options) => {
9
+ name: "unplugin-typegpu";
10
+ enforce: "post" | "pre" | undefined;
11
+ transform: {
12
+ filter: {
13
+ id: Omit<Options, "include" | "autoNamingEnabled" | "earlyPruning"> & Omit<{
14
+ include: RegExp;
15
+ autoNamingEnabled: boolean;
16
+ earlyPruning: boolean;
17
+ }, "include" | "autoNamingEnabled" | "earlyPruning"> & {
18
+ include: string | RegExp | unplugin.StringOrRegExp[];
19
+ autoNamingEnabled: boolean;
20
+ earlyPruning: boolean;
21
+ };
22
+ code: RegExp[];
23
+ } | {
24
+ id: Omit<Options, "include" | "autoNamingEnabled" | "earlyPruning"> & Omit<{
25
+ include: RegExp;
26
+ autoNamingEnabled: boolean;
27
+ earlyPruning: boolean;
28
+ }, "include" | "autoNamingEnabled" | "earlyPruning"> & {
29
+ include: string | RegExp | unplugin.StringOrRegExp[];
30
+ autoNamingEnabled: boolean;
31
+ earlyPruning: boolean;
32
+ };
33
+ code?: never;
34
+ };
35
+ handler(this: UnpluginBuildContext & UnpluginContext, code: string, id: string): magic_string_ast0.CodeTransform | undefined;
36
+ };
37
+ };
38
+ //#endregion
39
+ export { rollUpImpl };
@@ -1,4 +1,4 @@
1
- import { a as gatherTgpuAliases, c as operators, i as embedJSON, l as performExpressionNaming, n as defaultOptions, o as getFunctionName, r as earlyPruneRegex, s as isShellImplementationCall, u as useGpuDirective } from "./filter-6T-5w4kG.mjs";
1
+ import { defaultOptions, earlyPruneRegex, embedJSON, gatherTgpuAliases, getFunctionName, isShellImplementationCall, operators, performExpressionNaming, useGpuDirective } from "./common.mjs";
2
2
  import defu from "defu";
3
3
  import { MagicStringAST, generateTransform } from "magic-string-ast";
4
4
  import { walk } from "estree-walker";
@@ -122,9 +122,4 @@ const rollUpImpl = (rawOptions) => {
122
122
  };
123
123
 
124
124
  //#endregion
125
- //#region src/rolldown-browser.ts
126
- var rolldown_browser_default = rollUpImpl;
127
-
128
- //#endregion
129
- export { rollUpImpl as n, rolldown_browser_default as t };
130
- //# sourceMappingURL=rolldown-browser-DKeiFM_e.mjs.map
125
+ export { rollUpImpl };
package/rollup.d.cts CHANGED
@@ -1,3 +1,2 @@
1
- import "./rollup-impl-DqC_d-_W.cjs";
2
1
  import { rollupPlugin } from "./index.cjs";
3
2
  export = rollupPlugin;
package/rollup.d.mts CHANGED
@@ -1,4 +1,2 @@
1
- import "./common-CRPQ2KE6.mjs";
2
- import "./rolldown-browser-JYqfNLQ8.mjs";
3
1
  import { rollupPlugin } from "./index.mjs";
4
2
  export { rollupPlugin as default };
package/rollup.mjs CHANGED
@@ -4,5 +4,4 @@ import { rollupPlugin } from "./index.mjs";
4
4
  var rollup_default = rollupPlugin;
5
5
 
6
6
  //#endregion
7
- export { rollup_default as default };
8
- //# sourceMappingURL=rollup.mjs.map
7
+ export { rollup_default as default };
package/rspack.d.cts CHANGED
@@ -1,3 +1,2 @@
1
- import "./rollup-impl-DqC_d-_W.cjs";
2
1
  import { rspackPlugin } from "./index.cjs";
3
2
  export = rspackPlugin;
package/rspack.d.mts CHANGED
@@ -1,4 +1,2 @@
1
- import "./common-CRPQ2KE6.mjs";
2
- import "./rolldown-browser-JYqfNLQ8.mjs";
3
1
  import { rspackPlugin } from "./index.mjs";
4
2
  export { rspackPlugin as default };
package/rspack.mjs CHANGED
@@ -4,5 +4,4 @@ import { rspackPlugin } from "./index.mjs";
4
4
  var rspack_default = rspackPlugin;
5
5
 
6
6
  //#endregion
7
- export { rspack_default as default };
8
- //# sourceMappingURL=rspack.mjs.map
7
+ export { rspack_default as default };
package/vite.d.cts CHANGED
@@ -1,3 +1,2 @@
1
- import "./rollup-impl-DqC_d-_W.cjs";
2
1
  import { vitePlugin } from "./index.cjs";
3
2
  export = vitePlugin;
package/vite.d.mts CHANGED
@@ -1,4 +1,2 @@
1
- import "./common-CRPQ2KE6.mjs";
2
- import "./rolldown-browser-JYqfNLQ8.mjs";
3
1
  import { vitePlugin } from "./index.mjs";
4
2
  export { vitePlugin as default };
package/vite.mjs CHANGED
@@ -4,5 +4,4 @@ import { vitePlugin } from "./index.mjs";
4
4
  var vite_default = vitePlugin;
5
5
 
6
6
  //#endregion
7
- export { vite_default as default };
8
- //# sourceMappingURL=vite.mjs.map
7
+ export { vite_default as default };
package/webpack.d.cts CHANGED
@@ -1,3 +1,2 @@
1
- import "./rollup-impl-DqC_d-_W.cjs";
2
1
  import { webpackPlugin } from "./index.cjs";
3
2
  export = webpackPlugin;
package/webpack.d.mts CHANGED
@@ -1,4 +1,2 @@
1
- import "./common-CRPQ2KE6.mjs";
2
- import "./rolldown-browser-JYqfNLQ8.mjs";
3
1
  import { webpackPlugin } from "./index.mjs";
4
2
  export { webpackPlugin as default };
package/webpack.mjs CHANGED
@@ -4,5 +4,4 @@ import { webpackPlugin } from "./index.mjs";
4
4
  var webpack_default = webpackPlugin;
5
5
 
6
6
  //#endregion
7
- export { webpack_default as default };
8
- //# sourceMappingURL=webpack.mjs.map
7
+ export { webpack_default as default };
package/babel.d.cts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel.d.cts","names":[],"sources":["../src/babel.ts"],"mappings":";;;;iBAG2C,cAAA,CAAA"}
package/babel.d.mts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel.d.mts","names":[],"sources":["../src/babel.ts"],"mappings":";;;;iBAG2C,cAAA,CAAA"}
package/babel.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel.mjs","names":[],"sources":["../src/babel.ts"],"sourcesContent":["import * as Babel from '@babel/standalone';\nimport type TemplateGenerator from '@babel/template';\nimport type { TraverseOptions } from '@babel/traverse';\nimport type * as babel from '@babel/types';\nimport defu from 'defu';\nimport { FORMAT_VERSION } from 'tinyest';\nimport { transpileFn } from 'tinyest-for-wgsl';\nimport {\n type Context,\n defaultOptions,\n embedJSON,\n gatherTgpuAliases,\n getFunctionName,\n isShellImplementationCall,\n operators,\n type Options,\n performExpressionNaming,\n useGpuDirective,\n} from './common.ts';\nimport { createFilterForId } from './filter.ts';\n\n// NOTE: @babel/standalone does expose internal packages, as specified in the docs, but the\n// typing for @babel/standalone does not expose them.\nconst template = (\n Babel as unknown as { packages: { template: typeof TemplateGenerator } }\n).packages.template;\nconst types = (Babel as unknown as { packages: { types: typeof babel } })\n .packages.types;\n\nfunction containsUseGpuDirective(\n node:\n | babel.FunctionDeclaration\n | babel.FunctionExpression\n | babel.ArrowFunctionExpression,\n): boolean {\n return ((\n 'directives' in node.body ? (node.body?.directives ?? []) : []\n )\n .map((directive) => directive.value.value))\n .includes(useGpuDirective);\n}\n\nfunction i(identifier: string): babel.Identifier {\n return types.identifier(identifier);\n}\n\nconst fnNodeToOriginalMap = new WeakMap<\n | babel.FunctionDeclaration\n | babel.FunctionExpression\n | babel.ArrowFunctionExpression,\n | babel.FunctionDeclaration\n | babel.FunctionExpression\n | babel.ArrowFunctionExpression\n>();\n\nfunction functionToTranspiled(\n node: babel.ArrowFunctionExpression | babel.FunctionExpression,\n parent: babel.Node | null,\n): babel.CallExpression {\n const { params, body, externalNames } = transpileFn(\n fnNodeToOriginalMap.get(node) ?? node,\n );\n const maybeName = getFunctionName(node, parent);\n\n const metadata = types.objectExpression([\n types.objectProperty(\n i('v'),\n types.numericLiteral(FORMAT_VERSION),\n ),\n types.objectProperty(\n i('name'),\n maybeName ? types.stringLiteral(maybeName) : types.buildUndefinedNode(),\n ),\n types.objectProperty(\n i('ast'),\n template.expression`${embedJSON({ params, body, externalNames })}`(),\n ),\n types.objectProperty(\n i('externals'),\n types.arrowFunctionExpression(\n [],\n types.blockStatement([\n types.returnStatement(\n types.objectExpression(\n externalNames.map((name) =>\n types.objectProperty(\n i(name),\n i(name),\n false,\n /* shorthand */ name !== 'this',\n )\n ),\n ),\n ),\n ]),\n ),\n ),\n ]);\n\n return types.callExpression(\n types.arrowFunctionExpression(\n [i('$')],\n types.logicalExpression(\n '&&',\n types.callExpression(\n types.memberExpression(\n types.assignmentExpression(\n '??=',\n types.memberExpression(i('globalThis'), i('__TYPEGPU_META__')),\n types.newExpression(i('WeakMap'), []),\n ),\n i('set'),\n ),\n [\n types.assignmentExpression(\n '=',\n types.memberExpression(i('$'), i('f')),\n node,\n ),\n metadata,\n ],\n ),\n types.memberExpression(i('$'), i('f')),\n ),\n ),\n [types.objectExpression([])],\n );\n}\n\nfunction wrapInAutoName(\n node: babel.Expression,\n name: string,\n) {\n return types.callExpression(\n template.expression('globalThis.__TYPEGPU_AUTONAME__ ?? (a => a)', {\n placeholderPattern: false,\n })(),\n [node, types.stringLiteral(name)],\n );\n}\n\nfunction functionVisitor(ctx: Context): TraverseOptions {\n let inUseGpuScope = false;\n\n return {\n VariableDeclarator(path) {\n performExpressionNaming(ctx, path.node, (node, name) => {\n path.get('init').replaceWith(wrapInAutoName(node, name));\n });\n },\n\n AssignmentExpression(path) {\n if (inUseGpuScope) {\n const runtimeFn =\n operators[path.node.operator as keyof typeof operators];\n\n if (runtimeFn) {\n path.replaceWith(\n types.assignmentExpression(\n '=',\n path.node.left,\n types.callExpression(types.identifier(runtimeFn), [\n path.node.left as babel.Expression,\n path.node.right,\n ]),\n ),\n );\n }\n }\n\n performExpressionNaming(ctx, path.node, (node, name) => {\n path.get('right').replaceWith(wrapInAutoName(node, name));\n });\n },\n\n ObjectProperty(path) {\n performExpressionNaming(ctx, path.node, (node, name) => {\n path.get('value').replaceWith(wrapInAutoName(node, name));\n });\n },\n\n ClassProperty(path) {\n performExpressionNaming(ctx, path.node, (node, name) => {\n path.get('value').replaceWith(wrapInAutoName(node, name));\n });\n },\n\n ImportDeclaration(path) {\n gatherTgpuAliases(path.node, ctx);\n },\n\n BinaryExpression: {\n exit(path) {\n if (!inUseGpuScope) {\n return;\n }\n\n const runtimeFn =\n operators[path.node.operator as keyof typeof operators];\n\n if (runtimeFn) {\n path.replaceWith(\n types.callExpression(types.identifier(runtimeFn), [\n path.node.left as babel.Expression,\n path.node.right,\n ]),\n );\n }\n },\n },\n\n ArrowFunctionExpression: {\n enter(path) {\n if (containsUseGpuDirective(path.node)) {\n fnNodeToOriginalMap.set(path.node, types.cloneNode(path.node, true));\n if (inUseGpuScope) {\n throw new Error(`Nesting 'use gpu' functions is not allowed`);\n }\n inUseGpuScope = true;\n }\n },\n exit(path) {\n const node = path.node;\n if (containsUseGpuDirective(node)) {\n inUseGpuScope = false;\n const parent = path.parentPath.node;\n path.replaceWith(functionToTranspiled(node, parent));\n path.skip();\n }\n },\n },\n\n FunctionExpression: {\n enter(path) {\n if (containsUseGpuDirective(path.node)) {\n fnNodeToOriginalMap.set(path.node, types.cloneNode(path.node, true));\n if (inUseGpuScope) {\n throw new Error(`Nesting 'use gpu' functions is not allowed`);\n }\n inUseGpuScope = true;\n }\n },\n exit(path) {\n const node = path.node;\n if (containsUseGpuDirective(node)) {\n inUseGpuScope = false;\n const parent = path.parentPath.node;\n path.replaceWith(functionToTranspiled(node, parent));\n path.skip();\n }\n },\n },\n\n FunctionDeclaration: {\n enter(path) {\n if (containsUseGpuDirective(path.node)) {\n fnNodeToOriginalMap.set(path.node, types.cloneNode(path.node, true));\n if (inUseGpuScope) {\n throw new Error(`Nesting 'use gpu' functions is not allowed`);\n }\n inUseGpuScope = true;\n }\n },\n exit(path) {\n const node = (fnNodeToOriginalMap.get(path.node) ??\n path.node) as babel.FunctionDeclaration;\n if (containsUseGpuDirective(node)) {\n inUseGpuScope = false;\n\n if (!node.id) {\n return;\n }\n\n const parent = path.parentPath.node;\n const expression = types.functionExpression(\n node.id,\n node.params,\n node.body,\n );\n\n path.replaceWith(\n types.variableDeclaration('const', [\n types.variableDeclarator(\n node.id,\n functionToTranspiled(expression, parent),\n ),\n ]),\n );\n path.skip();\n }\n },\n },\n\n CallExpression: {\n exit(path) {\n const node = path.node;\n\n if (isShellImplementationCall(node, ctx)) {\n const implementation = node.arguments[0];\n\n if (\n implementation &&\n (implementation.type === 'FunctionExpression' ||\n implementation.type === 'ArrowFunctionExpression')\n ) {\n const transpiled = functionToTranspiled(\n implementation,\n null,\n );\n\n path.replaceWith(\n types.callExpression(node.callee, [\n transpiled,\n ]),\n );\n\n path.skip();\n }\n }\n },\n },\n };\n}\n\nexport default function () {\n return {\n visitor: {\n Program(path, state) {\n // oxlint-disable-next-line typescript/no-explicit-any <oh babel babel...>\n const options = defu((state as any).opts as Options, defaultOptions);\n // oxlint-disable-next-line typescript/no-explicit-any <oh babel babel...>\n const id: string | undefined = (state as any).filename;\n\n const filter = createFilterForId(options);\n if (id && filter && !filter?.(id)) {\n return;\n }\n\n const ctx: Context = {\n tgpuAliases: new Set<string>(\n options.forceTgpuAlias ? [options.forceTgpuAlias] : [],\n ),\n fileId: id,\n autoNamingEnabled: options.autoNamingEnabled,\n };\n\n path.traverse(functionVisitor(ctx));\n },\n } satisfies TraverseOptions,\n };\n}\n"],"mappings":";;;;;;;AAuBA,MAAM,WACJ,MACA,SAAS;AACX,MAAM,QAAS,MACZ,SAAS;AAEZ,SAAS,wBACP,MAIS;;AACT,SACE,gBAAgB,KAAK,8CAAQ,KAAK,8DAAM,mFAAc,EAAE,GAAI,EAAE,EAE7D,KAAK,cAAc,UAAU,MAAM,MAAM,CACzC,SAAS,gBAAgB;;AAG9B,SA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AAoB,SAAS,CACjC,MAAM,mBACJ,KAAK,IACL,qBAAqB,YAAY,OAAO,CACzC,CACF,CAAC,CACH;AACD,UAAK,MAAM;;;GAGhB;EAED,gBAAgB,EACd,KAAK,MAAM;GACT,MAAM,OAAO,KAAK;AAElB,OAAI,0BAA0B,MAAM,IAAI,EAAE;IACxC,MAAM,iBAAiB,KAAK,UAAU;AAEtC,QACE,mBACC,eAAe,SAAS,wBACvB,eAAe,SAAS,4BAC1B;KACA,MAAM,aAAa,qBACjB,gBACA,KACD;AAED,UAAK,YACH,MAAM,eAAe,KAAK,QAAQ,CAChC,WACD,CAAC,CACH;AAED,UAAK,MAAM;;;KAIlB;EACF;;AAGH,yBAA2B;AACzB,QAAO,EACL,SAAS,EACP,QAAQ,MAAM,OAAO;EAEnB,MAAM,UAAU,KAAM,MAAc,MAAiB,eAAe;EAEpE,MAAM,KAA0B,MAAc;EAE9C,MAAM,SAAS,kBAAkB,QAAQ;AACzC,MAAI,MAAM,UAAU,kDAAC,OAAS,GAAG,EAC/B;EAGF,MAAM,MAAe;GACnB,aAAa,IAAI,IACf,QAAQ,iBAAiB,CAAC,QAAQ,eAAe,GAAG,EAAE,CACvD;GACD,QAAQ;GACR,mBAAmB,QAAQ;GAC5B;AAED,OAAK,SAAS,gBAAgB,IAAI,CAAC;IAEtC,EACF"}
package/bun.d.cts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun.d.cts","names":[],"sources":["../src/bun.ts"],"mappings":";;;cAG4E,QAAA,GAG5D,UAAA,EAAY,OAAA,KAAU,SAAA;AAAA"}
package/bun.d.mts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun.d.mts","names":[],"sources":["../src/bun.ts"],"mappings":";;;cAG4E,QAAA,GAG5D,UAAA,EAAY,OAAA,KAAU,SAAA"}
package/bun.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun.mjs","names":["babelPlugin"],"sources":["../src/bun.ts"],"sourcesContent":["import type { BunPlugin } from 'bun';\nimport * as Babel from '@babel/standalone';\nimport defu from 'defu';\nimport { defaultOptions, earlyPruneRegex, type Options } from './common.ts';\nimport babelPlugin from './babel.ts';\n\nexport default (rawOptions: Options): BunPlugin => {\n const options = defu(rawOptions, defaultOptions);\n const include = options.include;\n if (!(include instanceof RegExp)) {\n throw new Error(\n `Unsupported 'include' options in Bun plugin. Please provide a single regular expression`,\n );\n }\n if (options.exclude) {\n throw new Error(`Unsupported 'exclude' option in Bun plugin`);\n }\n\n return {\n name: 'unplugin-typegpu',\n setup(build) {\n build.onLoad({ filter: include }, async (args) => {\n const text = await Bun.file(args.path).text();\n\n // Pruning early before more expensive operations\n if (earlyPruneRegex.every((pattern) => !pattern.test(text))) {\n return {\n contents: text,\n loader: args.loader,\n };\n }\n\n const result = Babel.transform(text, {\n presets: [['typescript', { allowDeclareFields: true }]],\n filename: args.path,\n plugins: [babelPlugin],\n }).code;\n\n return {\n contents: result ?? text,\n loader: args.loader,\n };\n });\n },\n };\n};\n"],"mappings":";;;;;;AAMA,mBAAgB,eAAmC;CACjD,MAAM,UAAU,KAAK,YAAY,eAAe;CAChD,MAAM,UAAU,QAAQ;AACxB,KAAI,EAAE,mBAAmB,QACvB,OAAM,IAAI,MACR,0FACD;AAEH,KAAI,QAAQ,QACV,OAAM,IAAI,MAAM,6CAA6C;AAG/D,QAAO;EACL,MAAM;EACN,MAAM,OAAO;AACX,SAAM,OAAO,EAAE,QAAQ,SAAS,EAAE,OAAO,SAAS;IAChD,MAAM,OAAO,MAAM,IAAI,KAAK,KAAK,KAAK,CAAC,MAAM;AAG7C,QAAI,gBAAgB,OAAO,YAAY,CAAC,QAAQ,KAAK,KAAK,CAAC,CACzD,QAAO;KACL,UAAU;KACV,QAAQ,KAAK;KACd;IAGH,MAAM,SAAS,MAAM,UAAU,MAAM;KACnC,SAAS,CAAC,CAAC,cAAc,EAAE,oBAAoB,MAAM,CAAC,CAAC;KACvD,UAAU,KAAK;KACf,SAAS,CAACA,cAAY;KACvB,CAAC,CAAC;AAEH,WAAO;KACL,UAAU,gDAAU;KACpB,QAAQ,KAAK;KACd;KACD;;EAEL"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common-CRPQ2KE6.d.mts","names":[],"sources":["../src/common.ts"],"mappings":";;;UAciB,OAAA;EAcf;EAZA,OAAA,GAAU,aAAA;EAqBE;EAlBZ,OAAA,GAAU,aAAA;;EAGV,OAAA;;EAGA,cAAA;;EAGA,iBAAA;;;;;;;;EASA,YAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"common-Dpl8jppn.d.cts","names":[],"sources":["../src/common.ts"],"mappings":";;;UAciB,OAAA;EAcf;EAZA,OAAA,GAAU,aAAA;EAqBE;EAlBZ,OAAA,GAAU,aAAA;;EAGV,OAAA;;EAGA,cAAA;;EAGA,iBAAA;;;;;;;;EASA,YAAA;AAAA"}
package/esbuild.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"esbuild.mjs","names":[],"sources":["../src/esbuild.ts"],"sourcesContent":["import { esbuildPlugin } from './index.ts';\n\nexport default esbuildPlugin;\n"],"mappings":";;;AAEA,sBAAe"}
package/farm.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"farm.mjs","names":[],"sources":["../src/farm.ts"],"sourcesContent":["import { farmPlugin } from './index.ts';\n\nexport default farmPlugin;\n"],"mappings":";;;AAEA,mBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"filter-6T-5w4kG.mjs","names":[],"sources":["../src/common.ts","../src/filter.ts"],"sourcesContent":["import type * as babel from '@babel/types';\nimport type * as acorn from 'acorn';\nimport type { FilterPattern } from 'unplugin';\n\nexport type Context = {\n /**\n * How the `tgpu` object is used in code. Since it can be aliased, we\n * need to catch that and act accordingly.\n */\n tgpuAliases: Set<string>;\n fileId?: string | undefined;\n autoNamingEnabled: boolean;\n};\n\nexport interface Options {\n /** @default [/\\.m?[jt]sx?$/] */\n include?: FilterPattern;\n\n /** @default undefined */\n exclude?: FilterPattern;\n\n /** @default undefined */\n enforce?: 'post' | 'pre' | undefined;\n\n /** @default undefined */\n forceTgpuAlias?: string | undefined;\n\n /** @default true */\n autoNamingEnabled?: boolean | undefined;\n\n /**\n * Skipping files that don't contain \"typegpu\", \"tgpu\" or \"use gpu\".\n * In case this early pruning hinders transformation, you\n * can disable it.\n *\n * @default true\n */\n earlyPruning?: boolean | undefined;\n}\n\nexport const defaultOptions = {\n include: /\\.m?[jt]sx?(?:\\?.*)?$/,\n autoNamingEnabled: true,\n earlyPruning: true,\n};\n\nexport function embedJSON(jsValue: unknown) {\n return JSON.stringify(jsValue)\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n\n/**\n * Checks if `node` is an alias for the 'tgpu' object, traditionally\n * available via `import tgpu from 'typegpu'`.\n */\nfunction isTgpu(ctx: Context, node: babel.Node | acorn.AnyNode): boolean {\n let path = '';\n\n let tail = node;\n while (true) {\n if (tail.type === 'MemberExpression') {\n if (\n (tail.property.type === 'Literal' ||\n tail.property.type === 'StringLiteral') &&\n tail.property.value === '~unstable'\n ) {\n // Bypassing the '~unstable' property.\n tail = tail.object;\n continue;\n }\n\n if (tail.property.type !== 'Identifier') {\n // Not handling computed expressions.\n break;\n }\n\n path = path ? `${tail.property.name}.${path}` : tail.property.name;\n tail = tail.object;\n } else if (tail.type === 'Identifier') {\n path = path ? `${tail.name}.${path}` : tail.name;\n break;\n } else {\n break;\n }\n }\n\n return ctx.tgpuAliases.has(path);\n}\n\nexport function gatherTgpuAliases(\n node: acorn.ImportDeclaration | babel.ImportDeclaration,\n ctx: Context,\n) {\n if (node.source.value === 'typegpu') {\n for (const spec of node.specifiers) {\n if (\n // The default export of 'typegpu' is the `tgpu` object.\n spec.type === 'ImportDefaultSpecifier' ||\n // Aliasing 'tgpu' while importing, e.g. import { tgpu as t } from 'typegpu';\n (spec.type === 'ImportSpecifier' &&\n spec.imported.type === 'Identifier' &&\n spec.imported.name === 'tgpu')\n ) {\n ctx.tgpuAliases.add(spec.local.name);\n } else if (spec.type === 'ImportNamespaceSpecifier') {\n // Importing everything, e.g. import * as t from 'typegpu';\n ctx.tgpuAliases.add(`${spec.local.name}.tgpu`);\n }\n }\n }\n}\n\nconst fnShellFunctionNames = ['fn', 'vertexFn', 'fragmentFn', 'computeFn'];\n\nexport function isShellImplementationCall(\n node: acorn.CallExpression | babel.CallExpression,\n ctx: Context,\n) {\n return (\n node.callee.type === 'CallExpression' &&\n node.callee.callee.type === 'MemberExpression' &&\n node.callee.callee.property.type === 'Identifier' &&\n fnShellFunctionNames.includes(node.callee.callee.property.name) &&\n node.arguments.length === 1 && isTgpu(ctx, node.callee.callee.object)\n );\n}\n\n/**\n * Extracts a name and expression from nodes that contain a label and an expression,\n * such as VariableDeclarator or PropertyDefinition.\n * Returns a tuple of [name, expression] if found, otherwise undefined.\n *\n * @example\n * extractLabelledExpression(node`let name = tgpu.bindGroupLayout({});`)\n * // [\"name\", node`tgpu.bindGroupLayout({})`]\n */\nfunction extractLabelledExpression<T extends acorn.AnyNode | babel.Node>(\n node: T,\n): [string, ExpressionFor<T>] | undefined {\n if (\n node.type === 'VariableDeclarator' &&\n node.id.type === 'Identifier' &&\n node.init\n ) {\n // let id = init;\n return [node.id.name, node.init as ExpressionFor<T>];\n } else if (node.type === 'AssignmentExpression') {\n // left = right;\n const maybeName = tryFindIdentifier(node.left);\n if (maybeName) {\n return [maybeName, node.right as ExpressionFor<T>];\n }\n } else if (\n (node.type === 'Property' || node.type === 'ObjectProperty') &&\n node.key.type === 'Identifier'\n ) {\n // const a = { key: value }\n return [node.key.name, node.value as ExpressionFor<T>];\n } else if (\n (node.type === 'ClassProperty' || node.type === 'PropertyDefinition') &&\n node.value &&\n node.key.type === 'Identifier'\n ) {\n // class Class {\n //\t key = value;\n // }\n return [node.key.name, node.value as ExpressionFor<T>];\n }\n}\n\nexport function getFunctionName(\n node: acorn.AnyNode | babel.Node,\n parent: acorn.AnyNode | babel.Node | null,\n): string | undefined {\n const maybeName = parent ? extractLabelledExpression(parent)?.[0] : undefined;\n return maybeName ??\n (node.type === 'FunctionDeclaration' ||\n node.type === 'FunctionExpression'\n ? node.id?.name\n : undefined);\n}\n\nconst resourceConstructors: string[] = [\n // tgpu\n 'bindGroupLayout',\n 'vertexLayout',\n 'privateVar',\n 'workgroupVar',\n 'const',\n 'slot',\n 'accessor',\n 'comptime',\n ...fnShellFunctionNames,\n // root\n 'createBuffer',\n 'createMutable',\n 'createReadonly',\n 'createUniform',\n 'createQuerySet',\n 'createPipeline',\n 'createComputePipeline',\n 'createGuardedComputePipeline',\n 'createRenderPipeline',\n 'createTexture',\n 'createSampler',\n 'createComparisonSampler',\n // d\n 'struct',\n 'unstruct',\n // other\n 'createView',\n];\n\n/**\n * Checks if `node` should be wrapped in an autoname function.\n * Since it is mostly for debugging and clean WGSL generation,\n * some false positives and false negatives are admissible.\n */\nfunction containsResourceConstructorCall(\n node: acorn.AnyNode | babel.Node,\n ctx: Context,\n) {\n if (node.type === 'CallExpression') {\n if (isShellImplementationCall(node, ctx)) {\n return true;\n }\n // struct({...})\n if (\n node.callee.type === 'Identifier' &&\n resourceConstructors.includes(node.callee.name)\n ) {\n return true;\n }\n if (node.callee.type === 'MemberExpression') {\n if (node.callee.property.type === 'Identifier') {\n // root.createBuffer({...})\n if (resourceConstructors.includes(node.callee.property.name)) {\n return true;\n }\n if (node.callee.property.name === '$name') {\n return false;\n }\n }\n // root.createBuffer(d.f32).$usage('storage')\n return containsResourceConstructorCall(node.callee.object, ctx);\n }\n }\n if (node.type === 'TaggedTemplateExpression') {\n return containsResourceConstructorCall(node.tag, ctx);\n }\n return false;\n}\n\n/**\n * Tries to find an identifier in a node.\n *\n * @example\n * // syntax is simplified, imagine the arguments are appropriate nodes instead\n * tryFindIdentifier('myBuffer'); // 'myBuffer'\n * tryFindIdentifier('buffers.myBuffer'); // 'myBuffer'\n * tryFindIdentifier('this.myBuffer'); // 'myBuffer'\n * tryFindIdentifier('[a, b]'); // undefined\n */\nfunction tryFindIdentifier(\n node: acorn.AnyNode | babel.Node,\n): string | undefined {\n if (node.type === 'Identifier') {\n return node.name;\n }\n if (node.type === 'PrivateName') {\n return tryFindIdentifier(node.id);\n }\n if (node.type === 'PrivateIdentifier') {\n return node.name;\n }\n if (node.type === 'MemberExpression') {\n return tryFindIdentifier(node.property);\n }\n}\n\ntype ExpressionFor<T extends acorn.AnyNode | babel.Node> = T extends\n acorn.AnyNode ? acorn.Expression : babel.Expression;\n\n/**\n * Checks if `node` contains a label and a tgpu expression that could be named.\n * If so, it calls the provided callback. Nodes selected for naming include:\n *\n * `let name = tgpu.bindGroupLayout({});` (VariableDeclarator)\n *\n * `name = tgpu.bindGroupLayout({});` (AssignmentExpression)\n *\n * `property: tgpu.bindGroupLayout({})` (Property/ObjectProperty)\n *\n * Since it is mostly for debugging and clean WGSL generation,\n * some false positives and false negatives are admissible.\n *\n * This function is NOT used for auto-naming shell-less functions.\n * Those are handled separately.\n *\n * @privateRemarks\n * When adding new checks, you need to call this method in the corresponding node in Babel.\n */\nexport function performExpressionNaming<T extends acorn.AnyNode | babel.Node>(\n ctx: Context,\n node: T,\n namingCallback: (node: ExpressionFor<T>, name: string) => void,\n) {\n if (!ctx.autoNamingEnabled) {\n return;\n }\n\n const labelledExpression = extractLabelledExpression(node);\n if (labelledExpression) {\n const [label, expression] = labelledExpression;\n if (containsResourceConstructorCall(expression, ctx)) {\n namingCallback(expression, label);\n }\n }\n}\n\nexport const useGpuDirective = 'use gpu';\n\n/** Regular expressions used for early pruning (to avoid unnecessary parsing, which is expensive) */\nexport const earlyPruneRegex = [/[\"']use gpu[\"']/, /t(ype)?gpu/];\n\nexport const operators = {\n '+': '__tsover_add',\n '-': '__tsover_sub',\n '*': '__tsover_mul',\n '/': '__tsover_div',\n '%': '__tsover_mod',\n '+=': '__tsover_add',\n '-=': '__tsover_sub',\n '*=': '__tsover_mul',\n '/=': '__tsover_div',\n '%=': '__tsover_mod',\n};\n","// Copied from https://github.com/unjs/unplugin/blob/f514bf8e2d751b48b3a5acb1077eb1292d9711b3/src/utils/filter.ts#L2\n// Used only in the babel version of the plugin, since others can rely on native unplugin functionality.\n\nimport { resolve } from 'pathe';\nimport picomatch from 'picomatch';\nimport type {\n Arrayable,\n Nullable,\n StringFilter,\n StringOrRegExp,\n} from 'unplugin';\n\nfunction toArray<T>(array?: Nullable<Arrayable<T>>): Array<T> {\n const result = array || [];\n if (Array.isArray(result)) return result;\n return [result];\n}\n\nconst BACKSLASH_REGEX = /\\\\/g;\nfunction normalize(path: string): string {\n return path.replace(BACKSLASH_REGEX, '/');\n}\n\nconst ABSOLUTE_PATH_REGEX = /^(?:\\/|(?:[A-Z]:)?[/\\\\|])/i;\nfunction isAbsolute(path: string): boolean {\n return ABSOLUTE_PATH_REGEX.test(path);\n}\n\nexport type PluginFilter = (input: string) => boolean;\nexport type TransformHookFilter = (id: string, code: string) => boolean;\n\ninterface NormalizedStringFilter {\n include?: StringOrRegExp[] | undefined;\n exclude?: StringOrRegExp[] | undefined;\n}\n\nfunction getMatcherString(glob: string, cwd: string) {\n if (glob.startsWith('**') || isAbsolute(glob)) {\n return normalize(glob);\n }\n\n const resolved = resolve(cwd, glob);\n return normalize(resolved);\n}\n\nfunction patternToIdFilter(pattern: StringOrRegExp): PluginFilter {\n if (pattern instanceof RegExp) {\n return (id: string) => {\n const normalizedId = normalize(id);\n const result = pattern.test(normalizedId);\n pattern.lastIndex = 0;\n return result;\n };\n }\n const cwd = process.cwd();\n const glob = getMatcherString(pattern, cwd);\n const matcher = picomatch(glob, { dot: true });\n return (id: string) => {\n const normalizedId = normalize(id);\n return matcher(normalizedId);\n };\n}\n\nfunction createFilter(\n exclude: PluginFilter[] | undefined,\n include: PluginFilter[] | undefined,\n): PluginFilter | undefined {\n if (!exclude && !include) {\n return;\n }\n\n return (input) => {\n if (exclude?.some((filter) => filter(input))) {\n return false;\n }\n if (include?.some((filter) => filter(input))) {\n return true;\n }\n return !(include && include.length > 0);\n };\n}\n\nfunction normalizeFilter(filter: StringFilter): NormalizedStringFilter {\n if (typeof filter === 'string' || filter instanceof RegExp) {\n return {\n include: [filter],\n };\n }\n if (Array.isArray(filter)) {\n return {\n include: filter,\n };\n }\n return {\n exclude: filter.exclude ? toArray(filter.exclude) : undefined,\n include: filter.include ? toArray(filter.include) : undefined,\n };\n}\n\nfunction createIdFilter(\n filter: StringFilter | undefined,\n): PluginFilter | undefined {\n if (!filter) return;\n const { exclude, include } = normalizeFilter(filter);\n const excludeFilter = exclude?.map(patternToIdFilter);\n const includeFilter = include?.map(patternToIdFilter);\n return createFilter(excludeFilter, includeFilter);\n}\n\nexport function createFilterForId(\n filter: StringFilter | undefined,\n): PluginFilter | undefined {\n const filterFunction = createIdFilter(filter);\n return filterFunction ? (id) => !!filterFunction(id) : undefined;\n}\n"],"mappings":";;;;AAwCA,MAAa,iBAAiB;CAC5B,SAAS;CACT,mBAAmB;CACnB,cAAc;CACf;AAED,SAAgB,UAAU,SAAkB;AAC1C,QAAO,KAAK,UAAU,QAAQ,CAC3B,QAAQ,WAAW,UAAU,CAC7B,QAAQ,WAAW,UAAU;;;;;;AAOlC,SAAS,OAAO,KAAc,MAA2C;CACvE,IAAI,OAAO;CAEX,IAAI,OAAO;AACX,QAAO,KACL,KAAI,KAAK,SAAS,oBAAoB;AACpC,OACG,KAAK,SAAS,SAAS,aACtB,KAAK,SAAS,SAAS,oBACzB,KAAK,SAAS,UAAU,aACxB;AAEA,UAAO,KAAK;AACZ;;AAGF,MAAI,KAAK,SAAS,SAAS,aAEzB;AAGF,SAAO,OAAO,GAAG,KAAK,SAAS,KAAK,GAAG,SAAS,KAAK,SAAS;AAC9D,SAAO,KAAK;YACH,KAAK,SAAS,cAAc;AACrC,SAAO,OAAO,GAAG,KAAK,KAAK,GAAG,SAAS,KAAK;AAC5C;OAEA;AAIJ,QAAO,IAAI,YAAY,IAAI,KAAK;;AAGlC,SAAgB,kBACd,MACA,KACA;AACA,KAAI,KAAK,OAAO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