{"name":"babel-preset-expo","version":"0.0.1-canary-20231129-c0ec023","keywords":["babel","babel-preset","expo","expo-web","react-native","react-native-web","metro","webpack"],"author":{"name":"Expo","email":"support@expo.dev"},"license":"MIT","_id":"babel-preset-expo@0.0.1-canary-20231129-c0ec023","homepage":"https://github.com/expo/expo/tree/main/packages/babel-preset-expo#readme","bugs":{"url":"https://github.com/expo/expo/issues"},"dist":{"shasum":"5786770804d8fbe13c6bf6a4bf322a85337cc8d6","tarball":"http://registry-npm.ywwl.com/babel-preset-expo/download/babel-preset-expo-0.0.1-canary-20231129-c0ec023.tgz","fileCount":15,"integrity":"sha512-Mtpsgr45h6/LHnIeum50ZyDl2eqCmmx5pVj7UHZOlDw/CL1zot2lGnqf7mGGAIH/I0qPZZ+fxHbx8ZSyLk6tjg==","signatures":[{"sig":"MEUCIEMou5vznar+N3Mu24KWAO3tv1t99wW0P1w9oRaseSBaAiEA+hEcM7ubReZ6BU1HffyfvPWJaKvKxXsbIZkDVTh5cpE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43039,"size":11773,"noattachment":false,"key":"/babel-preset-expo/-/babel-preset-expo-0.0.1-canary-20231129-c0ec023.tgz"},"main":"build/index.js","types":"./build/index.d.ts","gitHead":"c0ec023855579d0d269e1f2e69717cf172af8fe5","scripts":{"lint":"expo-module lint","test":"expo-module test","build":"expo-module build","clean":"expo-module clean","prepare":"expo-module clean && expo-module build","prepublishOnly":"expo-module prepublishOnly"},"_npmUser":{"name":"brentvatne","email":"brentvatne@gmail.com"},"repository":{"url":"git+https://github.com/expo/expo.git","type":"git","directory":"packages/babel-preset-expo"},"_npmVersion":"9.6.7","description":"The Babel preset for Expo projects","directories":{},"_nodeVersion":"18.17.1","dependencies":{"react-refresh":"0.14.0","@babel/preset-env":"^7.20.0","@babel/preset-react":"^7.22.15","@react-native/babel-preset":"^0.73.18","babel-plugin-react-native-web":"~0.18.10","@babel/plugin-proposal-decorators":"^7.12.9","@babel/plugin-transform-parameters":"^7.22.15","@babel/plugin-proposal-object-rest-spread":"^7.12.13","@babel/plugin-transform-export-namespace-from":"^7.22.11"},"eslintConfig":{"extends":"universe/node"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^29.2.1","@babel/core":"^7.20.0","expo-module-scripts":"0.0.1-canary-20231129-c0ec023"},"_npmOperationalInternal":{"tmp":"tmp/babel-preset-expo_0.0.1-canary-20231129-c0ec023_1701301288332_0.55890781991996","host":"s3://npm-registry-packages"},"readme":"# babel-preset-expo\n\nThis preset extends the default React Native preset (`@react-native/babel-preset`) and adds support for decorators, tree-shaking web packages, and loading font icons with optional native dependencies if they're installed.\n\nYou can use this preset in any React Native project as a drop-in replacement for `@react-native/babel-preset`. If your project isn't using native font loading or web support then this preset will only add support for decorators with `@babel/plugin-proposal-decorators` - this is mostly used for supporting legacy community libraries.\n\nIf you start your **web** project with `@expo/webpack-config` or `npx expo start` and your project doesn't contain a `babel.config.js` or a `.babelrc` then it will default to using `babel-preset-expo` for loading.\n\nIf you have problems with the code in this repository, please file issues & bug reports\nat https://github.com/expo/expo. Thanks!\n\n## Expo Bundler Spec Compliance\n\nA bundler must follow these requirements if they are to be considered spec compliant for use with a **universal React** (Expo) project.\n\n### Babel Loader\n\nThe babel loading mechanism must include the following properties on its `caller`.\n\n#### platform\n\nA `platform` property denoting the target platform. If the `platform` is not defined, it will default to using `web` when the `bundler` is `webpack` -- this is temporary and will throw an error in the future.\n\n| Value     | Description             |\n| --------- | ----------------------- |\n| `ios`     | Runs on iOS devices     |\n| `android` | Runs on Android devices |\n| `web`     | Runs in web browsers    |\n\n#### bundler\n\nA `bundler` property denoting the name of the bundler that is being used to create the JavaScript bundle.\nIf the `bundler` is not defined, it will default to checking if a `babel-loader` is used, if so then `webpack` will be used, otherwise it will default to `metro`.\n\n| Value     | Description                      |\n| --------- | -------------------------------- |\n| `metro`   | Bundling with [Metro][metro]     |\n| `webpack` | Bundling with [Webpack][webpack] |\n\n[metro]: https://facebook.github.io/metro/\n[webpack]: https://webpack.js.org/\n\n## Options\n\n### `react-compiler`\n\nSettings to pass to `babel-plugin-react-compiler`. Set as `false` to disable the plugin. As of SDK 51, you must also enable `experiments.reactCompiler: true` in the `app.json`.\n\n```js\n[\n  'babel-preset-expo',\n  {\n    'react-compiler': {\n      sources: (filename) => {\n        // Match file names to include in the React Compiler.\n        return filename.includes('src/path/to/dir');\n      },\n    },\n  },\n];\n```\n\n### `minifyTypeofWindow`\n\nSet `minifyTypeofWindow: false` to preserve the `typeof window` check in your code, e.g. `if (typeof window === 'undefined')` -> `if (true)` in servers. This is useful when you're using libraries that mock the window object on native or in the server.\n\n```js\n[\n  'babel-preset-expo',\n  {\n    // If your native app doesn't polyfill `window` then setting this to `false` can reduce bundle size.\n    native: {\n      minifyTypeofWindow: true,\n    },\n  },\n];\n```\n\nDefaults to `false` for server environments and web, `true` for native platforms to support legacy browser polyfills.\n\n### `reanimated`\n\n`boolean`, defaults to `true`. Set `reanimated: false` to disable adding the `react-native-reanimated/plugin` when `react-native-reanimated` is installed.\n\n### [`jsxRuntime`](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#runtime)\n\n`classic | automatic`, defaults to `automatic`\n\n- `automatic` automatically convert JSX to JS without the need to `import React from 'react'` in every file. Be sure to follow the rest of the [setup guide](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#how-to-upgrade-to-the-new-jsx-transform) after enabling this, otherwise ESLint and other tools will throw warnings.\n- `classic` does not automatically import anything, React must imported into every file that uses JSX syntax.\n\n```js\n[\n  'babel-preset-expo',\n  {\n    jsxRuntime: 'classic',\n  },\n];\n```\n\nThis property is passed down to [`@babel/plugin-transform-react-jsx`](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx). This flag does nothing when `useTransformReactJSXExperimental` is set to `true` because `@babel/plugin-transform-react-jsx` is omitted.\n\n### [`jsxImportSource`](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#importsource)\n\n`string`, defaults to `react`\n\nThis option allows specifying a custom import source for importing functions.\n\n```js\n[\n  'babel-preset-expo',\n  {\n    jsxRuntime: 'automatic',\n    jsxImportSource: 'react',\n  },\n];\n```\n\nThis property is passed down to [`@babel/plugin-transform-react-jsx`](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx). This options does nothing when `jsxRuntime` is not set to `automatic`.\n\n### [`lazyImports`](https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs#lazy)\n\nChanges Babel's compiled `import` statements to be lazily evaluated when their imported bindings are used for the first time.\n\n_Note:_ this option has an effect only when the `disableImportExportTransform` option is set to `false`. On Android and iOS, `disableImportExportTransform` defaults to `false`, and on web it defaults to `true` to allow for tree shaking.\n\nThis can improve the initial load time of your app because evaluating dependencies up front is sometimes entirely un-necessary, particularly when the dependencies have no side effects.\n\nThe value of `lazyImports` has a few possible effects:\n\n- `null` - [@react-native/babel-preset](https://github.com/facebook/react-native/tree/main/packages/react-native-babel-preset) will handle it. (Learn more about it here: https://github.com/facebook/metro/commit/23e3503dde5f914f3e642ef214f508d0a699851d)\n- `false` - No lazy initialization of any imported module.\n- `true` - Lazy-init all imported modules except local imports (e.g., `./foo`), certain Expo packages that have side effects, and the two cases mentioned [here](https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs#lazy).\n- `Array<string>` - [babel-plugin-transform-modules-commonjs](https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs#lazy) will handle it.\n- `(string) => boolean` - [babel-plugin-transform-modules-commonjs](https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs#lazy) will handle it.\n\n  If you choose to do this, you can also access the list of Expo packages that have side effects by using `const lazyImportsBlacklist = require('babel-preset-expo/lazy-imports-blacklist');` which returns a `Set`.\n\n**default:** `null`\n\n```js\n[\n    'babel-preset-expo',\n    {\n        lazyImports: true\n    }\n],\n```\n\n### `disableImportExportTransform`\n\nPass `true` to disable the transform that converts import/export to `module.exports`. Avoid setting this property directly. If you're using Metro, set `experimentalImportSupport: true` instead to ensure the entire pipeline is configured correctly.\n\n```js\n// metro.config.js\n\nconfig.transformer.getTransformOptions = async () => ({\n  transform: {\n    // Setting this to `true` will automatically toggle `disableImportExportTransform` in `babel-preset-expo`.\n    experimentalImportSupport: true,\n  },\n});\n```\n\nIf `undefined` (default), this will be set automatically via `caller.supportsStaticESM` which is set by the bundler.\n\n```js\n[\n    'babel-preset-expo',\n    {\n        disableImportExportTransform: true\n    }\n],\n```\n\n### `unstable_transformProfile`\n\nChanges the engine preset in `@react-native/babel-preset` based on the JavaScript engine that is being targeted. In Expo SDK 50 and greater, this is automatically set based on the [`jsEngine`](https://docs.expo.dev/versions/latest/config/app/#jsengine) option in your `app.json`.\n\n### `enableBabelRuntime`\n\nPassed to `@react-native/babel-preset`.\n\n### `disableFlowStripTypesTransform`\n\nPassed to `@react-native/babel-preset`.\n\n## Platform-specific options\n\nAll options can be passed in the platform-specific objects `native` and `web` to provide different settings on different platforms. For example, if you'd like to only apply `disableImportExportTransform` on web, use the following:\n\n```js\n[\n  'babel-preset-expo',\n  {\n    // Default value:\n    disableImportExportTransform: false,\n\n    web: {\n      // Web-specific value:\n      disableImportExportTransform: true,\n    },\n  },\n];\n```\n\nPlatform-specific options have higher priority over top-level options.\n","publish_time":1701301288604,"maintainers":[{"name":"radoslawkrzemien","email":"radoslaw.krzemien@swmansion.com"},{"name":"pkham","email":"piotrek.szeremeta@swmansion.com"},{"name":"szdziedzic","email":"szymon.dziedzic@swmansion.com"},{"name":"tsapeta","email":"npm@tsapeta.com"},{"name":"ide","email":"ide+npm@jameside.com"},{"name":"lukmccall","email":"kosmatylukasz@gmail.com"},{"name":"expo-bot","email":"brent+expobotnpm@expo.io"},{"name":"alanhughes","email":"hughesno1@gmail.com"},{"name":"kadikraman","email":"hellokadi@gmail.com"},{"name":"aleqsio","email":"mikucki@gmail.com"},{"name":"marklawlor","email":"mwlawlor@gmail.com"},{"name":"gabrieldonadel","email":"donadeldev@gmail.com"},{"name":"simek","email":"gosimek@gmail.com"},{"name":"keith-kurak","email":"keith@expo.io"},{"name":"christopherwalter","email":"chris@christopherwalter.com"},{"name":"fiber-god","email":"datwheat@gmail.com"},{"name":"brentvatne","email":"brentvatne@gmail.com"},{"name":"evanbacon","email":"baconbrix@gmail.com"},{"name":"quinlanj","email":"quinlanjung@gmail.com"},{"name":"expoadmin","email":"support@expo.io"},{"name":"exponent","email":"exponent.team@gmail.com"},{"name":"wschurman","email":"wschurman@gmail.com"},{"name":"bycedric","email":"me@bycedric.com"},{"name":"jonsamp","email":"sampjon@gmail.com"},{"name":"princefleaswallow","email":"mhampton@hey.com"},{"name":"kudochien","email":"ckchien@gmail.com"}],"_cnpm_publish_time":1701301288604,"dist-tags":{"canary":"58.0.0-canary-20260909-ea7a89a","canary-sdk-55":"55.0.9-canary-20260429-a5e59cf","canary-sdk-56":"56.0.14-canary-20260701-9100865","latest":"58.0.24","next":"58.0.15","sdk-50":"10.0.1","sdk-51":"11.0.6","sdk-52":"12.0.12","sdk-53":"13.2.5","sdk-54":"54.0.12","sdk-55":"55.0.25","sdk-56":"56.0.21","sdk-57":"57.0.17"}}