@tamagui/build 1.0.0-alpha.22 → 1.0.0-alpha.37
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/.ultra.cache.json +1 -1
- package/package.json +2 -2
- package/tamagui-build.js +27 -71
package/.ultra.cache.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":{"node_modules":"1637314740088.0405","externalNodePlugin.js":"fa1cd57f4fb8bc9a8c7ea03adaabc309b322ae0b","package.json":"
|
|
1
|
+
{"files":{"node_modules":"1637314740088.0405","externalNodePlugin.js":"fa1cd57f4fb8bc9a8c7ea03adaabc309b322ae0b","package.json":"fb165ce522eeadc07d26aaefe482ed150d24db77","tamagui-build.js":"f7359459f24a3c821cd8a09dcec25aaae0e6bc76","tsconfig.json":"9862a02e4684884dd8a070c3b58132d338d0ca79"},"deps":{}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/build",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.37",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tamagui-build": "tamagui-build.js"
|
|
6
6
|
},
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/fs-extra": "^9.0.13"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "c6357d6e6108b437bb055dad0eae51cd55190143"
|
|
27
27
|
}
|
package/tamagui-build.js
CHANGED
|
@@ -8,12 +8,14 @@ const fg = require('fast-glob')
|
|
|
8
8
|
const createExternalPlugin = require('./externalNodePlugin')
|
|
9
9
|
const path = require('path')
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const jsOnly = !!process.env.JS_ONLY
|
|
12
|
+
const skipJS = !!(process.env.SKIP_JS || false)
|
|
13
|
+
const shouldSkipTypes = !!(process.argv.includes('skip-types') || process.env.SKIP_TYPES)
|
|
13
14
|
const shouldWatch = process.argv.includes('--watch')
|
|
14
15
|
|
|
16
|
+
let shouldSkipInitialTypes = !!process.env.SKIP_TYPES_INITIAL
|
|
17
|
+
|
|
15
18
|
const pkg = fs.readJSONSync('./package.json')
|
|
16
|
-
const pkgSource = pkg.source || 'src/index.ts'
|
|
17
19
|
const pkgMain = pkg.main
|
|
18
20
|
const pkgModule = pkg.module
|
|
19
21
|
|
|
@@ -29,7 +31,12 @@ async function build() {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
async function buildTsc() {
|
|
32
|
-
if (
|
|
34
|
+
if (jsOnly || shouldSkipTypes) return
|
|
35
|
+
if (shouldSkipInitialTypes) {
|
|
36
|
+
shouldSkipInitialTypes = false
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
// NOTE:
|
|
34
41
|
// for Intellisense to work in monorepo you need baseUrl: "../.."
|
|
35
42
|
// but to build things nicely we need here to reset a few things:
|
|
@@ -105,7 +112,7 @@ async function build() {
|
|
|
105
112
|
entryPoints: files,
|
|
106
113
|
outdir: 'dist/esm',
|
|
107
114
|
sourcemap: true,
|
|
108
|
-
target: '
|
|
115
|
+
target: 'es2019',
|
|
109
116
|
keepNames: true,
|
|
110
117
|
format: 'esm',
|
|
111
118
|
color: true,
|
|
@@ -124,7 +131,7 @@ async function build() {
|
|
|
124
131
|
outdir: 'dist/jsx',
|
|
125
132
|
entryPoints: files,
|
|
126
133
|
sourcemap: false,
|
|
127
|
-
target: '
|
|
134
|
+
target: 'es2019',
|
|
128
135
|
keepNames: true,
|
|
129
136
|
format: 'esm',
|
|
130
137
|
color: true,
|
|
@@ -148,72 +155,21 @@ if (shouldWatch) {
|
|
|
148
155
|
const path = require('path')
|
|
149
156
|
process.env.IS_WATCHING = true
|
|
150
157
|
process.env.DISABLE_AUTORUN = true
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
...new Set([...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {})]),
|
|
155
|
-
]
|
|
156
|
-
.filter(Boolean)
|
|
157
|
-
.filter((x) => x.includes(`tamagui`))
|
|
158
|
-
|
|
159
|
-
const watchDirs = [
|
|
160
|
-
'src',
|
|
161
|
-
...deps.flatMap((d) => {
|
|
162
|
-
try {
|
|
163
|
-
return path.dirname(require.resolve(d))
|
|
164
|
-
} catch {
|
|
165
|
-
const potentialDir = path.join('..', d.replace('@tamagui/', '') + '/dist')
|
|
166
|
-
if (fs.existsSync(potentialDir)) {
|
|
167
|
-
return potentialDir
|
|
168
|
-
}
|
|
169
|
-
return []
|
|
170
|
-
}
|
|
171
|
-
}),
|
|
172
|
-
]
|
|
173
|
-
|
|
174
|
-
for (const dir of watchDirs) {
|
|
175
|
-
if (dir === 'src') {
|
|
176
|
-
build().then(() => doWatch())
|
|
177
|
-
} else {
|
|
178
|
-
doWatch()
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const watchSize = {}
|
|
182
|
-
function doWatch() {
|
|
183
|
-
const finish = (event, path, stats) => {
|
|
184
|
-
if (dir === 'src' || (stats && stats.size != watchSize[path])) {
|
|
185
|
-
if (stats) watchSize[path] = stats.size
|
|
186
|
-
console.log('watch build', dir)
|
|
187
|
-
build()
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const chokidar = require('chokidar')
|
|
192
|
-
chokidar
|
|
193
|
-
// prevent infinite loop but cause race condition if you just build directly
|
|
194
|
-
.watch(dir, {
|
|
195
|
-
persistent: true,
|
|
196
|
-
alwaysStat: true,
|
|
197
|
-
ignoreInitial: true,
|
|
198
|
-
})
|
|
199
|
-
.on('change', finish)
|
|
200
|
-
.on('add', finish)
|
|
158
|
+
build().then(() => {
|
|
159
|
+
const finish = (_, path, stats) => {
|
|
160
|
+
build()
|
|
201
161
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
162
|
+
const chokidar = require('chokidar')
|
|
163
|
+
chokidar
|
|
164
|
+
// prevent infinite loop but cause race condition if you just build directly
|
|
165
|
+
.watch('src', {
|
|
166
|
+
persistent: true,
|
|
167
|
+
alwaysStat: true,
|
|
168
|
+
ignoreInitial: true,
|
|
169
|
+
})
|
|
170
|
+
.on('change', finish)
|
|
171
|
+
.on('add', finish)
|
|
172
|
+
})
|
|
207
173
|
} else {
|
|
208
|
-
process.on('uncaughtException', console.log.bind(console))
|
|
209
|
-
process.on('unhandledRejection', console.log.bind(console))
|
|
210
174
|
build()
|
|
211
175
|
}
|
|
212
|
-
|
|
213
|
-
function debounce(callback, wait) {
|
|
214
|
-
let timer
|
|
215
|
-
return (...args) => {
|
|
216
|
-
clearTimeout(timer)
|
|
217
|
-
timer = setTimeout(() => callback(...args), wait)
|
|
218
|
-
}
|
|
219
|
-
}
|