@tamagui/build 1.110.4 → 1.111.0
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamagui-build-test-simple-tpackage",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.111.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"build:target-native": "TAMAGUI_TARGET=native node ../../../tamagui-build.js"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tamagui/build": "1.
|
|
19
|
+
"@tamagui/build": "1.111.0",
|
|
20
20
|
"typescript": "^5.5.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamagui-build-test-watch-package",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.111.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"build:target-native": "TAMAGUI_TARGET=native node ../../../tamagui-build.js"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@tamagui/build": "1.
|
|
19
|
+
"@tamagui/build": "1.111.0",
|
|
20
20
|
"typescript": "^5.5.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/esbuild-es5.js
CHANGED
|
@@ -33,6 +33,24 @@ function transformFile(file, options) {
|
|
|
33
33
|
const isTs = file.endsWith('.ts') || file.endsWith('.tsx')
|
|
34
34
|
const isReact = file.endsWith('.jsx') || file.endsWith('.tsx')
|
|
35
35
|
let transformOptions = {
|
|
36
|
+
env: {
|
|
37
|
+
targets: {
|
|
38
|
+
node: '4',
|
|
39
|
+
},
|
|
40
|
+
include: [],
|
|
41
|
+
// this breaks the uniswap app for any file with a ...spread
|
|
42
|
+
exclude: [
|
|
43
|
+
'transform-spread',
|
|
44
|
+
'transform-destructuring',
|
|
45
|
+
'transform-object-rest-spread',
|
|
46
|
+
// `transform-async-to-generator` is relying on `transform-destructuring`.
|
|
47
|
+
// If we exclude `transform-destructuring` but not `transform-async-to-generator`, the SWC binary will panic
|
|
48
|
+
// with error: `called `Option::unwrap()` on a `None` value`.
|
|
49
|
+
// See: https://github.com/swc-project/swc/blob/v1.7.14/crates/swc_ecma_compat_es2015/src/generator.rs#L703-L705
|
|
50
|
+
'transform-async-to-generator',
|
|
51
|
+
'transform-regenerator', // Similar to above
|
|
52
|
+
],
|
|
53
|
+
},
|
|
36
54
|
jsc: {
|
|
37
55
|
preserveAllComments: true,
|
|
38
56
|
externalHelpers: false,
|
|
@@ -47,7 +65,6 @@ function transformFile(file, options) {
|
|
|
47
65
|
tsx: isReact && isTs,
|
|
48
66
|
jsx: isReact && !isTs,
|
|
49
67
|
},
|
|
50
|
-
target: 'es5',
|
|
51
68
|
},
|
|
52
69
|
module: { type: 'es6' },
|
|
53
70
|
sourceFileName: file,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/build",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.111.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tamagui-build": "tamagui-build.js",
|
|
6
6
|
"teesx": "./teesx.sh"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/core": "^7.25.2",
|
|
16
16
|
"@swc/core": "^1.7.21",
|
|
17
|
-
"@tamagui/babel-plugin-fully-specified": "1.
|
|
17
|
+
"@tamagui/babel-plugin-fully-specified": "1.111.0",
|
|
18
18
|
"@types/fs-extra": "^9.0.13",
|
|
19
19
|
"babel-plugin-fully-specified": "*",
|
|
20
20
|
"chokidar": "^3.5.2",
|
package/tamagui-build.js
CHANGED
|
@@ -13,9 +13,6 @@ const { es5Plugin } = require('./esbuild-es5')
|
|
|
13
13
|
const ts = require('typescript')
|
|
14
14
|
const path = require('node:path')
|
|
15
15
|
|
|
16
|
-
// biome-ignore lint/suspicious/noConsoleLog: <explanation>
|
|
17
|
-
console.log('TypeScript version:', ts.version)
|
|
18
|
-
|
|
19
16
|
const jsOnly = !!process.env.JS_ONLY
|
|
20
17
|
const skipJS = !!(process.env.SKIP_JS || false)
|
|
21
18
|
const shouldSkipTypes = !!(
|
|
@@ -136,7 +133,7 @@ async function build({ skipTypes } = {}) {
|
|
|
136
133
|
])
|
|
137
134
|
console.info('built', pkg.name, 'in', Date.now() - start, 'ms')
|
|
138
135
|
} catch (error) {
|
|
139
|
-
console.error(`Error building
|
|
136
|
+
console.error(` ❌ Error building in ${process.cwd()}:\n\n`, error.stack + '\n')
|
|
140
137
|
}
|
|
141
138
|
}
|
|
142
139
|
|
|
@@ -151,8 +148,6 @@ async function buildTsc() {
|
|
|
151
148
|
await fs.ensureDir(targetDir)
|
|
152
149
|
|
|
153
150
|
try {
|
|
154
|
-
console.info(`Starting TypeScript compilation for ${pkg.name}`)
|
|
155
|
-
|
|
156
151
|
const { config, error } = await loadTsConfig()
|
|
157
152
|
if (error) throw error
|
|
158
153
|
|
|
@@ -167,8 +162,6 @@ async function buildTsc() {
|
|
|
167
162
|
if (emitResult.emitSkipped) {
|
|
168
163
|
throw new Error('TypeScript compilation failed')
|
|
169
164
|
}
|
|
170
|
-
|
|
171
|
-
console.info(`TypeScript compilation completed successfully for ${pkg.name}`)
|
|
172
165
|
} catch (err) {
|
|
173
166
|
if (err.code === 'ENOTFOUND' || err.code === 'ECONNREFUSED') {
|
|
174
167
|
console.error(`Network error during compilation for ${pkg.name}:`, err.message)
|
|
@@ -436,6 +429,7 @@ async function buildJs() {
|
|
|
436
429
|
pkgModule
|
|
437
430
|
? esbuildWriteIfChanged(esmConfig, {
|
|
438
431
|
platform: 'native',
|
|
432
|
+
mjs: true,
|
|
439
433
|
})
|
|
440
434
|
: null,
|
|
441
435
|
|
|
@@ -507,7 +501,7 @@ async function esbuildWriteIfChanged(
|
|
|
507
501
|
// compat with jsx and hermes back a few versions generally:
|
|
508
502
|
/** @type { import('esbuild').BuildOptions } */
|
|
509
503
|
const nativeEsbuildSettings = {
|
|
510
|
-
target: 'node16',
|
|
504
|
+
target: mjs ? 'esnext' : 'node16',
|
|
511
505
|
supported: {
|
|
512
506
|
'logical-assignment': false,
|
|
513
507
|
},
|
|
@@ -597,6 +591,8 @@ async function esbuildWriteIfChanged(
|
|
|
597
591
|
})
|
|
598
592
|
)
|
|
599
593
|
|
|
594
|
+
const cleanupNonMjsFiles = []
|
|
595
|
+
|
|
600
596
|
await Promise.all(
|
|
601
597
|
built.outputFiles.map(async (file) => {
|
|
602
598
|
let outPath = file.path
|
|
@@ -691,17 +687,7 @@ async function esbuildWriteIfChanged(
|
|
|
691
687
|
configFile: false,
|
|
692
688
|
sourceMap: true,
|
|
693
689
|
plugins: [
|
|
694
|
-
|
|
695
|
-
require.resolve('@tamagui/babel-plugin-fully-specified'),
|
|
696
|
-
{
|
|
697
|
-
ensureFileExists: {
|
|
698
|
-
forceExtension: '.mjs',
|
|
699
|
-
},
|
|
700
|
-
esExtensionDefault: '.mjs',
|
|
701
|
-
tryExtensions: ['.js'],
|
|
702
|
-
esExtensions: ['.mjs'],
|
|
703
|
-
},
|
|
704
|
-
],
|
|
690
|
+
require.resolve('@tamagui/babel-plugin-fully-specified'),
|
|
705
691
|
// pkg.tamagui?.build?.skipEnvToMeta
|
|
706
692
|
// ? null
|
|
707
693
|
// : require.resolve('./babel-plugin-process-env-to-meta'),
|
|
@@ -715,6 +701,10 @@ async function esbuildWriteIfChanged(
|
|
|
715
701
|
(result.map ? `\n//# sourceMappingURL=${basename(mjsOutPath)}.map\n` : ''),
|
|
716
702
|
'utf8'
|
|
717
703
|
)
|
|
704
|
+
|
|
705
|
+
cleanupNonMjsFiles.push(outPath)
|
|
706
|
+
cleanupNonMjsFiles.push(outPath + '.map')
|
|
707
|
+
|
|
718
708
|
if (result.map) {
|
|
719
709
|
await fs.writeFile(mjsOutPath + '.map', JSON.stringify(result.map), 'utf8')
|
|
720
710
|
}
|
|
@@ -722,4 +712,15 @@ async function esbuildWriteIfChanged(
|
|
|
722
712
|
})()
|
|
723
713
|
})
|
|
724
714
|
)
|
|
715
|
+
|
|
716
|
+
// if we do mjs we should remove js after to avoid bloat
|
|
717
|
+
if (process.env.TAMAGUI_BUILD_REMOVE_ESM_JS_FILES) {
|
|
718
|
+
if (cleanupNonMjsFiles.length) {
|
|
719
|
+
await Promise.all(
|
|
720
|
+
cleanupNonMjsFiles.map(async (file) => {
|
|
721
|
+
await fs.remove(file)
|
|
722
|
+
})
|
|
723
|
+
)
|
|
724
|
+
}
|
|
725
|
+
}
|
|
725
726
|
}
|