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.
- package/_virtual/_rolldown/runtime.cjs +29 -0
- package/babel.cjs +17 -15
- package/babel.d.cts +2 -3
- package/babel.d.mts +2 -3
- package/babel.mjs +3 -3
- package/bun.cjs +6 -5
- package/bun.d.cts +2 -3
- package/bun.d.mts +2 -3
- package/bun.mjs +2 -3
- package/{filter-6T-5w4kG.mjs → common.cjs} +9 -61
- package/{common-CRPQ2KE6.d.mts → common.d.cts} +1 -2
- package/{common-Dpl8jppn.d.cts → common.d.mts} +1 -2
- package/{filter-CKmD4HRk.cjs → common.mjs} +1 -154
- package/esbuild.d.cts +0 -1
- package/esbuild.d.mts +0 -2
- package/esbuild.mjs +1 -2
- package/farm.d.cts +0 -1
- package/farm.d.mts +0 -2
- package/farm.mjs +1 -2
- package/filter.cjs +63 -0
- package/filter.mjs +61 -0
- package/index.cjs +5 -4
- package/index.d.cts +4 -4
- package/index.d.mts +5 -4
- package/index.mjs +3 -3
- package/package.json +18 -18
- package/rolldown-browser.cjs +7 -0
- package/rolldown-browser.d.mts +1 -0
- package/rolldown-browser.mjs +7 -0
- package/rolldown.d.cts +0 -1
- package/rolldown.d.mts +0 -2
- package/rolldown.mjs +1 -2
- package/{rolldown-browser-DUanNY-R.cjs → rollup-impl.cjs} +15 -29
- package/rollup-impl.d.cts +38 -0
- package/rollup-impl.d.mts +39 -0
- package/{rolldown-browser-DKeiFM_e.mjs → rollup-impl.mjs} +2 -7
- package/rollup.d.cts +0 -1
- package/rollup.d.mts +0 -2
- package/rollup.mjs +1 -2
- package/rspack.d.cts +0 -1
- package/rspack.d.mts +0 -2
- package/rspack.mjs +1 -2
- package/vite.d.cts +0 -1
- package/vite.d.mts +0 -2
- package/vite.mjs +1 -2
- package/webpack.d.cts +0 -1
- package/webpack.d.mts +0 -2
- package/webpack.mjs +1 -2
- package/babel.d.cts.map +0 -1
- package/babel.d.mts.map +0 -1
- package/babel.mjs.map +0 -1
- package/bun.d.cts.map +0 -1
- package/bun.d.mts.map +0 -1
- package/bun.mjs.map +0 -1
- package/common-CRPQ2KE6.d.mts.map +0 -1
- package/common-Dpl8jppn.d.cts.map +0 -1
- package/esbuild.mjs.map +0 -1
- package/farm.mjs.map +0 -1
- package/filter-6T-5w4kG.mjs.map +0 -1
- package/index-legacy-DRI9LQiG.d.mts +0 -1489
- package/index-legacy-DRI9LQiG.d.mts.map +0 -1
- package/index-legacy-xKi5C2ga.d.cts +0 -1489
- package/index-legacy-xKi5C2ga.d.cts.map +0 -1
- package/index.d.cts.map +0 -1
- package/index.d.mts.map +0 -1
- package/index.mjs.map +0 -1
- package/rolldown-browser-DKeiFM_e.mjs.map +0 -1
- package/rolldown-browser-JYqfNLQ8.d.mts +0 -1248
- package/rolldown-browser-JYqfNLQ8.d.mts.map +0 -1
- package/rolldown.mjs.map +0 -1
- package/rollup-impl-DqC_d-_W.d.cts +0 -1247
- package/rollup-impl-DqC_d-_W.d.cts.map +0 -1
- package/rollup.mjs.map +0 -1
- package/rspack.mjs.map +0 -1
- package/vite.mjs.map +0 -1
- package/webpack.mjs.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/babel.cjs
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_common = require('./common.cjs');
|
|
4
|
+
const require_filter = require('./filter.cjs');
|
|
3
5
|
let defu = require("defu");
|
|
4
|
-
defu =
|
|
6
|
+
defu = require_runtime.__toESM(defu);
|
|
5
7
|
let tinyest_for_wgsl = require("tinyest-for-wgsl");
|
|
6
8
|
let tinyest = require("tinyest");
|
|
7
9
|
let _babel_standalone = require("@babel/standalone");
|
|
8
|
-
_babel_standalone =
|
|
10
|
+
_babel_standalone = require_runtime.__toESM(_babel_standalone);
|
|
9
11
|
|
|
10
12
|
//#region src/babel.ts
|
|
11
13
|
const template = _babel_standalone.packages.template;
|
|
12
14
|
const types = _babel_standalone.packages.types;
|
|
13
15
|
function containsUseGpuDirective(node) {
|
|
14
16
|
var _node$body$directives, _node$body;
|
|
15
|
-
return ("directives" in node.body ? (_node$body$directives = (_node$body = node.body) === null || _node$body === void 0 ? void 0 : _node$body.directives) !== null && _node$body$directives !== void 0 ? _node$body$directives : [] : []).map((directive) => directive.value.value).includes(
|
|
17
|
+
return ("directives" in node.body ? (_node$body$directives = (_node$body = node.body) === null || _node$body === void 0 ? void 0 : _node$body.directives) !== null && _node$body$directives !== void 0 ? _node$body$directives : [] : []).map((directive) => directive.value.value).includes(require_common.useGpuDirective);
|
|
16
18
|
}
|
|
17
19
|
function i(identifier) {
|
|
18
20
|
return types.identifier(identifier);
|
|
@@ -21,11 +23,11 @@ const fnNodeToOriginalMap = /* @__PURE__ */ new WeakMap();
|
|
|
21
23
|
function functionToTranspiled(node, parent) {
|
|
22
24
|
var _fnNodeToOriginalMap$;
|
|
23
25
|
const { params, body, externalNames } = (0, tinyest_for_wgsl.transpileFn)((_fnNodeToOriginalMap$ = fnNodeToOriginalMap.get(node)) !== null && _fnNodeToOriginalMap$ !== void 0 ? _fnNodeToOriginalMap$ : node);
|
|
24
|
-
const maybeName =
|
|
26
|
+
const maybeName = require_common.getFunctionName(node, parent);
|
|
25
27
|
const metadata = types.objectExpression([
|
|
26
28
|
types.objectProperty(i("v"), types.numericLiteral(tinyest.FORMAT_VERSION)),
|
|
27
29
|
types.objectProperty(i("name"), maybeName ? types.stringLiteral(maybeName) : types.buildUndefinedNode()),
|
|
28
|
-
types.objectProperty(i("ast"), template.expression`${
|
|
30
|
+
types.objectProperty(i("ast"), template.expression`${require_common.embedJSON({
|
|
29
31
|
params,
|
|
30
32
|
body,
|
|
31
33
|
externalNames
|
|
@@ -41,35 +43,35 @@ function functionVisitor(ctx) {
|
|
|
41
43
|
let inUseGpuScope = false;
|
|
42
44
|
return {
|
|
43
45
|
VariableDeclarator(path) {
|
|
44
|
-
|
|
46
|
+
require_common.performExpressionNaming(ctx, path.node, (node, name) => {
|
|
45
47
|
path.get("init").replaceWith(wrapInAutoName(node, name));
|
|
46
48
|
});
|
|
47
49
|
},
|
|
48
50
|
AssignmentExpression(path) {
|
|
49
51
|
if (inUseGpuScope) {
|
|
50
|
-
const runtimeFn =
|
|
52
|
+
const runtimeFn = require_common.operators[path.node.operator];
|
|
51
53
|
if (runtimeFn) path.replaceWith(types.assignmentExpression("=", path.node.left, types.callExpression(types.identifier(runtimeFn), [path.node.left, path.node.right])));
|
|
52
54
|
}
|
|
53
|
-
|
|
55
|
+
require_common.performExpressionNaming(ctx, path.node, (node, name) => {
|
|
54
56
|
path.get("right").replaceWith(wrapInAutoName(node, name));
|
|
55
57
|
});
|
|
56
58
|
},
|
|
57
59
|
ObjectProperty(path) {
|
|
58
|
-
|
|
60
|
+
require_common.performExpressionNaming(ctx, path.node, (node, name) => {
|
|
59
61
|
path.get("value").replaceWith(wrapInAutoName(node, name));
|
|
60
62
|
});
|
|
61
63
|
},
|
|
62
64
|
ClassProperty(path) {
|
|
63
|
-
|
|
65
|
+
require_common.performExpressionNaming(ctx, path.node, (node, name) => {
|
|
64
66
|
path.get("value").replaceWith(wrapInAutoName(node, name));
|
|
65
67
|
});
|
|
66
68
|
},
|
|
67
69
|
ImportDeclaration(path) {
|
|
68
|
-
|
|
70
|
+
require_common.gatherTgpuAliases(path.node, ctx);
|
|
69
71
|
},
|
|
70
72
|
BinaryExpression: { exit(path) {
|
|
71
73
|
if (!inUseGpuScope) return;
|
|
72
|
-
const runtimeFn =
|
|
74
|
+
const runtimeFn = require_common.operators[path.node.operator];
|
|
73
75
|
if (runtimeFn) path.replaceWith(types.callExpression(types.identifier(runtimeFn), [path.node.left, path.node.right]));
|
|
74
76
|
} },
|
|
75
77
|
ArrowFunctionExpression: {
|
|
@@ -131,7 +133,7 @@ function functionVisitor(ctx) {
|
|
|
131
133
|
},
|
|
132
134
|
CallExpression: { exit(path) {
|
|
133
135
|
const node = path.node;
|
|
134
|
-
if (
|
|
136
|
+
if (require_common.isShellImplementationCall(node, ctx)) {
|
|
135
137
|
const implementation = node.arguments[0];
|
|
136
138
|
if (implementation && (implementation.type === "FunctionExpression" || implementation.type === "ArrowFunctionExpression")) {
|
|
137
139
|
const transpiled = functionToTranspiled(implementation, null);
|
|
@@ -144,7 +146,7 @@ function functionVisitor(ctx) {
|
|
|
144
146
|
}
|
|
145
147
|
function babel_default() {
|
|
146
148
|
return { visitor: { Program(path, state) {
|
|
147
|
-
const options = (0, defu.default)(state.opts,
|
|
149
|
+
const options = (0, defu.default)(state.opts, require_common.defaultOptions);
|
|
148
150
|
const id = state.filename;
|
|
149
151
|
const filter = require_filter.createFilterForId(options);
|
|
150
152
|
if (id && filter && !(filter === null || filter === void 0 ? void 0 : filter(id))) return;
|
package/babel.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node, Program } from "./node_modules/.pnpm/@babel_types@7.26.5/node_modules/@babel/types/lib/index-legacy.cjs";
|
|
2
2
|
import * as _babel_traverse0 from "@babel/traverse";
|
|
3
3
|
|
|
4
4
|
//#region src/babel.d.ts
|
|
@@ -7,5 +7,4 @@ declare function export_default(): {
|
|
|
7
7
|
Program(this: Node, path: _babel_traverse0.NodePath<Program>, state: Node): void;
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
export = export_default;
|
|
11
|
-
//# sourceMappingURL=babel.d.cts.map
|
|
10
|
+
export = export_default;
|
package/babel.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node, Program } from "./node_modules/.pnpm/@babel_types@7.26.5/node_modules/@babel/types/lib/index-legacy.mjs";
|
|
2
2
|
import * as _babel_traverse0 from "@babel/traverse";
|
|
3
3
|
|
|
4
4
|
//#region src/babel.d.ts
|
|
@@ -8,5 +8,4 @@ declare function export_default(): {
|
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
//#endregion
|
|
11
|
-
export { export_default as default };
|
|
12
|
-
//# sourceMappingURL=babel.d.mts.map
|
|
11
|
+
export { export_default as default };
|
package/babel.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defaultOptions, embedJSON, gatherTgpuAliases, getFunctionName, isShellImplementationCall, operators, performExpressionNaming, useGpuDirective } from "./common.mjs";
|
|
2
|
+
import { createFilterForId } from "./filter.mjs";
|
|
2
3
|
import defu from "defu";
|
|
3
4
|
import { transpileFn } from "tinyest-for-wgsl";
|
|
4
5
|
import { FORMAT_VERSION } from "tinyest";
|
|
@@ -155,5 +156,4 @@ function babel_default() {
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
//#endregion
|
|
158
|
-
export { babel_default as default };
|
|
159
|
-
//# sourceMappingURL=babel.mjs.map
|
|
159
|
+
export { babel_default as default };
|
package/bun.cjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_common = require('./common.cjs');
|
|
3
4
|
const require_babel = require('./babel.cjs');
|
|
4
5
|
let defu = require("defu");
|
|
5
|
-
defu =
|
|
6
|
+
defu = require_runtime.__toESM(defu);
|
|
6
7
|
let _babel_standalone = require("@babel/standalone");
|
|
7
|
-
_babel_standalone =
|
|
8
|
+
_babel_standalone = require_runtime.__toESM(_babel_standalone);
|
|
8
9
|
|
|
9
10
|
//#region src/bun.ts
|
|
10
11
|
var bun_default = (rawOptions) => {
|
|
11
|
-
const options = (0, defu.default)(rawOptions,
|
|
12
|
+
const options = (0, defu.default)(rawOptions, require_common.defaultOptions);
|
|
12
13
|
const include = options.include;
|
|
13
14
|
if (!(include instanceof RegExp)) throw new Error(`Unsupported 'include' options in Bun plugin. Please provide a single regular expression`);
|
|
14
15
|
if (options.exclude) throw new Error(`Unsupported 'exclude' option in Bun plugin`);
|
|
@@ -17,7 +18,7 @@ var bun_default = (rawOptions) => {
|
|
|
17
18
|
setup(build) {
|
|
18
19
|
build.onLoad({ filter: include }, async (args) => {
|
|
19
20
|
const text = await Bun.file(args.path).text();
|
|
20
|
-
if (
|
|
21
|
+
if (require_common.earlyPruneRegex.every((pattern) => !pattern.test(text))) return {
|
|
21
22
|
contents: text,
|
|
22
23
|
loader: args.loader
|
|
23
24
|
};
|
package/bun.d.cts
CHANGED
package/bun.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Options } from "./common.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/bun.d.ts
|
|
4
4
|
declare const _default: (rawOptions: Options) => BunPlugin;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { _default as default };
|
|
7
|
-
//# sourceMappingURL=bun.d.mts.map
|
|
6
|
+
export { _default as default };
|
package/bun.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defaultOptions, earlyPruneRegex } from "./common.mjs";
|
|
2
2
|
import babel_default from "./babel.mjs";
|
|
3
3
|
import defu from "defu";
|
|
4
4
|
import * as Babel from "@babel/standalone";
|
|
@@ -33,5 +33,4 @@ var bun_default = (rawOptions) => {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
|
-
export { bun_default as default };
|
|
37
|
-
//# sourceMappingURL=bun.mjs.map
|
|
36
|
+
export { bun_default as default };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { resolve } from "pathe";
|
|
2
|
-
import picomatch from "picomatch";
|
|
3
1
|
|
|
4
2
|
//#region src/common.ts
|
|
5
3
|
const defaultOptions = {
|
|
@@ -174,62 +172,12 @@ const operators = {
|
|
|
174
172
|
};
|
|
175
173
|
|
|
176
174
|
//#endregion
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
|
|
188
|
-
function isAbsolute(path) {
|
|
189
|
-
return ABSOLUTE_PATH_REGEX.test(path);
|
|
190
|
-
}
|
|
191
|
-
function getMatcherString(glob, cwd) {
|
|
192
|
-
if (glob.startsWith("**") || isAbsolute(glob)) return normalize(glob);
|
|
193
|
-
return normalize(resolve(cwd, glob));
|
|
194
|
-
}
|
|
195
|
-
function patternToIdFilter(pattern) {
|
|
196
|
-
if (pattern instanceof RegExp) return (id) => {
|
|
197
|
-
const normalizedId = normalize(id);
|
|
198
|
-
const result = pattern.test(normalizedId);
|
|
199
|
-
pattern.lastIndex = 0;
|
|
200
|
-
return result;
|
|
201
|
-
};
|
|
202
|
-
const matcher = picomatch(getMatcherString(pattern, process.cwd()), { dot: true });
|
|
203
|
-
return (id) => {
|
|
204
|
-
return matcher(normalize(id));
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function createFilter(exclude, include) {
|
|
208
|
-
if (!exclude && !include) return;
|
|
209
|
-
return (input) => {
|
|
210
|
-
if (exclude === null || exclude === void 0 ? void 0 : exclude.some((filter) => filter(input))) return false;
|
|
211
|
-
if (include === null || include === void 0 ? void 0 : include.some((filter) => filter(input))) return true;
|
|
212
|
-
return !(include && include.length > 0);
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
function normalizeFilter(filter) {
|
|
216
|
-
if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
|
|
217
|
-
if (Array.isArray(filter)) return { include: filter };
|
|
218
|
-
return {
|
|
219
|
-
exclude: filter.exclude ? toArray(filter.exclude) : void 0,
|
|
220
|
-
include: filter.include ? toArray(filter.include) : void 0
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function createIdFilter(filter) {
|
|
224
|
-
if (!filter) return;
|
|
225
|
-
const { exclude, include } = normalizeFilter(filter);
|
|
226
|
-
return createFilter(exclude === null || exclude === void 0 ? void 0 : exclude.map(patternToIdFilter), include === null || include === void 0 ? void 0 : include.map(patternToIdFilter));
|
|
227
|
-
}
|
|
228
|
-
function createFilterForId(filter) {
|
|
229
|
-
const filterFunction = createIdFilter(filter);
|
|
230
|
-
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
//#endregion
|
|
234
|
-
export { gatherTgpuAliases as a, operators as c, embedJSON as i, performExpressionNaming as l, defaultOptions as n, getFunctionName as o, earlyPruneRegex as r, isShellImplementationCall as s, createFilterForId as t, useGpuDirective as u };
|
|
235
|
-
//# sourceMappingURL=filter-6T-5w4kG.mjs.map
|
|
175
|
+
exports.defaultOptions = defaultOptions;
|
|
176
|
+
exports.earlyPruneRegex = earlyPruneRegex;
|
|
177
|
+
exports.embedJSON = embedJSON;
|
|
178
|
+
exports.gatherTgpuAliases = gatherTgpuAliases;
|
|
179
|
+
exports.getFunctionName = getFunctionName;
|
|
180
|
+
exports.isShellImplementationCall = isShellImplementationCall;
|
|
181
|
+
exports.operators = operators;
|
|
182
|
+
exports.performExpressionNaming = performExpressionNaming;
|
|
183
|
+
exports.useGpuDirective = useGpuDirective;
|
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
let pathe = require("pathe");
|
|
29
|
-
let picomatch = require("picomatch");
|
|
30
|
-
picomatch = __toESM(picomatch);
|
|
31
|
-
|
|
32
1
|
//#region src/common.ts
|
|
33
2
|
const defaultOptions = {
|
|
34
3
|
include: /\.m?[jt]sx?(?:\?.*)?$/,
|
|
@@ -202,126 +171,4 @@ const operators = {
|
|
|
202
171
|
};
|
|
203
172
|
|
|
204
173
|
//#endregion
|
|
205
|
-
|
|
206
|
-
function toArray(array) {
|
|
207
|
-
const result = array || [];
|
|
208
|
-
if (Array.isArray(result)) return result;
|
|
209
|
-
return [result];
|
|
210
|
-
}
|
|
211
|
-
const BACKSLASH_REGEX = /\\/g;
|
|
212
|
-
function normalize(path) {
|
|
213
|
-
return path.replace(BACKSLASH_REGEX, "/");
|
|
214
|
-
}
|
|
215
|
-
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
|
|
216
|
-
function isAbsolute(path) {
|
|
217
|
-
return ABSOLUTE_PATH_REGEX.test(path);
|
|
218
|
-
}
|
|
219
|
-
function getMatcherString(glob, cwd) {
|
|
220
|
-
if (glob.startsWith("**") || isAbsolute(glob)) return normalize(glob);
|
|
221
|
-
return normalize((0, pathe.resolve)(cwd, glob));
|
|
222
|
-
}
|
|
223
|
-
function patternToIdFilter(pattern) {
|
|
224
|
-
if (pattern instanceof RegExp) return (id) => {
|
|
225
|
-
const normalizedId = normalize(id);
|
|
226
|
-
const result = pattern.test(normalizedId);
|
|
227
|
-
pattern.lastIndex = 0;
|
|
228
|
-
return result;
|
|
229
|
-
};
|
|
230
|
-
const matcher = (0, picomatch.default)(getMatcherString(pattern, process.cwd()), { dot: true });
|
|
231
|
-
return (id) => {
|
|
232
|
-
return matcher(normalize(id));
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
function createFilter(exclude, include) {
|
|
236
|
-
if (!exclude && !include) return;
|
|
237
|
-
return (input) => {
|
|
238
|
-
if (exclude === null || exclude === void 0 ? void 0 : exclude.some((filter) => filter(input))) return false;
|
|
239
|
-
if (include === null || include === void 0 ? void 0 : include.some((filter) => filter(input))) return true;
|
|
240
|
-
return !(include && include.length > 0);
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
function normalizeFilter(filter) {
|
|
244
|
-
if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
|
|
245
|
-
if (Array.isArray(filter)) return { include: filter };
|
|
246
|
-
return {
|
|
247
|
-
exclude: filter.exclude ? toArray(filter.exclude) : void 0,
|
|
248
|
-
include: filter.include ? toArray(filter.include) : void 0
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
function createIdFilter(filter) {
|
|
252
|
-
if (!filter) return;
|
|
253
|
-
const { exclude, include } = normalizeFilter(filter);
|
|
254
|
-
return createFilter(exclude === null || exclude === void 0 ? void 0 : exclude.map(patternToIdFilter), include === null || include === void 0 ? void 0 : include.map(patternToIdFilter));
|
|
255
|
-
}
|
|
256
|
-
function createFilterForId(filter) {
|
|
257
|
-
const filterFunction = createIdFilter(filter);
|
|
258
|
-
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
//#endregion
|
|
262
|
-
Object.defineProperty(exports, '__toESM', {
|
|
263
|
-
enumerable: true,
|
|
264
|
-
get: function () {
|
|
265
|
-
return __toESM;
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
Object.defineProperty(exports, 'createFilterForId', {
|
|
269
|
-
enumerable: true,
|
|
270
|
-
get: function () {
|
|
271
|
-
return createFilterForId;
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
Object.defineProperty(exports, 'defaultOptions', {
|
|
275
|
-
enumerable: true,
|
|
276
|
-
get: function () {
|
|
277
|
-
return defaultOptions;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
Object.defineProperty(exports, 'earlyPruneRegex', {
|
|
281
|
-
enumerable: true,
|
|
282
|
-
get: function () {
|
|
283
|
-
return earlyPruneRegex;
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
Object.defineProperty(exports, 'embedJSON', {
|
|
287
|
-
enumerable: true,
|
|
288
|
-
get: function () {
|
|
289
|
-
return embedJSON;
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
Object.defineProperty(exports, 'gatherTgpuAliases', {
|
|
293
|
-
enumerable: true,
|
|
294
|
-
get: function () {
|
|
295
|
-
return gatherTgpuAliases;
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
Object.defineProperty(exports, 'getFunctionName', {
|
|
299
|
-
enumerable: true,
|
|
300
|
-
get: function () {
|
|
301
|
-
return getFunctionName;
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
Object.defineProperty(exports, 'isShellImplementationCall', {
|
|
305
|
-
enumerable: true,
|
|
306
|
-
get: function () {
|
|
307
|
-
return isShellImplementationCall;
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
Object.defineProperty(exports, 'operators', {
|
|
311
|
-
enumerable: true,
|
|
312
|
-
get: function () {
|
|
313
|
-
return operators;
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
Object.defineProperty(exports, 'performExpressionNaming', {
|
|
317
|
-
enumerable: true,
|
|
318
|
-
get: function () {
|
|
319
|
-
return performExpressionNaming;
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
Object.defineProperty(exports, 'useGpuDirective', {
|
|
323
|
-
enumerable: true,
|
|
324
|
-
get: function () {
|
|
325
|
-
return useGpuDirective;
|
|
326
|
-
}
|
|
327
|
-
});
|
|
174
|
+
export { defaultOptions, earlyPruneRegex, embedJSON, gatherTgpuAliases, getFunctionName, isShellImplementationCall, operators, performExpressionNaming, useGpuDirective };
|
package/esbuild.d.cts
CHANGED
package/esbuild.d.mts
CHANGED
package/esbuild.mjs
CHANGED
package/farm.d.cts
CHANGED
package/farm.d.mts
CHANGED
package/farm.mjs
CHANGED
package/filter.cjs
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let pathe = require("pathe");
|
|
3
|
+
let picomatch = require("picomatch");
|
|
4
|
+
picomatch = require_runtime.__toESM(picomatch);
|
|
5
|
+
|
|
6
|
+
//#region src/filter.ts
|
|
7
|
+
function toArray(array) {
|
|
8
|
+
const result = array || [];
|
|
9
|
+
if (Array.isArray(result)) return result;
|
|
10
|
+
return [result];
|
|
11
|
+
}
|
|
12
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
13
|
+
function normalize(path) {
|
|
14
|
+
return path.replace(BACKSLASH_REGEX, "/");
|
|
15
|
+
}
|
|
16
|
+
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
|
|
17
|
+
function isAbsolute(path) {
|
|
18
|
+
return ABSOLUTE_PATH_REGEX.test(path);
|
|
19
|
+
}
|
|
20
|
+
function getMatcherString(glob, cwd) {
|
|
21
|
+
if (glob.startsWith("**") || isAbsolute(glob)) return normalize(glob);
|
|
22
|
+
return normalize((0, pathe.resolve)(cwd, glob));
|
|
23
|
+
}
|
|
24
|
+
function patternToIdFilter(pattern) {
|
|
25
|
+
if (pattern instanceof RegExp) return (id) => {
|
|
26
|
+
const normalizedId = normalize(id);
|
|
27
|
+
const result = pattern.test(normalizedId);
|
|
28
|
+
pattern.lastIndex = 0;
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
const matcher = (0, picomatch.default)(getMatcherString(pattern, process.cwd()), { dot: true });
|
|
32
|
+
return (id) => {
|
|
33
|
+
return matcher(normalize(id));
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function createFilter(exclude, include) {
|
|
37
|
+
if (!exclude && !include) return;
|
|
38
|
+
return (input) => {
|
|
39
|
+
if (exclude === null || exclude === void 0 ? void 0 : exclude.some((filter) => filter(input))) return false;
|
|
40
|
+
if (include === null || include === void 0 ? void 0 : include.some((filter) => filter(input))) return true;
|
|
41
|
+
return !(include && include.length > 0);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function normalizeFilter(filter) {
|
|
45
|
+
if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
|
|
46
|
+
if (Array.isArray(filter)) return { include: filter };
|
|
47
|
+
return {
|
|
48
|
+
exclude: filter.exclude ? toArray(filter.exclude) : void 0,
|
|
49
|
+
include: filter.include ? toArray(filter.include) : void 0
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function createIdFilter(filter) {
|
|
53
|
+
if (!filter) return;
|
|
54
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
55
|
+
return createFilter(exclude === null || exclude === void 0 ? void 0 : exclude.map(patternToIdFilter), include === null || include === void 0 ? void 0 : include.map(patternToIdFilter));
|
|
56
|
+
}
|
|
57
|
+
function createFilterForId(filter) {
|
|
58
|
+
const filterFunction = createIdFilter(filter);
|
|
59
|
+
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.createFilterForId = createFilterForId;
|
package/filter.mjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { resolve } from "pathe";
|
|
2
|
+
import picomatch from "picomatch";
|
|
3
|
+
|
|
4
|
+
//#region src/filter.ts
|
|
5
|
+
function toArray(array) {
|
|
6
|
+
const result = array || [];
|
|
7
|
+
if (Array.isArray(result)) return result;
|
|
8
|
+
return [result];
|
|
9
|
+
}
|
|
10
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
11
|
+
function normalize(path) {
|
|
12
|
+
return path.replace(BACKSLASH_REGEX, "/");
|
|
13
|
+
}
|
|
14
|
+
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Z]:)?[/\\|])/i;
|
|
15
|
+
function isAbsolute(path) {
|
|
16
|
+
return ABSOLUTE_PATH_REGEX.test(path);
|
|
17
|
+
}
|
|
18
|
+
function getMatcherString(glob, cwd) {
|
|
19
|
+
if (glob.startsWith("**") || isAbsolute(glob)) return normalize(glob);
|
|
20
|
+
return normalize(resolve(cwd, glob));
|
|
21
|
+
}
|
|
22
|
+
function patternToIdFilter(pattern) {
|
|
23
|
+
if (pattern instanceof RegExp) return (id) => {
|
|
24
|
+
const normalizedId = normalize(id);
|
|
25
|
+
const result = pattern.test(normalizedId);
|
|
26
|
+
pattern.lastIndex = 0;
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
const matcher = picomatch(getMatcherString(pattern, process.cwd()), { dot: true });
|
|
30
|
+
return (id) => {
|
|
31
|
+
return matcher(normalize(id));
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function createFilter(exclude, include) {
|
|
35
|
+
if (!exclude && !include) return;
|
|
36
|
+
return (input) => {
|
|
37
|
+
if (exclude === null || exclude === void 0 ? void 0 : exclude.some((filter) => filter(input))) return false;
|
|
38
|
+
if (include === null || include === void 0 ? void 0 : include.some((filter) => filter(input))) return true;
|
|
39
|
+
return !(include && include.length > 0);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function normalizeFilter(filter) {
|
|
43
|
+
if (typeof filter === "string" || filter instanceof RegExp) return { include: [filter] };
|
|
44
|
+
if (Array.isArray(filter)) return { include: filter };
|
|
45
|
+
return {
|
|
46
|
+
exclude: filter.exclude ? toArray(filter.exclude) : void 0,
|
|
47
|
+
include: filter.include ? toArray(filter.include) : void 0
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function createIdFilter(filter) {
|
|
51
|
+
if (!filter) return;
|
|
52
|
+
const { exclude, include } = normalizeFilter(filter);
|
|
53
|
+
return createFilter(exclude === null || exclude === void 0 ? void 0 : exclude.map(patternToIdFilter), include === null || include === void 0 ? void 0 : include.map(patternToIdFilter));
|
|
54
|
+
}
|
|
55
|
+
function createFilterForId(filter) {
|
|
56
|
+
const filterFunction = createIdFilter(filter);
|
|
57
|
+
return filterFunction ? (id) => !!filterFunction(id) : void 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { createFilterForId };
|