@webority/mobile-tools 0.165.0 → 0.167.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.
@@ -27,8 +27,9 @@ export interface MetroConfig {
27
27
  [key: string]: unknown;
28
28
  }
29
29
  /**
30
- * Expo's default Metro config for the app at appRoot (expo/metro-config, resolved from the app),
31
- * with console calls dropped from minified bundles. An app's metro.config.js:
30
+ * The Metro config for the app at appRoot: Expo's default (expo/metro-config) when Expo is installed,
31
+ * otherwise React Native's (@react-native/metro-config), resolved from the app, with console calls
32
+ * dropped from minified bundles. An app's metro.config.js:
32
33
  * module.exports = require("@webority/mobile-tools/metro-config").createMetroConfig(__dirname);
33
34
  * With WEBORITY_PROFILING=1 (mobile-tools run --profiling) the bundle is production JavaScript
34
35
  * with the profiling renderer; WEBORITY_PROFILING set during a release bundle is refused.
@@ -1 +1 @@
1
- import{createRequire}from"node:module";import path from"node:path";const FABRIC_PROD=/[\\/]react-native[\\/]Libraries[\\/]Renderer[\\/]implementations[\\/]ReactFabric-prod\.js$/,isReleaseBundle=()=>process.argv.includes("export:embed")||process.argv.includes("bundle"),applyProfiling=(e,r)=>{const o=e.resolver.resolveRequest;e.resolver.resolveRequest=(e,r,i)=>{const n=o?o(e,r,i):e.resolveRequest(e,r,i);return"sourceFile"===n.type&&void 0!==n.filePath&&FABRIC_PROD.test(n.filePath)?{...n,filePath:n.filePath.replace(/ReactFabric-prod\.js$/,"ReactFabric-profiling.js")}:n},e.transformer.minifierConfig={...e.transformer.minifierConfig,keep_fnames:!0,keep_classnames:!0};const i=e.serializer.getModulesRunBeforeMainModule;e.serializer.getModulesRunBeforeMainModule=e=>[r,...i(e)]};export const createMetroConfig=e=>{if(void 0!==process.env.WEBORITY_PROFILING&&isReleaseBundle())throw new Error("WEBORITY_PROFILING must never reach a release bundle");const r=createRequire(path.join(e,"package.json"));let o;try{o=r("expo/metro-config")}catch{throw new Error(`@webority/mobile-tools/metro-config: expo is not installed in ${e}; run npx mobile-tools sync`)}const i=o.getDefaultConfig(e);return i.transformer.minifierConfig={...i.transformer.minifierConfig,compress:{...i.transformer.minifierConfig?.compress,drop_console:!0}},"1"===process.env.WEBORITY_PROFILING&&applyProfiling(i,r.resolve("@webority/mobile-tools/profiling-hook")),i};
1
+ import{createRequire}from"node:module";import path from"node:path";const FABRIC_PROD=/[\\/]react-native[\\/]Libraries[\\/]Renderer[\\/]implementations[\\/]ReactFabric-prod\.js$/,isReleaseBundle=()=>process.argv.includes("export:embed")||process.argv.includes("bundle"),applyProfiling=(e,r)=>{const o=e.resolver.resolveRequest;e.resolver.resolveRequest=(e,r,i)=>{const n=o?o(e,r,i):e.resolveRequest(e,r,i);return"sourceFile"===n.type&&void 0!==n.filePath&&FABRIC_PROD.test(n.filePath)?{...n,filePath:n.filePath.replace(/ReactFabric-prod\.js$/,"ReactFabric-profiling.js")}:n},e.transformer.minifierConfig={...e.transformer.minifierConfig,keep_fnames:!0,keep_classnames:!0};const i=e.serializer.getModulesRunBeforeMainModule;e.serializer.getModulesRunBeforeMainModule=e=>[r,...i(e)]};export const createMetroConfig=e=>{if(void 0!==process.env.WEBORITY_PROFILING&&isReleaseBundle())throw new Error("WEBORITY_PROFILING must never reach a release bundle");const r=createRequire(path.join(e,"package.json")),o=["expo/metro-config","@react-native/metro-config"].find(e=>{try{return r.resolve(e),!0}catch(e){if(!(e instanceof Error&&"code"in e&&"MODULE_NOT_FOUND"===e.code))throw e;return!1}});if(void 0===o)throw new Error(`@webority/mobile-tools/metro-config: neither expo nor @react-native/metro-config is installed in ${e}; install expo for an Expo app or @react-native/metro-config for a plain React Native app`);const i=r(o).getDefaultConfig(e);return i.transformer.minifierConfig={...i.transformer.minifierConfig,compress:{...i.transformer.minifierConfig?.compress,drop_console:!0}},"1"===process.env.WEBORITY_PROFILING&&applyProfiling(i,r.resolve("@webority/mobile-tools/profiling-hook")),i};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-tools",
3
- "version": "0.165.0",
3
+ "version": "0.167.0",
4
4
  "description": "Dev-time CLI for Webority React Native apps: one prebuild, a dependency guard, a device-aware run and per-environment launcher icons, the same on Windows and macOS.",
5
5
  "keywords": [
6
6
  "react-native",