unplugin-typegpu 0.11.0 → 0.11.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/{babel-izRcz0Uk.cjs → babel-B-IcpMR7.cjs} +31 -27
- package/{babel-C0RyQRMk.d.mts → babel-C8UzthFd.d.cts} +1 -2
- package/{babel-Bnfeonoo.mjs → babel-CbManzjz.js} +7 -5
- package/{babel-C1TaJd38.d.cts → babel-CmCnq-43.d.ts} +1 -2
- package/babel.cjs +5 -6
- package/babel.d.cts +2 -1
- package/babel.d.ts +3 -0
- package/babel.js +4 -0
- package/{bun-DFr_PiLh.mjs → bun-CDECNeIU.js} +7 -5
- package/{bun-CUGitP44.cjs → bun-DU5xZoDJ.cjs} +30 -25
- package/{bun-9JrHWE4u.d.mts → bun-cwXs2EDP.d.cts} +1 -1
- package/{bun-ChNeklBe.d.cts → bun-ovScJ4Es.d.ts} +1 -1
- package/bun.cjs +5 -6
- package/bun.d.cts +2 -1
- package/bun.d.ts +3 -0
- package/bun.js +4 -0
- package/{common-Ccx_dEqH.cjs → common-B8wsLJUq.cjs} +53 -36
- package/{common-BvAFT5IV.d.mts → common-BlvLUwEz.d.ts} +4 -4
- package/{common-e08X6w0a.mjs → common-CElmMmuq.js} +9 -2
- package/{common-BKqBivuE.d.cts → common-DZ2cLtbe.d.cts} +2 -2
- package/esbuild.cjs +9 -6
- package/esbuild.d.cts +4 -1
- package/esbuild.d.ts +5 -0
- package/esbuild.js +10 -0
- package/farm.cjs +9 -6
- package/farm.d.cts +4 -1
- package/farm.d.ts +5 -0
- package/farm.js +10 -0
- package/{index-HrLja1mV.d.cts → index-COIv1oYx.d.cts} +14 -14
- package/{index-BuKVXaph.d.mts → index-PPreQbn5.d.ts} +14 -14
- package/index.cjs +8 -9
- package/index.d.cts +4 -4
- package/{index.d.mts → index.d.ts} +4 -4
- package/index.js +6 -0
- package/package.json +26 -27
- package/rolldown.cjs +9 -6
- package/rolldown.d.cts +4 -1
- package/rolldown.d.ts +5 -0
- package/rolldown.js +10 -0
- package/rollup.cjs +9 -6
- package/rollup.d.cts +4 -1
- package/rollup.d.ts +5 -0
- package/rollup.js +10 -0
- package/rspack.cjs +9 -6
- package/rspack.d.cts +4 -1
- package/rspack.d.ts +5 -0
- package/rspack.js +10 -0
- package/src-CDZ6lHsg.cjs +82 -0
- package/{src-BV9Uh6WO.mjs → src-D84rmPxv.js} +6 -2
- package/vite.cjs +9 -6
- package/vite.d.cts +4 -1
- package/vite.d.ts +5 -0
- package/vite.js +10 -0
- package/webpack.cjs +9 -6
- package/webpack.d.cts +4 -1
- package/webpack.d.ts +5 -0
- package/webpack.js +10 -0
- package/babel.d.mts +0 -2
- package/babel.mjs +0 -2
- package/bun.d.mts +0 -2
- package/bun.mjs +0 -2
- package/esbuild.d.mts +0 -2
- package/esbuild.mjs +0 -5
- package/farm.d.mts +0 -2
- package/farm.mjs +0 -5
- package/index.mjs +0 -4
- package/rolldown.d.mts +0 -2
- package/rolldown.mjs +0 -5
- package/rollup.d.mts +0 -2
- package/rollup.mjs +0 -5
- package/rspack.d.mts +0 -2
- package/rspack.mjs +0 -5
- package/src-2vvPp2dY.cjs +0 -77
- package/vite.d.mts +0 -2
- package/vite.mjs +0 -5
- package/webpack.d.mts +0 -2
- package/webpack.mjs +0 -5
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
const require_common = require(
|
|
1
|
+
const require_common = require('./common-B8wsLJUq.cjs');
|
|
2
2
|
let defu = require("defu");
|
|
3
3
|
defu = require_common.__toESM(defu);
|
|
4
|
+
let tinyest_for_wgsl = require("tinyest-for-wgsl");
|
|
5
|
+
tinyest_for_wgsl = require_common.__toESM(tinyest_for_wgsl);
|
|
4
6
|
let tinyest = require("tinyest");
|
|
5
|
-
|
|
6
|
-
let _babel_types = require("@babel/types");
|
|
7
|
-
_babel_types = require_common.__toESM(_babel_types);
|
|
7
|
+
tinyest = require_common.__toESM(tinyest);
|
|
8
8
|
let pathe = require("pathe");
|
|
9
|
+
pathe = require_common.__toESM(pathe);
|
|
9
10
|
let picomatch = require("picomatch");
|
|
10
11
|
picomatch = require_common.__toESM(picomatch);
|
|
12
|
+
|
|
11
13
|
//#region src/core/filter.ts
|
|
12
14
|
function toArray(array) {
|
|
13
15
|
const result = array || [];
|
|
@@ -63,28 +65,29 @@ function createFilterForId(filter) {
|
|
|
63
65
|
const filterFunction = createIdFilter(filter);
|
|
64
66
|
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
65
67
|
}
|
|
68
|
+
|
|
66
69
|
//#endregion
|
|
67
70
|
//#region src/babel.ts
|
|
68
71
|
function i(identifier) {
|
|
69
|
-
return
|
|
72
|
+
return require_common.t.identifier(identifier);
|
|
70
73
|
}
|
|
71
74
|
function assignMetadata(path, name, ast) {
|
|
72
|
-
const metadata =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
const metadata = require_common.t.objectExpression([
|
|
76
|
+
require_common.t.objectProperty(i("v"), require_common.t.numericLiteral(tinyest.FORMAT_VERSION)),
|
|
77
|
+
require_common.t.objectProperty(i("name"), require_common.t.valueToNode(name)),
|
|
78
|
+
require_common.t.objectProperty(i("ast"), require_common.t.valueToNode(ast)),
|
|
79
|
+
require_common.t.objectProperty(i("externals"), require_common.t.arrowFunctionExpression([], require_common.t.blockStatement([require_common.t.returnStatement(require_common.t.objectExpression(ast.externalNames.map((name$1) => name$1 === "this" ? require_common.t.objectProperty(i("this"), require_common.t.thisExpression()) : require_common.t.objectProperty(i(name$1), i(name$1), false, name$1 !== "this"))))])))
|
|
77
80
|
]);
|
|
78
81
|
let expression;
|
|
79
|
-
const visibility =
|
|
80
|
-
if (
|
|
82
|
+
const visibility = require_common.t.isFunctionDeclaration(path.node) ? require_common.getBlockScope(path) : void 0;
|
|
83
|
+
if (require_common.t.isFunctionDeclaration(path.node)) expression = require_common.t.functionExpression(path.node.id, path.node.params, path.node.body);
|
|
81
84
|
else expression = path.node;
|
|
82
|
-
const callExpr =
|
|
83
|
-
|
|
85
|
+
const callExpr = require_common.t.callExpression(require_common.t.arrowFunctionExpression([i("$")], require_common.t.logicalExpression("&&", require_common.t.callExpression(require_common.t.memberExpression(require_common.t.assignmentExpression("??=", require_common.t.memberExpression(i("globalThis"), i("__TYPEGPU_META__")), require_common.t.newExpression(i("WeakMap"), [])), i("set")), [require_common.t.assignmentExpression("=", require_common.t.memberExpression(i("$"), i("f")), expression), metadata]), require_common.t.memberExpression(i("$"), i("f")))), [require_common.t.objectExpression([])]);
|
|
86
|
+
require_common.t.addComment(callExpr, "leading", "#__PURE__");
|
|
84
87
|
let replacement = callExpr;
|
|
85
|
-
if (
|
|
86
|
-
const declaration =
|
|
87
|
-
|
|
88
|
+
if (require_common.t.isFunctionDeclaration(path.node) && path.node.id) {
|
|
89
|
+
const declaration = require_common.t.variableDeclaration("const", [require_common.t.variableDeclarator(path.node.id, callExpr)]);
|
|
90
|
+
require_common.t.inheritLeadingComments(declaration, path.node);
|
|
88
91
|
replacement = declaration;
|
|
89
92
|
}
|
|
90
93
|
if (visibility) {
|
|
@@ -95,15 +98,15 @@ function assignMetadata(path, name, ast) {
|
|
|
95
98
|
path.skip();
|
|
96
99
|
}
|
|
97
100
|
function wrapInAutoName(path, name) {
|
|
98
|
-
const callExpr =
|
|
99
|
-
|
|
101
|
+
const callExpr = require_common.t.callExpression(require_common.t.logicalExpression("??", require_common.t.memberExpression(i("globalThis"), i("__TYPEGPU_AUTONAME__")), require_common.t.arrowFunctionExpression([i("a")], i("a"))), [path.node, require_common.t.stringLiteral(name)]);
|
|
102
|
+
require_common.t.addComment(callExpr, "leading", "#__PURE__");
|
|
100
103
|
path.replaceWith(callExpr);
|
|
101
104
|
}
|
|
102
105
|
function replaceWithAssignmentOverload(path, runtimeFn) {
|
|
103
|
-
path.replaceWith(
|
|
106
|
+
path.replaceWith(require_common.t.assignmentExpression("=", path.node.left, require_common.t.callExpression(i(runtimeFn), [path.node.left, path.node.right])));
|
|
104
107
|
}
|
|
105
108
|
function replaceWithBinaryOverload(path, runtimeFn) {
|
|
106
|
-
path.replaceWith(
|
|
109
|
+
path.replaceWith(require_common.t.callExpression(i(runtimeFn), [path.node.left, path.node.right]));
|
|
107
110
|
}
|
|
108
111
|
function TypeGPUPlugin() {
|
|
109
112
|
return {
|
|
@@ -125,10 +128,11 @@ function TypeGPUPlugin() {
|
|
|
125
128
|
} }
|
|
126
129
|
};
|
|
127
130
|
}
|
|
131
|
+
|
|
128
132
|
//#endregion
|
|
129
|
-
Object.defineProperty(exports,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
133
|
+
Object.defineProperty(exports, 'TypeGPUPlugin', {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
get: function () {
|
|
136
|
+
return TypeGPUPlugin;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as PluginState } from "./common-
|
|
1
|
+
import { n as PluginState, r as t } from "./common-DZ2cLtbe.cjs";
|
|
2
2
|
import { NodePath } from "@babel/traverse";
|
|
3
|
-
import * as t from "@babel/types";
|
|
4
3
|
|
|
5
4
|
//#region src/babel.d.ts
|
|
6
5
|
declare function TypeGPUPlugin(): {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as initPluginState, i as getBlockScope, r as functionVisitor, t as defaultOptions } from "./common-
|
|
1
|
+
import { a as initPluginState, i as getBlockScope, o as t, r as functionVisitor, t as defaultOptions } from "./common-CElmMmuq.js";
|
|
2
2
|
import defu from "defu";
|
|
3
|
+
import { transpileFn } from "tinyest-for-wgsl";
|
|
3
4
|
import { FORMAT_VERSION } from "tinyest";
|
|
4
|
-
import "tinyest-for-wgsl";
|
|
5
|
-
import * as t from "@babel/types";
|
|
6
5
|
import { resolve } from "pathe";
|
|
7
6
|
import picomatch from "picomatch";
|
|
7
|
+
|
|
8
8
|
//#region src/core/filter.ts
|
|
9
9
|
function toArray(array) {
|
|
10
10
|
const result = array || [];
|
|
@@ -60,6 +60,7 @@ function createFilterForId(filter) {
|
|
|
60
60
|
const filterFunction = createIdFilter(filter);
|
|
61
61
|
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
62
62
|
}
|
|
63
|
+
|
|
63
64
|
//#endregion
|
|
64
65
|
//#region src/babel.ts
|
|
65
66
|
function i(identifier) {
|
|
@@ -70,7 +71,7 @@ function assignMetadata(path, name, ast) {
|
|
|
70
71
|
t.objectProperty(i("v"), t.numericLiteral(FORMAT_VERSION)),
|
|
71
72
|
t.objectProperty(i("name"), t.valueToNode(name)),
|
|
72
73
|
t.objectProperty(i("ast"), t.valueToNode(ast)),
|
|
73
|
-
t.objectProperty(i("externals"), t.arrowFunctionExpression([], t.blockStatement([t.returnStatement(t.objectExpression(ast.externalNames.map((name) => name === "this" ? t.objectProperty(i("this"), t.thisExpression()) : t.objectProperty(i(name), i(name), false, name !== "this"))))])))
|
|
74
|
+
t.objectProperty(i("externals"), t.arrowFunctionExpression([], t.blockStatement([t.returnStatement(t.objectExpression(ast.externalNames.map((name$1) => name$1 === "this" ? t.objectProperty(i("this"), t.thisExpression()) : t.objectProperty(i(name$1), i(name$1), false, name$1 !== "this"))))])))
|
|
74
75
|
]);
|
|
75
76
|
let expression;
|
|
76
77
|
const visibility = t.isFunctionDeclaration(path.node) ? getBlockScope(path) : void 0;
|
|
@@ -122,5 +123,6 @@ function TypeGPUPlugin() {
|
|
|
122
123
|
} }
|
|
123
124
|
};
|
|
124
125
|
}
|
|
126
|
+
|
|
125
127
|
//#endregion
|
|
126
|
-
export { TypeGPUPlugin as t };
|
|
128
|
+
export { TypeGPUPlugin as t };
|
package/babel.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = require_babel.TypeGPUPlugin;
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
require('./common-B8wsLJUq.cjs');
|
|
3
|
+
const require_babel = require('./babel-B-IcpMR7.cjs');
|
|
4
|
+
|
|
5
|
+
exports.default = require_babel.TypeGPUPlugin;
|
package/babel.d.cts
CHANGED
package/babel.d.ts
ADDED
package/babel.js
ADDED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as initPluginState, i as getBlockScope, n as earlyPruneRegex, r as functionVisitor, t as defaultOptions } from "./common-
|
|
1
|
+
import { a as initPluginState, i as getBlockScope, n as earlyPruneRegex, o as t, r as functionVisitor, t as defaultOptions } from "./common-CElmMmuq.js";
|
|
2
2
|
import defu from "defu";
|
|
3
|
+
import { transpileFn } from "tinyest-for-wgsl";
|
|
4
|
+
import { FORMAT_VERSION } from "tinyest";
|
|
3
5
|
import { MagicStringAST, generateTransform } from "magic-string-ast";
|
|
4
6
|
import { getBabelParserOptions, getLang } from "ast-kit";
|
|
5
7
|
import _traverse from "@babel/traverse";
|
|
6
|
-
import { FORMAT_VERSION } from "tinyest";
|
|
7
|
-
import "tinyest-for-wgsl";
|
|
8
8
|
import * as parser from "@babel/parser";
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
//#region src/core/factory.ts
|
|
11
11
|
let traverse = _traverse;
|
|
12
12
|
if (typeof traverse.default === "function") traverse = traverse.default;
|
|
@@ -101,6 +101,7 @@ const unpluginFactory = ((rawOptions, _meta) => {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
});
|
|
104
|
+
|
|
104
105
|
//#endregion
|
|
105
106
|
//#region src/bun.ts
|
|
106
107
|
var bun_default = (rawOptions) => {
|
|
@@ -128,5 +129,6 @@ var bun_default = (rawOptions) => {
|
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
};
|
|
132
|
+
|
|
131
133
|
//#endregion
|
|
132
|
-
export { unpluginFactory as n, bun_default as t };
|
|
134
|
+
export { unpluginFactory as n, bun_default as t };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
const require_common = require(
|
|
1
|
+
const require_common = require('./common-B8wsLJUq.cjs');
|
|
2
2
|
let defu = require("defu");
|
|
3
3
|
defu = require_common.__toESM(defu);
|
|
4
|
+
let tinyest_for_wgsl = require("tinyest-for-wgsl");
|
|
5
|
+
tinyest_for_wgsl = require_common.__toESM(tinyest_for_wgsl);
|
|
6
|
+
let tinyest = require("tinyest");
|
|
7
|
+
tinyest = require_common.__toESM(tinyest);
|
|
4
8
|
let magic_string_ast = require("magic-string-ast");
|
|
9
|
+
magic_string_ast = require_common.__toESM(magic_string_ast);
|
|
5
10
|
let ast_kit = require("ast-kit");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
require("
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let _babel_types = require("@babel/types");
|
|
13
|
-
_babel_types = require_common.__toESM(_babel_types);
|
|
11
|
+
ast_kit = require_common.__toESM(ast_kit);
|
|
12
|
+
let __babel_traverse = require("@babel/traverse");
|
|
13
|
+
__babel_traverse = require_common.__toESM(__babel_traverse);
|
|
14
|
+
let __babel_parser = require("@babel/parser");
|
|
15
|
+
__babel_parser = require_common.__toESM(__babel_parser);
|
|
16
|
+
|
|
14
17
|
//#region src/core/factory.ts
|
|
15
|
-
let traverse =
|
|
18
|
+
let traverse = __babel_traverse.default;
|
|
16
19
|
if (typeof traverse.default === "function") traverse = traverse.default;
|
|
17
20
|
const fnWrapperTemplate = (fnCode, metadata) => `(/*#__PURE__*/($ => (globalThis.__TYPEGPU_META__ ??= new WeakMap()).set($.f = (${fnCode}), ${metadata}) && $.f)({}))`;
|
|
18
21
|
function embedJSON(jsValue) {
|
|
@@ -26,16 +29,16 @@ function assignMetadata(path, name, ast) {
|
|
|
26
29
|
ast: ${embedJSON(ast)},
|
|
27
30
|
externals: () => ({${ast.externalNames.map((e) => e === "this" ? "\"this\": this" : e).join(", ")}}),
|
|
28
31
|
}`;
|
|
29
|
-
const visibility =
|
|
32
|
+
const visibility = require_common.t.isFunctionDeclaration(path.node) ? require_common.getBlockScope(path) : void 0;
|
|
30
33
|
const fnCode = this.magicString.sliceNode(path.node);
|
|
31
34
|
let nodeToOverride = path.node;
|
|
32
35
|
let code = fnWrapperTemplate(fnCode, metadata);
|
|
33
36
|
let insertPos = (_path$node$start = path.node.start) !== null && _path$node$start !== void 0 ? _path$node$start : 0;
|
|
34
|
-
if (
|
|
37
|
+
if (require_common.t.isFunctionDeclaration(path.node) && path.node.id) code = `const ${path.node.id.name} = ${code};\n\n`;
|
|
35
38
|
if (visibility) {
|
|
36
39
|
var _visibility$node$body, _visibility$node$body2;
|
|
37
40
|
insertPos = (_visibility$node$body = (_visibility$node$body2 = visibility.node.body[0]) === null || _visibility$node$body2 === void 0 ? void 0 : _visibility$node$body2.start) !== null && _visibility$node$body !== void 0 ? _visibility$node$body : insertPos;
|
|
38
|
-
if (
|
|
41
|
+
if (require_common.t.isExportNamedDeclaration(path.parent)) {
|
|
39
42
|
nodeToOverride = path.parent;
|
|
40
43
|
code = `export ${code}`;
|
|
41
44
|
}
|
|
@@ -78,7 +81,7 @@ const unpluginFactory = ((rawOptions, _meta) => {
|
|
|
78
81
|
handler(code, id) {
|
|
79
82
|
let ast;
|
|
80
83
|
try {
|
|
81
|
-
ast =
|
|
84
|
+
ast = __babel_parser.parse(code, (0, ast_kit.getBabelParserOptions)((0, ast_kit.getLang)(id), {
|
|
82
85
|
sourceType: "module",
|
|
83
86
|
allowReturnOutsideFunction: true
|
|
84
87
|
}));
|
|
@@ -105,6 +108,7 @@ const unpluginFactory = ((rawOptions, _meta) => {
|
|
|
105
108
|
}
|
|
106
109
|
};
|
|
107
110
|
});
|
|
111
|
+
|
|
108
112
|
//#endregion
|
|
109
113
|
//#region src/bun.ts
|
|
110
114
|
var bun_default = (rawOptions) => {
|
|
@@ -132,16 +136,17 @@ var bun_default = (rawOptions) => {
|
|
|
132
136
|
}
|
|
133
137
|
};
|
|
134
138
|
};
|
|
139
|
+
|
|
135
140
|
//#endregion
|
|
136
|
-
Object.defineProperty(exports,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
142
|
-
Object.defineProperty(exports, "unpluginFactory", {
|
|
143
|
-
enumerable: true,
|
|
144
|
-
get: function() {
|
|
145
|
-
return unpluginFactory;
|
|
146
|
-
}
|
|
141
|
+
Object.defineProperty(exports, 'bun_default', {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function () {
|
|
144
|
+
return bun_default;
|
|
145
|
+
}
|
|
147
146
|
});
|
|
147
|
+
Object.defineProperty(exports, 'unpluginFactory', {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () {
|
|
150
|
+
return unpluginFactory;
|
|
151
|
+
}
|
|
152
|
+
});
|
package/bun.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = require_bun.bun_default;
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
require('./common-B8wsLJUq.cjs');
|
|
3
|
+
const require_bun = require('./bun-DU5xZoDJ.cjs');
|
|
4
|
+
|
|
5
|
+
exports.default = require_bun.bun_default;
|
package/bun.d.cts
CHANGED
package/bun.d.ts
ADDED
package/bun.js
ADDED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region rolldown:runtime
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -19,10 +19,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
23
24
|
let tinyest_for_wgsl = require("tinyest-for-wgsl");
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
tinyest_for_wgsl = __toESM(tinyest_for_wgsl);
|
|
26
|
+
let __babel_types = require("@babel/types");
|
|
27
|
+
__babel_types = __toESM(__babel_types);
|
|
28
|
+
let magic_string_ast = require("magic-string-ast");
|
|
29
|
+
magic_string_ast = __toESM(magic_string_ast);
|
|
30
|
+
|
|
31
|
+
//#region src/core/polyfill-process.ts
|
|
32
|
+
if (typeof globalThis.process === "undefined") globalThis.process = {};
|
|
33
|
+
if (typeof globalThis.process.env === "undefined") globalThis.process.env = {};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
26
36
|
//#region src/core/common.ts
|
|
27
37
|
function initPluginState(state, methods) {
|
|
28
38
|
var _state$opts$autoNamin;
|
|
@@ -48,8 +58,8 @@ function getBlockScope(path) {
|
|
|
48
58
|
const binding = path.scope.getBinding(path.node.id.name);
|
|
49
59
|
if (!binding) return;
|
|
50
60
|
let scopePath = binding.scope.path;
|
|
51
|
-
if (
|
|
52
|
-
if (
|
|
61
|
+
if (__babel_types.isNode(scopePath.node.body)) scopePath = scopePath.get("body");
|
|
62
|
+
if (__babel_types.isBlockStatement(scopePath.node) || __babel_types.isProgram(scopePath.node)) return scopePath;
|
|
53
63
|
}
|
|
54
64
|
/**
|
|
55
65
|
* Checks if `node` is an alias for the 'tgpu' object, traditionally
|
|
@@ -290,40 +300,47 @@ const functionVisitor = {
|
|
|
290
300
|
}
|
|
291
301
|
} }
|
|
292
302
|
};
|
|
303
|
+
|
|
293
304
|
//#endregion
|
|
294
|
-
Object.defineProperty(exports,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
305
|
+
Object.defineProperty(exports, '__toESM', {
|
|
306
|
+
enumerable: true,
|
|
307
|
+
get: function () {
|
|
308
|
+
return __toESM;
|
|
309
|
+
}
|
|
299
310
|
});
|
|
300
|
-
Object.defineProperty(exports,
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
311
|
+
Object.defineProperty(exports, 'defaultOptions', {
|
|
312
|
+
enumerable: true,
|
|
313
|
+
get: function () {
|
|
314
|
+
return defaultOptions;
|
|
315
|
+
}
|
|
305
316
|
});
|
|
306
|
-
Object.defineProperty(exports,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
317
|
+
Object.defineProperty(exports, 'earlyPruneRegex', {
|
|
318
|
+
enumerable: true,
|
|
319
|
+
get: function () {
|
|
320
|
+
return earlyPruneRegex;
|
|
321
|
+
}
|
|
311
322
|
});
|
|
312
|
-
Object.defineProperty(exports,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
323
|
+
Object.defineProperty(exports, 'functionVisitor', {
|
|
324
|
+
enumerable: true,
|
|
325
|
+
get: function () {
|
|
326
|
+
return functionVisitor;
|
|
327
|
+
}
|
|
317
328
|
});
|
|
318
|
-
Object.defineProperty(exports,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
329
|
+
Object.defineProperty(exports, 'getBlockScope', {
|
|
330
|
+
enumerable: true,
|
|
331
|
+
get: function () {
|
|
332
|
+
return getBlockScope;
|
|
333
|
+
}
|
|
323
334
|
});
|
|
324
|
-
Object.defineProperty(exports,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
335
|
+
Object.defineProperty(exports, 'initPluginState', {
|
|
336
|
+
enumerable: true,
|
|
337
|
+
get: function () {
|
|
338
|
+
return initPluginState;
|
|
339
|
+
}
|
|
329
340
|
});
|
|
341
|
+
Object.defineProperty(exports, 't', {
|
|
342
|
+
enumerable: true,
|
|
343
|
+
get: function () {
|
|
344
|
+
return t;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FilterPattern } from "unplugin";
|
|
2
|
-
import { MagicStringAST } from "magic-string-ast";
|
|
3
|
-
import { NodePath } from "@babel/traverse";
|
|
4
1
|
import { transpileFn } from "tinyest-for-wgsl";
|
|
5
2
|
import * as t from "@babel/types";
|
|
3
|
+
import { MagicStringAST } from "magic-string-ast";
|
|
4
|
+
import { NodePath } from "@babel/traverse";
|
|
5
|
+
import { FilterPattern } from "unplugin";
|
|
6
6
|
|
|
7
7
|
//#region src/core/common.d.ts
|
|
8
8
|
interface Options {
|
|
@@ -82,4 +82,4 @@ interface PluginState extends TransformMethods {
|
|
|
82
82
|
alreadyTransformed: WeakSet<t.Node>;
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
|
-
export { PluginState as n, Options as t };
|
|
85
|
+
export { PluginState as n, t as r, Options as t };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import "magic-string-ast";
|
|
2
1
|
import { transpileFn } from "tinyest-for-wgsl";
|
|
3
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
|
|
4
10
|
//#region src/core/common.ts
|
|
5
11
|
function initPluginState(state, methods) {
|
|
6
12
|
var _state$opts$autoNamin;
|
|
@@ -268,5 +274,6 @@ const functionVisitor = {
|
|
|
268
274
|
}
|
|
269
275
|
} }
|
|
270
276
|
};
|
|
277
|
+
|
|
271
278
|
//#endregion
|
|
272
|
-
export { initPluginState as a, getBlockScope as i, earlyPruneRegex as n, functionVisitor as r, defaultOptions as t };
|
|
279
|
+
export { initPluginState as a, getBlockScope as i, earlyPruneRegex as n, t as o, functionVisitor as r, defaultOptions as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as t from "@babel/types";
|
|
2
1
|
import { NodePath } from "@babel/traverse";
|
|
2
|
+
import * as t from "@babel/types";
|
|
3
3
|
import { FilterPattern } from "unplugin";
|
|
4
4
|
import { transpileFn } from "tinyest-for-wgsl";
|
|
5
5
|
|
|
@@ -81,4 +81,4 @@ interface PluginState extends TransformMethods {
|
|
|
81
81
|
alreadyTransformed: WeakSet<t.Node>;
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
|
-
export { PluginState as n, Options as t };
|
|
84
|
+
export { PluginState as n, t as r, Options as t };
|
package/esbuild.cjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
require('./common-B8wsLJUq.cjs');
|
|
3
|
+
require('./babel-B-IcpMR7.cjs');
|
|
4
|
+
require('./bun-DU5xZoDJ.cjs');
|
|
5
|
+
const require_src = require('./src-CDZ6lHsg.cjs');
|
|
6
|
+
|
|
5
7
|
//#region src/esbuild.ts
|
|
6
|
-
var esbuild_default =
|
|
8
|
+
var esbuild_default = require_src.esbuildPlugin;
|
|
9
|
+
|
|
7
10
|
//#endregion
|
|
8
|
-
exports.default = esbuild_default;
|
|
11
|
+
exports.default = esbuild_default;
|
package/esbuild.d.cts
CHANGED
package/esbuild.d.ts
ADDED
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.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
require('./common-B8wsLJUq.cjs');
|
|
3
|
+
require('./babel-B-IcpMR7.cjs');
|
|
4
|
+
require('./bun-DU5xZoDJ.cjs');
|
|
5
|
+
const require_src = require('./src-CDZ6lHsg.cjs');
|
|
6
|
+
|
|
5
7
|
//#region src/farm.ts
|
|
6
|
-
var farm_default =
|
|
8
|
+
var farm_default = require_src.farmPlugin;
|
|
9
|
+
|
|
7
10
|
//#endregion
|
|
8
|
-
exports.default = farm_default;
|
|
11
|
+
exports.default = farm_default;
|
package/farm.d.cts
CHANGED
package/farm.d.ts
ADDED
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 };
|