@tamagui/build 1.108.1 → 1.108.3

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 ADDED
@@ -0,0 +1,69 @@
1
+ ## @tamagui/build
2
+
3
+ A small, opinionated build script for libraries that target both React Native and React web.
4
+
5
+ It has a few features that make it useful for "universal" libraries:
6
+
7
+ - uses tsc to output declaration files to `./types`
8
+ - esbuild to output `dist/esm` and `dist/cjs` for ESModules and CommonJS
9
+ - outputs `.js` and `.mjs` files in `dist/esm`
10
+ - in `.mjs`, adds path-specific imports to non-specific imports
11
+ - removes hanging imports that esbuild leaves (see `pkgRemoveSideEffects`)
12
+ - 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,
13
+ - swc is sued to transform to es5
14
+ - `process.env.TAMAGUI_TARGET` is defined `native` (otherwise `web`)
15
+ - on non-native files:
16
+ - imports of `react-native` are transformed to `react-native-web`
17
+
18
+ It assumes your package.json looks something like this:
19
+
20
+ ```
21
+ {
22
+ "source": "src/index.tsx",
23
+ "types": "./types/index.d.ts",
24
+ "main": "dist/cjs",
25
+ "module": "dist/esm",
26
+ "removeSideEffects": "true",
27
+ "scripts": {
28
+ "build": "tamagui-build",
29
+ "watch": "tamagui-build --watch",
30
+ "clean": "tamagui-build clean"
31
+ },
32
+ "exports": {
33
+ "./package.json": "./package.json",
34
+ ".": {
35
+ "react-native-import": "./dist/esm/index.native.js",
36
+ "react-native": "./dist/cjs/index.native.js",
37
+ "types": "./types/index.d.ts",
38
+ "import": "./dist/esm/index.mjs",
39
+ "require": "./dist/cjs/index.js"
40
+ }
41
+ },
42
+ "devDependencies": {
43
+ "@tamagui/build": "latest"
44
+ },
45
+ "tamagui": {
46
+ "build": {
47
+ "skipEnvToMeta": true,
48
+ "bundle.native": "./src/index.ts",
49
+ "bundle.native.test": "./src/index.ts"
50
+ }
51
+ },
52
+ }
53
+ ```
54
+
55
+ ### Install
56
+
57
+ `npx @tamagui/build` or install and use the CLI:
58
+
59
+ ### Use
60
+
61
+ - `tamagui-build` - builds `src` folder to `dist` and `types` folders
62
+ - `tamagui build .` second argument sets baseUrl to tsc
63
+ - `--bundle-modules` - inline node_modules
64
+ - `--declaration-root` - sets tsc flag `--declarationDir ./`
65
+ - `--ignore-base-url` - if not set, tsc is passed `--baseUrl .`
66
+ - `--skip-mjs` - don't output mjs files
67
+ - `tamagui-build --watch` - watches for changes and does the above
68
+ - `tamagui-build clean` - cleans dist, types, node_modules folders
69
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.108.1",
3
+ "version": "1.108.3",
4
4
  "bin": {
5
5
  "tamagui-build": "tamagui-build.js",
6
6
  "teesx": "./teesx.sh"
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@babel/core": "^7.23.3",
13
- "@tamagui/babel-plugin-fully-specified": "1.108.1",
13
+ "@tamagui/babel-plugin-fully-specified": "1.108.3",
14
14
  "@types/fs-extra": "^9.0.13",
15
15
  "babel-plugin-fully-specified": "*",
16
16
  "chokidar": "^3.5.2",
package/tamagui-build.js CHANGED
@@ -70,7 +70,6 @@ async function clean() {
70
70
  //
71
71
  fs.remove('.turbo'),
72
72
  fs.remove('node_modules'),
73
- fs.remove('.ultra.cache.json'),
74
73
  fs.remove('types'),
75
74
  fs.remove('dist'),
76
75
  ])