@tamagui/build 1.97.0 → 1.98.0

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.
Files changed (2) hide show
  1. package/package.json +3 -6
  2. package/tamagui-build.js +41 -42
package/package.json CHANGED
@@ -1,19 +1,16 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.97.0",
3
+ "version": "1.98.0",
4
4
  "bin": {
5
5
  "tamagui-build": "tamagui-build.js",
6
6
  "teesx": "./teesx.sh"
7
7
  },
8
- "scripts": {
9
- "build": "true",
10
- "watch": "true"
11
- },
12
8
  "publishConfig": {
13
9
  "access": "public"
14
10
  },
15
11
  "dependencies": {
16
12
  "@babel/core": "^7.23.3",
13
+ "@tamagui/babel-plugin-fully-specified": "1.98.0",
17
14
  "@types/fs-extra": "^9.0.13",
18
15
  "babel-plugin-fully-specified": "*",
19
16
  "chokidar": "^3.5.2",
@@ -30,7 +27,7 @@
30
27
  "typescript": "*"
31
28
  },
32
29
  "devDependencies": {
33
- "typescript": "^5.3.3"
30
+ "typescript": "^5.4.5"
34
31
  },
35
32
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
36
33
  }
package/tamagui-build.js CHANGED
@@ -245,7 +245,7 @@ async function buildJs() {
245
245
  '.js',
246
246
  '.jsx',
247
247
  ],
248
- minify: process.env.MINIFY ? true : false,
248
+ minify: !!process.env.MINIFY,
249
249
  define: {
250
250
  'process.env.TAMAGUI_IS_CORE_NODE': '"1"',
251
251
  },
@@ -261,7 +261,7 @@ async function buildJs() {
261
261
  bundle: shouldBundle,
262
262
  external,
263
263
  plugins: shouldBundleNodeModules ? [] : [externalPlugin],
264
- minify: process.env.MINIFY ? true : false,
264
+ minify: !!process.env.MINIFY,
265
265
  platform: 'node',
266
266
  }
267
267
 
@@ -272,7 +272,7 @@ async function buildJs() {
272
272
  bundle: shouldBundle,
273
273
  external,
274
274
  allowOverwrite: true,
275
- minify: process.env.MINIFY ? true : false,
275
+ minify: !!process.env.MINIFY,
276
276
  }
277
277
 
278
278
  if (pkgSource) {
@@ -357,7 +357,7 @@ async function buildJs() {
357
357
  allowOverwrite: true,
358
358
  target: 'esnext',
359
359
  format: 'esm',
360
- minify: process.env.MINIFY ? true : false,
360
+ minify: !!process.env.MINIFY,
361
361
  platform: 'neutral',
362
362
  },
363
363
  {
@@ -379,7 +379,7 @@ async function buildJs() {
379
379
  allowOverwrite: true,
380
380
  target: 'node16',
381
381
  format: 'esm',
382
- minify: process.env.MINIFY ? true : false,
382
+ minify: !!process.env.MINIFY,
383
383
  platform: 'neutral',
384
384
  },
385
385
  {
@@ -587,48 +587,47 @@ async function esbuildWriteIfChanged(
587
587
  !(await fs.pathExists(path)) ||
588
588
  (await fs.readFile(path, 'utf8')) !== contents
589
589
  ) {
590
- await fs.writeFile(path, contents)
590
+ await fs.writeFile(path, contents, 'utf8')
591
591
  }
592
592
  } else {
593
- await fs.writeFile(path, contents)
593
+ await fs.writeFile(path, contents, 'utf8')
594
594
  }
595
595
  }
596
596
 
597
- await Promise.all([
598
- flush(outString, outPath),
599
- (async () => {
600
- const shouldDoMJS = !shouldSkipMJS && isESM && mjs && outPath.endsWith('.js')
601
- if (shouldDoMJS) {
602
- const mjsOutPath = outPath.replace('.js', '.mjs')
603
- // if bundling no need to specify as its all internal
604
- // and babel is bad on huge bundled files
605
- const output = shouldBundle
606
- ? outString
607
- : transform(outString, {
608
- filename: mjsOutPath,
609
- configFile: false,
610
- plugins: [
611
- [
612
- require.resolve('babel-plugin-fully-specified'),
613
- {
614
- // this doesnt work because the files dont exist as you build in random orders
615
- // ensureFileExists: true,
616
- esExtensionDefault: '.mjs',
617
- tryExtensions: ['.mjs', '.js'],
618
- esExtensions: ['.mjs', '.js'],
619
- },
620
- ],
621
- // pkg.tamagui?.build?.skipEnvToMeta
622
- // ? null
623
- // : require.resolve('./babel-plugin-process-env-to-meta'),
624
- ].filter(Boolean),
625
- }).code
626
-
627
- // output to mjs fully specified
628
- await flush(output, mjsOutPath)
629
- }
630
- })(),
631
- ])
597
+ // flush before fully specified so it finds the file
598
+ await flush(outString, outPath)
599
+
600
+ await (async () => {
601
+ const shouldDoMJS = !shouldSkipMJS && isESM && mjs && outPath.endsWith('.js')
602
+ if (shouldDoMJS) {
603
+ const mjsOutPath = outPath.replace('.js', '.mjs')
604
+ // if bundling no need to specify as its all internal
605
+ // and babel is bad on huge bundled files
606
+ const output = shouldBundle
607
+ ? outString
608
+ : transform(outString, {
609
+ filename: mjsOutPath,
610
+ configFile: false,
611
+ plugins: [
612
+ [
613
+ require.resolve('@tamagui/babel-plugin-fully-specified'),
614
+ {
615
+ ensureFileExists: true,
616
+ esExtensionDefault: '.mjs',
617
+ tryExtensions: ['.js'],
618
+ esExtensions: ['.mjs'],
619
+ },
620
+ ],
621
+ // pkg.tamagui?.build?.skipEnvToMeta
622
+ // ? null
623
+ // : require.resolve('./babel-plugin-process-env-to-meta'),
624
+ ].filter(Boolean),
625
+ }).code
626
+
627
+ // output to mjs fully specified
628
+ await fs.writeFile(mjsOutPath, output, 'utf8')
629
+ }
630
+ })()
632
631
  })
633
632
  )
634
633
  }