one 1.1.385 → 1.1.386

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/src/setup.ts CHANGED
@@ -1,8 +1,7 @@
1
- // FIXME: This will break the release build of the React Native app.
2
- import { scan } from 'react-scan'
3
-
4
1
  if (process.env.ONE_ENABLE_REACT_SCAN) {
5
- scan(JSON.parse(process.env.ONE_ENABLE_REACT_SCAN))
2
+ import('react-scan').then(({ scan }) => {
3
+ scan(JSON.parse(`${process.env.ONE_ENABLE_REACT_SCAN}`))
4
+ })
6
5
  }
7
6
 
8
7
  // fixes bad import error in expo-modules-core
package/src/vite/one.ts CHANGED
@@ -296,6 +296,14 @@ export function one(options: One.PluginOptions = {}): PluginOption {
296
296
  // react scan
297
297
  const scan = options.react?.scan
298
298
 
299
+ const reactScanPlugin = {
300
+ name: `one:react-scan`,
301
+ config() {
302
+ return reactScanConfig
303
+ },
304
+ }
305
+ devAndProdPlugins.push(reactScanPlugin)
306
+
299
307
  // do it here because it gets called a few times
300
308
  const reactScanConfig = ((): UserConfig => {
301
309
  const stringify = (obj: Object) => JSON.stringify(JSON.stringify(obj))
@@ -303,7 +311,7 @@ export function one(options: One.PluginOptions = {}): PluginOption {
303
311
  const configs = {
304
312
  disabled: {
305
313
  define: {
306
- 'process.env.ONE_ENABLE_REACT_SCAN': 'false',
314
+ 'process.env.ONE_ENABLE_REACT_SCAN': '""',
307
315
  },
308
316
  },
309
317
  enabled: {
@@ -318,6 +326,9 @@ export function one(options: One.PluginOptions = {}): PluginOption {
318
326
  } satisfies Record<string, UserConfig>
319
327
 
320
328
  const getConfigFor = (platform: 'ios' | 'android' | 'client'): UserConfig => {
329
+ if (process.env.NODE_ENV === 'production') {
330
+ return configs.disabled
331
+ }
321
332
  if (!scan) {
322
333
  return configs.disabled
323
334
  }
@@ -358,15 +369,7 @@ export function one(options: One.PluginOptions = {}): PluginOption {
358
369
  })()
359
370
 
360
371
  // TODO move to single config and through environments
361
- const nativeWebDevAndProdPlugsin: Plugin[] = [
362
- clientTreeShakePlugin(),
363
- {
364
- name: `one:react-scan`,
365
- config() {
366
- return reactScanConfig
367
- },
368
- },
369
- ]
372
+ const nativeWebDevAndProdPlugsin: Plugin[] = [clientTreeShakePlugin(), reactScanPlugin]
370
373
 
371
374
  // TODO make this passed into vxrn through real API
372
375
  globalThis.__vxrnAddNativePlugins = nativeWebDevAndProdPlugsin
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAUA,OAAO,wCAAwC,CAAA"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AASA,OAAO,wCAAwC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"one.d.ts","sourceRoot":"","sources":["../../src/vite/one.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,YAAY,EAAc,MAAM,MAAM,CAAA;AAW5D,OAAO,qBAAqB,CAAA;AAY5B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAkBlC,wBAAgB,GAAG,CAAC,OAAO,GAAE,GAAG,CAAC,aAAkB,GAAG,YAAY,CA2ajE"}
1
+ {"version":3,"file":"one.d.ts","sourceRoot":"","sources":["../../src/vite/one.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,YAAY,EAAc,MAAM,MAAM,CAAA;AAW5D,OAAO,qBAAqB,CAAA;AAY5B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAkBlC,wBAAgB,GAAG,CAAC,OAAO,GAAE,GAAG,CAAC,aAAkB,GAAG,YAAY,CA8ajE"}