@tamagui/build 1.142.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.
- package/.turbo/turbo-test.log +13 -13
- package/README.md +14 -9
- package/package.json +2 -2
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
|
|
2
|
-
[1m[46m RUN [49m[22m [36mv4.0.4 [39m[90m/Users/n8/
|
|
2
|
+
[1m[46m RUN [49m[22m [36mv4.0.4 [39m[90m/Users/n8/tamagui2/code/packages/build[39m
|
|
3
3
|
|
|
4
4
|
[90mstdout[2m | __tests__/integration.test.ts[2m > [22m[2mtamagui-build integration test[2m > [22m[2mshould rebuild the package on file change when --watch is used
|
|
5
|
-
[22m[39mWatch process output: built tamagui-build-test-watch-package in
|
|
5
|
+
[22m[39mWatch process output: built tamagui-build-test-watch-package in 69 ms
|
|
6
6
|
|
|
7
7
|
Initial build complete, modifying file...
|
|
8
8
|
|
|
9
9
|
[90mstdout[2m | __tests__/integration.test.ts[2m > [22m[2mtamagui-build integration test[2m > [22m[2mshould rebuild the package on file change when --watch is used
|
|
10
|
-
[22m[39mWatch process output: built tamagui-build-test-watch-package in
|
|
10
|
+
[22m[39mWatch process output: built tamagui-build-test-watch-package in 329 ms
|
|
11
11
|
|
|
12
12
|
Rebuild after file modification complete
|
|
13
13
|
|
|
14
|
-
[32m✓[39m __tests__/integration.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m
|
|
15
|
-
[33m[2m✓[22m[39m should build the package correctly [33m
|
|
16
|
-
[33m[2m✓[22m[39m should bundle the package correctly [33m
|
|
17
|
-
[33m[2m✓[22m[39m should skip mjs files when --skip-mjs is used [33m
|
|
18
|
-
[33m[2m✓[22m[39m should ignore base URL when --ignore-base-url is used [33m
|
|
19
|
-
[33m[2m✓[22m[39m should rebuild the package on file change when --watch is used [33m
|
|
20
|
-
[33m[2m✓[22m[39m should generate correct platform-specific output [33m
|
|
21
|
-
[33m[2m✓[22m[39m should minify the output when MINIFY=true is set [33m
|
|
14
|
+
[32m✓[39m __tests__/integration.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 7479[2mms[22m[39m
|
|
15
|
+
[33m[2m✓[22m[39m should build the package correctly [33m 933[2mms[22m[39m
|
|
16
|
+
[33m[2m✓[22m[39m should bundle the package correctly [33m 869[2mms[22m[39m
|
|
17
|
+
[33m[2m✓[22m[39m should skip mjs files when --skip-mjs is used [33m 905[2mms[22m[39m
|
|
18
|
+
[33m[2m✓[22m[39m should ignore base URL when --ignore-base-url is used [33m 907[2mms[22m[39m
|
|
19
|
+
[33m[2m✓[22m[39m should rebuild the package on file change when --watch is used [33m 1060[2mms[22m[39m
|
|
20
|
+
[33m[2m✓[22m[39m should generate correct platform-specific output [33m 920[2mms[22m[39m
|
|
21
|
+
[33m[2m✓[22m[39m should minify the output when MINIFY=true is set [33m 1863[2mms[22m[39m
|
|
22
22
|
|
|
23
23
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
24
24
|
[2m Tests [22m [1m[32m7 passed[39m[22m[90m (7)[39m
|
|
25
|
-
[2m Start at [22m
|
|
26
|
-
[2m Duration [22m 7.
|
|
25
|
+
[2m Start at [22m 22:05:45
|
|
26
|
+
[2m Duration [22m 7.59s[2m (transform 36ms, setup 0ms, collect 42ms, tests 7.48s, environment 0ms, prepare 2ms)[22m
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
|
42
|
-
|
|
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.
|
|
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": "
|
|
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": "
|
|
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",
|