posthog-react-native 4.74.2 → 4.76.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.
- package/dist/PostHogErrorBoundary.js.map +1 -1
- package/dist/PostHogProvider.js.map +1 -1
- package/dist/autocapture.d.ts +1 -1
- package/dist/autocapture.js.map +1 -1
- package/dist/error-tracking/index.js.map +1 -1
- package/dist/error-tracking/utils.js.map +1 -1
- package/dist/frameworks/wix-navigation.js +1 -1
- package/dist/frameworks/wix-navigation.js.map +1 -1
- package/dist/hooks/useNavigationTracker.js.map +1 -1
- package/dist/logs-defaults.js +1 -1
- package/dist/logs-defaults.js.map +1 -1
- package/dist/optional/OptionalExpoUpdates.js.map +1 -1
- package/dist/optional/OptionalPlugin.js.map +1 -1
- package/dist/optional/OptionalReactNativeSafeArea.js.map +1 -1
- package/dist/optional/OptionalReactNativeSvg.js.map +1 -1
- package/dist/posthog-rn.js +1 -1
- package/dist/posthog-rn.js.map +1 -1
- package/dist/surveys/PostHogSurveyProvider.js +1 -1
- package/dist/surveys/PostHogSurveyProvider.js.map +1 -1
- package/dist/surveys/components/QuestionHeader.js.map +1 -1
- package/dist/surveys/components/QuestionTypes.js +1 -1
- package/dist/surveys/components/QuestionTypes.js.map +1 -1
- package/dist/surveys/components/SurveyModal.d.ts +5 -0
- package/dist/surveys/components/SurveyModal.js +1 -1
- package/dist/surveys/components/SurveyModal.js.map +1 -1
- package/dist/surveys/components/Surveys.d.ts +7 -4
- package/dist/surveys/components/Surveys.js +1 -1
- package/dist/surveys/components/Surveys.js.map +1 -1
- package/dist/surveys/getActiveMatchingSurveys.d.ts +1 -1
- package/dist/surveys/getActiveMatchingSurveys.js +1 -1
- package/dist/surveys/getActiveMatchingSurveys.js.map +1 -1
- package/dist/surveys/icons.js.map +1 -1
- package/dist/surveys/safeStyleSheet.js.map +1 -1
- package/dist/surveys/survey-progress.d.ts +23 -0
- package/dist/surveys/survey-progress.js +2 -0
- package/dist/surveys/survey-progress.js.map +1 -0
- package/dist/surveys/survey-shuffling.js.map +1 -1
- package/dist/surveys/surveys-utils.d.ts +1 -1
- package/dist/surveys/useActivatedSurveys.js +1 -1
- package/dist/surveys/useActivatedSurveys.js.map +1 -1
- package/dist/surveys/useSurveyStorage.d.ts +3 -1
- package/dist/surveys/useSurveyStorage.js +1 -1
- package/dist/surveys/useSurveyStorage.js.map +1 -1
- package/dist/tooling/expoconfig.d.ts +24 -4
- package/dist/tooling/expoconfig.js +1 -1
- package/dist/tooling/expoconfig.js.map +1 -1
- package/dist/tooling/metroconfig.js.map +1 -1
- package/dist/tooling/posthogMetroSerializer.js.map +1 -1
- package/dist/tooling/utils.js.map +1 -1
- package/dist/tooling/vendor/metro/countLines.d.ts +1 -1
- package/dist/tooling/vendor/metro/utils.js.map +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +6 -6
- package/tooling/posthog-xcode.sh +22 -1
- package/tooling/posthog.gradle +13 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["crypto","_interopRequireWildcard","require","_countLines","_interopRequireDefault","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","isDevServerBuild","graph","options","transformOptions","Boolean","hot","dev","sourceUrl","createDebugIdSnippet","debugId","concat","stringToUUID","str","md5sum","createHash","update","md5Hash","digest","v4variant","substring","charCodeAt","toLowerCase","determineDebugIdFromBundleSource","code","match","undefined","resolveSetCreator","CountingSetFromPrivate","safeRequireCountingSetFromPrivate","CountingSetFromSrc","safeRequireCountingSetFromSrc","Set","createSet","exports","PRELUDE_MODULE_PATH","prependModule","modules","module","modifiedPremodules","_toConsumableArray2","length","path","unshift","createVirtualJSModule","modulePath","moduleCode","sourceCode","outputData","lineCount","countLines","map","setSource","dependencies","Map","getSource","Buffer","from","inverseDependencies","output","type","data","getExpoConfig","projectRoot","expoConfig","getConfig","_expoConfig$getConfig","exp","name","version","_a"],"sources":["../../src/tooling/utils.ts"],"sourcesContent":["// Portions of this file are derived from getsentry/sentry-react-native\n// Copyright (c) 2017 Sentry\n// Licensed under the MIT License: https://github.com/getsentry/sentry-react-native/blob/main/LICENSE.md\n\nimport * as crypto from 'crypto'\n// oxlint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph, SerializerOptions } from 'metro'\nimport type CountingSet from 'metro/src/lib/CountingSet' // types are in src but exports are in private\nimport countLines from './vendor/metro/countLines'\n\n// Variant of MixedOutput\n// https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/DeltaBundler/types.flow.js#L21\nexport type VirtualJSOutput = {\n type: 'js/script/virtual'\n data: {\n code: string\n lineCount: number\n map: []\n }\n}\n\nexport type Bundle = {\n modules: Array<[id: number, code: string]>\n post: string\n pre: string\n}\n\nexport type SerializedBundle = { code: string; map: string }\n\nexport type MetroSerializerOutput = string | SerializedBundle | Promise<string | SerializedBundle>\n\nexport type MetroSerializer = (\n entryPoint: string,\n premodules: ReadonlyArray<Module>,\n graph: ReadOnlyGraph,\n options: SerializerOptions\n) => MetroSerializerOutput\n\n/**\n * Metro removed `hot` from transform options in 0.83.2. On newer versions,\n * dev-server requests can be distinguished from development CLI bundles by\n * the source URL that Metro supplies.\n */\nexport function isDevServerBuild(graph: ReadOnlyGraph, options: SerializerOptions): boolean {\n const transformOptions = graph.transformOptions as { hot?: boolean; dev?: boolean }\n if ('hot' in transformOptions) {\n return Boolean(transformOptions.hot)\n }\n return Boolean(transformOptions.dev) && options.sourceUrl != null\n}\n\n/**\n * Returns minified Chunk ID code snippet.\n */\nexport function createDebugIdSnippet(debugId: string): string {\n return `!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"${debugId}\")}catch(e){}}();`\n}\n\n/**\n * Deterministically hashes a string and turns the hash into a uuid.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/58271f1af2ade6b3e64d393d70376ae53bc5bd2f/packages/bundler-plugin-core/src/utils.ts#L174\n */\nexport function stringToUUID(str: string): string {\n const md5sum = crypto.createHash('md5')\n md5sum.update(str)\n const md5Hash = md5sum.digest('hex')\n\n // Position 16 is fixed to either 8, 9, a, or b in the uuid v4 spec (10xx in binary)\n // RFC 4122 section 4.4\n const v4variant = ['8', '9', 'a', 'b'][md5Hash.substring(16, 17).charCodeAt(0) % 4] as string\n\n return `${md5Hash.substring(0, 8)}-${md5Hash.substring(8, 12)}-4${md5Hash.substring(\n 13,\n 16\n )}-${v4variant}${md5Hash.substring(17, 20)}-${md5Hash.substring(20)}`.toLowerCase()\n}\n\n/**\n * Looks for an injected `_posthogChunkIds[...] = \"uuid\"` pattern in bundle\n * source and extracts the generated Chunk ID. The runtime key is the stack\n * expression and can be minified to a variable such as `n`, so the key itself\n * must not be restricted to string or numeric literals.\n */\nexport function determineDebugIdFromBundleSource(code: string): string | undefined {\n const match = code.match(\n /_posthogChunkIds\\[[^\\]]+\\]\\s*=\\s*\"([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})\"/\n )\n return match ? match[1] : undefined\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction resolveSetCreator(): () => CountingSet<string> {\n const CountingSetFromPrivate = safeRequireCountingSetFromPrivate()\n if (CountingSetFromPrivate) {\n return () => new CountingSetFromPrivate.default()\n }\n\n const CountingSetFromSrc = safeRequireCountingSetFromSrc()\n if (CountingSetFromSrc) {\n return () => new CountingSetFromSrc.default()\n }\n\n return () => new Set() as unknown as CountingSet<string>\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction safeRequireCountingSetFromSrc(): { default: new <T>() => CountingSet<T> } | undefined {\n try {\n // oxlint-disable-next-line typescript/no-var-requires, import/no-extraneous-dependencies\n return require('metro/src/lib/CountingSet')\n } catch (e) {\n return undefined\n }\n}\n\n/**\n * CountingSet was moved to private in Metro 0.83.0. (all src exports were moved to private)\n *\n * https://github.com/facebook/metro/commit/ae6f42372ed361611b5672705f22081c2022cf28\n */\nfunction safeRequireCountingSetFromPrivate(): { default: new <T>() => CountingSet<T> } | undefined {\n try {\n // oxlint-disable-next-line typescript/no-var-requires, import/no-extraneous-dependencies\n return require('metro/private/lib/CountingSet')\n } catch (e) {\n return undefined\n }\n}\n\nexport const createSet = resolveSetCreator()\n\nconst PRELUDE_MODULE_PATH = '__prelude__'\n\n/**\n * Prepends the module after default required prelude modules.\n */\nexport function prependModule(\n modules: readonly Module<MixedOutput>[],\n module: Module<VirtualJSOutput>\n): Module<MixedOutput>[] {\n const modifiedPremodules = [...modules]\n if (\n modifiedPremodules.length > 0 &&\n modifiedPremodules[0] !== undefined &&\n modifiedPremodules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPremodules.unshift(modules[0] as Module<VirtualJSOutput>)\n modifiedPremodules[1] = module\n } else {\n modifiedPremodules.unshift(module)\n }\n return modifiedPremodules\n}\n\n/**\n * Creates a virtual JS module with the given path and code.\n */\nexport function createVirtualJSModule(\n modulePath: string,\n moduleCode: string\n): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n let sourceCode = moduleCode\n const outputData: VirtualJSOutput['data'] = {\n code: sourceCode,\n lineCount: countLines(sourceCode),\n map: [],\n }\n\n return {\n setSource: (code: string) => {\n sourceCode = code\n outputData.code = code\n outputData.lineCount = countLines(code)\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(sourceCode),\n inverseDependencies: createSet(),\n path: modulePath,\n output: [\n {\n type: 'js/script/virtual',\n data: outputData,\n },\n ],\n }\n}\n\n/**\n * Tries to load Expo config using `@expo/config` package.\n */\nexport function getExpoConfig(projectRoot: string): Partial<{\n name: string\n version: string\n}> {\n try {\n // oxlint-disable-next-line typescript/no-var-requires, import/no-extraneous-dependencies\n const expoConfig = require('@expo/config') as {\n getConfig?: (projectRoot: string) => { exp: Record<string, unknown> }\n }\n if (expoConfig.getConfig) {\n const { exp } = expoConfig.getConfig(projectRoot)\n return {\n name: typeof exp.name === 'string' && exp.name ? exp.name : undefined,\n version: typeof exp.version === 'string' && exp.version ? exp.version : undefined,\n }\n }\n } catch {\n // @expo/config not available, do nothing\n }\n\n return {}\n}\n"],"mappings":"+oBAIA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,YAIA,IAAAC,WAAA,CAAAC,sBAAA,CAAAF,OAAA,+BAAkD,SAAAD,wBAAAI,CAAA,CAAAC,CAAA,wBAAAC,OAAA,KAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAN,uBAAA,UAAAA,wBAAAI,CAAA,CAAAC,CAAA,MAAAA,CAAA,EAAAD,CAAA,EAAAA,CAAA,CAAAK,UAAA,QAAAL,CAAA,KAAAM,CAAA,CAAAC,CAAA,CAAAC,CAAA,EAAAC,SAAA,gBAAAT,CAAA,YAAAA,CAAA,YAAAU,OAAA,CAAAV,CAAA,sBAAAA,CAAA,QAAAQ,CAAA,IAAAF,CAAA,CAAAL,CAAA,CAAAG,CAAA,CAAAD,CAAA,KAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,SAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,CAAAM,CAAA,EAAAO,GAAA,CAAAb,CAAA,CAAAQ,CAAA,WAAAM,GAAA,IAA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,CAAEzB,SAAS,EAAE,CAChCS,IAAI,CAAEG,UAAU,CAChBc,MAAM,CAAE,CACN,CACEC,IAAI,CAAE,mBAAmB,CACzBC,IAAI,CAAEb,U,CACP,C,CAEJ,CACH,CAKM,QAAU,CAAAc,aAAaA,CAACC,WAAmB,EAI/C,GAAI,CAEF,GAAM,CAAAC,UAAU,CAAGtF,OAAO,CAAC,cAAc,CAExC,CACD,GAAIsF,UAAU,CAACC,SAAS,CAAE,CACxB,IAAAC,qBAAA,CAAgBF,UAAU,CAACC,SAAS,CAACF,WAAW,CAAC,CAAzCI,GAAG,CAAAD,qBAAA,CAAHC,GAAG,CACX,MAAO,CACLC,IAAI,CAAE,MAAO,CAAAD,GAAG,CAACC,IAAI,GAAK,QAAQ,EAAID,GAAG,CAACC,IAAI,CAAGD,GAAG,CAACC,IAAI,CAAG1C,SAAS,CACrE2C,OAAO,CAAE,MAAO,CAAAF,GAAG,CAACE,OAAO,GAAK,QAAQ,EAAIF,GAAG,CAACE,OAAO,CAAGF,GAAG,CAACE,OAAO,CAAG3C,S,CACzE,CACH,CACF,CAAE,MAAA4C,EAAA,CAAM,CAER,CAEA,MAAO,EAAE,CACX","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["crypto","_interopRequireWildcard","require","_countLines","_interopRequireDefault","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","isDevServerBuild","graph","options","transformOptions","Boolean","hot","dev","sourceUrl","createDebugIdSnippet","debugId","concat","stringToUUID","str","md5sum","createHash","update","md5Hash","digest","v4variant","substring","charCodeAt","toLowerCase","determineDebugIdFromBundleSource","code","match","undefined","resolveSetCreator","CountingSetFromPrivate","safeRequireCountingSetFromPrivate","CountingSetFromSrc","safeRequireCountingSetFromSrc","Set","createSet","exports","PRELUDE_MODULE_PATH","prependModule","modules","module","modifiedPremodules","_toConsumableArray2","length","path","unshift","createVirtualJSModule","modulePath","moduleCode","sourceCode","outputData","lineCount","countLines","map","setSource","dependencies","Map","getSource","Buffer","from","inverseDependencies","output","type","data","getExpoConfig","projectRoot","expoConfig","getConfig","_expoConfig$getConfig","exp","name","version"],"sources":["../../src/tooling/utils.ts"],"sourcesContent":["// Portions of this file are derived from getsentry/sentry-react-native\n// Copyright (c) 2017 Sentry\n// Licensed under the MIT License: https://github.com/getsentry/sentry-react-native/blob/main/LICENSE.md\n\nimport * as crypto from 'crypto'\n// oxlint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph, SerializerOptions } from 'metro'\nimport type CountingSet from 'metro/src/lib/CountingSet' // types are in src but exports are in private\nimport countLines from './vendor/metro/countLines'\n\n// Variant of MixedOutput\n// https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/DeltaBundler/types.flow.js#L21\nexport type VirtualJSOutput = {\n type: 'js/script/virtual'\n data: {\n code: string\n lineCount: number\n map: []\n }\n}\n\nexport type Bundle = {\n modules: Array<[id: number, code: string]>\n post: string\n pre: string\n}\n\nexport type SerializedBundle = { code: string; map: string }\n\nexport type MetroSerializerOutput = string | SerializedBundle | Promise<string | SerializedBundle>\n\nexport type MetroSerializer = (\n entryPoint: string,\n premodules: ReadonlyArray<Module>,\n graph: ReadOnlyGraph,\n options: SerializerOptions\n) => MetroSerializerOutput\n\n/**\n * Metro removed `hot` from transform options in 0.83.2. On newer versions,\n * dev-server requests can be distinguished from development CLI bundles by\n * the source URL that Metro supplies.\n */\nexport function isDevServerBuild(graph: ReadOnlyGraph, options: SerializerOptions): boolean {\n const transformOptions = graph.transformOptions as { hot?: boolean; dev?: boolean }\n if ('hot' in transformOptions) {\n return Boolean(transformOptions.hot)\n }\n return Boolean(transformOptions.dev) && options.sourceUrl != null\n}\n\n/**\n * Returns minified Chunk ID code snippet.\n */\nexport function createDebugIdSnippet(debugId: string): string {\n return `!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]=\"${debugId}\")}catch(e){}}();`\n}\n\n/**\n * Deterministically hashes a string and turns the hash into a uuid.\n *\n * https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/58271f1af2ade6b3e64d393d70376ae53bc5bd2f/packages/bundler-plugin-core/src/utils.ts#L174\n */\nexport function stringToUUID(str: string): string {\n const md5sum = crypto.createHash('md5')\n md5sum.update(str)\n const md5Hash = md5sum.digest('hex')\n\n // Position 16 is fixed to either 8, 9, a, or b in the uuid v4 spec (10xx in binary)\n // RFC 4122 section 4.4\n const v4variant = ['8', '9', 'a', 'b'][md5Hash.substring(16, 17).charCodeAt(0) % 4] as string\n\n return `${md5Hash.substring(0, 8)}-${md5Hash.substring(8, 12)}-4${md5Hash.substring(\n 13,\n 16\n )}-${v4variant}${md5Hash.substring(17, 20)}-${md5Hash.substring(20)}`.toLowerCase()\n}\n\n/**\n * Looks for an injected `_posthogChunkIds[...] = \"uuid\"` pattern in bundle\n * source and extracts the generated Chunk ID. The runtime key is the stack\n * expression and can be minified to a variable such as `n`, so the key itself\n * must not be restricted to string or numeric literals.\n */\nexport function determineDebugIdFromBundleSource(code: string): string | undefined {\n const match = code.match(\n /_posthogChunkIds\\[[^\\]]+\\]\\s*=\\s*\"([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})\"/\n )\n return match ? match[1] : undefined\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction resolveSetCreator(): () => CountingSet<string> {\n const CountingSetFromPrivate = safeRequireCountingSetFromPrivate()\n if (CountingSetFromPrivate) {\n return () => new CountingSetFromPrivate.default()\n }\n\n const CountingSetFromSrc = safeRequireCountingSetFromSrc()\n if (CountingSetFromSrc) {\n return () => new CountingSetFromSrc.default()\n }\n\n return () => new Set() as unknown as CountingSet<string>\n}\n\n/**\n * CountingSet was added in Metro 0.72.0 before that NodeJS Set was used.\n *\n * https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/CountingSet.js\n */\nfunction safeRequireCountingSetFromSrc(): { default: new <T>() => CountingSet<T> } | undefined {\n try {\n // oxlint-disable-next-line typescript/no-var-requires, import/no-extraneous-dependencies\n return require('metro/src/lib/CountingSet')\n } catch (e) {\n return undefined\n }\n}\n\n/**\n * CountingSet was moved to private in Metro 0.83.0. (all src exports were moved to private)\n *\n * https://github.com/facebook/metro/commit/ae6f42372ed361611b5672705f22081c2022cf28\n */\nfunction safeRequireCountingSetFromPrivate(): { default: new <T>() => CountingSet<T> } | undefined {\n try {\n // oxlint-disable-next-line typescript/no-var-requires, import/no-extraneous-dependencies\n return require('metro/private/lib/CountingSet')\n } catch (e) {\n return undefined\n }\n}\n\nexport const createSet = resolveSetCreator()\n\nconst PRELUDE_MODULE_PATH = '__prelude__'\n\n/**\n * Prepends the module after default required prelude modules.\n */\nexport function prependModule(\n modules: readonly Module<MixedOutput>[],\n module: Module<VirtualJSOutput>\n): Module<MixedOutput>[] {\n const modifiedPremodules = [...modules]\n if (\n modifiedPremodules.length > 0 &&\n modifiedPremodules[0] !== undefined &&\n modifiedPremodules[0].path === PRELUDE_MODULE_PATH\n ) {\n // prelude module must be first as it measures the bundle startup time\n modifiedPremodules.unshift(modules[0] as Module<VirtualJSOutput>)\n modifiedPremodules[1] = module\n } else {\n modifiedPremodules.unshift(module)\n }\n return modifiedPremodules\n}\n\n/**\n * Creates a virtual JS module with the given path and code.\n */\nexport function createVirtualJSModule(\n modulePath: string,\n moduleCode: string\n): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n let sourceCode = moduleCode\n const outputData: VirtualJSOutput['data'] = {\n code: sourceCode,\n lineCount: countLines(sourceCode),\n map: [],\n }\n\n return {\n setSource: (code: string) => {\n sourceCode = code\n outputData.code = code\n outputData.lineCount = countLines(code)\n },\n dependencies: new Map(),\n getSource: () => Buffer.from(sourceCode),\n inverseDependencies: createSet(),\n path: modulePath,\n output: [\n {\n type: 'js/script/virtual',\n data: outputData,\n },\n ],\n }\n}\n\n/**\n * Tries to load Expo config using `@expo/config` package.\n */\nexport function getExpoConfig(projectRoot: string): Partial<{\n name: string\n version: string\n}> {\n try {\n // oxlint-disable-next-line typescript/no-var-requires, import/no-extraneous-dependencies\n const expoConfig = require('@expo/config') as {\n getConfig?: (projectRoot: string) => { exp: Record<string, unknown> }\n }\n if (expoConfig.getConfig) {\n const { exp } = expoConfig.getConfig(projectRoot)\n return {\n name: typeof exp.name === 'string' && exp.name ? exp.name : undefined,\n version: typeof exp.version === 'string' && exp.version ? exp.version : undefined,\n }\n }\n } catch {\n // @expo/config not available, do nothing\n }\n\n return {}\n}\n"],"mappings":"+oBAIA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,YAIA,IAAAC,WAAA,CAAAC,sBAAA,CAAAF,OAAA,+BAAkD,SAAAD,wBAAAI,CAAA,CAAAC,CAAA,wBAAAC,OAAA,KAAAC,CAAA,KAAAD,OAAA,GAAAE,CAAA,KAAAF,OAAA,UAAAN,uBAAA,UAAAA,wBAAAI,CAAA,CAAAC,CAAA,MAAAA,CAAA,EAAAD,CAAA,EAAAA,CAAA,CAAAK,UAAA,QAAAL,CAAA,KAAAM,CAAA,CAAAC,CAAA,CAAAC,CAAA,EAAAC,SAAA,gBAAAT,CAAA,YAAAA,CAAA,YAAAU,OAAA,CAAAV,CAAA,sBAAAA,CAAA,QAAAQ,CAAA,IAAAF,CAAA,CAAAL,CAAA,CAAAG,CAAA,CAAAD,CAAA,KAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,SAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,CAA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A,QAAQ,CAAAC,MAAM,CAACC,IAAI,CAACV,UAAU,CAAC,GACxCW,mBAAmB,CAAEzB,SAAS,EAAE,CAChCS,IAAI,CAAEG,UAAU,CAChBc,MAAM,CAAE,CACN,CACEC,IAAI,CAAE,mBAAmB,CACzBC,IAAI,CAAEb,U,CACP,C,CAEJ,CACH,CAKM,QAAU,CAAAc,aAAaA,CAACC,WAAmB,EAI/C,GAAI,CAEF,GAAM,CAAAC,UAAU,CAAGtF,OAAO,CAAC,cAAc,CAExC,CACD,GAAIsF,UAAU,CAACC,SAAS,CAAE,CACxB,IAAAC,qBAAA,CAAgBF,UAAU,CAACC,SAAS,CAACF,WAAW,CAAC,CAAzCI,GAAG,CAAAD,qBAAA,CAAHC,GAAG,CACX,MAAO,CACLC,IAAI,CAAE,MAAO,CAAAD,GAAG,CAACC,IAAI,GAAK,QAAQ,EAAID,GAAG,CAACC,IAAI,CAAGD,GAAG,CAACC,IAAI,CAAG1C,SAAS,CACrE2C,OAAO,CAAE,MAAO,CAAAF,GAAG,CAACE,OAAO,GAAK,QAAQ,EAAIF,GAAG,CAACE,OAAO,CAAGF,GAAG,CAACE,OAAO,CAAG3C,S,CACzE,CACH,CACF,C,SAAQ,CAER,CAEA,MAAO,EAAE,CACX","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_utils","require","baseJSBundleModule","_c","baseJSBundle","_a","sourceMapString","sourceMapStringModule","e","bundleToStringModule","_d","bundleToString","_b","getSortedModules","exports","graph","_ref","createModuleId","modules","_toConsumableArray2","dependencies","values","sort","a","b","path","createDefaultMetroSerializer","entryPoint","premodules","options","bundle","serializerOptions","posthogBundleCallback","isDevServerBuild","_ref2","code","sourceMapStringFunction","_typeof2","Error","map","concat","processModuleFilter","shouldAddToIgnoreList"],"sources":["../../../../src/tooling/vendor/metro/utils.ts"],"sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/commit/9b85f83c9cc837d8cd897aa7723be7da5b296067\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// oxlint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro'\nimport type * as baseJSBundleType from 'metro/private/DeltaBundler/Serializers/baseJSBundle'\nimport type * as sourceMapStringType from 'metro/private/DeltaBundler/Serializers/sourceMapString'\nimport type * as bundleToStringType from 'metro/private/lib/bundleToString'\nimport { isDevServerBuild, type Bundle, type MetroSerializer } from '../../utils'\n\nlet baseJSBundleModule: any\ntry {\n // oxlint-disable-next-line typescript/no-require-imports\n baseJSBundleModule = require('metro/private/DeltaBundler/Serializers/baseJSBundle')\n} catch {\n // oxlint-disable-next-line typescript/no-require-imports\n baseJSBundleModule = require('metro/src/DeltaBundler/Serializers/baseJSBundle')\n}\n\nconst baseJSBundle: typeof baseJSBundleType =\n typeof baseJSBundleModule === 'function'\n ? baseJSBundleModule\n : // oxlint-disable-next-line typescript/no-unsafe-member-access\n (baseJSBundleModule?.baseJSBundle ?? baseJSBundleModule?.default)\n\nlet sourceMapString: typeof sourceMapStringType\ntry {\n // oxlint-disable-next-line typescript/no-var-requires\n const sourceMapStringModule = require('metro/private/DeltaBundler/Serializers/sourceMapString')\n sourceMapString = (sourceMapStringModule as { sourceMapString: typeof sourceMapStringType }).sourceMapString\n} catch (e) {\n sourceMapString = require('metro/src/DeltaBundler/Serializers/sourceMapString')\n if ('sourceMapString' in sourceMapString) {\n // Changed to named export in https://github.com/facebook/metro/commit/34148e61200a508923315fbe387b26d1da27bf4b\n // Metro 0.81.0 and 0.80.10 patch\n sourceMapString = (sourceMapString as { sourceMapString: typeof sourceMapStringType }).sourceMapString\n }\n}\n\nlet bundleToStringModule: any\ntry {\n bundleToStringModule = require('metro/private/lib/bundleToString')\n} catch {\n bundleToStringModule = require('metro/src/lib/bundleToString')\n}\n\nconst bundleToString: typeof bundleToStringType =\n typeof bundleToStringModule === 'function'\n ? bundleToStringModule\n : // oxlint-disable-next-line typescript/no-unsafe-member-access\n (bundleToStringModule?.bundleToString ?? bundleToStringModule?.default)\n\ntype NewSourceMapStringExport = {\n // Since Metro v0.80.10 https://github.com/facebook/metro/compare/v0.80.9...v0.80.10#diff-1b836d1729e527a725305eef0cec22e44605af2700fa413f4c2489ea1a03aebcL28\n sourceMapString: typeof sourceMapString\n}\n\ntype PostHogSerializerOptions = Parameters<MetroSerializer>[3] & {\n posthogBundleCallback?: (bundle: Bundle) => Bundle\n}\n\n/**\n * This function ensures that modules in source maps are sorted in the same\n * order as in a plain JS bundle.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L984\n */\nexport const getSortedModules = (\n graph: ReadOnlyGraph,\n {\n createModuleId,\n }: {\n createModuleId: (file: string) => number\n }\n): readonly Module[] => {\n const modules = [...graph.dependencies.values()]\n // Sort by IDs\n return modules.sort(\n (a: Module<MixedOutput>, b: Module<MixedOutput>) => createModuleId(a.path) - createModuleId(b.path)\n )\n}\n\n/**\n * Creates the default Metro plain bundle serializer.\n * Because Metro exports only the intermediate serializer functions, we need to\n * assemble the final serializer ourselves. We have to work with the modules the same as Metro does\n * to avoid unexpected changes in the final bundle.\n *\n * This is used when the user does not provide a custom serializer.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L244-L277\n */\nexport const createDefaultMetroSerializer = (): MetroSerializer => {\n return (entryPoint, premodules, graph, options) => {\n // baseJSBundle assigns IDs to modules in a consistent order\n let bundle = (baseJSBundle.default || baseJSBundle)(entryPoint, premodules, graph, options)\n const serializerOptions = options as PostHogSerializerOptions\n\n // Inject the final Chunk ID before both code rendering and source-map\n // generation so they describe the same bundle bytes.\n if (serializerOptions.posthogBundleCallback && !isDevServerBuild(graph, options)) {\n bundle = serializerOptions.posthogBundleCallback(bundle)\n }\n\n const { code } = (bundleToString.default || bundleToString)(bundle)\n if (isDevServerBuild(graph, options)) {\n // Hot means running in dev server, sourcemaps are generated on demand\n return code\n }\n\n let sourceMapStringFunction: typeof sourceMapString | undefined\n if (typeof sourceMapString === 'function') {\n sourceMapStringFunction = sourceMapString\n } else if (\n typeof sourceMapString === 'object' &&\n sourceMapString != null &&\n 'sourceMapString' in sourceMapString &&\n typeof sourceMapString['sourceMapString'] === 'function'\n ) {\n sourceMapStringFunction = (sourceMapString as NewSourceMapStringExport).sourceMapString\n } else {\n throw new Error(`\n[posthog-react-native/metro] Can't find sourceMapString function in 'metro/src/DeltaBundler/Serializers/sourceMapString'.\nPlease check the version of Metro you are using and report the issue at https://github.com/postHog/posthog-js\n`)\n }\n\n // Always generate source maps\n const map = (sourceMapStringFunction.default || sourceMapStringFunction)(\n [...premodules, ...getSortedModules(graph, options)],\n {\n processModuleFilter: options.processModuleFilter,\n shouldAddToIgnoreList: options.shouldAddToIgnoreList || (() => false),\n }\n )\n return { code, map }\n }\n}\n"],"mappings":"gZA+BA,IAA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B,eAAe,CAC3C,CAAC,IAAM,IACL,GAAA+B,QAAA,aAAO/B,eAAe,IAAK,QAAQ,EACnCA,eAAe,EAAI,IAAI,EACvB,iBAAiB,EAAI,CAAAA,eAAe,EACpC,MAAO,CAAAA,eAAe,CAAC,iBAAiB,CAAC,GAAK,UAAU,CACxD,CACA8B,uBAAuB,CAAI9B,eAA4C,CAACA,eAAe,CACzF,CAAC,IAAM,CACL,KAAM,IAAI,CAAAgC,KAAK,+OAGpB,CAAC,CACE,CAGA,GAAM,CAAAC,GAAG,CAAG,CAACH,uBAAuB,WAAQ,EAAIA,uBAAuB,KAAAI,MAAA,IAAArB,mBAAA,aACjES,UAAU,KAAAT,mBAAA,aAAKN,gBAAgB,CAACE,KAAK,CAAEc,OAAO,CAAC,GACnD,CACEY,mBAAmB,CAAEZ,OAAO,CAACY,mBAAmB,CAChDC,qBAAqB,CAAEb,OAAO,CAACa,qBAAqB,EAAK,iBAAM,MAAK,E,CACrE,CACF,CACD,MAAO,CAAEP,IAAI,CAAJA,IAAI,CAAEI,GAAG,CAAHA,GAAG,CAAE,CACtB,CAAC,CACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_utils","require","baseJSBundleModule","baseJSBundle","_a","sourceMapString","sourceMapStringModule","e","bundleToStringModule","bundleToString","_b","getSortedModules","exports","graph","_ref","createModuleId","modules","_toConsumableArray2","dependencies","values","sort","a","b","path","createDefaultMetroSerializer","entryPoint","premodules","options","bundle","serializerOptions","posthogBundleCallback","isDevServerBuild","_ref2","code","sourceMapStringFunction","_typeof2","Error","map","concat","processModuleFilter","shouldAddToIgnoreList"],"sources":["../../../../src/tooling/vendor/metro/utils.ts"],"sourcesContent":["// Vendored / modified from @facebook/metro\n\n// https://github.com/facebook/metro/commit/9b85f83c9cc837d8cd897aa7723be7da5b296067\n\n// MIT License\n\n// Copyright (c) Meta Platforms, Inc. and affiliates.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// oxlint-disable-next-line import/no-extraneous-dependencies\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro'\nimport type * as baseJSBundleType from 'metro/private/DeltaBundler/Serializers/baseJSBundle'\nimport type * as sourceMapStringType from 'metro/private/DeltaBundler/Serializers/sourceMapString'\nimport type * as bundleToStringType from 'metro/private/lib/bundleToString'\nimport { isDevServerBuild, type Bundle, type MetroSerializer } from '../../utils'\n\nlet baseJSBundleModule: any\ntry {\n // oxlint-disable-next-line typescript/no-require-imports\n baseJSBundleModule = require('metro/private/DeltaBundler/Serializers/baseJSBundle')\n} catch {\n // oxlint-disable-next-line typescript/no-require-imports\n baseJSBundleModule = require('metro/src/DeltaBundler/Serializers/baseJSBundle')\n}\n\nconst baseJSBundle: typeof baseJSBundleType =\n typeof baseJSBundleModule === 'function'\n ? baseJSBundleModule\n : // oxlint-disable-next-line typescript/no-unsafe-member-access\n (baseJSBundleModule?.baseJSBundle ?? baseJSBundleModule?.default)\n\nlet sourceMapString: typeof sourceMapStringType\ntry {\n // oxlint-disable-next-line typescript/no-var-requires\n const sourceMapStringModule = require('metro/private/DeltaBundler/Serializers/sourceMapString')\n sourceMapString = (sourceMapStringModule as { sourceMapString: typeof sourceMapStringType }).sourceMapString\n} catch (e) {\n sourceMapString = require('metro/src/DeltaBundler/Serializers/sourceMapString')\n if ('sourceMapString' in sourceMapString) {\n // Changed to named export in https://github.com/facebook/metro/commit/34148e61200a508923315fbe387b26d1da27bf4b\n // Metro 0.81.0 and 0.80.10 patch\n sourceMapString = (sourceMapString as { sourceMapString: typeof sourceMapStringType }).sourceMapString\n }\n}\n\nlet bundleToStringModule: any\ntry {\n bundleToStringModule = require('metro/private/lib/bundleToString')\n} catch {\n bundleToStringModule = require('metro/src/lib/bundleToString')\n}\n\nconst bundleToString: typeof bundleToStringType =\n typeof bundleToStringModule === 'function'\n ? bundleToStringModule\n : // oxlint-disable-next-line typescript/no-unsafe-member-access\n (bundleToStringModule?.bundleToString ?? bundleToStringModule?.default)\n\ntype NewSourceMapStringExport = {\n // Since Metro v0.80.10 https://github.com/facebook/metro/compare/v0.80.9...v0.80.10#diff-1b836d1729e527a725305eef0cec22e44605af2700fa413f4c2489ea1a03aebcL28\n sourceMapString: typeof sourceMapString\n}\n\ntype PostHogSerializerOptions = Parameters<MetroSerializer>[3] & {\n posthogBundleCallback?: (bundle: Bundle) => Bundle\n}\n\n/**\n * This function ensures that modules in source maps are sorted in the same\n * order as in a plain JS bundle.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L984\n */\nexport const getSortedModules = (\n graph: ReadOnlyGraph,\n {\n createModuleId,\n }: {\n createModuleId: (file: string) => number\n }\n): readonly Module[] => {\n const modules = [...graph.dependencies.values()]\n // Sort by IDs\n return modules.sort(\n (a: Module<MixedOutput>, b: Module<MixedOutput>) => createModuleId(a.path) - createModuleId(b.path)\n )\n}\n\n/**\n * Creates the default Metro plain bundle serializer.\n * Because Metro exports only the intermediate serializer functions, we need to\n * assemble the final serializer ourselves. We have to work with the modules the same as Metro does\n * to avoid unexpected changes in the final bundle.\n *\n * This is used when the user does not provide a custom serializer.\n *\n * https://github.com/facebook/metro/blob/9b85f83c9cc837d8cd897aa7723be7da5b296067/packages/metro/src/Server.js#L244-L277\n */\nexport const createDefaultMetroSerializer = (): MetroSerializer => {\n return (entryPoint, premodules, graph, options) => {\n // baseJSBundle assigns IDs to modules in a consistent order\n let bundle = (baseJSBundle.default || baseJSBundle)(entryPoint, premodules, graph, options)\n const serializerOptions = options as PostHogSerializerOptions\n\n // Inject the final Chunk ID before both code rendering and source-map\n // generation so they describe the same bundle bytes.\n if (serializerOptions.posthogBundleCallback && !isDevServerBuild(graph, options)) {\n bundle = serializerOptions.posthogBundleCallback(bundle)\n }\n\n const { code } = (bundleToString.default || bundleToString)(bundle)\n if (isDevServerBuild(graph, options)) {\n // Hot means running in dev server, sourcemaps are generated on demand\n return code\n }\n\n let sourceMapStringFunction: typeof sourceMapString | undefined\n if (typeof sourceMapString === 'function') {\n sourceMapStringFunction = sourceMapString\n } else if (\n typeof sourceMapString === 'object' &&\n sourceMapString != null &&\n 'sourceMapString' in sourceMapString &&\n typeof sourceMapString['sourceMapString'] === 'function'\n ) {\n sourceMapStringFunction = (sourceMapString as NewSourceMapStringExport).sourceMapString\n } else {\n throw new Error(`\n[posthog-react-native/metro] Can't find sourceMapString function in 'metro/src/DeltaBundler/Serializers/sourceMapString'.\nPlease check the version of Metro you are using and report the issue at https://github.com/postHog/posthog-js\n`)\n }\n\n // Always generate source maps\n const map = (sourceMapStringFunction.default || sourceMapStringFunction)(\n [...premodules, ...getSortedModules(graph, options)],\n {\n processModuleFilter: options.processModuleFilter,\n shouldAddToIgnoreList: options.shouldAddToIgnoreList || (() => false),\n }\n )\n return { code, map }\n }\n}\n"],"mappings":"gZA+BA,IAAAA,MAAA,CAAAC,OAAA,gB,UAEA,GAAI,CAAAC,kBAAuB,CAC3B,GAAI,CAEFA,kBAAkB,CAAGD,OAAO,CAAC,qDAAqD,C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,CAAAA,eAAe,CAAC,iBAAiB,CAAC,GAAK,UAAU,CACxD,CACA6B,uBAAuB,CAAI7B,eAA4C,CAACA,eAAe,CACzF,CAAC,IAAM,CACL,KAAM,IAAI,CAAA+B,KAAK,+OAGpB,CAAC,CACE,CAGA,GAAM,CAAAC,GAAG,CAAG,CAACH,uBAAuB,WAAQ,EAAIA,uBAAuB,KAAAI,MAAA,IAAArB,mBAAA,aACjES,UAAU,KAAAT,mBAAA,aAAKN,gBAAgB,CAACE,KAAK,CAAEc,OAAO,CAAC,GACnD,CACEY,mBAAmB,CAAEZ,OAAO,CAACY,mBAAmB,CAChDC,qBAAqB,CAAEb,OAAO,CAACa,qBAAqB,EAAK,iBAAM,MAAK,E,CACrE,CACF,CACD,MAAO,CAAEP,IAAI,CAAJA,IAAI,CAAEI,GAAG,CAAHA,GAAG,CAAE,CACtB,CAAC,CACH,CAAC","ignoreList":[]}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_reactNative","require","_core","_global","global","undefined","_globalThis","globalThis","GLOBAL_OBJ","exports","getPlatformOS","Platform","OS","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_reactNative","require","_core","_global","global","undefined","_globalThis","globalThis","GLOBAL_OBJ","exports","getPlatformOS","Platform","OS","isWeb","isMacOS","isWindows","isHermes","HermesInternal"],"sources":["../src/utils.ts"],"sourcesContent":["import { Platform } from 'react-native'\n\n// Re-export remote config utilities from core\nexport { getRemoteConfigBool, getRemoteConfigNumber, isValidSampleRate } from '@posthog/core'\n\ntype ReactNativeGlobal = {\n HermesInternal?: {\n enablePromiseRejectionTracker?: (args: {\n allRejections: boolean\n onUnhandled?: (id: string, error: any) => void\n onHandled?: (id: string, error: any) => void\n }) => void\n hasPromise?: () => boolean\n }\n ErrorUtils?: {\n getGlobalHandler?: () => (error: Error, isFatal: boolean) => void\n setGlobalHandler?: (handler: (error: Error, isFatal: boolean) => void) => void\n }\n onunhandledrejection?: (event: unknown) => void\n}\n\n// fallback for older environments\nconst _global: typeof global | undefined = typeof global !== 'undefined' ? global : undefined\n\n// works after for ECMAScript 2020 (React Native >= 0.63)\nconst _globalThis: typeof globalThis | undefined = typeof globalThis !== 'undefined' ? globalThis : undefined\n\nexport const GLOBAL_OBJ = (_globalThis ?? _global) as unknown as ReactNativeGlobal\n\nexport function getPlatformOS(): string | undefined {\n try {\n return Platform?.OS\n } catch {\n return undefined\n }\n}\n\n/** Checks if the current platform is web */\nexport function isWeb(): boolean {\n return getPlatformOS() === 'web'\n}\n\n/** Checks if the current platform is macOS */\nexport function isMacOS(): boolean {\n return getPlatformOS() === 'macos'\n}\n\n/** Checks if the current platform is Windows */\nexport function isWindows(): boolean {\n return getPlatformOS() === 'windows'\n}\n\nexport const isHermes = () => !!GLOBAL_OBJ.HermesInternal\n"],"mappings":"2lBAAA,IAAAA,YAAA,CAAAC,OAAA,iBAGA,IAAAC,KAAA,CAAAD,OAAA,kBAmBA,GAAM,CAAAE,OAAO,CAA8B,MAAO,CAAAC,MAAM,GAAK,WAAW,CAAGA,MAAM,CAAGC,SAAS,CAG7F,GAAM,CAAAC,WAAW,CAAkC,MAAO,CAAAC,UAAU,GAAK,WAAW,CAAGA,UAAU,CAAGF,SAAS,CAEtG,GAAM,CAAAG,UAAU,CAAAC,OAAA,CAAAD,UAAA,CAAIF,WAAW,SAAXA,WAAW,UAAXA,WAAW,CAAIH,OAAwC,CAE5E,QAAU,CAAAO,aAAaA,CAAA,EAC3B,GAAI,CACF,MAAO,CAAAC,qBAAQ,SAARA,qBAAQ,iBAARA,qBAAQ,CAAEC,EAAE,CACrB,C,SAAQ,CACN,MAAO,CAAAP,SAAS,CAClB,CACF,CAGM,QAAU,CAAAQ,KAAKA,CAAA,EACnB,MAAO,CAAAH,aAAa,EAAE,GAAK,KAAK,CAClC,CAGM,QAAU,CAAAI,OAAOA,CAAA,EACrB,MAAO,CAAAJ,aAAa,EAAE,GAAK,OAAO,CACpC,CAGM,QAAU,CAAAK,SAASA,CAAA,EACvB,MAAO,CAAAL,aAAa,EAAE,GAAK,SAAS,CACtC,CAEO,GAAM,CAAAM,QAAQ,CAAAP,OAAA,CAAAO,QAAA,CAAG,QAAX,CAAAA,QAAQA,CAAA,QAAS,CAAC,CAACR,UAAU,CAACS,cAAc","ignoreList":[]}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.
|
|
1
|
+
export declare const version = "4.76.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.version=void 0;var version=exports.version="4.76.0";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.
|
|
1
|
+
{"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.76.0\"\n"],"mappings":"6FAAO,GAAM,CAAAA,OAAO,CAAAC,OAAA,CAAAD,OAAA,CAAG,QAAQ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthog-react-native",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.76.0",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/PostHog/posthog-js/issues"
|
|
6
6
|
},
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"directory": "packages/react-native"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@posthog/
|
|
38
|
-
"@posthog/
|
|
37
|
+
"@posthog/core": "^1.55.1",
|
|
38
|
+
"@posthog/types": "^1.412.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/cli": "^7.19.3",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"react-native-safe-area-context": "^4.10.1",
|
|
71
71
|
"react-native-svg": "^15.0.0",
|
|
72
72
|
"jsdom": "^26.1.0",
|
|
73
|
-
"typescript": "
|
|
73
|
+
"typescript": "7.0.2",
|
|
74
74
|
"@vitest/coverage-v8": "^1.6.1",
|
|
75
75
|
"vitest": "^1.6.1",
|
|
76
|
-
"@posthog-tooling/tsconfig-base": "1.1.1",
|
|
77
76
|
"@posthog/react-native-plugin": "2.9.4",
|
|
78
|
-
"@posthog-tooling/rollup-utils": "1.1.1"
|
|
77
|
+
"@posthog-tooling/rollup-utils": "1.1.1",
|
|
78
|
+
"@posthog-tooling/tsconfig-base": "1.1.1"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@react-native-async-storage/async-storage": ">=1.0.0",
|
package/tooling/posthog-xcode.sh
CHANGED
|
@@ -33,6 +33,7 @@ print_command_error() {
|
|
|
33
33
|
# WITH_ENVIRONMENT is executed by React Native
|
|
34
34
|
|
|
35
35
|
POSTHOG_SKIP_ON_CONFLICT_ENABLED="${POSTHOG_SKIP_ON_CONFLICT:-}"
|
|
36
|
+
POSTHOG_FORCE_ENABLED="${POSTHOG_FORCE:-}"
|
|
36
37
|
# The mode is explicit when the environment or a --posthog-release-mode argument supplies it, and
|
|
37
38
|
# implicit when only the event default applies. The difference decides how an old posthog-cli is
|
|
38
39
|
# handled below: an explicit mode fails the build, the implicit default softens to a bound upload.
|
|
@@ -47,6 +48,10 @@ while [ "$#" -gt 0 ]; do
|
|
|
47
48
|
POSTHOG_SKIP_ON_CONFLICT_ENABLED=1
|
|
48
49
|
shift
|
|
49
50
|
;;
|
|
51
|
+
--posthog-force)
|
|
52
|
+
POSTHOG_FORCE_ENABLED=1
|
|
53
|
+
shift
|
|
54
|
+
;;
|
|
50
55
|
--posthog-release-mode)
|
|
51
56
|
# `shift 2` past the end of the argument list makes `set -e` abort the wrapper silently.
|
|
52
57
|
if [ "$#" -lt 2 ]; then
|
|
@@ -72,10 +77,26 @@ while [ "$#" -gt 0 ]; do
|
|
|
72
77
|
esac
|
|
73
78
|
done
|
|
74
79
|
|
|
80
|
+
posthog_flag_is_enabled() {
|
|
81
|
+
[ "$1" = "1" ] || [ "$1" = "true" ]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# How an upload treats a symbol set that already exists with different content: skip-on-conflict
|
|
85
|
+
# keeps the stored one, force overwrites it, and the default fails the build. posthog-cli declares
|
|
86
|
+
# the two flags mutually exclusive, so reject the pair here rather than letting the upload fail on
|
|
87
|
+
# an argument-parser error after the bundle is built.
|
|
88
|
+
if posthog_flag_is_enabled "$POSTHOG_SKIP_ON_CONFLICT_ENABLED" && posthog_flag_is_enabled "$POSTHOG_FORCE_ENABLED"; then
|
|
89
|
+
echo "error: posthog skip-on-conflict and force cannot both be set. posthog-cli accepts only one of --skip-on-conflict and --force."
|
|
90
|
+
exit 1
|
|
91
|
+
fi
|
|
92
|
+
|
|
75
93
|
POSTHOG_UPLOAD_ARGS=()
|
|
76
|
-
if
|
|
94
|
+
if posthog_flag_is_enabled "$POSTHOG_SKIP_ON_CONFLICT_ENABLED"; then
|
|
77
95
|
POSTHOG_UPLOAD_ARGS+=(--skip-on-conflict)
|
|
78
96
|
fi
|
|
97
|
+
if posthog_flag_is_enabled "$POSTHOG_FORCE_ENABLED"; then
|
|
98
|
+
POSTHOG_UPLOAD_ARGS+=(--force)
|
|
99
|
+
fi
|
|
79
100
|
|
|
80
101
|
# How the release a build belongs to gets associated with the exceptions it reports. This covers
|
|
81
102
|
# the Hermes source maps only. The dSYM upload always binds to the release its build creates.
|
package/tooling/posthog.gradle
CHANGED
|
@@ -92,10 +92,22 @@ plugins.withId('com.android.application') {
|
|
|
92
92
|
extraArgs.addAll(["--build", versionCode.toString()])
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
// How an upload treats a symbol set that already exists with different
|
|
96
|
+
// content: skip-on-conflict keeps the stored one, force overwrites it, and
|
|
97
|
+
// the default fails the build. posthog-cli declares the two flags mutually
|
|
98
|
+
// exclusive, so reject the pair rather than failing on a parser error.
|
|
95
99
|
def posthogUploadArgs = []
|
|
96
|
-
|
|
100
|
+
def posthogSkipOnConflict = project.ext.has("posthogReactNativeSkipOnConflict") && project.ext.get("posthogReactNativeSkipOnConflict") == true
|
|
101
|
+
def posthogForce = project.ext.has("posthogReactNativeForce") && project.ext.get("posthogReactNativeForce") == true
|
|
102
|
+
if (posthogSkipOnConflict && posthogForce) {
|
|
103
|
+
throw new GradleException("posthogReactNativeSkipOnConflict and posthogReactNativeForce cannot both be true. posthog-cli accepts only one of --skip-on-conflict and --force.")
|
|
104
|
+
}
|
|
105
|
+
if (posthogSkipOnConflict) {
|
|
97
106
|
posthogUploadArgs.add("--skip-on-conflict")
|
|
98
107
|
}
|
|
108
|
+
if (posthogForce) {
|
|
109
|
+
posthogUploadArgs.add("--force")
|
|
110
|
+
}
|
|
99
111
|
|
|
100
112
|
// How the release a build belongs to gets associated with the exceptions
|
|
101
113
|
// it reports. `event` (the default) uploads the source maps
|