{"name":"@expo/fingerprint","version":"0.0.1-canary-20240405-cdfd9c1","keywords":["expo","react-native","fingerprint","hash","node"],"author":{"name":"650 Industries, Inc."},"license":"MIT","_id":"@expo/fingerprint@0.0.1-canary-20240405-cdfd9c1","maintainers":[{"name":"szdziedzic","email":"szymon.dziedzic@swmansion.com"},{"name":"alanhughes","email":"hughesno1@gmail.com"},{"name":"kadikraman","email":"hellokadi@gmail.com"},{"name":"radoslawkrzemien","email":"radoslaw.krzemien@swmansion.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":"kbrandwijk","email":"kim.brandwijk@gmail.com"},{"name":"fiber-god","email":"datwheat@gmail.com"},{"name":"ide","email":"ide+npm@jameside.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":"tsapeta","email":"npm@tsapeta.com"},{"name":"exponent","email":"exponent.team@gmail.com"},{"name":"wschurman","email":"wschurman@gmail.com"},{"name":"wkozyra","email":"wojciech.kozyra@swmansion.com"},{"name":"bycedric","email":"me@bycedric.com"},{"name":"lukmccall","email":"kosmatylukasz@gmail.com"},{"name":"jonsamp","email":"sampjon@gmail.com"},{"name":"princefleaswallow","email":"mhampton@hey.com"},{"name":"kudochien","email":"ckchien@gmail.com"}],"homepage":"https://github.com/expo/expo/tree/main/packages/@expo/fingerprint#readme","bugs":{"url":"https://github.com/expo/expo/issues"},"bin":{"fingerprint":"bin/cli.js"},"dist":{"shasum":"8fee63095f569c95f0824d46bb51b14d7b5f263c","tarball":"http://registry-npm.ywwl.com/@expo/fingerprint/download/@expo/fingerprint-0.0.1-canary-20240405-cdfd9c1.tgz","fileCount":55,"integrity":"sha512-c3RwP2PyGY8o1pldo60PN+uhpIiRww/mVIhHDvzym2rWWLjQye3Di4dOLAJPcrxmj9mlIqX+0BdbkGT3Xmhypw==","signatures":[{"sig":"MEUCIG39a3gsOsyWX8xMQ/U/arvvkfK0f6payYlbPchpAYw/AiEA/wqp5t82X/6VuZJTv5adikh2wk2awvwW30nNhlhoYVM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":105138,"size":24961,"noattachment":false,"key":"/@expo/fingerprint/-/@expo/fingerprint-0.0.1-canary-20240405-cdfd9c1.tgz"},"main":"build/index.js","types":"build/index.d.ts","readme":"# @expo/fingerprint\n\nA library to generate a fingerprint from a React Native project\n\n## Table of Contents\n\n  * [API Usage](#api-usage)\n  * [CLI Usage](#cli-usage)\n  * [Customizations](#customizations)\n  * [Limitations](#limitations)\n\n## API Usage\n\n```ts\nimport * as Fingerprint from '@expo/fingerprint';\n\nawait Fingerprint.createFingerprintAsync('/projectRoot');\n```\n\n### createFingerprintAsync\n\nCreate a fingerprint from project\n\n```ts\nfunction createFingerprintAsync(projectRoot: string, options?: Options): Promise<Fingerprint>;\n```\n\nExample:\n\n```ts\nconst fingerprint = await createFingerprintAsync('/app');\nconsole.log(fingerprint);\n```\n\n```json\n{\n  \"sources\": [\n    {\n      \"type\": \"file\",\n      \"filePath\": \"app.json\",\n      \"reasons\": [\"expoConfig\"],\n      \"hash\": \"378083de0c6e6bb6caf8fb72df658b0b26fb29ef\"\n    },\n    {\n      \"type\": \"file\",\n      \"filePath\": \"eas.json\",\n      \"reasons\": [\"easBuild\"],\n      \"hash\": \"f723802b6ea916d1a6c4767b2299cc81ddb22eb4\"\n    },\n    {\n      \"type\": \"dir\",\n      \"filePath\": \"node_modules/expo\",\n      \"reasons\": [\"expoAutolinkingIos\", \"expoAutolinkingAndroid\", \"bareRncliAutolinking\"],\n      \"hash\": \"1faee4057fa943300905750b51c3b0cbf05f4b0d\"\n    }\n  ],\n  \"hash\": \"bf8a3b08935f056270b1688333b02f1ef5fa25bf\"\n}\n```\n\n### createProjectHashAsync\n\nCreate a native hash value from project\n\n```ts\nfunction createProjectHashAsync(projectRoot: string, options?: Options): Promise<string>;\n```\n\nExample:\n\n```ts\nconst hash = await createProjectHashAsync('/app');\nconsole.log(hash);\n```\n\n```json\nbf8a3b08935f056270b1688333b02f1ef5fa25bf\n```\n\n### diffFingerprintChangesAsync\n\nDiff the given `fingerprint` with the current project fingerprint state\n\n```ts\nfunction diffFingerprintChangesAsync(fingerprint: Fingerprint, projectRoot: string, options?: Options): Promise<FingerprintSource[]>;\n```\n\nExample:\n\n```ts\nconst fingerprint = {\n  sources: [\n    {\n      type: 'file',\n      filePath: 'app.json',\n      reasons: ['expoConfig'],\n      hash: '378083de0c6e6bb6caf8fb72df658b0b26fb29ef',\n    },\n    {\n      type: 'file',\n      filePath: 'eas.json',\n      reasons: ['easBuild'],\n      hash: 'f723802b6ea916d1a6c4767b2299cc81ddb22eb4',\n    },\n    {\n      type: 'dir',\n      filePath: 'node_modules/expo',\n      reasons: ['expoAutolinkingIos', 'expoAutolinkingAndroid', 'bareRncliAutolinking'],\n      hash: '1faee4057fa943300905750b51c3b0cbf05f4b0d',\n    },\n  ],\n  hash: 'bf8a3b08935f056270b1688333b02f1ef5fa25bf',\n};\nconst result = await diffFingerprintChangesAsync(fingerprint, '/app');\nconsole.log(result);\n```\n\n```json\n[\n  {\n    \"filePath\": \"ios\",\n    \"hash\": \"e4190c0af9142fe4add4842777d9aec713213cd4\",\n    \"reasons\": [\"bareNativeDir\"],\n    \"type\": \"dir\"\n  },\n  {\n    \"filePath\": \"app.json\",\n    \"hash\": \"9ff1b51ca9b9435e8b849bcc82e3900d70f0feee\",\n    \"reasons\": [\"expoConfig\"],\n    \"type\": \"file\"\n  }\n]\n```\n\n### diffFingerprints\n\nFind the diff between two fingerprints\n\n```ts\nfunction diffFingerprints(fingerprint1: Fingerprint, fingerprint2: Fingerprint): FingerprintSource[];\n```\n\n## CLI Usage\n\n### Generate a fingerprint for a given project\n\n`npx @expo/fingerprint /path/to/projectRoot`\n\n### Generate a fingerprint for a given project and write it to a file\n\n`npx @expo/fingerprint /path/to/projectRoot > fingerprint.json`\n\n### Compare a fingerprint with the current project state\n\n`npx @expo/fingerprint /path/to/projectRoot fingerprint.json`\n\n## Customizations\n\n### Include or exclude extra files in the **.fingerprintignore** file\n\nOur default ignore paths, found here [`DEFAULT_IGNORE_PATHS`](https://github.com/expo/expo/blob/main/packages/%40expo/fingerprint/src/Options.ts#L9), make hashing fast and keep hashing results stable. If the default setup does not fit your workflow, you can add a **.fingerprintignore** file in your project root. It works like [**.gitignore**](https://git-scm.com/docs/gitignore#_pattern_format) but with some slight differences: We use `minimatch` for pattern matching with the [limitations](https://github.com/expo/expo/blob/9b9133c96f209b0616d1796aadae28913f8d012f/packages/%40expo/fingerprint/src/Fingerprint.types.ts#L46-L55).\n\nHere's how to use **.fingerprintignore**: To skip a whole folder but keep some files, you can do this:\n\n```\n# Ignore the entire /app/ios folder\n/app/ios/**/*\n\n# But still keep /app/ios/Podfile and /app/ios/Podfile.lock\n!/app/ios/Podfile\n!/app/ios/Podfile.lock\n```\n\n## Limitations\n\n### Limited support for [config-plugins raw functions](https://docs.expo.dev/config-plugins/plugins-and-mods/#raw-functions)\n\nWhen using config-plugins with raw functions, it's essential to be aware of certain limitations, particularly in the context of fingerprinting. Expo makes its best effort to generate fingerprints for changes made through config-plugins; however, raw functions pose specific challenges. Raw functions are not serializable as fingerprints, which means they cannot be directly used for generating unique hashes.\n\nTo work around this limitation, Expo employs one of the following strategies to create serializable fingerprints for raw functions:\n\n1. **Using `Function.name`**: Expo utilizes the `Function.name` property if available for named raw functions. This property provides a recognizable name for the function, which can be used as a fingerprint property.\n\n2. **Using `withAnonymous`**: For anonymous raw functions without a `Function.name`, Expo resorts to using 'withAnonymous' as the fingerprint property. This is a generic identifier for anonymous functions.\n\nHere's an example to illustrate these concepts:\n\n```javascript\n// In app.config.js\nconst { withInfoPlist } = require('expo/config-plugins');\n\nconst withMyPlugin = (config) => {\n  return withInfoPlist(config, (config) => {\n    config.modResults.NSLocationWhenInUseUsageDescription = 'Allow $(PRODUCT_NAME) to use your location';\n    return config;\n  });\n};\n\nexport default ({ config }) => {\n  config.plugins ||= [];\n  config.plugins.push(withMyPlugin);\n  config.plugins.push((config) => config);\n  return config;\n};`\n```\n\nIn this example, Expo will use ['withMyPlugin', 'withAnonymous'] as plugin properties for fingerprint hashing.\n\nIt's important to note that due to this design, if you make changes to the implementation of raw config-plugins functions, such as altering the Info.plist value within 'withMyPlugin', the fingerprint will still generate the same hash value. To ensure unique fingerprints when modifying config-plugins implementations, consider the following options:\n\n- **Avoid Anonymous Functions**: Avoid using anonymous raw config-plugins functions. Instead, use named functions whenever possible, and ensure that their names remain consistent as long as the implementation changes.\n\n- **Use Local config-plugins**: Alternatively, you can create local config-plugins as separate modules, each with its own export. This approach allows you to specify a different function name when making changes to the config-plugins implementations.\n\n  Here's an example of using a local config-plugin:\n\n  ```javascript\n  // In ./plugins/withMyPlugin.js\n  const { withInfoPlist } = require('expo/config-plugins');\n\n  const withMyPlugin = (config) => {\n    return withInfoPlist(config, (config) => {\n      config.modResults.NSLocationWhenInUseUsageDescription =\n        'Allow $(PRODUCT_NAME) to use your location';\n      return config;\n    });\n  };\n\n  module.exports = withMyPlugin;\n  ```\n\n  ```json\n  // in app.json\n  {\n    \"expo\": {\n      // ...\n      \"plugins\": \"./plugins/withMyPlugin\"\n    }\n  }\n  ```\n\nBy following these guidelines, you can effectively manage changes to config-plugins and ensure that fingerprinting remains consistent and reliable.\n","gitHead":"cdfd9c1a0b8d8860b542edea45cb452f3eea5269","scripts":{"lint":"expo-module lint","test":"expo-module test","build":"expo-module tsc","clean":"expo-module clean","watch":"expo-module tsc --watch","prepare":"expo-module clean && expo-module tsc","test:e2e":"yarn run prepare && expo-module test --config e2e/jest.config.js","typecheck":"expo-module typecheck","prepublishOnly":"expo-module prepublishOnly"},"_npmUser":{"name":"brentvatne","email":"brentvatne@gmail.com"},"repository":{"url":"git+https://github.com/expo/expo.git","type":"git","directory":"packages/@expo/fingerprint"},"_npmVersion":"10.2.4","description":"A library to generate a fingerprint from a React Native project","directories":{},"_nodeVersion":"18.19.1","dependencies":{"chalk":"^4.1.2","debug":"^4.3.4","semver":"^7.6.0","find-up":"^5.0.0","p-limit":"^3.1.0","minimatch":"^3.0.4","resolve-from":"^5.0.0","@expo/spawn-async":"^1.7.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"glob":"^7.1.7","temp-dir":"^2.0.0","@types/find-up":"^4.0.0","expo-module-scripts":"0.0.1-canary-20240405-cdfd9c1"},"_npmOperationalInternal":{"tmp":"tmp/fingerprint_0.0.1-canary-20240405-cdfd9c1_1712344429123_0.5933040398164198","host":"s3://npm-registry-packages"},"publish_time":1712344429309,"_cnpm_publish_time":1712344429309,"dist-tags":{"canary":"1.0.0-canary-20260909-ea7a89a","canary-sdk-55":"0.17.0-canary-20260429-a5e59cf","canary-sdk-56":"1.0.0-canary-20260701-9100865","latest":"0.21.9","next":"0.21.5","sdk-50":"0.6.0","sdk-51":"0.8.0","sdk-54":"0.15.5","sdk-55":"0.16.8","sdk-56":"0.19.10","sdk-57":"0.20.15"}}