@tamagui/build 1.123.0 → 1.123.2

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/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  A small, opinionated build script for libraries that target both React Native and React web.
4
4
 
5
+ Path-specific extensions are the only way to support ESM. Bundlers used to be flexible and configure this for you, but to conform to spec your import must specify the full file path now, and not leave out the extension. This is trouble for React Native which has platform file extensions.
6
+
7
+ We wanted to build packages so we didn't have to deal with all this fuss. What it does, is builds out `.native` and `.web` versions of every file. It then does some transforms to each to support a wide variety of setups - Metro, Vite, modern Node, etc.
8
+
9
+ The one limitation for now is it doesn't support .ios and .android platform-specifics at least for platform-specific imports. It does output non-specific versions for Metro/older node, so it'll work there.
10
+
5
11
  It has a few features that make it useful for "universal" libraries:
6
12
 
7
13
  - uses tsc to output declaration files to `./types`
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamagui-build-test-simple-tpackage",
3
- "version": "1.123.0",
3
+ "version": "1.123.2",
4
4
  "main": "dist/cjs",
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.123.0",
19
+ "@tamagui/build": "1.123.2",
20
20
  "typescript": "^5.7.2"
21
21
  }
22
22
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamagui-build-test-watch-package",
3
- "version": "1.123.0",
3
+ "version": "1.123.2",
4
4
  "main": "dist/cjs",
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.123.0",
19
+ "@tamagui/build": "1.123.2",
20
20
  "typescript": "^5.7.2"
21
21
  }
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.123.0",
3
+ "version": "1.123.2",
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.123.0",
17
+ "@tamagui/babel-plugin-fully-specified": "1.123.2",
18
18
  "@types/fs-extra": "^9.0.13",
19
19
  "chokidar": "^3.5.2",
20
20
  "esbuild": "^0.24.2",
package/tamagui-build.js CHANGED
@@ -659,14 +659,16 @@ async function esbuildWriteIfChanged(
659
659
  return
660
660
  }
661
661
 
662
- const nativeFilesMap = Object.fromEntries(
663
- built.outputFiles.flatMap((p) => {
664
- if (p.path.includes('.native.js')) {
665
- return [[p.path, true]]
666
- }
667
- return []
668
- })
669
- )
662
+ const nativeFilesMap = {}
663
+ const webFilesMap = {}
664
+
665
+ for (const p of built.outputFiles) {
666
+ if (p.path.includes('.native.js')) {
667
+ nativeFilesMap[p.path] = true
668
+ } else if (p.path.includes('.web.js')) {
669
+ webFilesMap[p.path] = true
670
+ }
671
+ }
670
672
 
671
673
  const cleanupNonMjsFiles = []
672
674
 
@@ -705,6 +707,7 @@ async function esbuildWriteIfChanged(
705
707
  if (extPlatform === 'web') {
706
708
  return
707
709
  }
710
+
708
711
  if (!extPlatform) {
709
712
  path = path.replace('.js', '.native.js')
710
713
  }
@@ -718,6 +721,15 @@ async function esbuildWriteIfChanged(
718
721
  ) {
719
722
  return
720
723
  }
724
+ if (extPlatform === 'web') {
725
+ // we move web to just .js
726
+ path = path.replace('.web.js', '.js')
727
+ }
728
+ const webSpecific = webFilesMap[path.replace('.js', '.web.js')]
729
+ if (!extPlatform && webSpecific) {
730
+ // swap into the non-web exntesion
731
+ return
732
+ }
721
733
  }
722
734
  }
723
735