@vxrn/compiler 1.25.13 → 1.25.16-1788753284749
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/dist/cjs/cache.cjs +3 -1
- package/dist/cjs/configure.cjs +9 -1
- package/dist/cjs/index.cjs +82 -4
- package/dist/cjs/reactNativeCodegen.cjs +140 -0
- package/dist/cjs/reactNativeViewConfig.cjs +489 -0
- package/dist/cjs/transformBabel.cjs +15 -20
- package/dist/cjs/transformBabel.test.cjs +260 -0
- package/dist/cjs/transformHermesLoops.cjs +317 -0
- package/dist/cjs/transformHermesLoops.test.cjs +220 -0
- package/dist/cjs/transformSWC.cjs +102 -137
- package/dist/cjs/transformSWC.test.cjs +74 -0
- package/dist/cjs/transformWorklets.cjs +121 -0
- package/dist/cjs/transformWorklets.test.cjs +604 -0
- package/dist/cjs/worklets/autoworklet.cjs +265 -0
- package/dist/cjs/worklets/globals.cjs +71 -0
- package/dist/cjs/worklets/hash.cjs +38 -0
- package/dist/cjs/worklets/scope.cjs +370 -0
- package/dist/cjs/worklets/serialize.cjs +101 -0
- package/dist/cjs/worklets/transform.cjs +232 -0
- package/dist/cjs/worklets/types.cjs +18 -0
- package/dist/esm/cache.mjs +4 -2
- package/dist/esm/cache.mjs.map +1 -1
- package/dist/esm/configure.mjs +8 -1
- package/dist/esm/configure.mjs.map +1 -1
- package/dist/esm/index.js +72 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +72 -5
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/reactNativeCodegen.mjs +104 -0
- package/dist/esm/reactNativeCodegen.mjs.map +1 -0
- package/dist/esm/reactNativeViewConfig.mjs +460 -0
- package/dist/esm/reactNativeViewConfig.mjs.map +1 -0
- package/dist/esm/transformBabel.mjs +14 -19
- package/dist/esm/transformBabel.mjs.map +1 -1
- package/dist/esm/transformBabel.test.mjs +261 -1
- package/dist/esm/transformBabel.test.mjs.map +1 -1
- package/dist/esm/transformHermesLoops.mjs +281 -0
- package/dist/esm/transformHermesLoops.mjs.map +1 -0
- package/dist/esm/transformHermesLoops.test.mjs +197 -0
- package/dist/esm/transformHermesLoops.test.mjs.map +1 -0
- package/dist/esm/transformSWC.mjs +89 -138
- package/dist/esm/transformSWC.mjs.map +1 -1
- package/dist/esm/transformSWC.test.mjs +75 -0
- package/dist/esm/transformSWC.test.mjs.map +1 -0
- package/dist/esm/transformWorklets.mjs +81 -0
- package/dist/esm/transformWorklets.mjs.map +1 -0
- package/dist/esm/transformWorklets.test.mjs +581 -0
- package/dist/esm/transformWorklets.test.mjs.map +1 -0
- package/dist/esm/worklets/autoworklet.mjs +234 -0
- package/dist/esm/worklets/autoworklet.mjs.map +1 -0
- package/dist/esm/worklets/globals.mjs +45 -0
- package/dist/esm/worklets/globals.mjs.map +1 -0
- package/dist/esm/worklets/hash.mjs +13 -0
- package/dist/esm/worklets/hash.mjs.map +1 -0
- package/dist/esm/worklets/scope.mjs +345 -0
- package/dist/esm/worklets/scope.mjs.map +1 -0
- package/dist/esm/worklets/serialize.mjs +75 -0
- package/dist/esm/worklets/serialize.mjs.map +1 -0
- package/dist/esm/worklets/transform.mjs +196 -0
- package/dist/esm/worklets/transform.mjs.map +1 -0
- package/dist/esm/worklets/types.mjs +2 -0
- package/dist/esm/worklets/types.mjs.map +1 -0
- package/package.json +10 -6
- package/src/cache.ts +9 -2
- package/src/configure.ts +12 -0
- package/src/index.ts +93 -13
- package/src/reactNativeCodegen.ts +181 -0
- package/src/reactNativeViewConfig.ts +593 -0
- package/src/transformBabel.test.ts +268 -1
- package/src/transformBabel.ts +21 -31
- package/src/transformHermesLoops.test.ts +282 -0
- package/src/transformHermesLoops.ts +433 -0
- package/src/transformSWC.test.ts +88 -0
- package/src/transformSWC.ts +109 -160
- package/src/transformWorklets.test.ts +708 -0
- package/src/transformWorklets.ts +160 -0
- package/src/types.ts +4 -4
- package/src/worklets/autoworklet.ts +391 -0
- package/src/worklets/globals.ts +125 -0
- package/src/worklets/hash.ts +14 -0
- package/src/worklets/scope.ts +401 -0
- package/src/worklets/serialize.ts +114 -0
- package/src/worklets/transform.ts +282 -0
- package/src/worklets/types.ts +26 -0
- package/types/cache.d.ts +1 -0
- package/types/cache.d.ts.map +1 -1
- package/types/configure.d.ts +2 -0
- package/types/configure.d.ts.map +1 -1
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -1
- package/types/reactNativeCodegen.d.ts +5 -0
- package/types/reactNativeCodegen.d.ts.map +1 -0
- package/types/reactNativeViewConfig.d.ts +35 -0
- package/types/reactNativeViewConfig.d.ts.map +1 -0
- package/types/transformBabel.d.ts +3 -3
- package/types/transformBabel.d.ts.map +1 -1
- package/types/transformHermesLoops.d.ts +5 -0
- package/types/transformHermesLoops.d.ts.map +1 -0
- package/types/transformHermesLoops.test.d.ts +2 -0
- package/types/transformHermesLoops.test.d.ts.map +1 -0
- package/types/transformSWC.d.ts +12 -3
- package/types/transformSWC.d.ts.map +1 -1
- package/types/transformSWC.test.d.ts +2 -0
- package/types/transformSWC.test.d.ts.map +1 -0
- package/types/transformWorklets.d.ts +22 -0
- package/types/transformWorklets.d.ts.map +1 -0
- package/types/transformWorklets.test.d.ts +2 -0
- package/types/transformWorklets.test.d.ts.map +1 -0
- package/types/types.d.ts +4 -4
- package/types/types.d.ts.map +1 -1
- package/types/worklets/autoworklet.d.ts +14 -0
- package/types/worklets/autoworklet.d.ts.map +1 -0
- package/types/worklets/globals.d.ts +3 -0
- package/types/worklets/globals.d.ts.map +1 -0
- package/types/worklets/hash.d.ts +5 -0
- package/types/worklets/hash.d.ts.map +1 -0
- package/types/worklets/scope.d.ts +7 -0
- package/types/worklets/scope.d.ts.map +1 -0
- package/types/worklets/serialize.d.ts +12 -0
- package/types/worklets/serialize.d.ts.map +1 -0
- package/types/worklets/transform.d.ts +6 -0
- package/types/worklets/transform.d.ts.map +1 -0
- package/types/worklets/types.d.ts +21 -0
- package/types/worklets/types.d.ts.map +1 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import MagicString from 'magic-string'
|
|
3
|
+
import remapping from '@jridgewell/remapping'
|
|
4
|
+
import { parseSync } from 'oxc-parser'
|
|
5
|
+
import { bodyStartAfterDirectives, findWorkletCandidates, hasDirective } from './autoworklet'
|
|
6
|
+
import { createGlobalsSet } from './globals'
|
|
7
|
+
import { calculateWorkletHash } from './hash'
|
|
8
|
+
import { getClosureVariables } from './scope'
|
|
9
|
+
import { buildLocalFunction, serializeWorkletForUI } from './serialize'
|
|
10
|
+
import type { TransformWorkletsOptions } from './types'
|
|
11
|
+
|
|
12
|
+
const FUNCTION_TYPES = new Set([
|
|
13
|
+
'FunctionDeclaration',
|
|
14
|
+
'FunctionExpression',
|
|
15
|
+
'ArrowFunctionExpression',
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Innermost function whose body strictly contains `node`. A worklet marked
|
|
20
|
+
* `limit-init-data-hoisting` puts its init data at the top of that body instead
|
|
21
|
+
* of at module scope, so a `no-worklet-closure` parent can still reach it after
|
|
22
|
+
* being serialized to a string and evaluated on a worklet runtime.
|
|
23
|
+
*/
|
|
24
|
+
function findEnclosingFunction(program: any, node: any): any {
|
|
25
|
+
let best: any = undefined
|
|
26
|
+
const walk = (n: any) => {
|
|
27
|
+
if (!n || typeof n !== 'object') return
|
|
28
|
+
if (Array.isArray(n)) {
|
|
29
|
+
for (const c of n) walk(c)
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
if (typeof n.type !== 'string') return
|
|
33
|
+
// a node that does not span the target cannot contain it, so skip its subtree
|
|
34
|
+
if (typeof n.start === 'number' && (n.start > node.start || n.end < node.end)) return
|
|
35
|
+
if (
|
|
36
|
+
FUNCTION_TYPES.has(n.type) &&
|
|
37
|
+
n !== node &&
|
|
38
|
+
n.body?.type === 'BlockStatement' &&
|
|
39
|
+
n.body.start < node.start &&
|
|
40
|
+
n.body.end > node.end &&
|
|
41
|
+
(!best || n.body.start > best.body.start)
|
|
42
|
+
) {
|
|
43
|
+
best = n
|
|
44
|
+
}
|
|
45
|
+
for (const key in n) {
|
|
46
|
+
if (key === 'parent') continue
|
|
47
|
+
walk(n[key])
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
walk(program)
|
|
51
|
+
return best
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function executeWorkletTransform(
|
|
55
|
+
id: string,
|
|
56
|
+
code: string,
|
|
57
|
+
sourceMaps = false,
|
|
58
|
+
options?: TransformWorkletsOptions,
|
|
59
|
+
resolveVersionFn?: (projectRoot?: string, filename?: string) => string
|
|
60
|
+
): { code: string; map?: any } {
|
|
61
|
+
const cleanId = id.split('?')[0]
|
|
62
|
+
|
|
63
|
+
// react-native ships jsx inside plain .js files, and oxc disables jsx for .js
|
|
64
|
+
// unless told otherwise, so those files fail to parse on their first element.
|
|
65
|
+
// a .ts file is not tsx: `<T>(x: T) => x` is a generic arrow, not an element.
|
|
66
|
+
const lang = /\.[cm]?ts$/.test(cleanId)
|
|
67
|
+
? ('ts' as const)
|
|
68
|
+
: cleanId.endsWith('.tsx')
|
|
69
|
+
? ('tsx' as const)
|
|
70
|
+
: ('jsx' as const)
|
|
71
|
+
|
|
72
|
+
// 1. Initial quick parse to check if any worklet candidates exist
|
|
73
|
+
const initialParse = parseSync(cleanId, code, {
|
|
74
|
+
sourceType: 'module',
|
|
75
|
+
lang,
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
if (initialParse.errors && initialParse.errors.length > 0) {
|
|
79
|
+
const err = initialParse.errors[0]
|
|
80
|
+
throw new Error(err.codeframe || err.message || 'Syntax Error while parsing worklet')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const initialCandidates = findWorkletCandidates(initialParse.program)
|
|
84
|
+
if (initialCandidates.length === 0) {
|
|
85
|
+
let map: any = undefined
|
|
86
|
+
if (sourceMaps) {
|
|
87
|
+
const ms = new MagicString(code)
|
|
88
|
+
map = ms.generateMap({
|
|
89
|
+
source: cleanId,
|
|
90
|
+
file: cleanId,
|
|
91
|
+
hires: true,
|
|
92
|
+
includeContent: true,
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
return { code, map }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 2. Resolve plugin version and location
|
|
99
|
+
const pluginVersion =
|
|
100
|
+
options?.pluginVersion ||
|
|
101
|
+
(resolveVersionFn ? resolveVersionFn(options?.projectRoot, cleanId) : '0.0.0')
|
|
102
|
+
|
|
103
|
+
const globals = createGlobalsSet(options?.globals, options?.strictGlobal)
|
|
104
|
+
|
|
105
|
+
let location = cleanId
|
|
106
|
+
if (options?.relativeSourceLocation && options?.projectRoot) {
|
|
107
|
+
location = path.relative(options.projectRoot, cleanId).replace(/\\/g, '/')
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let currentCode = code
|
|
111
|
+
const initDataDefs = new Map<string, string>()
|
|
112
|
+
const passMaps: any[] = []
|
|
113
|
+
|
|
114
|
+
// 3. Iterative bottom-up transformation
|
|
115
|
+
// In each pass, we transform all innermost candidates (candidates that contain NO other candidates in their body).
|
|
116
|
+
// All innermost candidates are disjoint, so they can be rewritten simultaneously in a single MagicString.
|
|
117
|
+
let remainingPassBudget = 100
|
|
118
|
+
while (remainingPassBudget-- > 0) {
|
|
119
|
+
const parseResult = parseSync(cleanId, currentCode, {
|
|
120
|
+
sourceType: 'module',
|
|
121
|
+
lang,
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
if (parseResult.errors && parseResult.errors.length > 0) {
|
|
125
|
+
const err = parseResult.errors[0]
|
|
126
|
+
throw new Error(err.codeframe || err.message || 'Syntax Error while parsing worklet')
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const candidates = findWorkletCandidates(parseResult.program)
|
|
130
|
+
if (candidates.length === 0) {
|
|
131
|
+
break
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Find ALL innermost candidates in this pass
|
|
135
|
+
const innermostCandidates = candidates.filter((c) => {
|
|
136
|
+
return !candidates.some(
|
|
137
|
+
(other) =>
|
|
138
|
+
other !== c &&
|
|
139
|
+
other.fnNode.start >= c.fnNode.start &&
|
|
140
|
+
other.fnNode.end <= c.fnNode.end
|
|
141
|
+
)
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
if (innermostCandidates.length === 0) {
|
|
145
|
+
throw new Error(`[worklets] Cyclic or unresolvable worklet nesting detected in ${cleanId}`)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const ms = new MagicString(currentCode)
|
|
149
|
+
|
|
150
|
+
// init data declared inside an enclosing function body, keyed by that body's
|
|
151
|
+
// start offset, so the same hash is not declared twice in one function.
|
|
152
|
+
const inlinedInitData = new Map<number, Set<string>>()
|
|
153
|
+
|
|
154
|
+
for (const candidate of innermostCandidates) {
|
|
155
|
+
// `no-worklet-closure` says the worklet captures nothing, so it gets no
|
|
156
|
+
// unpacker line and an empty `__closure`. it is what lets the worklets
|
|
157
|
+
// runtime evaluate the serialized code with no closure to bind.
|
|
158
|
+
const closureVars = hasDirective(candidate.fnNode, 'no-worklet-closure')
|
|
159
|
+
? []
|
|
160
|
+
: getClosureVariables(candidate.fnNode, globals)
|
|
161
|
+
const fnName = candidate.name
|
|
162
|
+
|
|
163
|
+
const serializedCode = serializeWorkletForUI(candidate.fnNode, currentCode, fnName, closureVars)
|
|
164
|
+
const workletHash = calculateWorkletHash(serializedCode)
|
|
165
|
+
const initDataVar = `_worklet_${workletHash}_init_data`
|
|
166
|
+
|
|
167
|
+
const initDataDecl = `var ${initDataVar} = {\n code: ${JSON.stringify(serializedCode)},\n location: ${JSON.stringify(location)}\n};`
|
|
168
|
+
|
|
169
|
+
const enclosingFn = hasDirective(candidate.fnNode, 'limit-init-data-hoisting')
|
|
170
|
+
? findEnclosingFunction(parseResult.program, candidate.fnNode)
|
|
171
|
+
: undefined
|
|
172
|
+
|
|
173
|
+
if (enclosingFn) {
|
|
174
|
+
// past the parent's own directive prologue, or inserting here would stop
|
|
175
|
+
// its `'worklet'` from being a directive at all.
|
|
176
|
+
const insertAt = bodyStartAfterDirectives(enclosingFn, currentCode)
|
|
177
|
+
let declared = inlinedInitData.get(insertAt)
|
|
178
|
+
if (!declared) {
|
|
179
|
+
declared = new Set()
|
|
180
|
+
inlinedInitData.set(insertAt, declared)
|
|
181
|
+
}
|
|
182
|
+
if (!declared.has(initDataVar)) {
|
|
183
|
+
declared.add(initDataVar)
|
|
184
|
+
ms.appendLeft(insertAt, `\n${initDataDecl}\n`)
|
|
185
|
+
}
|
|
186
|
+
} else if (!initDataDefs.has(initDataVar)) {
|
|
187
|
+
initDataDefs.set(initDataVar, initDataDecl)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const localFnCode = buildLocalFunction(candidate.fnNode, currentCode, fnName)
|
|
191
|
+
const localName = fnName || '_worklet'
|
|
192
|
+
const closureProps = closureVars.map((v) => `${v}: ${v}`).join(', ')
|
|
193
|
+
|
|
194
|
+
const iife = `(function () {
|
|
195
|
+
var _e = [new (typeof global !== 'undefined' ? global : globalThis).Error(), 1, -27];
|
|
196
|
+
var ${localName} = ${localFnCode};
|
|
197
|
+
${localName}.__closure = { ${closureProps} };
|
|
198
|
+
${localName}.__workletHash = ${workletHash};
|
|
199
|
+
${localName}.__pluginVersion = ${JSON.stringify(pluginVersion)};
|
|
200
|
+
${localName}.__initData = ${initDataVar};
|
|
201
|
+
${localName}.__stackDetails = _e;
|
|
202
|
+
return ${localName};
|
|
203
|
+
})()`
|
|
204
|
+
|
|
205
|
+
if (candidate.kind === 'function_declaration') {
|
|
206
|
+
if (candidate.parent?.type === 'ExportNamedDeclaration') {
|
|
207
|
+
ms.overwrite(candidate.parent.start, candidate.parent.end, `export var ${candidate.name} = ${iife};`)
|
|
208
|
+
} else if (candidate.parent?.type === 'ExportDefaultDeclaration') {
|
|
209
|
+
ms.overwrite(
|
|
210
|
+
candidate.parent.start,
|
|
211
|
+
candidate.parent.end,
|
|
212
|
+
`var ${candidate.name || '_defaultWorklet'} = ${iife};\nexport default ${candidate.name || '_defaultWorklet'};`
|
|
213
|
+
)
|
|
214
|
+
} else {
|
|
215
|
+
ms.overwrite(candidate.node.start, candidate.node.end, `var ${candidate.name} = ${iife};`)
|
|
216
|
+
}
|
|
217
|
+
} else if (candidate.kind === 'object_method') {
|
|
218
|
+
ms.overwrite(candidate.node.start, candidate.node.end, `${candidate.name}: ${iife}`)
|
|
219
|
+
} else {
|
|
220
|
+
ms.overwrite(candidate.node.start, candidate.node.end, iife)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (sourceMaps) {
|
|
225
|
+
passMaps.push(
|
|
226
|
+
ms.generateMap({
|
|
227
|
+
source: cleanId,
|
|
228
|
+
file: cleanId,
|
|
229
|
+
hires: true,
|
|
230
|
+
includeContent: true,
|
|
231
|
+
})
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
currentCode = ms.toString()
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Check if any candidates remain untransformed after budget
|
|
239
|
+
const finalCheck = parseSync(cleanId, currentCode, { sourceType: 'module', lang })
|
|
240
|
+
const remaining = findWorkletCandidates(finalCheck.program)
|
|
241
|
+
if (remaining.length > 0) {
|
|
242
|
+
throw new Error(
|
|
243
|
+
`[worklets] Exceeded maximum pass budget while transforming worklets in ${cleanId}. ${remaining.length} worklet(s) remained untransformed.`
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Prepend initData definitions
|
|
248
|
+
if (initDataDefs.size > 0) {
|
|
249
|
+
const initDataCode = Array.from(initDataDefs.values()).join('\n') + '\n'
|
|
250
|
+
const msPrepend = new MagicString(currentCode)
|
|
251
|
+
msPrepend.prepend(initDataCode)
|
|
252
|
+
if (sourceMaps) {
|
|
253
|
+
passMaps.push(
|
|
254
|
+
msPrepend.generateMap({
|
|
255
|
+
source: cleanId,
|
|
256
|
+
file: cleanId,
|
|
257
|
+
hires: true,
|
|
258
|
+
includeContent: true,
|
|
259
|
+
})
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
currentCode = msPrepend.toString()
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
let map: any = undefined
|
|
266
|
+
if (sourceMaps && passMaps.length > 0) {
|
|
267
|
+
if (passMaps.length === 1) {
|
|
268
|
+
map = passMaps[0]
|
|
269
|
+
} else {
|
|
270
|
+
map = remapping(passMaps.slice().reverse(), () => null)
|
|
271
|
+
}
|
|
272
|
+
if (map) {
|
|
273
|
+
map.sources = [cleanId]
|
|
274
|
+
map.file = cleanId
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return {
|
|
279
|
+
code: currentCode,
|
|
280
|
+
map,
|
|
281
|
+
}
|
|
282
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type TransformWorkletsOptions = {
|
|
2
|
+
projectRoot?: string
|
|
3
|
+
bundleMode?: boolean
|
|
4
|
+
disableInlineStylesWarning?: boolean
|
|
5
|
+
disableSourceMaps?: boolean
|
|
6
|
+
disableWorkletClasses?: boolean
|
|
7
|
+
globals?: string[]
|
|
8
|
+
relativeSourceLocation?: boolean
|
|
9
|
+
strictGlobal?: boolean
|
|
10
|
+
pluginVersion?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type WorkletCandidateKind =
|
|
14
|
+
| 'function_declaration'
|
|
15
|
+
| 'function_expression'
|
|
16
|
+
| 'arrow_function'
|
|
17
|
+
| 'object_method'
|
|
18
|
+
|
|
19
|
+
export interface WorkletCandidate {
|
|
20
|
+
node: any
|
|
21
|
+
fnNode: any
|
|
22
|
+
kind: WorkletCandidateKind
|
|
23
|
+
name?: string
|
|
24
|
+
parent?: any
|
|
25
|
+
isAutoWorklet: boolean
|
|
26
|
+
}
|
package/types/cache.d.ts
CHANGED
package/types/cache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAqBA,UAAU,UAAU;IAClB,IAAI,EAAE,CAAC,CAAA;IACP,MAAM,EAAE,CAAC,CAAA;IACT,MAAM,EAAE,CAAC,CAAA;CACV;
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAqBA,UAAU,UAAU;IAClB,IAAI,EAAE,CAAC,CAAA;IACP,MAAM,EAAE,CAAC,CAAA;IACT,MAAM,EAAE,CAAC,CAAA;IACT,MAAM,EAAE,CAAC,CAAA;CACV;AAiDD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,CAoCpC;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,EACnC,WAAW,EAAE,MAAM,GAClB,IAAI,CAwBN;AAED,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,wBAAgB,aAAa,IAAI,IAAI,CAapC"}
|
package/types/configure.d.ts
CHANGED
|
@@ -7,10 +7,12 @@ type CompilerConfig = boolean | Environment[] | RegExp | ((id: string, environme
|
|
|
7
7
|
type Conf = {
|
|
8
8
|
enableNativewind?: boolean;
|
|
9
9
|
enableReanimated?: boolean;
|
|
10
|
+
enableNativeWorklets?: boolean;
|
|
10
11
|
enableCompiler?: CompilerConfig;
|
|
11
12
|
enableNativeCSS?: boolean;
|
|
12
13
|
};
|
|
13
14
|
export declare const configuration: Conf;
|
|
15
|
+
export declare function isNativeWorkletsEnabled(): boolean;
|
|
14
16
|
export declare function configureVXRNCompilerPlugin(_: Conf): void;
|
|
15
17
|
export {};
|
|
16
18
|
//# sourceMappingURL=configure.d.ts.map
|
package/types/configure.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,KAAK,cAAc,GACf,OAAO,GACP,MAAM,GACN,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,CAAA;AAEvD,KAAK,cAAc,GACf,OAAO,GACP,WAAW,EAAE,GACb,MAAM,GACN,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,GACnD;IACE,GAAG,CAAC,EAAE,cAAc,CAAA;IACpB,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,CAAA;AAEL,KAAK,IAAI,GAAG;IACV,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,KAAK,cAAc,GACf,OAAO,GACP,MAAM,GACN,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,CAAA;AAEvD,KAAK,cAAc,GACf,OAAO,GACP,WAAW,EAAE,GACb,MAAM,GACN,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,GACnD;IACE,GAAG,CAAC,EAAE,cAAc,CAAA;IACpB,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB,CAAA;AAEL,KAAK,IAAI,GAAG;IACV,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,IAM3B,CAAA;AAED,wBAAgB,uBAAuB,YAQtC;AAED,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,IAAI,QAElD"}
|
package/types/index.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ import type { Options } from './types';
|
|
|
8
8
|
export * from './configure';
|
|
9
9
|
export * from './transformBabel';
|
|
10
10
|
export * from './transformSWC';
|
|
11
|
+
export * from './transformWorklets';
|
|
12
|
+
export * from './reactNativeCodegen';
|
|
13
|
+
export * from './transformHermesLoops';
|
|
11
14
|
export type { GetTransform } from './types';
|
|
12
15
|
export declare function createVXRNCompilerPlugin(optionsIn?: Partial<Options>): Promise<PluginOption[]>;
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,MAAM,CAAA;AAUpE,OAAO,KAAK,EAAkC,OAAO,EAAE,MAAM,SAAS,CAAA;AAGtE,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA+Q3C,wBAAsB,wBAAwB,CAC5C,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC,CA6VzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactNativeCodegen.d.ts","sourceRoot":"","sources":["../src/reactNativeCodegen.ts"],"names":[],"mappings":"AAyEA,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,WAAW,CAAC,EAAE,MAAM,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAuG/C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View-config generation for react-native component specs, without babel.
|
|
3
|
+
*
|
|
4
|
+
* `@react-native/codegen` builds a full CodegenSchema with @babel/parser and
|
|
5
|
+
* emits the module with @babel/generator, which is the last thing in the native
|
|
6
|
+
* pipeline that runs babel at all: 11,774 babel calls per bundle of the soot
|
|
7
|
+
* app, every one of them from codegen. The view config itself is a plain object
|
|
8
|
+
* literal, so it can be read off the spec's own AST and printed as text.
|
|
9
|
+
*
|
|
10
|
+
* Only what a view config needs is modeled here: the prop list in declaration
|
|
11
|
+
* order, the five prop types that get a custom attribute descriptor, the two
|
|
12
|
+
* event handler shapes, and the command list. Everything else about a prop's
|
|
13
|
+
* type is irrelevant to the runtime, which is why the generated `validAttributes`
|
|
14
|
+
* is almost entirely `true`.
|
|
15
|
+
*
|
|
16
|
+
* TypeScript specs are parsed with oxc. React Native's own specs are Flow, which
|
|
17
|
+
* oxc cannot parse, so those go through hermes-parser (which is not babel).
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseSpec(code: string, filename: string, projectRoot?: string): any;
|
|
20
|
+
/**
|
|
21
|
+
* Generate the replacement for a spec's default export, plus the `Commands`
|
|
22
|
+
* export when the spec declares one. Returns null when the file is not a spec
|
|
23
|
+
* this can handle, so the caller can leave it alone.
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateViewConfig(program: any): {
|
|
26
|
+
imports: string[];
|
|
27
|
+
body: string;
|
|
28
|
+
} | null;
|
|
29
|
+
/** the full generated block, matching the layout codegen's file template emits */
|
|
30
|
+
export declare function renderViewConfigModule(result: {
|
|
31
|
+
imports: string[];
|
|
32
|
+
body: string;
|
|
33
|
+
}): string;
|
|
34
|
+
export declare function getLibraryName(filename: string): string;
|
|
35
|
+
//# sourceMappingURL=reactNativeViewConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactNativeViewConfig.d.ts","sourceRoot":"","sources":["../src/reactNativeViewConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAkdH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAmBnF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,GAAG,GACX;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsE5C;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,UAEjF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIvD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import babel from '@babel/core';
|
|
1
|
+
import type * as babel from '@babel/core';
|
|
2
2
|
import type { GetTransformProps, GetTransformResponse } from './types';
|
|
3
3
|
type Props = GetTransformProps & {
|
|
4
4
|
userSetting?: GetTransformResponse;
|
|
@@ -13,9 +13,9 @@ export declare function getBabelOptions(props: Props): babel.TransformOptions |
|
|
|
13
13
|
* still applies the project's jsxImportSource and dev-mode settings, exactly
|
|
14
14
|
* as it did when babel only stripped types here.
|
|
15
15
|
*/
|
|
16
|
-
export declare function transformOxcReactCompiler(id: string, code: string, target: '18' | '19'): Promise<{
|
|
16
|
+
export declare function transformOxcReactCompiler(id: string, code: string, target: '18' | '19', sourceMap?: boolean): Promise<{
|
|
17
17
|
code: string;
|
|
18
|
-
map:
|
|
18
|
+
map: any;
|
|
19
19
|
}>;
|
|
20
20
|
/**
|
|
21
21
|
* Transform input to mostly ES5 compatible code, keep ESM syntax, and transform generators.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformBabel.d.ts","sourceRoot":"","sources":["../src/transformBabel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transformBabel.d.ts","sourceRoot":"","sources":["../src/transformBabel.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAKzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEtE,KAAK,KAAK,GAAG,iBAAiB,GAAG;IAC/B,WAAW,CAAC,EAAE,oBAAoB,CAAA;CACnC,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAoB3E;AA8CD;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,IAAI,GAAG,IAAI,EACnB,SAAS,UAAQ;;;GA4BlB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,KAAK,CAAC,gBAAgB,kCAsDhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformHermesLoops.d.ts","sourceRoot":"","sources":["../src/transformHermesLoops.ts"],"names":[],"mappings":"AA6ZA,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,GAAG,IAAI,CAgBtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformHermesLoops.test.d.ts","sourceRoot":"","sources":["../src/transformHermesLoops.test.ts"],"names":[],"mappings":""}
|
package/types/transformSWC.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { type Output, type Options as SWCOptions } from '@swc/core';
|
|
2
1
|
import type { Options } from './types';
|
|
2
|
+
export interface Output {
|
|
3
|
+
code: string;
|
|
4
|
+
map?: any;
|
|
5
|
+
}
|
|
3
6
|
export declare function transformSWC(id: string, code: string, options: Options & {
|
|
4
7
|
es5?: boolean;
|
|
5
|
-
}, swcOptions?:
|
|
8
|
+
}, swcOptions?: any): Promise<Output | undefined>;
|
|
9
|
+
export declare const transformOxc: typeof transformSWC;
|
|
10
|
+
export declare function shouldSourceMap(): boolean;
|
|
11
|
+
export declare const transformSWCStripJSX: (id: string, code: string) => Promise<{
|
|
12
|
+
code: string;
|
|
13
|
+
map: any;
|
|
14
|
+
} | undefined>;
|
|
15
|
+
export declare const transformOxcStripJSX: (id: string, code: string) => Promise<{
|
|
6
16
|
code: string;
|
|
7
17
|
map: any;
|
|
8
18
|
} | undefined>;
|
|
9
|
-
export declare const transformSWCStripJSX: (id: string, code: string) => Promise<Output | undefined>;
|
|
10
19
|
//# sourceMappingURL=transformSWC.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformSWC.d.ts","sourceRoot":"","sources":["../src/transformSWC.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transformSWC.d.ts","sourceRoot":"","sources":["../src/transformSWC.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,GAAG,CAAA;CACV;AAKD,wBAAsB,YAAY,CAChC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GAAG;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,EACpC,UAAU,CAAC,EAAE,GAAG,GACf,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkI7B;AAED,eAAO,MAAM,YAAY,qBAAe,CAAA;AA+HxC,wBAAgB,eAAe,YAE9B;AA0BD,eAAO,MAAM,oBAAoB,GAAU,IAAI,MAAM,EAAE,MAAM,MAAM;;SAwBxB,GAAG;cAC7C,CAAA;AAED,eAAO,MAAM,oBAAoB,OA3Bc,MAAM,QAAQ,MAAM;;SAwBxB,GAAG;cAGU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformSWC.test.d.ts","sourceRoot":"","sources":["../src/transformSWC.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const REANIMATED_AUTOWORKLETIZATION_KEYWORDS: string[];
|
|
2
|
+
export declare function shouldTransformWorklets({ id, code }: {
|
|
3
|
+
id: string;
|
|
4
|
+
code: string;
|
|
5
|
+
}): boolean;
|
|
6
|
+
export declare function getWorkletsVersion(projectRoot?: string, filename?: string): string;
|
|
7
|
+
export type TransformWorkletsOptions = {
|
|
8
|
+
projectRoot?: string;
|
|
9
|
+
bundleMode?: boolean;
|
|
10
|
+
disableInlineStylesWarning?: boolean;
|
|
11
|
+
disableSourceMaps?: boolean;
|
|
12
|
+
disableWorkletClasses?: boolean;
|
|
13
|
+
globals?: string[];
|
|
14
|
+
relativeSourceLocation?: boolean;
|
|
15
|
+
strictGlobal?: boolean;
|
|
16
|
+
pluginVersion?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function transformWorklets(id: string, code: string, sourceMaps?: boolean, options?: TransformWorkletsOptions): Promise<{
|
|
19
|
+
code: string;
|
|
20
|
+
map?: any;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=transformWorklets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformWorklets.d.ts","sourceRoot":"","sources":["../src/transformWorklets.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,sCAAsC,UAiBlD,CAAA;AAiCD,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,WAWjF;AAED,wBAAgB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CA8DlF;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAID,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,UAAU,UAAQ,EAClB,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,CAEtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformWorklets.test.d.ts","sourceRoot":"","sources":["../src/transformWorklets.test.ts"],"names":[],"mappings":""}
|
package/types/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TransformOptions as OxcTransformOptions } from 'oxc-transform';
|
|
2
2
|
export type Environment = 'ios' | 'android' | 'ssr' | 'client';
|
|
3
3
|
export type Options = {
|
|
4
4
|
environment: Environment;
|
|
@@ -18,11 +18,11 @@ export type GetTransformProps = {
|
|
|
18
18
|
reactForRNVersion: '18' | '19';
|
|
19
19
|
};
|
|
20
20
|
export type GetTransform = (props: GetTransformProps) => GetTransformResponse;
|
|
21
|
-
export type GetTransformResponse = boolean | 'babel' | 'swc' | TransformOptions;
|
|
21
|
+
export type GetTransformResponse = boolean | 'babel' | 'swc' | 'oxc' | TransformOptions;
|
|
22
22
|
export type TransformOptions = BabelTransformOptions | SWCTransformOptions;
|
|
23
23
|
export type SWCTransformOptions = {
|
|
24
|
-
transform: 'swc';
|
|
25
|
-
} &
|
|
24
|
+
transform: 'swc' | 'oxc';
|
|
25
|
+
} & OxcTransformOptions;
|
|
26
26
|
export type BabelTransformOptions = {
|
|
27
27
|
transform: 'babel';
|
|
28
28
|
excludeDefaultPlugins?: boolean;
|
package/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAE5E,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAA;AAE9D,MAAM,MAAM,OAAO,GAAG;IACpB,WAAW,EAAE,WAAW,CAAA;IACxB,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,OAAO,CAAA;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC,SAAS,CAAC,EAAE,YAAY,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,WAAW,CAAA;IACxB,iBAAiB,EAAE,IAAI,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,oBAAoB,CAAA;AAE7E,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,gBAAgB,CAAA;AAEvF,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,mBAAmB,CAAA;AAE1E,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,KAAK,GAAG,KAAK,CAAA;CACzB,GAAG,mBAAmB,CAAA;AAEvB,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,OAAO,CAAA;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,GAAG,KAAK,CAAC,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WorkletCandidate } from './types';
|
|
2
|
+
export declare const AUTOWORKLET_FUNCTION_ARGS: Record<string, number[]>;
|
|
3
|
+
export declare const GESTURE_BUILDER_METHODS: Set<string>;
|
|
4
|
+
export declare const WORKLET_DIRECTIVES: string[];
|
|
5
|
+
export declare function hasDirective(fnNode: any, directive: string): boolean;
|
|
6
|
+
export declare function hasWorkletDirective(fnNode: any): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Source offset just past every leading worklets directive in the body, so a
|
|
9
|
+
* body slice drops all of them rather than only the first. Returns the offset
|
|
10
|
+
* of the first real statement.
|
|
11
|
+
*/
|
|
12
|
+
export declare function bodyStartAfterDirectives(fnNode: any, code: string): number;
|
|
13
|
+
export declare function findWorkletCandidates(program: any): WorkletCandidate[];
|
|
14
|
+
//# sourceMappingURL=autoworklet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoworklet.d.ts","sourceRoot":"","sources":["../../src/worklets/autoworklet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAK/C,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAoC9D,CAAA;AAOD,eAAO,MAAM,uBAAuB,aAWlC,CAAA;AAoHF,eAAO,MAAM,kBAAkB,UAAgE,CAAA;AAW/F,wBAAgB,YAAY,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAsBpE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAY1E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,GAAG,GAAG,gBAAgB,EAAE,CA6JtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../src/worklets/globals.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,aA0G1B,CAAA;AAEF,wBAAgB,gBAAgB,CAC9B,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,YAAY,CAAC,EAAE,OAAO,GACrB,GAAG,CAAC,MAAM,CAAC,CAab"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/worklets/hash.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUxD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexical scope analysis and free variable capture for worklets.
|
|
3
|
+
* Builds an authentic lexical scope tree to correctly handle variable shadowing,
|
|
4
|
+
* block scoping (let/const), function hoisting, and catch parameters.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getClosureVariables(fnNode: any, globals: Set<string>): string[];
|
|
7
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/worklets/scope.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAmY/E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializes a worklet function into a string for the Hermes UI thread (__initData.code).
|
|
3
|
+
* Includes injected unpacker: `const { var1, var2 } = this.__closure ?? this._closure;`
|
|
4
|
+
* Strips TypeScript types and formats via oxc-transform.
|
|
5
|
+
*/
|
|
6
|
+
export declare function serializeWorkletForUI(fnNode: any, code: string, name: string | undefined, closureVars: string[]): string;
|
|
7
|
+
/**
|
|
8
|
+
* Builds the local JavaScript function to run on the JS thread inside the worklet IIFE.
|
|
9
|
+
* Strips TypeScript types and the 'worklet' directive.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildLocalFunction(fnNode: any, code: string, name: string | undefined): string;
|
|
12
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/worklets/serialize.ts"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,WAAW,EAAE,MAAM,EAAE,GACpB,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,MAAM,CAqCR"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TransformWorkletsOptions } from './types';
|
|
2
|
+
export declare function executeWorkletTransform(id: string, code: string, sourceMaps?: boolean, options?: TransformWorkletsOptions, resolveVersionFn?: (projectRoot?: string, filename?: string) => string): {
|
|
3
|
+
code: string;
|
|
4
|
+
map?: any;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/worklets/transform.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AA4CvD,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,UAAU,UAAQ,EAClB,OAAO,CAAC,EAAE,wBAAwB,EAClC,gBAAgB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GACrE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,CA8N7B"}
|