@vxrn/compiler 1.27.0 → 1.27.1-1789414853455
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 +21 -7
- package/dist/cjs/index.cjs +3 -2
- package/dist/cjs/transformBabel.cjs +15 -1
- package/dist/cjs/transformBabel.test.cjs +221 -0
- package/dist/cjs/transformWorklets.test.cjs +3 -1
- package/dist/esm/cache.mjs +21 -7
- package/dist/esm/cache.mjs.map +1 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/transformBabel.mjs +15 -2
- package/dist/esm/transformBabel.mjs.map +1 -1
- package/dist/esm/transformBabel.test.mjs +221 -0
- package/dist/esm/transformBabel.test.mjs.map +1 -1
- package/dist/esm/transformWorklets.test.mjs +3 -1
- package/dist/esm/transformWorklets.test.mjs.map +1 -1
- package/package.json +6 -5
- package/src/cache.ts +37 -7
- package/src/index.ts +7 -3
- package/src/transformBabel.test.ts +160 -0
- package/src/transformBabel.ts +25 -1
- package/src/transformWorklets.test.ts +7 -1
- package/types/cache.d.ts +2 -2
- package/types/cache.d.ts.map +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/transformBabel.d.ts +12 -0
- package/types/transformBabel.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/compiler",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.1-1789414853455",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
"@babel/plugin-transform-react-jsx": "^7.27.1",
|
|
37
37
|
"@babel/plugin-transform-regenerator": "^7.28.4",
|
|
38
38
|
"@jridgewell/remapping": "^2.3.0",
|
|
39
|
-
"@vxrn/utils": "1.27.
|
|
40
|
-
"@vxrn/vite-native-client": "1.27.
|
|
39
|
+
"@vxrn/utils": "1.27.1-1789414853455",
|
|
40
|
+
"@vxrn/vite-native-client": "1.27.1-1789414853455",
|
|
41
41
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
42
|
-
"babel-plugin-syntax-hermes-parser": "^0.
|
|
42
|
+
"babel-plugin-syntax-hermes-parser": "^0.36.1",
|
|
43
|
+
"babel-plugin-transform-flow-enums": "^0.0.2",
|
|
43
44
|
"esbuild": "^0.25.12",
|
|
44
|
-
"hermes-parser": "^0.
|
|
45
|
+
"hermes-parser": "^0.36.1",
|
|
45
46
|
"magic-string": "^0.30.21",
|
|
46
47
|
"oxc-parser": "^0.112.0",
|
|
47
48
|
"oxc-transform": "^0.148.0",
|
package/src/cache.ts
CHANGED
|
@@ -50,7 +50,7 @@ function getCacheDir(): string {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// hash config state so cache invalidates when compiler/reanimated/nativewind toggles change
|
|
53
|
-
function getConfigFingerprint(): string {
|
|
53
|
+
function getConfigFingerprint(userBabelConfigPath?: string | null): string {
|
|
54
54
|
return createHash('sha1')
|
|
55
55
|
.update(
|
|
56
56
|
JSON.stringify({
|
|
@@ -59,6 +59,10 @@ function getConfigFingerprint(): string {
|
|
|
59
59
|
nativeWorklets: isNativeWorkletsEnabled(),
|
|
60
60
|
nativewind: configuration.enableNativewind,
|
|
61
61
|
nativeCSS: configuration.enableNativeCSS,
|
|
62
|
+
// transform output depends on the user babel config when one applies,
|
|
63
|
+
// so its identity joins the fingerprint. adding, removing, or editing
|
|
64
|
+
// babel.config.* must miss entries written without that change.
|
|
65
|
+
babelConfig: getBabelConfigIdentity(userBabelConfigPath),
|
|
62
66
|
// bump when the transform engine changes, so entries written by a
|
|
63
67
|
// previous engine aren't served for the same source
|
|
64
68
|
engine: 'oxc-worklets-hermes-async',
|
|
@@ -68,9 +72,33 @@ function getConfigFingerprint(): string {
|
|
|
68
72
|
.slice(0, 8)
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
// identity of the user babel config influencing a transform: path plus mtime
|
|
76
|
+
// and content hash, or null when none applies. mtime alone misses edits that
|
|
77
|
+
// preserve it, content alone misses same-byte swaps across paths. cheap: the
|
|
78
|
+
// file is tiny and its path is already resolved by the caller.
|
|
79
|
+
function getBabelConfigIdentity(configPath?: string | null): string | null {
|
|
80
|
+
if (!configPath) return null
|
|
81
|
+
try {
|
|
82
|
+
const mtime = statSync(configPath).mtimeMs
|
|
83
|
+
const hash = createHash('sha1')
|
|
84
|
+
.update(readFileSync(configPath))
|
|
85
|
+
.digest('hex')
|
|
86
|
+
.slice(0, 16)
|
|
87
|
+
return `${configPath}:${mtime}:${hash}`
|
|
88
|
+
} catch {
|
|
89
|
+
// deleted or unreadable between resolve and hash: the path alone still
|
|
90
|
+
// distinguishes this entry from the no-config one.
|
|
91
|
+
return configPath
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getCacheKey(
|
|
96
|
+
filePath: string,
|
|
97
|
+
environment: string,
|
|
98
|
+
userBabelConfigPath?: string | null
|
|
99
|
+
): string {
|
|
72
100
|
const hash = createHash('sha1')
|
|
73
|
-
.update(`${environment}:${filePath}:${getConfigFingerprint()}`)
|
|
101
|
+
.update(`${environment}:${filePath}:${getConfigFingerprint(userBabelConfigPath)}`)
|
|
74
102
|
.digest('hex')
|
|
75
103
|
return hash
|
|
76
104
|
}
|
|
@@ -83,13 +111,14 @@ function getContentHash(code: string): string {
|
|
|
83
111
|
export function getCachedTransform(
|
|
84
112
|
filePath: string,
|
|
85
113
|
code: string,
|
|
86
|
-
environment: string
|
|
114
|
+
environment: string,
|
|
115
|
+
userBabelConfigPath?: string | null
|
|
87
116
|
): { code: string; map?: any } | null {
|
|
88
117
|
try {
|
|
89
118
|
// Strip leading null byte (Vite virtual module prefix) if present
|
|
90
119
|
const cleanPath = filePath.startsWith('\0') ? filePath.slice(1) : filePath
|
|
91
120
|
const cacheDir = getCacheDir()
|
|
92
|
-
const cacheKey = getCacheKey(cleanPath, environment)
|
|
121
|
+
const cacheKey = getCacheKey(cleanPath, environment, userBabelConfigPath)
|
|
93
122
|
const cachePath = join(cacheDir, `${cacheKey}.json`)
|
|
94
123
|
|
|
95
124
|
if (!existsSync(cachePath)) {
|
|
@@ -126,13 +155,14 @@ export function setCachedTransform(
|
|
|
126
155
|
filePath: string,
|
|
127
156
|
code: string,
|
|
128
157
|
result: { code: string; map?: any },
|
|
129
|
-
environment: string
|
|
158
|
+
environment: string,
|
|
159
|
+
userBabelConfigPath?: string | null
|
|
130
160
|
): void {
|
|
131
161
|
try {
|
|
132
162
|
// Strip leading null byte (Vite virtual module prefix) if present
|
|
133
163
|
const cleanPath = filePath.startsWith('\0') ? filePath.slice(1) : filePath
|
|
134
164
|
const cacheDir = getCacheDir()
|
|
135
|
-
const cacheKey = getCacheKey(cleanPath, environment)
|
|
165
|
+
const cacheKey = getCacheKey(cleanPath, environment, userBabelConfigPath)
|
|
136
166
|
const cachePath = join(cacheDir, `${cacheKey}.json`)
|
|
137
167
|
|
|
138
168
|
const mtime = statSync(cleanPath).mtimeMs
|
package/src/index.ts
CHANGED
|
@@ -172,8 +172,12 @@ async function performBabelTransform({
|
|
|
172
172
|
(x) => Array.isArray(x) && x[0] === 'babel-plugin-react-compiler'
|
|
173
173
|
)
|
|
174
174
|
|
|
175
|
-
// Check cache first
|
|
176
|
-
|
|
175
|
+
// Check cache first. the user babel config feeds the transform output,
|
|
176
|
+
// so its identity joins the key: adding or editing babel.config.* must
|
|
177
|
+
// miss entries cached without that change.
|
|
178
|
+
const userBabelConfigPath =
|
|
179
|
+
typeof babelOptions.configFile === 'string' ? babelOptions.configFile : null
|
|
180
|
+
const cached = getCachedTransform(id, code, environment, userBabelConfigPath)
|
|
177
181
|
if (cached) {
|
|
178
182
|
perfStats.babel.byEnvironment[environment].transforms++
|
|
179
183
|
if (
|
|
@@ -322,7 +326,7 @@ async function performBabelTransform({
|
|
|
322
326
|
const result = { code: outCode, map: babelOut.map }
|
|
323
327
|
|
|
324
328
|
// Cache the result
|
|
325
|
-
setCachedTransform(id, code, result, environment)
|
|
329
|
+
setCachedTransform(id, code, result, environment, userBabelConfigPath)
|
|
326
330
|
|
|
327
331
|
return result
|
|
328
332
|
}
|
|
@@ -68,6 +68,27 @@ describe('transformBabel Flow parsing', () => {
|
|
|
68
68
|
expect(result?.code).not.toContain('HostComponent')
|
|
69
69
|
})
|
|
70
70
|
|
|
71
|
+
it('preserves React Native Flow enums as runtime values', async () => {
|
|
72
|
+
const result = await transformBabel(
|
|
73
|
+
'/project/VirtualView.js',
|
|
74
|
+
`
|
|
75
|
+
// @flow strict-local
|
|
76
|
+
export enum VirtualViewRenderState {
|
|
77
|
+
Unknown = 0,
|
|
78
|
+
Rendered = 1,
|
|
79
|
+
None = 2,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const rendered = VirtualViewRenderState.Rendered
|
|
83
|
+
`,
|
|
84
|
+
{ plugins: [] }
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
expect(result?.code).toContain('const VirtualViewRenderState =')
|
|
88
|
+
expect(result?.code).toContain('Rendered: 1')
|
|
89
|
+
expect(result?.code).toContain('VirtualViewRenderState.Rendered')
|
|
90
|
+
})
|
|
91
|
+
|
|
71
92
|
it('rejects a required transform error instead of returning untransformed source', async () => {
|
|
72
93
|
const negativeControl = () => ({
|
|
73
94
|
visitor: {
|
|
@@ -456,3 +477,142 @@ describe('findUserBabelConfig and user Babel config respect', () => {
|
|
|
456
477
|
})
|
|
457
478
|
})
|
|
458
479
|
|
|
480
|
+
describe('explicit swc/oxc per-file choice with a user babel config', () => {
|
|
481
|
+
it('returns null for swc/oxc string and object forms', () => {
|
|
482
|
+
const projectRoot = fs.realpathSync(
|
|
483
|
+
fs.mkdtempSync(path.join(os.tmpdir(), 'vxrn-babel-conf-'))
|
|
484
|
+
)
|
|
485
|
+
const userConfig = path.join(projectRoot, 'babel.config.js')
|
|
486
|
+
fs.writeFileSync(userConfig, 'module.exports = { plugins: [] }')
|
|
487
|
+
try {
|
|
488
|
+
const base = {
|
|
489
|
+
id: path.join(projectRoot, 'src', 'index.tsx'),
|
|
490
|
+
code: `export const x = 1`,
|
|
491
|
+
projectRoot,
|
|
492
|
+
development: true,
|
|
493
|
+
environment: 'client' as const,
|
|
494
|
+
reactForRNVersion: '19' as const,
|
|
495
|
+
}
|
|
496
|
+
// merely adding babel.config.js must not flip an explicit non-babel choice
|
|
497
|
+
expect(getBabelOptions({ ...base, userSetting: 'swc' })).toBeNull()
|
|
498
|
+
expect(getBabelOptions({ ...base, userSetting: 'oxc' })).toBeNull()
|
|
499
|
+
expect(getBabelOptions({ ...base, userSetting: { transform: 'swc' } })).toBeNull()
|
|
500
|
+
expect(getBabelOptions({ ...base, userSetting: { transform: 'oxc' } })).toBeNull()
|
|
501
|
+
// controls: babel choices still resolve through the user config
|
|
502
|
+
expect(getBabelOptions({ ...base, userSetting: 'babel' })?.configFile).toBe(
|
|
503
|
+
userConfig
|
|
504
|
+
)
|
|
505
|
+
expect(
|
|
506
|
+
getBabelOptions({ ...base, userSetting: { transform: 'babel' } })?.configFile
|
|
507
|
+
).toBe(userConfig)
|
|
508
|
+
expect(getBabelOptions(base)?.configFile).toBe(userConfig)
|
|
509
|
+
} finally {
|
|
510
|
+
fs.rmSync(projectRoot, { recursive: true, force: true })
|
|
511
|
+
}
|
|
512
|
+
})
|
|
513
|
+
|
|
514
|
+
it('skips the transform end-to-end for object-form swc', async () => {
|
|
515
|
+
const { createVXRNCompilerPlugin } = await import('./index')
|
|
516
|
+
const projectRoot = fs.realpathSync(
|
|
517
|
+
fs.mkdtempSync(path.join(os.tmpdir(), 'vxrn-babel-conf-'))
|
|
518
|
+
)
|
|
519
|
+
const srcDir = path.join(projectRoot, 'src')
|
|
520
|
+
fs.mkdirSync(srcDir, { recursive: true })
|
|
521
|
+
const file = path.join(srcDir, 'index.ts')
|
|
522
|
+
const code = `export const x = 1`
|
|
523
|
+
fs.writeFileSync(file, code)
|
|
524
|
+
fs.writeFileSync(
|
|
525
|
+
path.join(projectRoot, 'babel.config.js'),
|
|
526
|
+
'module.exports = { plugins: [] }'
|
|
527
|
+
)
|
|
528
|
+
configureVXRNCompilerPlugin({ enableCompiler: false, enableReanimated: false })
|
|
529
|
+
try {
|
|
530
|
+
const plugins = await createVXRNCompilerPlugin({
|
|
531
|
+
transform: () => ({ transform: 'swc' }) as any,
|
|
532
|
+
})
|
|
533
|
+
const plugin = plugins.find((p: any) => p.name === 'one:compiler') as any
|
|
534
|
+
await plugin.configResolved({ root: projectRoot, build: {} })
|
|
535
|
+
const hook = plugin.transform.handler || plugin.transform
|
|
536
|
+
const result = await hook.call({ environment: { name: 'client' } }, code, file)
|
|
537
|
+
expect(result == null).toBe(true)
|
|
538
|
+
} finally {
|
|
539
|
+
configureVXRNCompilerPlugin({ enableCompiler: false, enableReanimated: false })
|
|
540
|
+
fs.rmSync(projectRoot, { recursive: true, force: true })
|
|
541
|
+
}
|
|
542
|
+
})
|
|
543
|
+
})
|
|
544
|
+
|
|
545
|
+
describe('user babel config end-to-end through the compiler plugin', () => {
|
|
546
|
+
it('runs the user config when default plugins are empty', async () => {
|
|
547
|
+
const { createVXRNCompilerPlugin } = await import('./index')
|
|
548
|
+
const projectRoot = fs.realpathSync(
|
|
549
|
+
fs.mkdtempSync(path.join(os.tmpdir(), 'vxrn-babel-e2e-'))
|
|
550
|
+
)
|
|
551
|
+
const srcDir = path.join(projectRoot, 'src')
|
|
552
|
+
fs.mkdirSync(srcDir, { recursive: true })
|
|
553
|
+
const file = path.join(srcDir, 'index.ts')
|
|
554
|
+
const marker = 'babel-e2e-probe'
|
|
555
|
+
const code = `/* ${marker} */ export const x = 1`
|
|
556
|
+
fs.writeFileSync(file, code)
|
|
557
|
+
fs.writeFileSync(
|
|
558
|
+
path.join(projectRoot, 'babel.config.json'),
|
|
559
|
+
JSON.stringify({ comments: false })
|
|
560
|
+
)
|
|
561
|
+
configureVXRNCompilerPlugin({ enableCompiler: false, enableReanimated: false })
|
|
562
|
+
try {
|
|
563
|
+
const plugins = await createVXRNCompilerPlugin()
|
|
564
|
+
const plugin = plugins.find((p: any) => p.name === 'one:compiler') as any
|
|
565
|
+
await plugin.configResolved({ root: projectRoot, build: {} })
|
|
566
|
+
const hook = plugin.transform.handler || plugin.transform
|
|
567
|
+
const result = await hook.call({ environment: { name: 'client' } }, code, file)
|
|
568
|
+
// default plugins are empty here, but the user configFile must still
|
|
569
|
+
// route through transformBabel instead of taking the skip fast-path
|
|
570
|
+
expect(result).toBeDefined()
|
|
571
|
+
expect(result.code).toContain('export const x = 1')
|
|
572
|
+
expect(result.code).not.toContain(marker)
|
|
573
|
+
} finally {
|
|
574
|
+
configureVXRNCompilerPlugin({ enableCompiler: false, enableReanimated: false })
|
|
575
|
+
fs.rmSync(projectRoot, { recursive: true, force: true })
|
|
576
|
+
}
|
|
577
|
+
})
|
|
578
|
+
|
|
579
|
+
it('invalidates the cache when the user babel config is added or edited', async () => {
|
|
580
|
+
const { createVXRNCompilerPlugin } = await import('./index')
|
|
581
|
+
const projectRoot = fs.realpathSync(
|
|
582
|
+
fs.mkdtempSync(path.join(os.tmpdir(), 'vxrn-babel-cache-'))
|
|
583
|
+
)
|
|
584
|
+
const srcDir = path.join(projectRoot, 'src')
|
|
585
|
+
fs.mkdirSync(srcDir, { recursive: true })
|
|
586
|
+
const file = path.join(srcDir, 'index.ts')
|
|
587
|
+
const marker = 'babel-cache-probe'
|
|
588
|
+
const code = `/* ${marker} */ export const x = 1`
|
|
589
|
+
fs.writeFileSync(file, code)
|
|
590
|
+
const userConfig = path.join(projectRoot, 'babel.config.json')
|
|
591
|
+
configureVXRNCompilerPlugin({ enableCompiler: false, enableReanimated: false })
|
|
592
|
+
try {
|
|
593
|
+
const plugins = await createVXRNCompilerPlugin({
|
|
594
|
+
transform: () => 'babel' as const,
|
|
595
|
+
})
|
|
596
|
+
const plugin = plugins.find((p: any) => p.name === 'one:compiler') as any
|
|
597
|
+
await plugin.configResolved({ root: projectRoot, build: {} })
|
|
598
|
+
const hook = plugin.transform.handler || plugin.transform
|
|
599
|
+
const context = { environment: { name: 'client' } }
|
|
600
|
+
|
|
601
|
+
const res1 = await hook.call(context, code, file)
|
|
602
|
+
expect(res1.code).toContain(marker)
|
|
603
|
+
|
|
604
|
+
// adding a config without touching the source must miss the cache
|
|
605
|
+
fs.writeFileSync(userConfig, JSON.stringify({ comments: false }))
|
|
606
|
+
const res2 = await hook.call(context, code, file)
|
|
607
|
+
expect(res2.code).not.toContain(marker)
|
|
608
|
+
|
|
609
|
+
// editing the config contents must miss again
|
|
610
|
+
fs.writeFileSync(userConfig, JSON.stringify({ comments: true }))
|
|
611
|
+
const res3 = await hook.call(context, code, file)
|
|
612
|
+
expect(res3.code).toContain(marker)
|
|
613
|
+
} finally {
|
|
614
|
+
configureVXRNCompilerPlugin({ enableCompiler: false, enableReanimated: false })
|
|
615
|
+
fs.rmSync(projectRoot, { recursive: true, force: true })
|
|
616
|
+
}
|
|
617
|
+
})
|
|
618
|
+
})
|
package/src/transformBabel.ts
CHANGED
|
@@ -75,6 +75,19 @@ export function getBabelOptions(props: Props): babel.TransformOptions | null {
|
|
|
75
75
|
}
|
|
76
76
|
return getOptions(props, false, userBabelConfig)
|
|
77
77
|
}
|
|
78
|
+
// an explicit per-file opt-out of babel survives a user config. without
|
|
79
|
+
// this, merely adding babel.config.js flips swc/oxc files to babel.
|
|
80
|
+
const userSetting = props.userSetting
|
|
81
|
+
if (
|
|
82
|
+
userSetting === 'swc' ||
|
|
83
|
+
userSetting === 'oxc' ||
|
|
84
|
+
userSetting === false ||
|
|
85
|
+
(typeof userSetting === 'object' &&
|
|
86
|
+
userSetting !== null &&
|
|
87
|
+
(userSetting.transform === 'swc' || userSetting.transform === 'oxc'))
|
|
88
|
+
) {
|
|
89
|
+
return null
|
|
90
|
+
}
|
|
78
91
|
if (userBabelConfig) {
|
|
79
92
|
return getOptions(props, false, userBabelConfig)
|
|
80
93
|
}
|
|
@@ -236,7 +249,10 @@ export async function transformBabel(
|
|
|
236
249
|
plugins: [
|
|
237
250
|
...(isTS
|
|
238
251
|
? []
|
|
239
|
-
: [
|
|
252
|
+
: [
|
|
253
|
+
[hermesParserPlugin, { parseLangTypes: 'flow', reactRuntimeTarget: '19' }],
|
|
254
|
+
'babel-plugin-transform-flow-enums',
|
|
255
|
+
]),
|
|
240
256
|
...(options.plugins || []),
|
|
241
257
|
...(isTS ? [] : ['@babel/plugin-transform-flow-strip-types']),
|
|
242
258
|
],
|
|
@@ -252,6 +268,14 @@ export async function transformBabel(
|
|
|
252
268
|
})
|
|
253
269
|
}
|
|
254
270
|
|
|
271
|
+
export async function stripFlowTypes(id: string, code: string, sourceMaps = true) {
|
|
272
|
+
const result = await transformBabel(id, code, { sourceMaps })
|
|
273
|
+
return {
|
|
274
|
+
code: result.code!,
|
|
275
|
+
map: result.map,
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
255
279
|
const getBasePlugins = ({ development }: Props) =>
|
|
256
280
|
[
|
|
257
281
|
['@babel/plugin-transform-destructuring'],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import os from 'node:os'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
3
4
|
import path from 'node:path'
|
|
4
5
|
import { afterEach, describe, expect, it } from 'vitest'
|
|
5
6
|
import { configureVXRNCompilerPlugin } from './configure'
|
|
@@ -381,7 +382,12 @@ describe('transformWorklets', () => {
|
|
|
381
382
|
expect(typeof scaleFn).toBe('function')
|
|
382
383
|
expect(scaleFn.__workletHash).toBeDefined()
|
|
383
384
|
expect(typeof scaleFn.__workletHash).toBe('number')
|
|
384
|
-
|
|
385
|
+
// /app has no package.json, so the stamp comes from the worklets runtime
|
|
386
|
+
// this workspace actually installs
|
|
387
|
+
const installedWorklets = createRequire(path.resolve(process.cwd(), 'package.json'))(
|
|
388
|
+
'react-native-worklets/package.json'
|
|
389
|
+
).version
|
|
390
|
+
expect(scaleFn.__pluginVersion).toBe(installedWorklets)
|
|
385
391
|
expect(scaleFn.__closure).toEqual({ multiplier: 5 })
|
|
386
392
|
expect(scaleFn.__initData).toBeDefined()
|
|
387
393
|
expect(scaleFn.__initData.code).toContain('__closure')
|
package/types/cache.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ interface CacheStats {
|
|
|
4
4
|
writes: 0;
|
|
5
5
|
errors: 0;
|
|
6
6
|
}
|
|
7
|
-
export declare function getCachedTransform(filePath: string, code: string, environment: string): {
|
|
7
|
+
export declare function getCachedTransform(filePath: string, code: string, environment: string, userBabelConfigPath?: string | null): {
|
|
8
8
|
code: string;
|
|
9
9
|
map?: any;
|
|
10
10
|
} | null;
|
|
11
11
|
export declare function setCachedTransform(filePath: string, code: string, result: {
|
|
12
12
|
code: string;
|
|
13
13
|
map?: any;
|
|
14
|
-
}, environment: string): void;
|
|
14
|
+
}, environment: string, userBabelConfigPath?: string | null): void;
|
|
15
15
|
/** Drop every cached transform, for `react-native bundle --reset-cache`. */
|
|
16
16
|
export declare function clearTransformCache(): void;
|
|
17
17
|
export declare function getCacheStats(): CacheStats;
|
package/types/cache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AA4BA,UAAU,UAAU;IAClB,IAAI,EAAE,CAAC,CAAA;IACP,MAAM,EAAE,CAAC,CAAA;IACT,MAAM,EAAE,CAAC,CAAA;IACT,MAAM,EAAE,CAAC,CAAA;CACV;
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AA4BA,UAAU,UAAU;IAClB,IAAI,EAAE,CAAC,CAAA;IACP,MAAM,EAAE,CAAC,CAAA;IACT,MAAM,EAAE,CAAC,CAAA;IACT,MAAM,EAAE,CAAC,CAAA;CACV;AA6ED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,GAClC;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,EACnB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,GAClC,IAAI,CAwBN;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,wBAAgB,aAAa,IAAI,IAAI,CAapC"}
|
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;AAcpE,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,cAAc,wBAAwB,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,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;AAcpE,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,cAAc,wBAAwB,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA0S3C,wBAAsB,wBAAwB,CAC5C,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC,CA6VzB"}
|
|
@@ -24,5 +24,17 @@ export declare function transformOxcReactCompiler(id: string, code: string, opti
|
|
|
24
24
|
* Transform input to mostly ES5 compatible code, keep ESM syntax, and transform generators.
|
|
25
25
|
*/
|
|
26
26
|
export declare function transformBabel(id: string, code: string, options: babel.TransformOptions): Promise<babel.BabelFileResult>;
|
|
27
|
+
export declare function stripFlowTypes(id: string, code: string, sourceMaps?: boolean): Promise<{
|
|
28
|
+
code: string;
|
|
29
|
+
map: {
|
|
30
|
+
version: number;
|
|
31
|
+
sources: string[];
|
|
32
|
+
names: string[];
|
|
33
|
+
sourceRoot?: string | undefined;
|
|
34
|
+
sourcesContent?: string[] | undefined;
|
|
35
|
+
mappings: string;
|
|
36
|
+
file: string;
|
|
37
|
+
} | null | undefined;
|
|
38
|
+
}>;
|
|
27
39
|
export {};
|
|
28
40
|
//# sourceMappingURL=transformBabel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformBabel.d.ts","sourceRoot":"","sources":["../src/transformBabel.ts"],"names":[],"mappings":"AAKA,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;AAcD,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBvE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,gBAAgB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"transformBabel.d.ts","sourceRoot":"","sources":["../src/transformBabel.ts"],"names":[],"mappings":"AAKA,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;AAcD,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBvE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,gBAAgB,GAAG,IAAI,CA+C3E;AAuDD;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,eAAe,GAAE,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAQ,EACtF,SAAS,UAAQ;;;GAyClB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,KAAK,CAAC,gBAAgB,kCAyDhC;AAED,wBAAsB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,UAAO;;;;;;;;;;;GAM/E"}
|