unplugin-typegpu 0.10.1 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1,13 +1,12 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_rollup_impl = require('./rollup-impl.cjs');
2
+ const require_filter = require('./filter-CKmD4HRk.cjs');
3
+ const require_rolldown_browser = require('./rolldown-browser-DUanNY-R.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');
7
6
  let unplugin = require("unplugin");
8
7
 
9
8
  //#region src/index.ts
10
- const typegpu = (0, unplugin.createUnplugin)(require_rollup_impl.rollUpImpl);
9
+ const typegpu = (0, unplugin.createUnplugin)(require_rolldown_browser.rollUpImpl);
11
10
  const vitePlugin = typegpu.vite;
12
11
  const rollupPlugin = typegpu.rollup;
13
12
  const rolldownPlugin = typegpu.rolldown;
@@ -22,7 +21,7 @@ exports.bunPlugin = require_bun.default;
22
21
  exports.default = typegpu;
23
22
  exports.esbuildPlugin = esbuildPlugin;
24
23
  exports.farmPlugin = farmPlugin;
25
- exports.rolldownBrowserPlugin = require_rolldown_browser.default;
24
+ exports.rolldownBrowserPlugin = require_rolldown_browser.rolldown_browser_default;
26
25
  exports.rolldownPlugin = rolldownPlugin;
27
26
  exports.rollupPlugin = rollupPlugin;
28
27
  exports.rspackPlugin = rspackPlugin;
package/index.d.cts CHANGED
@@ -1,8 +1,7 @@
1
1
  import export_default from "./babel.cjs";
2
- import { Options } from "./common.cjs";
2
+ import { t as Options } from "./common-Dpl8jppn.cjs";
3
3
  import _default from "./bun.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";
4
+ import { n as Plugin, t as rollUpImpl } from "./rollup-impl-DqC_d-_W.cjs";
6
5
  import * as unplugin from "unplugin";
7
6
 
8
7
  //#region src/index.d.ts
package/index.d.mts CHANGED
@@ -1,9 +1,7 @@
1
1
  import export_default from "./babel.mjs";
2
- import { Options } from "./common.mjs";
2
+ import { t as Options } from "./common-CRPQ2KE6.mjs";
3
3
  import _default from "./bun.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";
4
+ import { n as Plugin, t as rollUpImpl } from "./rolldown-browser-JYqfNLQ8.mjs";
7
5
  import * as unplugin from "unplugin";
8
6
 
9
7
  //#region src/index.d.ts
package/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
- import { rollUpImpl } from "./rollup-impl.mjs";
1
+ import { n as rollUpImpl, t as rolldown_browser_default } from "./rolldown-browser-DKeiFM_e.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";
5
4
  import { createUnplugin } from "unplugin";
6
5
 
7
6
  //#region src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-typegpu",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Build plugins for TypeGPU, enabling seamless JavaScript -> WGSL transpilation and improved debugging.",
5
5
  "keywords": [
6
6
  "babel-plugin",
@@ -146,8 +146,8 @@
146
146
  "magic-string-ast": "^1.0.0",
147
147
  "pathe": "^2.0.3",
148
148
  "picomatch": "^4.0.3",
149
- "tinyest": "~0.3.0",
150
- "tinyest-for-wgsl": "~0.3.1",
149
+ "tinyest": "~0.3.1",
150
+ "tinyest-for-wgsl": "~0.3.2",
151
151
  "unplugin": "^2.3.5"
152
152
  },
153
153
  "peerDependencies": {
@@ -1,4 +1,4 @@
1
- import { defaultOptions, earlyPruneRegex, embedJSON, gatherTgpuAliases, getFunctionName, isShellImplementationCall, operators, performExpressionNaming, useGpuDirective } from "./common.mjs";
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";
2
2
  import defu from "defu";
3
3
  import { MagicStringAST, generateTransform } from "magic-string-ast";
4
4
  import { walk } from "estree-walker";
@@ -122,4 +122,8 @@ const rollUpImpl = (rawOptions) => {
122
122
  };
123
123
 
124
124
  //#endregion
125
- export { rollUpImpl };
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 };
@@ -1,7 +1,6 @@
1
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
- const require_common = require('./common.cjs');
1
+ const require_filter = require('./filter-CKmD4HRk.cjs');
3
2
  let defu = require("defu");
4
- defu = require_runtime.__toESM(defu);
3
+ defu = require_filter.__toESM(defu);
5
4
  let magic_string_ast = require("magic-string-ast");
6
5
  let estree_walker = require("estree-walker");
7
6
  let tinyest_for_wgsl = require("tinyest-for-wgsl");
@@ -10,13 +9,13 @@ let tinyest = require("tinyest");
10
9
  //#region src/rollup-impl.ts
11
10
  function containsUseGpuDirective(node) {
12
11
  if (node.body.type === "BlockStatement") {
13
- for (const statement of node.body.body) if (statement.type === "ExpressionStatement" && statement.directive === require_common.useGpuDirective) return true;
12
+ for (const statement of node.body.body) if (statement.type === "ExpressionStatement" && statement.directive === require_filter.useGpuDirective) return true;
14
13
  }
15
14
  return false;
16
15
  }
17
16
  function removeUseGpuDirective(node) {
18
17
  const cloned = structuredClone(node);
19
- if (cloned.body.type === "BlockStatement") cloned.body.body = cloned.body.body.filter((statement) => !(statement.type === "ExpressionStatement" && statement.directive === require_common.useGpuDirective));
18
+ if (cloned.body.type === "BlockStatement") cloned.body.body = cloned.body.body.filter((statement) => !(statement.type === "ExpressionStatement" && statement.directive === require_filter.useGpuDirective));
20
19
  return cloned;
21
20
  }
22
21
  function assignMetadata(magicString, node, metadata) {
@@ -26,14 +25,14 @@ function wrapInAutoName(magicString, node, name) {
26
25
  magicString.prependLeft(node.start, "((globalThis.__TYPEGPU_AUTONAME__ ?? (a => a))(").appendRight(node.end, `, "${name}"))`);
27
26
  }
28
27
  const rollUpImpl = (rawOptions) => {
29
- const options = (0, defu.default)(rawOptions, require_common.defaultOptions);
28
+ const options = (0, defu.default)(rawOptions, require_filter.defaultOptions);
30
29
  return {
31
30
  name: "unplugin-typegpu",
32
31
  enforce: options.enforce,
33
32
  transform: {
34
33
  filter: options.earlyPruning ? {
35
34
  id: options,
36
- code: require_common.earlyPruneRegex
35
+ code: require_filter.earlyPruneRegex
37
36
  } : { id: options },
38
37
  handler(code, id) {
39
38
  const ctx = {
@@ -56,12 +55,12 @@ const rollUpImpl = (rawOptions) => {
56
55
  (0, estree_walker.walk)(ast, { enter(_node, _parent) {
57
56
  const node = _node;
58
57
  const parent = _parent;
59
- require_common.performExpressionNaming(ctx, node, (node, name) => {
58
+ require_filter.performExpressionNaming(ctx, node, (node, name) => {
60
59
  wrapInAutoName(magicString, node, name);
61
60
  });
62
- if (node.type === "ImportDeclaration") require_common.gatherTgpuAliases(node, ctx);
61
+ if (node.type === "ImportDeclaration") require_filter.gatherTgpuAliases(node, ctx);
63
62
  if (node.type === "CallExpression") {
64
- if (require_common.isShellImplementationCall(node, ctx)) {
63
+ if (require_filter.isShellImplementationCall(node, ctx)) {
65
64
  const implementation = node.arguments[0];
66
65
  if (implementation && (implementation.type === "FunctionExpression" || implementation.type === "ArrowFunctionExpression")) {
67
66
  tgslFunctionDefs.push({ def: removeUseGpuDirective(implementation) });
@@ -73,7 +72,7 @@ const rollUpImpl = (rawOptions) => {
73
72
  if (containsUseGpuDirective(node)) {
74
73
  tgslFunctionDefs.push({
75
74
  def: removeUseGpuDirective(node),
76
- name: require_common.getFunctionName(node, parent)
75
+ name: require_filter.getFunctionName(node, parent)
77
76
  });
78
77
  this.skip();
79
78
  }
@@ -85,7 +84,7 @@ const rollUpImpl = (rawOptions) => {
85
84
  (0, estree_walker.walk)(def, { leave(_node) {
86
85
  const node = _node;
87
86
  if (node.type === "AssignmentExpression") {
88
- const runtimeFn = require_common.operators[node.operator];
87
+ const runtimeFn = require_filter.operators[node.operator];
89
88
  if (runtimeFn) {
90
89
  const left = node.left;
91
90
  const right = node.right;
@@ -94,7 +93,7 @@ const rollUpImpl = (rawOptions) => {
94
93
  magicString.overwriteNode(node, `${lhs} = ${runtimeFn}(${lhs}, ${rhs})`);
95
94
  }
96
95
  } else if (node.type === "BinaryExpression") {
97
- const runtimeFn = require_common.operators[node.operator];
96
+ const runtimeFn = require_filter.operators[node.operator];
98
97
  if (runtimeFn) {
99
98
  const left = node.left;
100
99
  const right = node.right;
@@ -108,7 +107,7 @@ const rollUpImpl = (rawOptions) => {
108
107
  assignMetadata(magicString, def, `{
109
108
  v: ${tinyest.FORMAT_VERSION},
110
109
  name: ${name ? `"${name}"` : "undefined"},
111
- ast: ${require_common.embedJSON({
110
+ ast: ${require_filter.embedJSON({
112
111
  params,
113
112
  body,
114
113
  externalNames
@@ -124,4 +123,19 @@ const rollUpImpl = (rawOptions) => {
124
123
  };
125
124
 
126
125
  //#endregion
127
- exports.rollUpImpl = rollUpImpl;
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
+ });