@tamagui/build 1.112.0 → 1.112.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.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Nate Wienert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamagui-build-test-simple-tpackage",
|
|
3
|
-
"version": "1.112.
|
|
4
|
-
"main": "dist/cjs
|
|
3
|
+
"version": "1.112.1",
|
|
4
|
+
"main": "dist/cjs",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -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.112.
|
|
19
|
+
"@tamagui/build": "1.112.1",
|
|
20
20
|
"typescript": "^5.5.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Nate Wienert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamagui-build-test-watch-package",
|
|
3
|
-
"version": "1.112.
|
|
4
|
-
"main": "dist/cjs
|
|
3
|
+
"version": "1.112.1",
|
|
4
|
+
"main": "dist/cjs",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -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.112.
|
|
19
|
+
"@tamagui/build": "1.112.1",
|
|
20
20
|
"typescript": "^5.5.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/build",
|
|
3
|
-
"version": "1.112.
|
|
3
|
+
"version": "1.112.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.7.21",
|
|
17
|
-
"@tamagui/babel-plugin-fully-specified": "1.112.
|
|
17
|
+
"@tamagui/babel-plugin-fully-specified": "1.112.1",
|
|
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
|
@@ -19,7 +19,7 @@ const shouldSkipTypes = !!(
|
|
|
19
19
|
process.argv.includes('--skip-types') || process.env.SKIP_TYPES
|
|
20
20
|
)
|
|
21
21
|
const shouldSkipMJS = !!process.argv.includes('--skip-mjs')
|
|
22
|
-
const
|
|
22
|
+
const shouldBundleFlag = !!process.argv.includes('--bundle')
|
|
23
23
|
const shouldBundleNodeModules = !!process.argv.includes('--bundle-modules')
|
|
24
24
|
const shouldClean = !!process.argv.includes('clean')
|
|
25
25
|
const shouldCleanBuildOnly = !!process.argv.includes('clean:build')
|
|
@@ -271,17 +271,26 @@ async function buildJs() {
|
|
|
271
271
|
return
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
const files = shouldBundle
|
|
275
|
-
? [pkgSource || './src/index.ts']
|
|
276
|
-
: (await fg(['src/**/*.(m)?[jt]s(x)?', 'src/**/*.css'])).filter(
|
|
277
|
-
(x) => !x.includes('.d.ts') && (exclude ? !x.match(exclude) : true)
|
|
278
|
-
)
|
|
279
|
-
|
|
280
274
|
const externalPlugin = createExternalPlugin({
|
|
281
275
|
skipNodeModulesBundle: true,
|
|
282
276
|
})
|
|
283
277
|
|
|
284
|
-
const
|
|
278
|
+
const bundlePlugin = {
|
|
279
|
+
name: `external-most-modules`,
|
|
280
|
+
setup(build) {
|
|
281
|
+
build.onResolve({ filter: /.*/ }, (args) => {
|
|
282
|
+
if (
|
|
283
|
+
!args.path.startsWith('.') &&
|
|
284
|
+
!args.path.startsWith('/') &&
|
|
285
|
+
!args.path.startsWith('node:')
|
|
286
|
+
) {
|
|
287
|
+
return { external: /^(esbuild|mdx-bundler)$/.test(args.path) }
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
},
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const external = shouldBundleFlag ? ['@swc/*', '*.node'] : undefined
|
|
285
294
|
|
|
286
295
|
/** @type { import('esbuild').BuildOptions } */
|
|
287
296
|
const esbuildBundleProps =
|
|
@@ -341,24 +350,36 @@ async function buildJs() {
|
|
|
341
350
|
|
|
342
351
|
const start = Date.now()
|
|
343
352
|
|
|
353
|
+
const allFiles = (await fg(['src/**/*.(m)?[jt]s(x)?', 'src/**/*.css'])).filter(
|
|
354
|
+
(x) => !x.includes('.d.ts') && (exclude ? !x.match(exclude) : true)
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
const entryPoints = shouldBundleFlag ? [pkgSource || './src/index.ts'] : allFiles
|
|
358
|
+
|
|
344
359
|
const cjsConfig = {
|
|
345
360
|
format: 'cjs',
|
|
346
|
-
entryPoints
|
|
361
|
+
entryPoints,
|
|
347
362
|
outdir: flatOut ? 'dist' : 'dist/cjs',
|
|
348
|
-
bundle:
|
|
363
|
+
bundle: shouldBundleFlag,
|
|
349
364
|
external,
|
|
350
|
-
plugins: shouldBundleNodeModules ? [] : [externalPlugin],
|
|
365
|
+
plugins: shouldBundleNodeModules ? [bundlePlugin] : [externalPlugin],
|
|
351
366
|
minify: !!process.env.MINIFY,
|
|
352
367
|
platform: 'node',
|
|
353
368
|
}
|
|
354
369
|
|
|
370
|
+
const cjsConfigWeb = {
|
|
371
|
+
...cjsConfig,
|
|
372
|
+
|
|
373
|
+
// metro cant do platform-specific with cjs :/
|
|
374
|
+
// outExtension: { '.js': '.cjs' },
|
|
375
|
+
}
|
|
376
|
+
|
|
355
377
|
const esmConfig = {
|
|
356
378
|
target: 'esnext',
|
|
357
379
|
format: 'esm',
|
|
358
|
-
entryPoints
|
|
380
|
+
entryPoints,
|
|
381
|
+
bundle: shouldBundleFlag,
|
|
359
382
|
outdir: flatOut ? 'dist' : 'dist/esm',
|
|
360
|
-
bundle: shouldBundle,
|
|
361
|
-
external,
|
|
362
383
|
allowOverwrite: true,
|
|
363
384
|
minify: !!process.env.MINIFY,
|
|
364
385
|
}
|
|
@@ -379,8 +400,10 @@ async function buildJs() {
|
|
|
379
400
|
return await Promise.all([
|
|
380
401
|
// web output to cjs
|
|
381
402
|
pkgMain
|
|
382
|
-
? esbuildWriteIfChanged(
|
|
403
|
+
? esbuildWriteIfChanged(cjsConfigWeb, {
|
|
383
404
|
platform: 'web',
|
|
405
|
+
bundle: shouldBundleFlag,
|
|
406
|
+
// specifyCJS: true,
|
|
384
407
|
})
|
|
385
408
|
: null,
|
|
386
409
|
|
|
@@ -422,6 +445,7 @@ async function buildJs() {
|
|
|
422
445
|
pkgModule
|
|
423
446
|
? esbuildWriteIfChanged(esmConfig, {
|
|
424
447
|
platform: 'web',
|
|
448
|
+
bundle: shouldBundleFlag,
|
|
425
449
|
})
|
|
426
450
|
: null,
|
|
427
451
|
|
|
@@ -439,8 +463,8 @@ async function buildJs() {
|
|
|
439
463
|
// only diff is jsx preserve and outdir
|
|
440
464
|
jsx: 'preserve',
|
|
441
465
|
outdir: flatOut ? 'dist' : 'dist/jsx',
|
|
442
|
-
entryPoints
|
|
443
|
-
bundle:
|
|
466
|
+
entryPoints,
|
|
467
|
+
bundle: shouldBundleFlag,
|
|
444
468
|
allowOverwrite: true,
|
|
445
469
|
target: 'esnext',
|
|
446
470
|
format: 'esm',
|
|
@@ -460,8 +484,8 @@ async function buildJs() {
|
|
|
460
484
|
// only diff is jsx preserve and outdir
|
|
461
485
|
jsx: 'preserve',
|
|
462
486
|
outdir: flatOut ? 'dist' : 'dist/jsx',
|
|
463
|
-
entryPoints
|
|
464
|
-
bundle:
|
|
487
|
+
entryPoints,
|
|
488
|
+
bundle: shouldBundleFlag,
|
|
465
489
|
allowOverwrite: true,
|
|
466
490
|
target: 'node16',
|
|
467
491
|
format: 'esm',
|
|
@@ -486,13 +510,14 @@ async function buildJs() {
|
|
|
486
510
|
async function esbuildWriteIfChanged(
|
|
487
511
|
/** @type { import('esbuild').BuildOptions } */
|
|
488
512
|
opts,
|
|
489
|
-
{ platform, env } = {
|
|
513
|
+
{ platform, env, specifyCJS } = {
|
|
490
514
|
platform: '',
|
|
515
|
+
specifyCJS: false,
|
|
491
516
|
env: '',
|
|
492
517
|
}
|
|
493
518
|
) {
|
|
494
|
-
if (!
|
|
495
|
-
|
|
519
|
+
if (!platform) {
|
|
520
|
+
throw new Error(`Must provide platform of web or native`)
|
|
496
521
|
}
|
|
497
522
|
|
|
498
523
|
const isESM = opts.target === 'esm' || opts.target === 'esnext'
|
|
@@ -513,7 +538,7 @@ async function esbuildWriteIfChanged(
|
|
|
513
538
|
const webEsbuildSettings = {
|
|
514
539
|
target: 'esnext',
|
|
515
540
|
jsx: 'automatic',
|
|
516
|
-
platform:
|
|
541
|
+
platform: opts.bundle ? 'node' : 'neutral',
|
|
517
542
|
tsconfigRaw: {
|
|
518
543
|
compilerOptions: {
|
|
519
544
|
paths: {
|
|
@@ -674,6 +699,32 @@ async function esbuildWriteIfChanged(
|
|
|
674
699
|
|
|
675
700
|
// path specifics:
|
|
676
701
|
|
|
702
|
+
if (specifyCJS) {
|
|
703
|
+
await Promise.all(
|
|
704
|
+
outputs.map(async (file) => {
|
|
705
|
+
if (!file) return
|
|
706
|
+
|
|
707
|
+
const { path, contents } = file
|
|
708
|
+
|
|
709
|
+
if (!path.endsWith('.cjs')) return
|
|
710
|
+
|
|
711
|
+
const result = opts.bundle
|
|
712
|
+
? { code: contents }
|
|
713
|
+
: transform(contents, {
|
|
714
|
+
filename: path,
|
|
715
|
+
configFile: false,
|
|
716
|
+
sourceMap: true,
|
|
717
|
+
plugins: [
|
|
718
|
+
require.resolve('@tamagui/babel-plugin-fully-specified/commonjs'),
|
|
719
|
+
].filter(Boolean),
|
|
720
|
+
})
|
|
721
|
+
|
|
722
|
+
await FSE.writeFile(path, result.code)
|
|
723
|
+
})
|
|
724
|
+
)
|
|
725
|
+
return
|
|
726
|
+
}
|
|
727
|
+
|
|
677
728
|
if (shouldSkipMJS || !isESM) {
|
|
678
729
|
return
|
|
679
730
|
}
|
|
@@ -691,7 +742,7 @@ async function esbuildWriteIfChanged(
|
|
|
691
742
|
|
|
692
743
|
// if bundling no need to specify as its all internal
|
|
693
744
|
// and babel is bad on huge bundled files
|
|
694
|
-
const result =
|
|
745
|
+
const result = opts.bundle
|
|
695
746
|
? { code: contents }
|
|
696
747
|
: transform(contents, {
|
|
697
748
|
filename: mjsOutPath,
|