@tamagui/build 1.104.1 → 1.105.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 +2 -2
  2. package/tamagui-build.js +14 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.104.1",
3
+ "version": "1.105.0",
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.104.1",
13
+ "@tamagui/babel-plugin-fully-specified": "1.105.0",
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
@@ -9,7 +9,7 @@ const esbuild = require('esbuild')
9
9
  const fg = require('fast-glob')
10
10
  const createExternalPlugin = require('./externalNodePlugin')
11
11
  const debounce = require('lodash.debounce')
12
- const { dirname } = require('node:path')
12
+ const { basename, dirname } = require('node:path')
13
13
  const alias = require('./esbuildAliasPlugin')
14
14
 
15
15
  const jsOnly = !!process.env.JS_ONLY
@@ -603,11 +603,12 @@ async function esbuildWriteIfChanged(
603
603
  const mjsOutPath = outPath.replace('.js', '.mjs')
604
604
  // if bundling no need to specify as its all internal
605
605
  // and babel is bad on huge bundled files
606
- const output = shouldBundle
607
- ? outString
606
+ const result = shouldBundle
607
+ ? { code: outString }
608
608
  : transform(outString, {
609
609
  filename: mjsOutPath,
610
610
  configFile: false,
611
+ sourceMap: true,
611
612
  plugins: [
612
613
  [
613
614
  require.resolve('@tamagui/babel-plugin-fully-specified'),
@@ -624,10 +625,18 @@ async function esbuildWriteIfChanged(
624
625
  // ? null
625
626
  // : require.resolve('./babel-plugin-process-env-to-meta'),
626
627
  ].filter(Boolean),
627
- }).code
628
+ })
628
629
 
629
630
  // output to mjs fully specified
630
- await fs.writeFile(mjsOutPath, output, 'utf8')
631
+ await fs.writeFile(
632
+ mjsOutPath,
633
+ result.code +
634
+ (result.map ? `\n//# sourceMappingURL=${basename(mjsOutPath)}.map\n` : ''),
635
+ 'utf8'
636
+ )
637
+ if (result.map) {
638
+ await fs.writeFile(mjsOutPath + '.map', JSON.stringify(result.map), 'utf8')
639
+ }
631
640
  }
632
641
  })()
633
642
  })