@tamagui/build 1.140.0 → 1.140.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.
@@ -2,26 +2,26 @@
2
2
   RUN  v4.0.4 /Users/n8/tamagui/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 72 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 329 ms
10
+ Watch process output: built tamagui-build-test-watch-package in 365 ms
11
11
 
12
12
  Rebuild after file modification complete
13
13
 
14
- ✓ __tests__/integration.test.ts (7 tests) 9195ms
15
- ✓ should build the package correctly  1623ms
16
- ✓ should bundle the package correctly  979ms
17
- ✓ should skip mjs files when --skip-mjs is used  1098ms
18
- ✓ should ignore base URL when --ignore-base-url is used  1023ms
19
- ✓ should rebuild the package on file change when --watch is used  1227ms
20
- ✓ should generate correct platform-specific output  1050ms
21
- ✓ should minify the output when MINIFY=true is set  2175ms
14
+ ✓ __tests__/integration.test.ts (7 tests) 9282ms
15
+ ✓ should build the package correctly  1233ms
16
+ ✓ should bundle the package correctly  1063ms
17
+ ✓ should skip mjs files when --skip-mjs is used  1138ms
18
+ ✓ should ignore base URL when --ignore-base-url is used  1128ms
19
+ ✓ should rebuild the package on file change when --watch is used  1305ms
20
+ ✓ should generate correct platform-specific output  1147ms
21
+ ✓ should minify the output when MINIFY=true is set  2248ms
22
22
 
23
23
   Test Files  1 passed (1)
24
24
   Tests  7 passed (7)
25
-  Start at  13:05:00
26
-  Duration  9.31s (transform 36ms, setup 0ms, collect 41ms, tests 9.20s, environment 0ms, prepare 2ms)
25
+  Start at  09:11:43
26
+  Duration  9.40s (transform 39ms, setup 0ms, collect 45ms, tests 9.28s, environment 0ms, prepare 2ms)
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.140.0",
3
+ "version": "1.140.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.14.0",
17
- "@tamagui/babel-plugin-fully-specified": "1.140.0",
17
+ "@tamagui/babel-plugin-fully-specified": "1.140.2",
18
18
  "@types/fs-extra": "^9.0.13",
19
19
  "chokidar": "^3.5.2",
20
20
  "esbuild": "^0.25.11",
package/tamagui-build.js CHANGED
@@ -8,7 +8,6 @@ const fastGlob = require('fast-glob')
8
8
  const createExternalPlugin = require('./externalNodePlugin')
9
9
  const debounce = require('lodash.debounce')
10
10
  const { basename, dirname } = require('node:path')
11
- const alias = require('./esbuildAliasPlugin')
12
11
  const { es5Plugin } = require('./esbuild-es5')
13
12
  const ts = require('typescript')
14
13
  const path = require('node:path')
@@ -60,6 +59,14 @@ const pkgModuleJSX = pkg['module:jsx']
60
59
  const pkgTypes = Boolean(pkg.types || pkg.typings)
61
60
  const pkgRemoveSideEffects = pkg.removeSideEffects || false
62
61
 
62
+ // build config from package.json
63
+ const buildConfig = pkg['tamagui-build'] || {}
64
+ // if bundleOnly is set, only bundle those packages (old behavior)
65
+ // otherwise bundle ALL packages by default (new behavior)
66
+ const bundleOnly = buildConfig.bundleOnly || null
67
+ // if bundleExternal is set, always keep those packages external
68
+ const bundleExternal = buildConfig.bundleExternal || null
69
+
63
70
  const flatOut = [pkgMain, pkgModule, pkgModuleJSX].filter(Boolean).length === 1
64
71
 
65
72
  const avoidCJS = pkgMain?.endsWith('.js')
@@ -387,11 +394,14 @@ async function buildJs(allFiles) {
387
394
  skipNodeModulesBundle: true,
388
395
  })
389
396
 
397
+ // packages that must always stay external (need runtime access to files/wasm/native bindings)
398
+ const alwaysExternal = ['esbuild-wasm', '@swc/core']
399
+
390
400
  const bundlePlugin = {
391
- name: `external-most-modules`,
401
+ name: `bundle-all-modules`,
392
402
  setup(build) {
393
403
  // Alias esbuild to esbuild-wasm (but keep it external)
394
- build.onResolve({ filter: /^esbuild$/ }, (args) => {
404
+ build.onResolve({ filter: /^esbuild$/ }, () => {
395
405
  return { path: 'esbuild-wasm', external: true }
396
406
  })
397
407
 
@@ -402,16 +412,40 @@ async function buildJs(allFiles) {
402
412
  }
403
413
 
404
414
  if (!args.path.startsWith('.') && !args.path.startsWith('/')) {
405
- // Keep esbuild-wasm external (it needs access to WASM files)
406
- if (args.path === 'esbuild-wasm' || args.path.startsWith('esbuild-wasm/')) {
415
+ // Always keep these external (need runtime file access)
416
+ if (
417
+ alwaysExternal.some(
418
+ (pkg) => args.path === pkg || args.path.startsWith(pkg + '/')
419
+ )
420
+ ) {
407
421
  return { external: true }
408
422
  }
409
- // Bundle mdx-bundler and its dependencies
410
- if (args.path === 'mdx-bundler' || args.path.startsWith('mdx-bundler/')) {
411
- return { external: false }
423
+
424
+ // If bundleExternal is set, keep those packages external
425
+ if (bundleExternal) {
426
+ if (
427
+ bundleExternal.some(
428
+ (pkg) => args.path === pkg || args.path.startsWith(pkg + '/')
429
+ )
430
+ ) {
431
+ return { external: true }
432
+ }
412
433
  }
413
- // Externalize all other npm packages
414
- return { external: true }
434
+
435
+ // If bundleOnly is set, only bundle those specific packages
436
+ if (bundleOnly) {
437
+ if (
438
+ bundleOnly.some(
439
+ (pkg) => args.path === pkg || args.path.startsWith(pkg + '/')
440
+ )
441
+ ) {
442
+ return { external: false }
443
+ }
444
+ return { external: true }
445
+ }
446
+
447
+ // Default: bundle ALL packages
448
+ return { external: false }
415
449
  }
416
450
  })
417
451
  },
@@ -1,42 +0,0 @@
1
- /**
2
- * alias plugin
3
- * @description
4
- * config example:
5
- * ```
6
- * {
7
- * '@lib': '/some/absolute/path'
8
- * }
9
- * ```
10
- * then `import { something } from '@tamagui/core'` will be transformed to
11
- * `import { something } from '/some/absolute/path/xxx'`
12
- * @param {object} config
13
- */
14
- const aliasPlugin = (config) => {
15
- const alias = config && Object.keys(config)
16
- return {
17
- name: 'path-alias',
18
-
19
- setup(build) {
20
- if (!alias || !alias.length) {
21
- return
22
- }
23
- const main = (k, args) => {
24
- const targetPath = config[k].replace(/\/$/, '')
25
- return {
26
- path: targetPath,
27
- }
28
- }
29
-
30
- alias.forEach((k) => {
31
- build.onResolve({ filter: new RegExp(`^.*${k}$`) }, (args) => {
32
- return main(k, args)
33
- })
34
- build.onResolve({ filter: new RegExp(`^.*\\/${k}\\/.*$`) }, (args) => {
35
- return main(k, args)
36
- })
37
- })
38
- },
39
- }
40
- }
41
-
42
- module.exports = aliasPlugin