@tamagui/build 1.84.2 → 1.85.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/package.json +1 -1
- package/tamagui-build.js +30 -27
package/package.json
CHANGED
package/tamagui-build.js
CHANGED
|
@@ -41,7 +41,8 @@ const bundleNative = pkg.tamagui?.['bundle.native']
|
|
|
41
41
|
const bundleNativeTest = pkg.tamagui?.['bundle.native.test']
|
|
42
42
|
const pkgModule = pkg.module
|
|
43
43
|
const pkgModuleJSX = pkg['module:jsx']
|
|
44
|
-
const pkgTypes = Boolean(pkg
|
|
44
|
+
const pkgTypes = Boolean(pkg.types || pkg.typings)
|
|
45
|
+
const pkgRemoveSideEffects = pkg.removeSideEffects || false
|
|
45
46
|
|
|
46
47
|
const flatOut = [pkgMain, pkgModule, pkgModuleJSX].filter(Boolean).length === 1
|
|
47
48
|
|
|
@@ -86,34 +87,32 @@ if (shouldClean || shouldCleanBuildOnly) {
|
|
|
86
87
|
clean().then(() => {
|
|
87
88
|
process.exit(0)
|
|
88
89
|
})
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
build({
|
|
100
|
-
skipTypes: true,
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
chokidar
|
|
104
|
-
// prevent infinite loop but cause race condition if you just build directly
|
|
105
|
-
.watch('src', {
|
|
106
|
-
persistent: true,
|
|
107
|
-
alwaysStat: true,
|
|
108
|
-
ignoreInitial: true,
|
|
90
|
+
} else {
|
|
91
|
+
if (shouldWatch) {
|
|
92
|
+
process.env.IS_WATCHING = true
|
|
93
|
+
process.env.DISABLE_AUTORUN = true
|
|
94
|
+
const rebuild = debounce(build, 100)
|
|
95
|
+
const chokidar = require('chokidar')
|
|
96
|
+
|
|
97
|
+
// do one js build but not types
|
|
98
|
+
build({
|
|
99
|
+
skipTypes: true,
|
|
109
100
|
})
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
|
|
102
|
+
chokidar
|
|
103
|
+
// prevent infinite loop but cause race condition if you just build directly
|
|
104
|
+
.watch('src', {
|
|
105
|
+
persistent: true,
|
|
106
|
+
alwaysStat: true,
|
|
107
|
+
ignoreInitial: true,
|
|
108
|
+
})
|
|
109
|
+
.on('change', rebuild)
|
|
110
|
+
.on('add', rebuild)
|
|
111
|
+
} else {
|
|
112
|
+
build()
|
|
113
|
+
}
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
build()
|
|
116
|
-
|
|
117
116
|
async function build({ skipTypes } = {}) {
|
|
118
117
|
if (process.env.DEBUG) console.info('🔹', pkg.name)
|
|
119
118
|
try {
|
|
@@ -178,7 +177,7 @@ async function buildJs() {
|
|
|
178
177
|
return
|
|
179
178
|
}
|
|
180
179
|
|
|
181
|
-
|
|
180
|
+
const files = shouldBundle
|
|
182
181
|
? [pkgSource || './src/index.ts']
|
|
183
182
|
: (await fg(['src/**/*.(m)?[jt]s(x)?', 'src/**/*.css'])).filter(
|
|
184
183
|
(x) => !x.includes('.d.ts')
|
|
@@ -509,6 +508,10 @@ async function esbuildWriteIfChanged(
|
|
|
509
508
|
}
|
|
510
509
|
}
|
|
511
510
|
|
|
511
|
+
if (pkgRemoveSideEffects && opts.format === 'esm') {
|
|
512
|
+
outString = outString.replace(/\nimport "[^"]+";\n/g, '\n')
|
|
513
|
+
}
|
|
514
|
+
|
|
512
515
|
if (shouldWatch) {
|
|
513
516
|
if (
|
|
514
517
|
!(await fs.pathExists(outPath)) ||
|