@tamagui/build 2.0.0-1768586279389 → 2.0.0-1768696252732
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/.turbo/turbo-test.log +22 -12
- package/package.json +5 -2
- package/tamagui-build.js +61 -0
package/.turbo/turbo-test.log
CHANGED
|
@@ -2,26 +2,36 @@
|
|
|
2
2
|
[1m[46m RUN [49m[22m [36mv4.0.4 [39m[90m/Users/n8/tamagui/code/packages/build[39m
|
|
3
3
|
|
|
4
4
|
[90mstdout[2m | __tests__/integration.test.ts[2m > [22m[2mtamagui-build integration test[2m > [22m[2mshould rebuild the package on file change when --watch is used
|
|
5
|
-
[22m[39mWatch process output: built tamagui-build-test-watch-package in
|
|
5
|
+
[22m[39mWatch process output: built tamagui-build-test-watch-package in 68 ms
|
|
6
6
|
|
|
7
7
|
Initial build complete, modifying file...
|
|
8
8
|
|
|
9
9
|
[90mstdout[2m | __tests__/integration.test.ts[2m > [22m[2mtamagui-build integration test[2m > [22m[2mshould rebuild the package on file change when --watch is used
|
|
10
|
-
[22m[39mWatch process output: built tamagui-build-test-watch-package in
|
|
10
|
+
[22m[39mWatch process output: built tamagui-build-test-watch-package in 354 ms
|
|
11
11
|
|
|
12
12
|
Rebuild after file modification complete
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
[90mstdout[2m | __tests__/integration.test.ts[2m > [22m[2mtamagui-build integration test[2m > [22m[2mshould generate correct platform-specific output
|
|
15
|
+
[22m[39mWatch process output: built tamagui-build-test-watch-package in 238 ms
|
|
16
|
+
|
|
17
|
+
Rebuild after file modification complete
|
|
18
|
+
|
|
19
|
+
[90mstdout[2m | __tests__/integration.test.ts
|
|
20
|
+
[22m[39mWatch process output: built tamagui-build-test-watch-package in 219 ms
|
|
21
|
+
|
|
22
|
+
Rebuild after file modification complete
|
|
23
|
+
|
|
24
|
+
[32m✓[39m __tests__/integration.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 8393[2mms[22m[39m
|
|
25
|
+
[33m[2m✓[22m[39m should build the package correctly [33m 1069[2mms[22m[39m
|
|
26
|
+
[33m[2m✓[22m[39m should bundle the package correctly [33m 992[2mms[22m[39m
|
|
27
|
+
[33m[2m✓[22m[39m should skip mjs files when --skip-mjs is used [33m 1011[2mms[22m[39m
|
|
28
|
+
[33m[2m✓[22m[39m should ignore base URL when --ignore-base-url is used [33m 998[2mms[22m[39m
|
|
29
|
+
[33m[2m✓[22m[39m should rebuild the package on file change when --watch is used [33m 1185[2mms[22m[39m
|
|
30
|
+
[33m[2m✓[22m[39m should generate correct platform-specific output [33m 1017[2mms[22m[39m
|
|
31
|
+
[33m[2m✓[22m[39m should minify the output when MINIFY=true is set [33m 2099[2mms[22m[39m
|
|
22
32
|
|
|
23
33
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
24
34
|
[2m Tests [22m [1m[32m7 passed[39m[22m[90m (7)[39m
|
|
25
|
-
[2m Start at [22m
|
|
26
|
-
[2m Duration [22m
|
|
35
|
+
[2m Start at [22m 11:21:00
|
|
36
|
+
[2m Duration [22m 8.50s[2m (transform 37ms, setup 0ms, collect 42ms, tests 8.39s, environment 0ms, prepare 2ms)[22m
|
|
27
37
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/build",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-1768696252732",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tamagui-build": "tamagui-build.js",
|
|
6
6
|
"teesx": "./teesx.sh"
|
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/core": "^7.25.2",
|
|
16
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
16
17
|
"@swc/core": "^1.14.0",
|
|
17
|
-
"@tamagui/babel-plugin-fully-specified": "2.0.0-
|
|
18
|
+
"@tamagui/babel-plugin-fully-specified": "2.0.0-1768696252732",
|
|
18
19
|
"@types/fs-extra": "^9.0.13",
|
|
20
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
21
|
+
"baseline-browser-mapping": "^2.9.11",
|
|
19
22
|
"chokidar": "^3.5.2",
|
|
20
23
|
"esbuild": "^0.25.11",
|
|
21
24
|
"esbuild-plugin-es5": "^2.1.1",
|
package/tamagui-build.js
CHANGED
|
@@ -21,12 +21,70 @@ const {
|
|
|
21
21
|
|
|
22
22
|
const jsOnly = !!process.env.JS_ONLY
|
|
23
23
|
const skipJS = !!(process.env.SKIP_JS || false)
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* esbuild plugin that runs React Compiler on TS/TSX files before transformation
|
|
27
|
+
*/
|
|
28
|
+
const reactCompilerPlugin = {
|
|
29
|
+
name: 'react-compiler',
|
|
30
|
+
setup(build) {
|
|
31
|
+
build.onLoad({ filter: /\.tsx?$/ }, async (args) => {
|
|
32
|
+
const source = await FSE.readFile(args.path, 'utf8')
|
|
33
|
+
const isTSX = args.path.endsWith('.tsx')
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
const result = transform(source, {
|
|
37
|
+
filename: args.path,
|
|
38
|
+
configFile: false,
|
|
39
|
+
presets: [
|
|
40
|
+
['@babel/preset-typescript', { isTSX, allExtensions: true }],
|
|
41
|
+
],
|
|
42
|
+
plugins: [
|
|
43
|
+
[
|
|
44
|
+
require.resolve('babel-plugin-react-compiler'),
|
|
45
|
+
{
|
|
46
|
+
// Target React 19 for optimal output
|
|
47
|
+
target: '19',
|
|
48
|
+
// Log when functions can't be compiled and why
|
|
49
|
+
logger: process.env.REACT_COMPILER_DEBUG
|
|
50
|
+
? {
|
|
51
|
+
logEvent(filename, event) {
|
|
52
|
+
if (event.kind === 'CompileError' || event.kind === 'CompileSkip') {
|
|
53
|
+
const name = event.fnLoc?.identifierName || 'unknown'
|
|
54
|
+
const reason = event.detail?.reason || event.reason || ''
|
|
55
|
+
console.log(`[RC] ${basename(filename)}:${name} - ${reason}`)
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
: undefined,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
],
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
contents: result.code,
|
|
67
|
+
loader: isTSX ? 'jsx' : 'js', // jsx/js since babel stripped TS
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
// If React Compiler fails, fall back to original source
|
|
71
|
+
console.warn(`React Compiler skipped for ${args.path}:`, err.message)
|
|
72
|
+
return null // let esbuild handle it normally
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
24
78
|
const shouldSkipTypes = !!(
|
|
25
79
|
process.argv.includes('--skip-types') || process.env.SKIP_TYPES
|
|
26
80
|
)
|
|
27
81
|
|
|
28
82
|
const shouldSkipNative = !!process.argv.includes('--skip-native')
|
|
29
83
|
const shouldSkipMJS = !!process.argv.includes('--skip-mjs')
|
|
84
|
+
// React Compiler is disabled by default - use --react-compiler to enable
|
|
85
|
+
const shouldEnableCompiler = !!(
|
|
86
|
+
process.argv.includes('--react-compiler') || process.env.REACT_COMPILER
|
|
87
|
+
)
|
|
30
88
|
const shouldBundleFlag = !!process.argv.includes('--bundle')
|
|
31
89
|
const shouldBundleNodeModules = !!process.argv.includes('--bundle-modules')
|
|
32
90
|
const shouldClean = !!process.argv.includes('clean')
|
|
@@ -631,6 +689,9 @@ async function esbuildWriteIfChanged(
|
|
|
631
689
|
plugins: [
|
|
632
690
|
...(opts.plugins || []),
|
|
633
691
|
|
|
692
|
+
// React Compiler for automatic memoization (disabled by default, enable with --react-compiler)
|
|
693
|
+
...(shouldEnableCompiler ? [reactCompilerPlugin] : []),
|
|
694
|
+
|
|
634
695
|
...(platform === 'native' && !opts.bundle
|
|
635
696
|
? [
|
|
636
697
|
// class isnt supported by hermes
|