@tamagui/build 1.135.4 → 1.135.5
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 +18 -18
- package/package.json +6 -6
- package/tamagui-build.js +78 -96
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
|
|
2
|
-
RUN
|
|
2
|
+
[1m[46m RUN [49m[22m [36mv4.0.4 [39m[90m/Users/n8/tamagui/code/packages/build[39m
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
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 70 ms
|
|
6
6
|
|
|
7
7
|
Initial build complete, modifying file...
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
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 374 ms
|
|
11
11
|
|
|
12
12
|
Rebuild after file modification complete
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Test Files
|
|
24
|
-
Tests
|
|
25
|
-
Start at
|
|
26
|
-
Duration
|
|
14
|
+
[32m✓[39m __tests__/integration.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 9752[2mms[22m[39m
|
|
15
|
+
[33m[2m✓[22m[39m should build the package correctly [33m 1507[2mms[22m[39m
|
|
16
|
+
[33m[2m✓[22m[39m should bundle the package correctly [33m 1113[2mms[22m[39m
|
|
17
|
+
[33m[2m✓[22m[39m should skip mjs files when --skip-mjs is used [33m 1164[2mms[22m[39m
|
|
18
|
+
[33m[2m✓[22m[39m should ignore base URL when --ignore-base-url is used [33m 1125[2mms[22m[39m
|
|
19
|
+
[33m[2m✓[22m[39m should rebuild the package on file change when --watch is used [33m 1328[2mms[22m[39m
|
|
20
|
+
[33m[2m✓[22m[39m should generate correct platform-specific output [33m 1181[2mms[22m[39m
|
|
21
|
+
[33m[2m✓[22m[39m should minify the output when MINIFY=true is set [33m 2313[2mms[22m[39m
|
|
22
|
+
|
|
23
|
+
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
24
|
+
[2m Tests [22m [1m[32m7 passed[39m[22m[90m (7)[39m
|
|
25
|
+
[2m Start at [22m 06:15:53
|
|
26
|
+
[2m Duration [22m 9.86s[2m (transform 37ms, setup 0ms, collect 42ms, tests 9.75s, environment 0ms, prepare 2ms)[22m
|
|
27
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/build",
|
|
3
|
-
"version": "1.135.
|
|
3
|
+
"version": "1.135.5",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tamagui-build": "tamagui-build.js",
|
|
6
6
|
"teesx": "./teesx.sh"
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/core": "^7.25.2",
|
|
16
|
-
"@swc/core": "^1.
|
|
17
|
-
"@tamagui/babel-plugin-fully-specified": "1.135.
|
|
16
|
+
"@swc/core": "^1.14.0",
|
|
17
|
+
"@tamagui/babel-plugin-fully-specified": "1.135.5",
|
|
18
18
|
"@types/fs-extra": "^9.0.13",
|
|
19
19
|
"chokidar": "^3.5.2",
|
|
20
|
-
"esbuild": "^0.25.
|
|
20
|
+
"esbuild": "^0.25.11",
|
|
21
21
|
"esbuild-plugin-es5": "^2.1.1",
|
|
22
22
|
"esbuild-register": "^3.6.0",
|
|
23
23
|
"execa": "^5.0.0",
|
|
24
24
|
"fast-glob": "^3.2.11",
|
|
25
25
|
"fs-extra": "^11.2.0",
|
|
26
26
|
"lodash.debounce": "^4.0.8",
|
|
27
|
-
"oxc-transform": "^0.
|
|
27
|
+
"oxc-transform": "^0.95.0",
|
|
28
28
|
"typescript": "^5.8.2"
|
|
29
29
|
},
|
|
30
30
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"vitest": "^
|
|
32
|
+
"vitest": "^4.0.4"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/tamagui-build.js
CHANGED
|
@@ -56,8 +56,6 @@ const pkg = FSE.readJSONSync('./package.json')
|
|
|
56
56
|
let shouldSkipInitialTypes = !!process.env.SKIP_TYPES_INITIAL
|
|
57
57
|
const pkgMain = pkg.main
|
|
58
58
|
const pkgSource = pkg.source
|
|
59
|
-
const bundleNative = pkg.tamagui?.['bundle.native']
|
|
60
|
-
const bundleNativeTest = pkg.tamagui?.['bundle.native.test']
|
|
61
59
|
const pkgModule = pkg.module
|
|
62
60
|
const pkgModuleJSX = pkg['module:jsx']
|
|
63
61
|
const pkgTypes = Boolean(pkg.types || pkg.typings)
|
|
@@ -176,6 +174,9 @@ async function build({ skipTypes } = {}) {
|
|
|
176
174
|
])
|
|
177
175
|
|
|
178
176
|
console.info('built', pkg.name, 'in', Date.now() - start, 'ms')
|
|
177
|
+
|
|
178
|
+
// Run afterBuild script if defined
|
|
179
|
+
await runAfterBuild()
|
|
179
180
|
} catch (error) {
|
|
180
181
|
console.error(` ❌ Error building in ${process.cwd()}:\n\n`, error.stack + '\n')
|
|
181
182
|
if (!shouldWatch) {
|
|
@@ -184,6 +185,28 @@ async function build({ skipTypes } = {}) {
|
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
|
|
188
|
+
async function runAfterBuild() {
|
|
189
|
+
const afterBuild = pkg.scripts?.afterBuild
|
|
190
|
+
if (!afterBuild) return
|
|
191
|
+
|
|
192
|
+
try {
|
|
193
|
+
console.info('Running afterBuild script...')
|
|
194
|
+
const start = Date.now()
|
|
195
|
+
|
|
196
|
+
childProcess.execSync(afterBuild, {
|
|
197
|
+
stdio: 'inherit',
|
|
198
|
+
cwd: process.cwd()
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
console.info('afterBuild completed in', Date.now() - start, 'ms')
|
|
202
|
+
} catch (error) {
|
|
203
|
+
console.error('afterBuild failed:', error.message)
|
|
204
|
+
if (!shouldWatch) {
|
|
205
|
+
throw error
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
187
210
|
async function buildTsc(allFiles) {
|
|
188
211
|
if (!pkgTypes || jsOnly || shouldSkipTypes) return
|
|
189
212
|
if (shouldSkipInitialTypes) {
|
|
@@ -374,13 +397,31 @@ async function buildJs(allFiles) {
|
|
|
374
397
|
const bundlePlugin = {
|
|
375
398
|
name: `external-most-modules`,
|
|
376
399
|
setup(build) {
|
|
400
|
+
// Alias esbuild to esbuild-wasm (but keep it external)
|
|
401
|
+
build.onResolve({ filter: /^esbuild$/ }, (args) => {
|
|
402
|
+
return { path: 'esbuild-wasm', external: true }
|
|
403
|
+
})
|
|
404
|
+
|
|
377
405
|
build.onResolve({ filter: /.*/ }, (args) => {
|
|
406
|
+
// Externalize node built-ins
|
|
407
|
+
if (args.path.startsWith('node:')) {
|
|
408
|
+
return { external: true }
|
|
409
|
+
}
|
|
410
|
+
|
|
378
411
|
if (
|
|
379
412
|
!args.path.startsWith('.') &&
|
|
380
|
-
!args.path.startsWith('/')
|
|
381
|
-
!args.path.startsWith('node:')
|
|
413
|
+
!args.path.startsWith('/')
|
|
382
414
|
) {
|
|
383
|
-
|
|
415
|
+
// Keep esbuild-wasm external (it needs access to WASM files)
|
|
416
|
+
if (args.path === 'esbuild-wasm' || args.path.startsWith('esbuild-wasm/')) {
|
|
417
|
+
return { external: true }
|
|
418
|
+
}
|
|
419
|
+
// Bundle mdx-bundler and its dependencies
|
|
420
|
+
if (args.path === 'mdx-bundler' || args.path.startsWith('mdx-bundler/')) {
|
|
421
|
+
return { external: false }
|
|
422
|
+
}
|
|
423
|
+
// Externalize all other npm packages
|
|
424
|
+
return { external: true }
|
|
384
425
|
}
|
|
385
426
|
})
|
|
386
427
|
},
|
|
@@ -388,58 +429,6 @@ async function buildJs(allFiles) {
|
|
|
388
429
|
|
|
389
430
|
const external = shouldBundleFlag ? ['@swc/*', '*.node'] : undefined
|
|
390
431
|
|
|
391
|
-
/** @type { import('esbuild').BuildOptions } */
|
|
392
|
-
const esbuildBundleProps =
|
|
393
|
-
bundleNative || bundleNativeTest
|
|
394
|
-
? {
|
|
395
|
-
entryPoints: [bundleNative],
|
|
396
|
-
bundle: true,
|
|
397
|
-
plugins: [
|
|
398
|
-
alias({
|
|
399
|
-
'@tamagui/web': require.resolve('@tamagui/web/native'),
|
|
400
|
-
|
|
401
|
-
'react-native': require.resolve('@tamagui/fake-react-native'),
|
|
402
|
-
'react-native/Libraries/Renderer/shims/ReactFabric': require.resolve(
|
|
403
|
-
'@tamagui/fake-react-native'
|
|
404
|
-
),
|
|
405
|
-
'react-native/Libraries/Renderer/shims/ReactNative': require.resolve(
|
|
406
|
-
'@tamagui/fake-react-native'
|
|
407
|
-
),
|
|
408
|
-
|
|
409
|
-
'react-native/Libraries/Pressability/Pressability': require.resolve(
|
|
410
|
-
'@tamagui/fake-react-native'
|
|
411
|
-
),
|
|
412
|
-
|
|
413
|
-
'react-native/Libraries/Pressability/usePressability': require.resolve(
|
|
414
|
-
'@tamagui/fake-react-native/idFn'
|
|
415
|
-
),
|
|
416
|
-
|
|
417
|
-
'react-native-safe-area-context': require.resolve(
|
|
418
|
-
'@tamagui/fake-react-native'
|
|
419
|
-
),
|
|
420
|
-
'react-native-gesture-handler': require.resolve('@tamagui/proxy-worm'),
|
|
421
|
-
}),
|
|
422
|
-
],
|
|
423
|
-
external: [
|
|
424
|
-
'react',
|
|
425
|
-
'react-dom',
|
|
426
|
-
bundleNativeTest ? 'react-native' : undefined,
|
|
427
|
-
].filter(Boolean),
|
|
428
|
-
resolveExtensions: [
|
|
429
|
-
'.native.ts',
|
|
430
|
-
'.native.tsx',
|
|
431
|
-
'.native.js',
|
|
432
|
-
'.ts',
|
|
433
|
-
'.tsx',
|
|
434
|
-
'.js',
|
|
435
|
-
'.jsx',
|
|
436
|
-
],
|
|
437
|
-
minify: !!process.env.MINIFY,
|
|
438
|
-
define: {
|
|
439
|
-
'process.env.TAMAGUI_IS_CORE_NODE': '"1"',
|
|
440
|
-
},
|
|
441
|
-
}
|
|
442
|
-
: {}
|
|
443
432
|
|
|
444
433
|
const start = Date.now()
|
|
445
434
|
|
|
@@ -498,33 +487,6 @@ async function buildJs(allFiles) {
|
|
|
498
487
|
})
|
|
499
488
|
: null,
|
|
500
489
|
|
|
501
|
-
// for tests to load native-mode from node
|
|
502
|
-
bundleNative && !shouldSkipNative
|
|
503
|
-
? esbuildWriteIfChanged(
|
|
504
|
-
{
|
|
505
|
-
...esbuildBundleProps,
|
|
506
|
-
outfile: `dist/native.js`,
|
|
507
|
-
},
|
|
508
|
-
{
|
|
509
|
-
platform: 'native',
|
|
510
|
-
}
|
|
511
|
-
)
|
|
512
|
-
: null,
|
|
513
|
-
|
|
514
|
-
// for tests to load native-mode from node
|
|
515
|
-
bundleNativeTest && !shouldSkipNative
|
|
516
|
-
? esbuildWriteIfChanged(
|
|
517
|
-
{
|
|
518
|
-
...esbuildBundleProps,
|
|
519
|
-
outfile: `dist/test.js`,
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
platform: 'native',
|
|
523
|
-
env: 'test',
|
|
524
|
-
}
|
|
525
|
-
)
|
|
526
|
-
: null,
|
|
527
|
-
|
|
528
490
|
// web output to esm
|
|
529
491
|
pkgModule
|
|
530
492
|
? esbuildWriteIfChanged(esmConfig, {
|
|
@@ -614,12 +576,12 @@ async function esbuildWriteIfChanged(
|
|
|
614
576
|
// compat with jsx and hermes back a few versions generally:
|
|
615
577
|
/** @type { import('esbuild').BuildOptions } */
|
|
616
578
|
const nativeEsbuildSettings = {
|
|
617
|
-
target:
|
|
579
|
+
target: 'esnext',
|
|
618
580
|
supported: {
|
|
619
581
|
'logical-assignment': false,
|
|
620
582
|
},
|
|
621
583
|
jsx: 'automatic',
|
|
622
|
-
platform: '
|
|
584
|
+
platform: 'neutral',
|
|
623
585
|
}
|
|
624
586
|
|
|
625
587
|
/** @type { import('esbuild').BuildOptions } */
|
|
@@ -636,13 +598,17 @@ async function esbuildWriteIfChanged(
|
|
|
636
598
|
},
|
|
637
599
|
}
|
|
638
600
|
|
|
639
|
-
|
|
601
|
+
/** @type { import('esbuild').BuildOptions } */
|
|
602
|
+
const out = {
|
|
640
603
|
...opts,
|
|
641
604
|
|
|
605
|
+
conditions: platform === 'native' ? ['react-native'] : [],
|
|
606
|
+
mainFields: isESM ? ['import', 'module', 'main'] : ['require', 'main'],
|
|
607
|
+
|
|
642
608
|
plugins: [
|
|
643
609
|
...(opts.plugins || []),
|
|
644
610
|
|
|
645
|
-
...(platform === 'native'
|
|
611
|
+
...(platform === 'native' && !opts.bundle
|
|
646
612
|
? [
|
|
647
613
|
// class isnt supported by hermes
|
|
648
614
|
es5Plugin(),
|
|
@@ -650,6 +616,9 @@ async function esbuildWriteIfChanged(
|
|
|
650
616
|
: []),
|
|
651
617
|
].filter(Boolean),
|
|
652
618
|
|
|
619
|
+
|
|
620
|
+
format: isESM ? 'esm' : 'cjs',
|
|
621
|
+
|
|
653
622
|
treeShaking: true,
|
|
654
623
|
minifySyntax: true,
|
|
655
624
|
write: false,
|
|
@@ -669,9 +638,14 @@ async function esbuildWriteIfChanged(
|
|
|
669
638
|
...(env && {
|
|
670
639
|
'process.env.NODE_ENV': `"${env}"`,
|
|
671
640
|
}),
|
|
641
|
+
...(shouldBundleNodeModules && {
|
|
642
|
+
'process.env.ESBUILD_BINARY_PATH': `"true"`,
|
|
643
|
+
}),
|
|
672
644
|
...opts.define,
|
|
673
645
|
},
|
|
674
646
|
}
|
|
647
|
+
|
|
648
|
+
return out
|
|
675
649
|
})()
|
|
676
650
|
|
|
677
651
|
let built
|
|
@@ -832,7 +806,12 @@ async function esbuildWriteIfChanged(
|
|
|
832
806
|
configFile: false,
|
|
833
807
|
sourceMap: true,
|
|
834
808
|
plugins: [
|
|
835
|
-
|
|
809
|
+
[
|
|
810
|
+
require.resolve('@tamagui/babel-plugin-fully-specified/commonjs'),
|
|
811
|
+
{
|
|
812
|
+
esExtensionDefault: platform === 'native' ? '.native.cjs' : '.cjs',
|
|
813
|
+
},
|
|
814
|
+
],
|
|
836
815
|
].filter(Boolean),
|
|
837
816
|
})
|
|
838
817
|
|
|
@@ -844,7 +823,8 @@ async function esbuildWriteIfChanged(
|
|
|
844
823
|
return
|
|
845
824
|
}
|
|
846
825
|
|
|
847
|
-
if
|
|
826
|
+
// Skip mjs transformation if --skip-mjs flag is set
|
|
827
|
+
if (shouldSkipMJS) {
|
|
848
828
|
return
|
|
849
829
|
}
|
|
850
830
|
|
|
@@ -857,19 +837,21 @@ async function esbuildWriteIfChanged(
|
|
|
857
837
|
if (!path.endsWith('.js')) return
|
|
858
838
|
|
|
859
839
|
// for web do mjs, for native keep js since rollup gets confused when you have both
|
|
860
|
-
const
|
|
840
|
+
const newOutPath = platform === 'native' ? path : path.replace('.js', '.mjs')
|
|
861
841
|
|
|
862
842
|
// if bundling no need to specify as its all internal
|
|
863
843
|
// and babel is bad on huge bundled files
|
|
864
844
|
const result = opts.bundle
|
|
865
845
|
? { code: contents }
|
|
866
846
|
: transform(contents, {
|
|
867
|
-
filename:
|
|
847
|
+
filename: newOutPath,
|
|
868
848
|
configFile: false,
|
|
869
849
|
sourceMap: true,
|
|
870
850
|
plugins: [
|
|
871
851
|
[
|
|
872
|
-
|
|
852
|
+
isESM
|
|
853
|
+
? require.resolve('@tamagui/babel-plugin-fully-specified')
|
|
854
|
+
: require.resolve('@tamagui/babel-plugin-fully-specified/commonjs'),
|
|
873
855
|
{
|
|
874
856
|
esExtensionDefault: platform === 'native' ? '.native.js' : '.mjs',
|
|
875
857
|
esExtensions: platform === 'native' ? ['.js'] : ['.mjs'],
|
|
@@ -886,13 +868,13 @@ async function esbuildWriteIfChanged(
|
|
|
886
868
|
// output to mjs fully specified
|
|
887
869
|
if (
|
|
888
870
|
await flush(
|
|
889
|
-
|
|
871
|
+
newOutPath,
|
|
890
872
|
result.code +
|
|
891
|
-
(result.map ? `\n//# sourceMappingURL=${basename(
|
|
873
|
+
(result.map ? `\n//# sourceMappingURL=${basename(newOutPath)}.map\n` : '')
|
|
892
874
|
)
|
|
893
875
|
) {
|
|
894
876
|
if (result.map) {
|
|
895
|
-
await FSE.writeFile(
|
|
877
|
+
await FSE.writeFile(newOutPath + '.map', JSON.stringify(result.map), 'utf8')
|
|
896
878
|
}
|
|
897
879
|
}
|
|
898
880
|
})
|