@tamagui/build 1.143.0 → 2.0.0-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.
@@ -1,27 +1,27 @@
1
1
 
2
-  RUN  v4.0.4 /Users/n8/tamagui/code/packages/build
2
+  RUN  v4.0.4 /Users/n8/tamagui2/code/packages/build
3
3
 
4
4
  stdout | __tests__/integration.test.ts > tamagui-build integration test > should rebuild the package on file change when --watch is used
5
- Watch process output: built tamagui-build-test-watch-package in 83 ms
5
+ Watch process output: built tamagui-build-test-watch-package in 69 ms
6
6
 
7
7
  Initial build complete, modifying file...
8
8
 
9
9
  stdout | __tests__/integration.test.ts > tamagui-build integration test > should rebuild the package on file change when --watch is used
10
- Watch process output: built tamagui-build-test-watch-package in 360 ms
10
+ Watch process output: built tamagui-build-test-watch-package in 329 ms
11
11
 
12
12
  Rebuild after file modification complete
13
13
 
14
- ✓ __tests__/integration.test.ts (7 tests) 7845ms
15
- ✓ should build the package correctly  974ms
16
- ✓ should bundle the package correctly  901ms
17
- ✓ should skip mjs files when --skip-mjs is used  945ms
18
- ✓ should ignore base URL when --ignore-base-url is used  946ms
19
- ✓ should rebuild the package on file change when --watch is used  1131ms
20
- ✓ should generate correct platform-specific output  965ms
21
- ✓ should minify the output when MINIFY=true is set  1964ms
14
+ ✓ __tests__/integration.test.ts (7 tests) 7479ms
15
+ ✓ should build the package correctly  933ms
16
+ ✓ should bundle the package correctly  869ms
17
+ ✓ should skip mjs files when --skip-mjs is used  905ms
18
+ ✓ should ignore base URL when --ignore-base-url is used  907ms
19
+ ✓ should rebuild the package on file change when --watch is used  1060ms
20
+ ✓ should generate correct platform-specific output  920ms
21
+ ✓ should minify the output when MINIFY=true is set  1863ms
22
22
 
23
23
   Test Files  1 passed (1)
24
24
   Tests  7 passed (7)
25
-  Start at  12:33:54
26
-  Duration  7.96s (transform 40ms, setup 0ms, collect 45ms, tests 7.85s, environment 0ms, prepare 2ms)
25
+  Start at  22:05:45
26
+  Duration  7.59s (transform 36ms, setup 0ms, collect 42ms, tests 7.48s, environment 0ms, prepare 2ms)
27
27
 
package/README.md CHANGED
@@ -2,24 +2,24 @@
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.
5
+ Path-specific extensions are the only way to support both ESM and CJS properly in modern Node and across all bundlers. Some bundlers used to be flexible and configure this for you, but we found this was the only way to achieve "no config" packages that target native and web. This is even more true as React Native is now supporting package.json exports with an experimental flag.
6
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.
7
+ We wanted to build packages so we didn't have to deal with all this fuss. `@tamagui/build` will build every input file out to both `.native` and `.web` output files to make this work. It then adds path-specific imports to the files that are reachable via package.json exports, but leaves plain `.js` files for older bundlers that don't support it (Metro without the experimental exports flag). It also does a few small re-writes to ensure everyting works without needing bundler configuration. This means it supports basically every possible setup - Metro in either mode, Vite, and older and newer Node versions.
8
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
-
11
- It has a few features that make it useful for "universal" libraries:
9
+ Some details on how it works:
12
10
 
13
11
  - uses tsc to output declaration files to `./types`
14
12
  - esbuild to output `dist/esm` and `dist/cjs` for ESModules and CommonJS
15
13
  - outputs `.js` and `.mjs` files in `dist/esm`
16
14
  - in `.mjs`, adds path-specific imports to non-specific imports
15
+ - outputs both `.js` and `.cjs` files in `dist/cjs`:
16
+ - in `.cjs`, adds path-specific imports to non-specific imports
17
17
  - removes hanging imports that esbuild leaves (see `pkgRemoveSideEffects`)
18
18
  - outputs `.native.js` and regular `.js` files for all output files, so React Native always loads separate files from web. In the `native` specific files,
19
19
  - swc is sued to transform to es5
20
20
  - `process.env.TAMAGUI_TARGET` is defined `native` (otherwise `web`)
21
21
  - on non-native files:
22
- - imports of `react-native` are transformed to `react-native-web`
22
+ - on web, imports of `react-native` are transformed to `react-native-web`
23
23
 
24
24
  It assumes your package.json looks something like this:
25
25
 
@@ -29,6 +29,7 @@ It assumes your package.json looks something like this:
29
29
  "types": "./types/index.d.ts",
30
30
  "main": "dist/cjs",
31
31
  "module": "dist/esm",
32
+ "type": "module",
32
33
  "removeSideEffects": "true",
33
34
  "scripts": {
34
35
  "build": "tamagui-build",
@@ -38,11 +39,14 @@ It assumes your package.json looks something like this:
38
39
  "exports": {
39
40
  "./package.json": "./package.json",
40
41
  ".": {
41
- "react-native-import": "./dist/esm/index.native.js",
42
- "react-native": "./dist/cjs/index.native.js",
42
+ "react-native": {
43
+ "import": "./dist/esm/index.native.js",
44
+ "require": "./dist/cjs/index.native.js"
45
+ },
43
46
  "types": "./types/index.d.ts",
44
47
  "import": "./dist/esm/index.mjs",
45
- "require": "./dist/cjs/index.js"
48
+ "require": "./dist/cjs/index.cjs",
49
+ "default": "./dist/cjs/index.native.js"
46
50
  }
47
51
  },
48
52
  "devDependencies": {
@@ -70,6 +74,7 @@ It assumes your package.json looks something like this:
70
74
  - `--declaration-root` - sets tsc flag `--declarationDir ./`
71
75
  - `--ignore-base-url` - if not set, tsc is passed `--baseUrl .`
72
76
  - `--skip-mjs` - don't output mjs files
77
+ - `--skip-native` - don't output native files
73
78
  - `tamagui-build --watch` - watches for changes and does the above
74
79
  - `tamagui-build clean` - cleans dist, types, node_modules folders
75
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.143.0",
3
+ "version": "2.0.0-001",
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.143.0",
17
+ "@tamagui/babel-plugin-fully-specified": "2.0.0-001",
18
18
  "@types/fs-extra": "^9.0.13",
19
19
  "chokidar": "^3.5.2",
20
20
  "esbuild": "^0.25.11",