@tamagui/build 1.135.7 → 1.136.1
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 +12 -12
- package/package.json +2 -2
- package/pretty-print-errors.js +130 -0
- package/tamagui-build.js +10 -10
package/.turbo/turbo-test.log
CHANGED
|
@@ -2,26 +2,26 @@
|
|
|
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 64 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 349 ms
|
|
11
11
|
|
|
12
12
|
Rebuild after file modification complete
|
|
13
13
|
|
|
14
|
-
[32m✓[39m __tests__/integration.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m
|
|
15
|
-
[33m[2m✓[22m[39m should build the package correctly [33m
|
|
16
|
-
[33m[2m✓[22m[39m should bundle the package correctly [33m
|
|
17
|
-
[33m[2m✓[22m[39m should skip mjs files when --skip-mjs is used [33m
|
|
18
|
-
[33m[2m✓[22m[39m should ignore base URL when --ignore-base-url is used [33m
|
|
19
|
-
[33m[2m✓[22m[39m should rebuild the package on file change when --watch is used [33m
|
|
20
|
-
[33m[2m✓[22m[39m should generate correct platform-specific output [33m
|
|
21
|
-
[33m[2m✓[22m[39m should minify the output when MINIFY=true is set [33m
|
|
14
|
+
[32m✓[39m __tests__/integration.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 10037[2mms[22m[39m
|
|
15
|
+
[33m[2m✓[22m[39m should build the package correctly [33m 1451[2mms[22m[39m
|
|
16
|
+
[33m[2m✓[22m[39m should bundle the package correctly [33m 1172[2mms[22m[39m
|
|
17
|
+
[33m[2m✓[22m[39m should skip mjs files when --skip-mjs is used [33m 1266[2mms[22m[39m
|
|
18
|
+
[33m[2m✓[22m[39m should ignore base URL when --ignore-base-url is used [33m 1160[2mms[22m[39m
|
|
19
|
+
[33m[2m✓[22m[39m should rebuild the package on file change when --watch is used [33m 1350[2mms[22m[39m
|
|
20
|
+
[33m[2m✓[22m[39m should generate correct platform-specific output [33m 1222[2mms[22m[39m
|
|
21
|
+
[33m[2m✓[22m[39m should minify the output when MINIFY=true is set [33m 2396[2mms[22m[39m
|
|
22
22
|
|
|
23
23
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
24
24
|
[2m Tests [22m [1m[32m7 passed[39m[22m[90m (7)[39m
|
|
25
|
-
[2m Start at [22m
|
|
26
|
-
[2m Duration [22m
|
|
25
|
+
[2m Start at [22m 16:45:26
|
|
26
|
+
[2m Duration [22m 10.14s[2m (transform 36ms, setup 0ms, collect 41ms, tests 10.04s, 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.
|
|
3
|
+
"version": "1.136.1",
|
|
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.14.0",
|
|
17
|
-
"@tamagui/babel-plugin-fully-specified": "1.
|
|
17
|
+
"@tamagui/babel-plugin-fully-specified": "1.136.1",
|
|
18
18
|
"@types/fs-extra": "^9.0.13",
|
|
19
19
|
"chokidar": "^3.5.2",
|
|
20
20
|
"esbuild": "^0.25.11",
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pretty print TypeScript diagnostics with file location and error codes
|
|
5
|
+
* @param {import('typescript').Diagnostic[]} diagnostics
|
|
6
|
+
* @param {import('typescript')} ts
|
|
7
|
+
*/
|
|
8
|
+
function printTypescriptDiagnostics(diagnostics, ts) {
|
|
9
|
+
console.error('\n❌ TypeScript compilation errors:\n')
|
|
10
|
+
|
|
11
|
+
diagnostics.forEach((diagnostic) => {
|
|
12
|
+
const messageText =
|
|
13
|
+
typeof diagnostic.messageText === 'string'
|
|
14
|
+
? diagnostic.messageText
|
|
15
|
+
: diagnostic.messageText?.messageText || JSON.stringify(diagnostic.messageText)
|
|
16
|
+
|
|
17
|
+
if (diagnostic.file && diagnostic.start !== undefined) {
|
|
18
|
+
const { line, character } = ts.getLineAndCharacterOfPosition(
|
|
19
|
+
diagnostic.file,
|
|
20
|
+
diagnostic.start
|
|
21
|
+
)
|
|
22
|
+
console.error(
|
|
23
|
+
` ${diagnostic.file.fileName}:${line + 1}:${character + 1} - error TS${diagnostic.code}: ${messageText}`
|
|
24
|
+
)
|
|
25
|
+
} else {
|
|
26
|
+
console.error(` error TS${diagnostic.code}: ${messageText}`)
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
console.error('')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Pretty print esbuild errors with file location and code snippets
|
|
35
|
+
* @param {Error & { errors?: any[], warnings?: any[] }} err
|
|
36
|
+
*/
|
|
37
|
+
function printEsbuildError(err) {
|
|
38
|
+
console.error('\n❌ Build error:\n')
|
|
39
|
+
|
|
40
|
+
// esbuild errors have a formatted message that's much more readable
|
|
41
|
+
if (err.errors && err.errors.length > 0) {
|
|
42
|
+
err.errors.forEach((error) => {
|
|
43
|
+
if (error.location) {
|
|
44
|
+
console.error(
|
|
45
|
+
` ${error.location.file}:${error.location.line}:${error.location.column}: ${error.text}`
|
|
46
|
+
)
|
|
47
|
+
if (error.location.lineText) {
|
|
48
|
+
console.error(` ${error.location.lineText}`)
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
console.error(` ${error.text}`)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
} else {
|
|
55
|
+
// Fallback for non-esbuild errors
|
|
56
|
+
console.error(err.message || err)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (err.warnings && err.warnings.length > 0) {
|
|
60
|
+
console.error('\n⚠️ Warnings:\n')
|
|
61
|
+
err.warnings.forEach((warning) => {
|
|
62
|
+
if (warning.location) {
|
|
63
|
+
console.error(
|
|
64
|
+
` ${warning.location.file}:${warning.location.line}:${warning.location.column}: ${warning.text}`
|
|
65
|
+
)
|
|
66
|
+
} else {
|
|
67
|
+
console.error(` ${warning.text}`)
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
console.error('')
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Pretty print general build errors with stack traces
|
|
77
|
+
* @param {Error} error
|
|
78
|
+
* @param {string} packageName
|
|
79
|
+
* @param {string} cwd
|
|
80
|
+
*/
|
|
81
|
+
function printBuildError(error, packageName, cwd) {
|
|
82
|
+
console.error(`\n❌ Error building ${packageName} in ${cwd}:\n`)
|
|
83
|
+
|
|
84
|
+
if (error.stack) {
|
|
85
|
+
// Show a more readable error with the stack trace
|
|
86
|
+
const lines = error.stack.split('\n')
|
|
87
|
+
console.error(` ${lines[0]}`) // The error message
|
|
88
|
+
if (lines.length > 1) {
|
|
89
|
+
console.error('\nStack trace:')
|
|
90
|
+
lines.slice(1, 6).forEach((line) => console.error(` ${line.trim()}`))
|
|
91
|
+
if (lines.length > 6) {
|
|
92
|
+
console.error(` ... and ${lines.length - 6} more`)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
console.error(` ${error.message || error}`)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
console.error('')
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Pretty print TypeScript compilation errors (network, config, etc)
|
|
104
|
+
* @param {Error & { code?: string }} err
|
|
105
|
+
* @param {string} packageName
|
|
106
|
+
*/
|
|
107
|
+
function printTypescriptCompilationError(err, packageName) {
|
|
108
|
+
console.error(`\n❌ Error during TypeScript compilation for ${packageName}:\n`)
|
|
109
|
+
|
|
110
|
+
if (err.code === 'ENOTFOUND' || err.code === 'ECONNREFUSED') {
|
|
111
|
+
console.error(` Network error: ${err.message}`)
|
|
112
|
+
} else if (err.message) {
|
|
113
|
+
console.error(` ${err.message}`)
|
|
114
|
+
if (err.stack && process.env.DEBUG) {
|
|
115
|
+
console.error('\nStack trace (DEBUG mode):')
|
|
116
|
+
err.stack.split('\n').slice(1, 6).forEach((line) => console.error(` ${line.trim()}`))
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
console.error(` ${err}`)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
console.error('')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
module.exports = {
|
|
126
|
+
printTypescriptDiagnostics,
|
|
127
|
+
printEsbuildError,
|
|
128
|
+
printBuildError,
|
|
129
|
+
printTypescriptCompilationError,
|
|
130
|
+
}
|
package/tamagui-build.js
CHANGED
|
@@ -13,6 +13,12 @@ const { es5Plugin } = require('./esbuild-es5')
|
|
|
13
13
|
const ts = require('typescript')
|
|
14
14
|
const path = require('node:path')
|
|
15
15
|
const childProcess = require('node:child_process')
|
|
16
|
+
const {
|
|
17
|
+
printTypescriptDiagnostics,
|
|
18
|
+
printEsbuildError,
|
|
19
|
+
printBuildError,
|
|
20
|
+
printTypescriptCompilationError,
|
|
21
|
+
} = require('./pretty-print-errors')
|
|
16
22
|
|
|
17
23
|
const jsOnly = !!process.env.JS_ONLY
|
|
18
24
|
const skipJS = !!(process.env.SKIP_JS || false)
|
|
@@ -178,7 +184,7 @@ async function build({ skipTypes } = {}) {
|
|
|
178
184
|
// Run afterBuild script if defined
|
|
179
185
|
await runAfterBuild()
|
|
180
186
|
} catch (error) {
|
|
181
|
-
|
|
187
|
+
printBuildError(error, pkg.name, process.cwd())
|
|
182
188
|
if (!shouldWatch) {
|
|
183
189
|
process.exit(1)
|
|
184
190
|
}
|
|
@@ -267,9 +273,7 @@ async function buildTsc(allFiles) {
|
|
|
267
273
|
|
|
268
274
|
// exit on errors
|
|
269
275
|
if (diagnostics.some((x) => x.code) && !shouldWatch) {
|
|
270
|
-
|
|
271
|
-
`Error building: ${diagnostics.map((x) => JSON.stringify(x.messageText)).join('\n')}`
|
|
272
|
-
)
|
|
276
|
+
printTypescriptDiagnostics(diagnostics, ts)
|
|
273
277
|
if (shouldWatch) {
|
|
274
278
|
return
|
|
275
279
|
}
|
|
@@ -282,11 +286,7 @@ async function buildTsc(allFiles) {
|
|
|
282
286
|
throw new Error('TypeScript compilation failed')
|
|
283
287
|
}
|
|
284
288
|
} catch (err) {
|
|
285
|
-
|
|
286
|
-
console.error(`Network error during compilation for ${pkg.name}:`, err.message)
|
|
287
|
-
} else {
|
|
288
|
-
console.error(`Error during TypeScript compilation for ${pkg.name}:`, err)
|
|
289
|
-
}
|
|
289
|
+
printTypescriptCompilationError(err, pkg.name)
|
|
290
290
|
if (!shouldWatch) {
|
|
291
291
|
process.exit(1)
|
|
292
292
|
}
|
|
@@ -653,7 +653,7 @@ async function esbuildWriteIfChanged(
|
|
|
653
653
|
try {
|
|
654
654
|
built = await esbuild.build(buildSettings)
|
|
655
655
|
} catch (err) {
|
|
656
|
-
|
|
656
|
+
printEsbuildError(err)
|
|
657
657
|
if (!shouldWatch) {
|
|
658
658
|
process.exit(1)
|
|
659
659
|
}
|