unplugin-typegpu 0.11.0 → 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.
- 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-izRcz0Uk.cjs → babel-Dis-Pwfu.cjs} +33 -27
- 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-DCACcaN2.cjs} +32 -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-BvAFT5IV.d.mts → common-BlvLUwEz.d.ts} +4 -4
- package/{common-Ccx_dEqH.cjs → common-BoeQmwpt.cjs} +48 -37
- 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 +2 -3
- 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-BV9Uh6WO.mjs → src-D84rmPxv.js} +6 -2
- package/src-bIj7OBnd.cjs +82 -0
- 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,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 };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
const require_common = require(
|
|
1
|
+
const require_common = require('./common-BoeQmwpt.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
|
+
let __babel_types = require("@babel/types");
|
|
13
|
+
__babel_types = require_common.__toESM(__babel_types);
|
|
14
|
+
|
|
11
15
|
//#region src/core/filter.ts
|
|
12
16
|
function toArray(array) {
|
|
13
17
|
const result = array || [];
|
|
@@ -63,28 +67,29 @@ function createFilterForId(filter) {
|
|
|
63
67
|
const filterFunction = createIdFilter(filter);
|
|
64
68
|
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
65
69
|
}
|
|
70
|
+
|
|
66
71
|
//#endregion
|
|
67
72
|
//#region src/babel.ts
|
|
68
73
|
function i(identifier) {
|
|
69
|
-
return
|
|
74
|
+
return __babel_types.identifier(identifier);
|
|
70
75
|
}
|
|
71
76
|
function assignMetadata(path, name, ast) {
|
|
72
|
-
const metadata =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
const metadata = __babel_types.objectExpression([
|
|
78
|
+
__babel_types.objectProperty(i("v"), __babel_types.numericLiteral(tinyest.FORMAT_VERSION)),
|
|
79
|
+
__babel_types.objectProperty(i("name"), __babel_types.valueToNode(name)),
|
|
80
|
+
__babel_types.objectProperty(i("ast"), __babel_types.valueToNode(ast)),
|
|
81
|
+
__babel_types.objectProperty(i("externals"), __babel_types.arrowFunctionExpression([], __babel_types.blockStatement([__babel_types.returnStatement(__babel_types.objectExpression(ast.externalNames.map((name$1) => name$1 === "this" ? __babel_types.objectProperty(i("this"), __babel_types.thisExpression()) : __babel_types.objectProperty(i(name$1), i(name$1), false, name$1 !== "this"))))])))
|
|
77
82
|
]);
|
|
78
83
|
let expression;
|
|
79
|
-
const visibility =
|
|
80
|
-
if (
|
|
84
|
+
const visibility = __babel_types.isFunctionDeclaration(path.node) ? require_common.getBlockScope(path) : void 0;
|
|
85
|
+
if (__babel_types.isFunctionDeclaration(path.node)) expression = __babel_types.functionExpression(path.node.id, path.node.params, path.node.body);
|
|
81
86
|
else expression = path.node;
|
|
82
|
-
const callExpr =
|
|
83
|
-
|
|
87
|
+
const callExpr = __babel_types.callExpression(__babel_types.arrowFunctionExpression([i("$")], __babel_types.logicalExpression("&&", __babel_types.callExpression(__babel_types.memberExpression(__babel_types.assignmentExpression("??=", __babel_types.memberExpression(i("globalThis"), i("__TYPEGPU_META__")), __babel_types.newExpression(i("WeakMap"), [])), i("set")), [__babel_types.assignmentExpression("=", __babel_types.memberExpression(i("$"), i("f")), expression), metadata]), __babel_types.memberExpression(i("$"), i("f")))), [__babel_types.objectExpression([])]);
|
|
88
|
+
__babel_types.addComment(callExpr, "leading", "#__PURE__");
|
|
84
89
|
let replacement = callExpr;
|
|
85
|
-
if (
|
|
86
|
-
const declaration =
|
|
87
|
-
|
|
90
|
+
if (__babel_types.isFunctionDeclaration(path.node) && path.node.id) {
|
|
91
|
+
const declaration = __babel_types.variableDeclaration("const", [__babel_types.variableDeclarator(path.node.id, callExpr)]);
|
|
92
|
+
__babel_types.inheritLeadingComments(declaration, path.node);
|
|
88
93
|
replacement = declaration;
|
|
89
94
|
}
|
|
90
95
|
if (visibility) {
|
|
@@ -95,15 +100,15 @@ function assignMetadata(path, name, ast) {
|
|
|
95
100
|
path.skip();
|
|
96
101
|
}
|
|
97
102
|
function wrapInAutoName(path, name) {
|
|
98
|
-
const callExpr =
|
|
99
|
-
|
|
103
|
+
const callExpr = __babel_types.callExpression(__babel_types.logicalExpression("??", __babel_types.memberExpression(i("globalThis"), i("__TYPEGPU_AUTONAME__")), __babel_types.arrowFunctionExpression([i("a")], i("a"))), [path.node, __babel_types.stringLiteral(name)]);
|
|
104
|
+
__babel_types.addComment(callExpr, "leading", "#__PURE__");
|
|
100
105
|
path.replaceWith(callExpr);
|
|
101
106
|
}
|
|
102
107
|
function replaceWithAssignmentOverload(path, runtimeFn) {
|
|
103
|
-
path.replaceWith(
|
|
108
|
+
path.replaceWith(__babel_types.assignmentExpression("=", path.node.left, __babel_types.callExpression(i(runtimeFn), [path.node.left, path.node.right])));
|
|
104
109
|
}
|
|
105
110
|
function replaceWithBinaryOverload(path, runtimeFn) {
|
|
106
|
-
path.replaceWith(
|
|
111
|
+
path.replaceWith(__babel_types.callExpression(i(runtimeFn), [path.node.left, path.node.right]));
|
|
107
112
|
}
|
|
108
113
|
function TypeGPUPlugin() {
|
|
109
114
|
return {
|
|
@@ -125,10 +130,11 @@ function TypeGPUPlugin() {
|
|
|
125
130
|
} }
|
|
126
131
|
};
|
|
127
132
|
}
|
|
133
|
+
|
|
128
134
|
//#endregion
|
|
129
|
-
Object.defineProperty(exports,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
+
Object.defineProperty(exports, 'TypeGPUPlugin', {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () {
|
|
138
|
+
return TypeGPUPlugin;
|
|
139
|
+
}
|
|
140
|
+
});
|
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-BoeQmwpt.cjs');
|
|
3
|
+
const require_babel = require('./babel-Dis-Pwfu.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,23 @@
|
|
|
1
|
-
const require_common = require(
|
|
1
|
+
const require_common = require('./common-BoeQmwpt.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
|
-
|
|
13
|
-
|
|
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
|
+
let __babel_types = require("@babel/types");
|
|
17
|
+
__babel_types = require_common.__toESM(__babel_types);
|
|
18
|
+
|
|
14
19
|
//#region src/core/factory.ts
|
|
15
|
-
let traverse =
|
|
20
|
+
let traverse = __babel_traverse.default;
|
|
16
21
|
if (typeof traverse.default === "function") traverse = traverse.default;
|
|
17
22
|
const fnWrapperTemplate = (fnCode, metadata) => `(/*#__PURE__*/($ => (globalThis.__TYPEGPU_META__ ??= new WeakMap()).set($.f = (${fnCode}), ${metadata}) && $.f)({}))`;
|
|
18
23
|
function embedJSON(jsValue) {
|
|
@@ -26,16 +31,16 @@ function assignMetadata(path, name, ast) {
|
|
|
26
31
|
ast: ${embedJSON(ast)},
|
|
27
32
|
externals: () => ({${ast.externalNames.map((e) => e === "this" ? "\"this\": this" : e).join(", ")}}),
|
|
28
33
|
}`;
|
|
29
|
-
const visibility =
|
|
34
|
+
const visibility = __babel_types.isFunctionDeclaration(path.node) ? require_common.getBlockScope(path) : void 0;
|
|
30
35
|
const fnCode = this.magicString.sliceNode(path.node);
|
|
31
36
|
let nodeToOverride = path.node;
|
|
32
37
|
let code = fnWrapperTemplate(fnCode, metadata);
|
|
33
38
|
let insertPos = (_path$node$start = path.node.start) !== null && _path$node$start !== void 0 ? _path$node$start : 0;
|
|
34
|
-
if (
|
|
39
|
+
if (__babel_types.isFunctionDeclaration(path.node) && path.node.id) code = `const ${path.node.id.name} = ${code};\n\n`;
|
|
35
40
|
if (visibility) {
|
|
36
41
|
var _visibility$node$body, _visibility$node$body2;
|
|
37
42
|
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 (
|
|
43
|
+
if (__babel_types.isExportNamedDeclaration(path.parent)) {
|
|
39
44
|
nodeToOverride = path.parent;
|
|
40
45
|
code = `export ${code}`;
|
|
41
46
|
}
|
|
@@ -78,7 +83,7 @@ const unpluginFactory = ((rawOptions, _meta) => {
|
|
|
78
83
|
handler(code, id) {
|
|
79
84
|
let ast;
|
|
80
85
|
try {
|
|
81
|
-
ast =
|
|
86
|
+
ast = __babel_parser.parse(code, (0, ast_kit.getBabelParserOptions)((0, ast_kit.getLang)(id), {
|
|
82
87
|
sourceType: "module",
|
|
83
88
|
allowReturnOutsideFunction: true
|
|
84
89
|
}));
|
|
@@ -105,6 +110,7 @@ const unpluginFactory = ((rawOptions, _meta) => {
|
|
|
105
110
|
}
|
|
106
111
|
};
|
|
107
112
|
});
|
|
113
|
+
|
|
108
114
|
//#endregion
|
|
109
115
|
//#region src/bun.ts
|
|
110
116
|
var bun_default = (rawOptions) => {
|
|
@@ -132,16 +138,17 @@ var bun_default = (rawOptions) => {
|
|
|
132
138
|
}
|
|
133
139
|
};
|
|
134
140
|
};
|
|
141
|
+
|
|
135
142
|
//#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
|
-
}
|
|
143
|
+
Object.defineProperty(exports, 'bun_default', {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get: function () {
|
|
146
|
+
return bun_default;
|
|
147
|
+
}
|
|
147
148
|
});
|
|
149
|
+
Object.defineProperty(exports, 'unpluginFactory', {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: function () {
|
|
152
|
+
return unpluginFactory;
|
|
153
|
+
}
|
|
154
|
+
});
|
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-BoeQmwpt.cjs');
|
|
3
|
+
const require_bun = require('./bun-DCACcaN2.cjs');
|
|
4
|
+
|
|
5
|
+
exports.default = require_bun.bun_default;
|
package/bun.d.cts
CHANGED
package/bun.d.ts
ADDED
package/bun.js
ADDED
|
@@ -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,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,41 @@ 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
|
-
|
|
317
|
-
});
|
|
318
|
-
Object.defineProperty(exports, "getBlockScope", {
|
|
319
|
-
enumerable: true,
|
|
320
|
-
get: function() {
|
|
321
|
-
return getBlockScope;
|
|
322
|
-
}
|
|
323
|
+
Object.defineProperty(exports, 'functionVisitor', {
|
|
324
|
+
enumerable: true,
|
|
325
|
+
get: function () {
|
|
326
|
+
return functionVisitor;
|
|
327
|
+
}
|
|
323
328
|
});
|
|
324
|
-
Object.defineProperty(exports,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
+
Object.defineProperty(exports, 'getBlockScope', {
|
|
330
|
+
enumerable: true,
|
|
331
|
+
get: function () {
|
|
332
|
+
return getBlockScope;
|
|
333
|
+
}
|
|
329
334
|
});
|
|
335
|
+
Object.defineProperty(exports, 'initPluginState', {
|
|
336
|
+
enumerable: true,
|
|
337
|
+
get: function () {
|
|
338
|
+
return initPluginState;
|
|
339
|
+
}
|
|
340
|
+
});
|
|
@@ -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-BoeQmwpt.cjs');
|
|
3
|
+
require('./babel-Dis-Pwfu.cjs');
|
|
4
|
+
require('./bun-DCACcaN2.cjs');
|
|
5
|
+
const require_src = require('./src-bIj7OBnd.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-BoeQmwpt.cjs');
|
|
3
|
+
require('./babel-Dis-Pwfu.cjs');
|
|
4
|
+
require('./bun-DCACcaN2.cjs');
|
|
5
|
+
const require_src = require('./src-bIj7OBnd.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 };
|