posthog-react-native 4.74.1 → 4.75.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/PostHogContext.js +2 -1
- package/dist/PostHogContext.js.map +1 -1
- package/dist/PostHogErrorBoundary.js +2 -1
- package/dist/PostHogErrorBoundary.js.map +1 -1
- package/dist/PostHogMaskView.js +2 -1
- package/dist/PostHogMaskView.js.map +1 -1
- package/dist/PostHogProvider.js +2 -1
- package/dist/PostHogProvider.js.map +1 -1
- package/dist/autocapture.d.ts +1 -1
- package/dist/autocapture.js +2 -1
- package/dist/autocapture.js.map +1 -1
- package/dist/error-tracking/exception-context.js +2 -1
- package/dist/error-tracking/exception-context.js.map +1 -1
- package/dist/error-tracking/index.js +2 -1
- package/dist/error-tracking/index.js.map +1 -1
- package/dist/error-tracking/utils.js +2 -1
- package/dist/error-tracking/utils.js.map +1 -1
- package/dist/frameworks/wix-navigation.js +2 -1
- package/dist/frameworks/wix-navigation.js.map +1 -1
- package/dist/hooks/useFeatureFlag.js +2 -1
- package/dist/hooks/useFeatureFlag.js.map +1 -1
- package/dist/hooks/useFeatureFlagResult.js +2 -1
- package/dist/hooks/useFeatureFlagResult.js.map +1 -1
- package/dist/hooks/useFeatureFlags.js +2 -1
- package/dist/hooks/useFeatureFlags.js.map +1 -1
- package/dist/hooks/useNavigationTracker.js +2 -1
- package/dist/hooks/useNavigationTracker.js.map +1 -1
- package/dist/hooks/usePostHog.js +2 -1
- package/dist/hooks/usePostHog.js.map +1 -1
- package/dist/hooks/utils.js +2 -1
- package/dist/hooks/utils.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/logs-defaults.js +2 -1
- package/dist/logs-defaults.js.map +1 -1
- package/dist/native-deps.js +2 -1
- package/dist/native-deps.js.map +1 -1
- package/dist/optional/OptionalAsyncStorage.js +2 -1
- package/dist/optional/OptionalAsyncStorage.js.map +1 -1
- package/dist/optional/OptionalExpoApplication.js +2 -1
- package/dist/optional/OptionalExpoApplication.js.map +1 -1
- package/dist/optional/OptionalExpoDevice.js +2 -1
- package/dist/optional/OptionalExpoDevice.js.map +1 -1
- package/dist/optional/OptionalExpoFileSystem.js +2 -1
- package/dist/optional/OptionalExpoFileSystem.js.map +1 -1
- package/dist/optional/OptionalExpoFileSystemLegacy.js +2 -1
- package/dist/optional/OptionalExpoFileSystemLegacy.js.map +1 -1
- package/dist/optional/OptionalExpoLocalization.js +2 -1
- package/dist/optional/OptionalExpoLocalization.js.map +1 -1
- package/dist/optional/OptionalExpoUpdates.js +2 -1
- package/dist/optional/OptionalExpoUpdates.js.map +1 -1
- package/dist/optional/OptionalPlugin.js +2 -1
- package/dist/optional/OptionalPlugin.js.map +1 -1
- package/dist/optional/OptionalReactNativeDeviceInfo.js +2 -1
- package/dist/optional/OptionalReactNativeDeviceInfo.js.map +1 -1
- package/dist/optional/OptionalReactNativeLocalize.js +2 -1
- package/dist/optional/OptionalReactNativeLocalize.js.map +1 -1
- package/dist/optional/OptionalReactNativeNavigation.js +2 -1
- package/dist/optional/OptionalReactNativeNavigation.js.map +1 -1
- package/dist/optional/OptionalReactNativeNavigationWix.js +2 -1
- package/dist/optional/OptionalReactNativeNavigationWix.js.map +1 -1
- package/dist/optional/OptionalReactNativeSafeArea.js +2 -1
- package/dist/optional/OptionalReactNativeSafeArea.js.map +1 -1
- package/dist/optional/OptionalReactNativeSvg.js +2 -1
- package/dist/optional/OptionalReactNativeSvg.js.map +1 -1
- package/dist/posthog-rn.js +2 -1
- package/dist/posthog-rn.js.map +1 -1
- package/dist/storage.js +2 -1
- package/dist/storage.js.map +1 -1
- package/dist/surveys/PostHogSurveyProvider.js +2 -1
- package/dist/surveys/PostHogSurveyProvider.js.map +1 -1
- package/dist/surveys/components/BottomSection.js +2 -1
- package/dist/surveys/components/BottomSection.js.map +1 -1
- package/dist/surveys/components/Cancel.js +2 -1
- package/dist/surveys/components/Cancel.js.map +1 -1
- package/dist/surveys/components/ConfirmationMessage.js +2 -1
- package/dist/surveys/components/ConfirmationMessage.js.map +1 -1
- package/dist/surveys/components/IntroMessage.js +2 -1
- package/dist/surveys/components/IntroMessage.js.map +1 -1
- package/dist/surveys/components/QuestionHeader.js +2 -1
- package/dist/surveys/components/QuestionHeader.js.map +1 -1
- package/dist/surveys/components/QuestionTypes.js +2 -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 +2 -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 +2 -1
- package/dist/surveys/components/Surveys.js.map +1 -1
- package/dist/surveys/getActiveMatchingSurveys.d.ts +1 -1
- package/dist/surveys/getActiveMatchingSurveys.js +2 -1
- package/dist/surveys/getActiveMatchingSurveys.js.map +1 -1
- package/dist/surveys/icons.js +2 -1
- package/dist/surveys/icons.js.map +1 -1
- package/dist/surveys/index.js +2 -1
- package/dist/surveys/index.js.map +1 -1
- package/dist/surveys/safeStyleSheet.js +2 -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 +2 -1
- package/dist/surveys/survey-shuffling.js.map +1 -1
- package/dist/surveys/survey-translations.js +2 -1
- package/dist/surveys/survey-translations.js.map +1 -1
- package/dist/surveys/surveys-utils.d.ts +1 -1
- package/dist/surveys/surveys-utils.js +2 -1
- package/dist/surveys/surveys-utils.js.map +1 -1
- package/dist/surveys/useActivatedSurveys.js +2 -1
- package/dist/surveys/useActivatedSurveys.js.map +1 -1
- package/dist/surveys/useSurveyStorage.d.ts +3 -1
- package/dist/surveys/useSurveyStorage.js +2 -1
- package/dist/surveys/useSurveyStorage.js.map +1 -1
- package/dist/tooling/expoconfig.js +2 -1
- package/dist/tooling/expoconfig.js.map +1 -1
- package/dist/tooling/metroconfig.js +2 -1
- package/dist/tooling/metroconfig.js.map +1 -1
- package/dist/tooling/posthogMetroSerializer.js +2 -1
- package/dist/tooling/posthogMetroSerializer.js.map +1 -1
- package/dist/tooling/utils.js +2 -1
- package/dist/tooling/utils.js.map +1 -1
- package/dist/tooling/vendor/expo/expoconfig.js +2 -1
- package/dist/tooling/vendor/expo/expoconfig.js.map +1 -1
- package/dist/tooling/vendor/metro/countLines.d.ts +1 -1
- package/dist/tooling/vendor/metro/countLines.js +2 -1
- package/dist/tooling/vendor/metro/countLines.js.map +1 -1
- package/dist/tooling/vendor/metro/utils.js +2 -1
- package/dist/tooling/vendor/metro/utils.js.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -1
- package/dist/version.js.map +1 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthogMetroSerializer.js","sourceRoot":"","sources":["../../src/tooling/posthogMetroSerializer.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,4BAA4B;AAC5B,wGAAwG;AAExG,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAIhC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,gCAAgC,EAChC,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AAQnE,MAAM,qBAAqB,GAAG,sBAAsB,CAAA;AACpD,MAAM,oBAAoB,GAAG,aAAa,CAAA;AAE1C,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AAClD,MAAM,gBAAgB,GAAG,cAAc,CAAA;AAEvC;;GAEG;AACH,MAAM,UAAU,6CAA6C,CAAC,EAC5D,KAAK,EACL,UAAU,EACV,OAAO,GAKR;IACC,4EAA4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,CAAC;IACD,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;AACzC,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,OAAe;IAClD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,qBAAqB,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAA;AACtE,CAAC"}
|
|
1
|
+
{"version":3,"file":"posthogMetroSerializer.js","names":["crypto","_interopRequireWildcard","require","_utils","_utils2","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_createForOfIteratorHelper","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","done","value","TypeError","a","u","next","_arrayLikeToArray","toString","slice","constructor","name","from","test","DEBUG_ID_PLACE_HOLDER","DEBUG_ID_MODULE_PATH","SOURCE_MAP_COMMENT","DEBUG_ID_COMMENT","unstableBeforeAssetSerializationDebugIdPlugin","_ref","graph","premodules","debugId","transformOptions","platform","debugIdModuleExists","some","module","path","console","warn","debugIdModule","createDebugIdModule","prependModule","createPostHogMetroSerializer","exports","customSerializer","serializer","createDefaultMetroSerializer","_ref2","_asyncToGenerator2","_regenerator","mark","_callee","entryPoint","options","serializerOptions","modifiedPremodules","serializerResult","_ref3","bundleCode","bundleMapString","debugIdComment","indexOfSourceMapComment","bundleCodeWithDebugId","bundleMap","wrap","_context","prev","isDevServerBuild","abrupt","isExpoStaticExport","modulesOnly","posthogBundleCallback","createPostHogBundleCallback","sent","code","map","determineDebugIdFromBundleSource","Error","log","concat","lastIndexOf","substring","JSON","parse","stringify","stop","_x","_x2","_x3","_x4","apply","arguments","output","sourceUrl","url","URL","jscQueryStart","pathname","indexOf","query","split","includes","URLSearchParams","searchParams","bundle","calculateDebugId","pre","modules","setSource","injectDebugId","getSource","createVirtualJSModule","createDebugIdSnippet","hash","createHash","update","_iterator","_step","_step$value","_slicedToArray2","err","stringToUUID","digest","replace","RegExp"],"sources":["../../src/tooling/posthogMetroSerializer.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 } from 'metro'\nimport type { Bundle, MetroSerializer, VirtualJSOutput } from './utils'\nimport {\n createDebugIdSnippet,\n createVirtualJSModule,\n determineDebugIdFromBundleSource,\n isDevServerBuild,\n prependModule,\n stringToUUID,\n} from './utils'\nimport { createDefaultMetroSerializer } from './vendor/metro/utils'\n\ntype SourceMap = Record<string, unknown>\ntype PostHogSerializerOptions = Parameters<MetroSerializer>[3] & {\n posthogBundleCallback?: (bundle: Bundle) => Bundle\n serializerOptions?: { output?: string }\n}\n\nconst DEBUG_ID_PLACE_HOLDER = '__POSTHOG_CHUNK_ID__'\nconst DEBUG_ID_MODULE_PATH = '__chunkid__'\n\nconst SOURCE_MAP_COMMENT = '//# sourceMappingURL='\nconst DEBUG_ID_COMMENT = '//# chunkId='\n\n/**\n * Adds PostHog Chunk ID polyfill module to the bundle.\n */\nexport function unstableBeforeAssetSerializationDebugIdPlugin({\n graph,\n premodules,\n debugId,\n}: {\n graph: ReadOnlyGraph<MixedOutput>\n premodules: Module[]\n debugId?: string\n}): Module[] {\n // Skip for web platform - sourcemaps are handled differently for web builds\n if (graph.transformOptions.platform === 'web') {\n return premodules\n }\n\n if (!debugId) {\n return premodules\n }\n\n const debugIdModuleExists = premodules.some((module) => module.path === DEBUG_ID_MODULE_PATH)\n if (debugIdModuleExists) {\n // oxlint-disable-next-line no-console\n console.warn('\\n\\nChunk ID module found. Skipping PostHog Chunk ID module...\\n\\n')\n return premodules\n }\n\n const debugIdModule = createDebugIdModule(debugId)\n return prependModule(premodules, debugIdModule)\n}\n\n/**\n * Creates a Metro serializer that adds Chunk ID module to the plain bundle.\n * The Chunk ID module is a virtual module that provides a Chunk ID in runtime.\n * Expo static exports are delegated unchanged. Use getPostHogExpoConfig to\n * enable PostHog Chunk IDs through Expo's per-asset serialization hook.\n *\n * RAM Bundles do not support custom serializers.\n */\nexport const createPostHogMetroSerializer = (customSerializer?: MetroSerializer): MetroSerializer => {\n const serializer = customSerializer || createDefaultMetroSerializer()\n return async function (entryPoint, premodules, graph, options) {\n if (isDevServerBuild(graph, options)) {\n return serializer(entryPoint, premodules, graph, options)\n }\n\n // Expo static exports can contain multiple assets (or JSON), not one plain\n // bundle. Its per-asset PostHog plugin injects real IDs before source maps\n // are generated. A placeholder here would prevent that plugin from running.\n if (customSerializer && isExpoStaticExport(options)) {\n return serializer(entryPoint, premodules, graph, options)\n }\n\n const debugIdModuleExists = premodules.some((module) => module.path === DEBUG_ID_MODULE_PATH)\n if (debugIdModuleExists) {\n // oxlint-disable-next-line no-console\n console.warn('Chunk ID module found. Skipping PostHog Chunk ID module...')\n return serializer(entryPoint, premodules, graph, options)\n }\n\n // Async chunks are serialized with `modulesOnly`, which drops the premodules\n // that carry the Chunk ID. There is nothing to inject into such a chunk.\n if (options.modulesOnly) {\n return serializer(entryPoint, premodules, graph, options)\n }\n\n const debugIdModule = createDebugIdModule(DEBUG_ID_PLACE_HOLDER)\n const serializerOptions = options as PostHogSerializerOptions\n serializerOptions.posthogBundleCallback = createPostHogBundleCallback(debugIdModule)\n const modifiedPremodules = prependModule(premodules, debugIdModule)\n\n // The default serializer invokes posthogBundleCallback after Metro assembles\n // the bundle and before it renders code/source maps, so both outputs contain\n // the same real Chunk ID.\n const serializerResult = await serializer(entryPoint, modifiedPremodules, graph, serializerOptions)\n const { code: bundleCode, map: bundleMapString } =\n typeof serializerResult === 'string' ? { code: serializerResult, map: '{}' } : serializerResult\n\n const debugId = determineDebugIdFromBundleSource(bundleCode)\n if (!debugId) {\n throw new Error('Chunk ID was not found in the bundle.')\n }\n\n // Only print Chunk ID for command line builds => not hot reload from dev server\n // oxlint-disable-next-line no-console\n console.log('info ' + `Bundle Chunk ID: ${debugId}`)\n\n const debugIdComment = `${DEBUG_ID_COMMENT}${debugId}`\n const indexOfSourceMapComment = bundleCode.lastIndexOf(SOURCE_MAP_COMMENT)\n const bundleCodeWithDebugId =\n indexOfSourceMapComment === -1\n ? // If source map comment is missing lets just add the Chunk ID comment\n `${bundleCode}\\n${debugIdComment}`\n : // If source map comment is present lets add the Chunk ID comment before it\n `${bundleCode.substring(0, indexOfSourceMapComment) + debugIdComment}\\n${bundleCode.substring(\n indexOfSourceMapComment\n )}`\n\n const bundleMap: SourceMap = JSON.parse(bundleMapString)\n bundleMap['chunkId'] = debugId\n\n return {\n code: bundleCodeWithDebugId,\n map: JSON.stringify(bundleMap),\n }\n }\n}\n\nfunction isExpoStaticExport(options: PostHogSerializerOptions): boolean {\n // Match Expo's precedence: explicit serializer options override the URL,\n // even when they do not specify an output mode.\n if (options.serializerOptions) {\n return options.serializerOptions.output === 'static'\n }\n if (!options.sourceUrl) {\n return false\n }\n\n try {\n const url = new URL(options.sourceUrl, 'https://expo.dev')\n // JSC-safe URLs move the query into the path after //&. Only decode that\n // form when there is no actual query, as Expo's serializer does.\n const jscQueryStart = url.pathname.indexOf('//&')\n const query =\n !options.sourceUrl.split('#')[0].includes('?') && jscQueryStart !== -1\n ? new URLSearchParams(url.pathname.slice(jscQueryStart + 3))\n : url.searchParams\n return query.get('serializer.output') === 'static'\n } catch {\n return false\n }\n}\n\n/**\n * Called by the default Metro serializer after baseJSBundle has produced the\n * final bundle but before source-map generation. That ordering is important:\n * both generated code and sourcesContent must contain the same real Chunk ID.\n */\nfunction createPostHogBundleCallback(\n debugIdModule: Module<VirtualJSOutput> & { setSource: (code: string) => void }\n): (bundle: Bundle) => Bundle {\n return (bundle) => {\n const debugId = calculateDebugId(bundle.pre, bundle.modules)\n debugIdModule.setSource(injectDebugId(debugIdModule.getSource().toString(), debugId))\n bundle.pre = injectDebugId(bundle.pre, debugId)\n return bundle\n }\n}\n\nfunction createDebugIdModule(debugId: string): Module<VirtualJSOutput> & { setSource: (code: string) => void } {\n return createVirtualJSModule(DEBUG_ID_MODULE_PATH, createDebugIdSnippet(debugId))\n}\n\nfunction calculateDebugId(bundleCode: string, modules?: Array<[id: number, code: string]>): string {\n const hash = crypto.createHash('md5')\n hash.update(bundleCode)\n if (modules) {\n for (const [, code] of modules) {\n hash.update(code)\n }\n }\n return stringToUUID(hash.digest('hex'))\n}\n\nfunction injectDebugId(code: string, debugId: string): string {\n return code.replace(new RegExp(DEBUG_ID_PLACE_HOLDER, 'g'), debugId)\n}\n"],"mappings":"2mBAIA,IAAAA,MAAA,CAAAC,uBAAA,CAAAC,OAAA,YAIA,IAAAC,MAAA,CAAAD,OAAA,YAQA,IAAAE,OAAA,CAAAF,OAAA,yBAAmE,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,IAAAd,CAAA,aAAAc,GAAA,KAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,CAAAc,GAAA,KAAAP,CAAA,EAAAD,CAAA,CAAAW,MAAA,CAAAC,cAAA,GAAAD,MAAA,CAAAE,wBAAA,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,CAAG3I,MAAM,CAAC4I,UAAU,CAAC,KAAK,CAAC,CACrCD,IAAI,CAACE,MAAM,CAACzD,UAAU,CAAC,CACvB,GAAIiD,OAAO,CAAE,KAAAS,SAAA,CAAArH,0BAAA,CACY4G,OAAO,EAAAU,KAAA,KAA9B,IAAAD,SAAA,CAAA5G,CAAA,KAAA6G,KAAA,CAAAD,SAAA,CAAArI,CAAA,IAAA0B,IAAA,EAAgC,KAAA6G,WAAA,IAAAC,eAAA,aAAAF,KAAA,CAAA3G,KAAA,IAAlBgE,IAAI,CAAA4C,WAAA,IAChBL,IAAI,CAACE,MAAM,CAACzC,IAAI,CAAC,CACnB,CAAC,OAAA8C,GAAA,EAAAJ,SAAA,CAAAzI,CAAA,CAAA6I,GAAA,WAAAJ,SAAA,CAAAjI,CAAA,IACH,CACA,MAAO,GAAAsI,mBAAY,EAACR,IAAI,CAACS,MAAM,CAAC,KAAK,CAAC,CAAC,CACzC,CAEA,QAAS,CAAAb,aAAaA,CAACnC,IAAY,CAAE5C,OAAe,EAClD,MAAO,CAAA4C,IAAI,CAACiD,OAAO,CAAC,GAAI,CAAAC,MAAM,CAACtG,qBAAqB,CAAE,GAAG,CAAC,CAAEQ,OAAO,CAAC,CACtE","ignoreList":[]}
|
package/dist/tooling/utils.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.createDebugIdSnippet=createDebugIdSnippet;exports.createSet=void 0;exports.createVirtualJSModule=createVirtualJSModule;exports.determineDebugIdFromBundleSource=determineDebugIdFromBundleSource;exports.getExpoConfig=getExpoConfig;exports.isDevServerBuild=isDevServerBuild;exports.prependModule=prependModule;exports.stringToUUID=stringToUUID;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var crypto=_interopRequireWildcard(require("crypto"));var _countLines=_interopRequireDefault(require("./vendor/metro/countLines"));function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,"default":e};if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t2 in e)"default"!==_t2&&{}.hasOwnProperty.call(e,_t2)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t2))&&(i.get||i.set)?o(f,_t2,i):f[_t2]=e[_t2]);return f;})(e,t);}function isDevServerBuild(graph,options){var transformOptions=graph.transformOptions;if('hot'in transformOptions){return Boolean(transformOptions.hot);}return Boolean(transformOptions.dev)&&options.sourceUrl!=null;}function createDebugIdSnippet(debugId){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]=\"".concat(debugId,"\")}catch(e){}}();");}function stringToUUID(str){var md5sum=crypto.createHash('md5');md5sum.update(str);var md5Hash=md5sum.digest('hex');var v4variant=['8','9','a','b'][md5Hash.substring(16,17).charCodeAt(0)%4];return"".concat(md5Hash.substring(0,8),"-").concat(md5Hash.substring(8,12),"-4").concat(md5Hash.substring(13,16),"-").concat(v4variant).concat(md5Hash.substring(17,20),"-").concat(md5Hash.substring(20)).toLowerCase();}function determineDebugIdFromBundleSource(code){var match=code.match(/_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})"/);return match?match[1]:undefined;}function resolveSetCreator(){var CountingSetFromPrivate=safeRequireCountingSetFromPrivate();if(CountingSetFromPrivate){return function(){return new CountingSetFromPrivate["default"]();};}var CountingSetFromSrc=safeRequireCountingSetFromSrc();if(CountingSetFromSrc){return function(){return new CountingSetFromSrc["default"]();};}return function(){return new Set();};}function safeRequireCountingSetFromSrc(){try{return require('metro/src/lib/CountingSet');}catch(e){return undefined;}}function safeRequireCountingSetFromPrivate(){try{return require('metro/private/lib/CountingSet');}catch(e){return undefined;}}var createSet=exports.createSet=resolveSetCreator();var PRELUDE_MODULE_PATH='__prelude__';function prependModule(modules,module){var modifiedPremodules=(0,_toConsumableArray2["default"])(modules);if(modifiedPremodules.length>0&&modifiedPremodules[0]!==undefined&&modifiedPremodules[0].path===PRELUDE_MODULE_PATH){modifiedPremodules.unshift(modules[0]);modifiedPremodules[1]=module;}else{modifiedPremodules.unshift(module);}return modifiedPremodules;}function createVirtualJSModule(modulePath,moduleCode){var sourceCode=moduleCode;var outputData={code:sourceCode,lineCount:(0,_countLines["default"])(sourceCode),map:[]};return{setSource:function setSource(code){sourceCode=code;outputData.code=code;outputData.lineCount=(0,_countLines["default"])(code);},dependencies:new Map(),getSource:function getSource(){return Buffer.from(sourceCode);},inverseDependencies:createSet(),path:modulePath,output:[{type:'js/script/virtual',data:outputData}]};}function getExpoConfig(projectRoot){try{var expoConfig=require('@expo/config');if(expoConfig.getConfig){var _expoConfig$getConfig=expoConfig.getConfig(projectRoot),exp=_expoConfig$getConfig.exp;return{name:typeof exp.name==='string'&&exp.name?exp.name:undefined,version:typeof exp.version==='string'&&exp.version?exp.version:undefined};}}catch(_a){}return{};}
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _typeof=require("@babel/runtime/helpers/typeof");Object.defineProperty(exports,"__esModule",{value:true});exports.createDebugIdSnippet=createDebugIdSnippet;exports.createSet=void 0;exports.createVirtualJSModule=createVirtualJSModule;exports.determineDebugIdFromBundleSource=determineDebugIdFromBundleSource;exports.getExpoConfig=getExpoConfig;exports.isDevServerBuild=isDevServerBuild;exports.prependModule=prependModule;exports.stringToUUID=stringToUUID;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var crypto=_interopRequireWildcard(require("crypto"));var _countLines=_interopRequireDefault(require("./vendor/metro/countLines"));function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap(),n=new WeakMap();return(_interopRequireWildcard=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var o,i,f={__proto__:null,"default":e};if(null===e||"object"!=_typeof(e)&&"function"!=typeof e)return f;if(o=t?n:r){if(o.has(e))return o.get(e);o.set(e,f);}for(var _t2 in e)"default"!==_t2&&{}.hasOwnProperty.call(e,_t2)&&((i=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,_t2))&&(i.get||i.set)?o(f,_t2,i):f[_t2]=e[_t2]);return f;})(e,t);}function isDevServerBuild(graph,options){var transformOptions=graph.transformOptions;if('hot'in transformOptions){return Boolean(transformOptions.hot);}return Boolean(transformOptions.dev)&&options.sourceUrl!=null;}function createDebugIdSnippet(debugId){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]=\"".concat(debugId,"\")}catch(e){}}();");}function stringToUUID(str){var md5sum=crypto.createHash('md5');md5sum.update(str);var md5Hash=md5sum.digest('hex');var v4variant=['8','9','a','b'][md5Hash.substring(16,17).charCodeAt(0)%4];return"".concat(md5Hash.substring(0,8),"-").concat(md5Hash.substring(8,12),"-4").concat(md5Hash.substring(13,16),"-").concat(v4variant).concat(md5Hash.substring(17,20),"-").concat(md5Hash.substring(20)).toLowerCase();}function determineDebugIdFromBundleSource(code){var match=code.match(/_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})"/);return match?match[1]:undefined;}function resolveSetCreator(){var CountingSetFromPrivate=safeRequireCountingSetFromPrivate();if(CountingSetFromPrivate){return function(){return new CountingSetFromPrivate["default"]();};}var CountingSetFromSrc=safeRequireCountingSetFromSrc();if(CountingSetFromSrc){return function(){return new CountingSetFromSrc["default"]();};}return function(){return new Set();};}function safeRequireCountingSetFromSrc(){try{return require('metro/src/lib/CountingSet');}catch(e){return undefined;}}function safeRequireCountingSetFromPrivate(){try{return require('metro/private/lib/CountingSet');}catch(e){return undefined;}}var createSet=exports.createSet=resolveSetCreator();var PRELUDE_MODULE_PATH='__prelude__';function prependModule(modules,module){var modifiedPremodules=(0,_toConsumableArray2["default"])(modules);if(modifiedPremodules.length>0&&modifiedPremodules[0]!==undefined&&modifiedPremodules[0].path===PRELUDE_MODULE_PATH){modifiedPremodules.unshift(modules[0]);modifiedPremodules[1]=module;}else{modifiedPremodules.unshift(module);}return modifiedPremodules;}function createVirtualJSModule(modulePath,moduleCode){var sourceCode=moduleCode;var outputData={code:sourceCode,lineCount:(0,_countLines["default"])(sourceCode),map:[]};return{setSource:function setSource(code){sourceCode=code;outputData.code=code;outputData.lineCount=(0,_countLines["default"])(code);},dependencies:new Map(),getSource:function getSource(){return Buffer.from(sourceCode);},inverseDependencies:createSet(),path:modulePath,output:[{type:'js/script/virtual',data:outputData}]};}function getExpoConfig(projectRoot){try{var expoConfig=require('@expo/config');if(expoConfig.getConfig){var _expoConfig$getConfig=expoConfig.getConfig(projectRoot),exp=_expoConfig$getConfig.exp;return{name:typeof exp.name==='string'&&exp.name?exp.name:undefined,version:typeof exp.version==='string'&&exp.version?exp.version:undefined};}}catch(_a){}return{};}
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/tooling/utils.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,4BAA4B;AAC5B,wGAAwG;AAExG,OAAO,KAAK,MAAM,MAAM,QAA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IAAI,CAAC;QACH,yFAAyF;QACzF,MAAM,UAAU,GAAG,OAAO,CAAC,cAAc,CAExC,CAAA;QACD,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;YACzB,MAAM,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;YACjD,OAAO;gBACL,IAAI,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;gBACrE,OAAO,EAAE,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;aAClF,CAAA;QACH,CAAC;IACH,CAAC;IAAC,WAAM,CAAC;QACP,yCAAyC;IAC3C,CAAC;IAED,OAAO,EAAE,CAAA;AACX,CAAC"}
|
|
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,CAAAM,CAAA,EAAAO,GAAA,CAAAb,CAAA,CAAAQ,CAAA,WAAAM,GAAA,IAAAd,CAAA,aAAAc,GAAA,KAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,CAAA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ACN,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,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|
|
2
|
+
//# sourceMappingURL=expoconfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expoconfig.js","
|
|
1
|
+
{"version":3,"file":"expoconfig.js","names":[],"sources":["../../../../src/tooling/vendor/expo/expoconfig.ts"],"sourcesContent":["// The MIT License (MIT)\n\n// Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)\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 typescript/no-require-imports\nimport type { MixedOutput, Module, ReadOnlyGraph } from 'metro'\n\n// https://github.com/expo/expo/blob/44d03f59e25b01fbfee82075da18dd7f8ce44e96/packages/%40expo/metro-config/src/ExpoMetroConfig.ts\nexport interface DefaultConfigOptions {\n /** @deprecated */\n mode?: 'exotic'\n /**\n * **Experimental:** Enable CSS support for Metro web, and shim on native.\n *\n * This is an experimental feature and may change in the future. The underlying implementation\n * is subject to change, and native support for CSS Modules may be added in the future during a non-major SDK release.\n */\n isCSSEnabled?: boolean\n /**\n * **Experimental:** Modify premodules before a code asset is serialized\n *\n * This is an experimental feature and may change in the future. The underlying implementation\n * is subject to change.\n */\n unstable_beforeAssetSerializationPlugins?: ((serializationInput: {\n graph: ReadOnlyGraph<MixedOutput>\n premodules: Module[]\n debugId?: string\n }) => Module[])[]\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var newline=/\r\n?|\n|\u2028|\u2029/g;var _default=exports["default"]=function _default(string){return(string.match(newline)||[]).length+1;};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var newline=/\r\n?|\n|\u2028|\u2029/g;var _default=exports["default"]=function _default(string){return(string.match(newline)||[]).length+1;};
|
|
2
|
+
//# sourceMappingURL=countLines.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countLines.js","
|
|
1
|
+
{"version":3,"file":"countLines.js","names":["newline","_default","exports","string","match","length"],"sources":["../../../../src/tooling/vendor/metro/countLines.ts"],"sourcesContent":["// Vendored from @facebook/metro\n\n// https://github.com/facebook/metro/blob/93d68cca249202fd3eb52672217e725d90e44eb4/packages/metro/src/lib/countLines.js\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// This is exported as private from `metro` and as such breaking changes can appear anytime.\n// In the past these were related to the way the function is exported. Never to the function itself.\n// Thus it should be more stable to vendor it.\n\nconst newline = /\\r\\n?|\\n|\\u2028|\\u2029/g\n\nexport default (string: string): number => (string.match(newline) || []).length + 1\n"],"mappings":"gGA8BA,GAAM,CAAAA,OAAO,CAAG,yBAAyB,KAAAC,QAAA,CAAAC,OAAA,YAE1B,SAAAD,SAACE,MAAc,QAAa,CAACA,MAAM,CAACC,KAAK,CAACJ,OAAO,CAAC,EAAI,EAAE,EAAEK,MAAM,CAAG,CAAC","ignoreList":[]}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getSortedModules=exports.createDefaultMetroSerializer=void 0;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _utils=require("../../utils");var _a,_b;var baseJSBundleModule;try{baseJSBundleModule=require('metro/private/DeltaBundler/Serializers/baseJSBundle');}catch(_c){baseJSBundleModule=require('metro/src/DeltaBundler/Serializers/baseJSBundle');}var baseJSBundle=typeof baseJSBundleModule==='function'?baseJSBundleModule:(_a=baseJSBundleModule===null||baseJSBundleModule===void 0?void 0:baseJSBundleModule.baseJSBundle)!==null&&_a!==void 0?_a:baseJSBundleModule===null||baseJSBundleModule===void 0?void 0:baseJSBundleModule["default"];var sourceMapString;try{var sourceMapStringModule=require('metro/private/DeltaBundler/Serializers/sourceMapString');sourceMapString=sourceMapStringModule.sourceMapString;}catch(e){sourceMapString=require('metro/src/DeltaBundler/Serializers/sourceMapString');if('sourceMapString'in sourceMapString){sourceMapString=sourceMapString.sourceMapString;}}var bundleToStringModule;try{bundleToStringModule=require('metro/private/lib/bundleToString');}catch(_d){bundleToStringModule=require('metro/src/lib/bundleToString');}var bundleToString=typeof bundleToStringModule==='function'?bundleToStringModule:(_b=bundleToStringModule===null||bundleToStringModule===void 0?void 0:bundleToStringModule.bundleToString)!==null&&_b!==void 0?_b:bundleToStringModule===null||bundleToStringModule===void 0?void 0:bundleToStringModule["default"];var getSortedModules=exports.getSortedModules=function getSortedModules(graph,_ref){var createModuleId=_ref.createModuleId;var modules=(0,_toConsumableArray2["default"])(graph.dependencies.values());return modules.sort(function(a,b){return createModuleId(a.path)-createModuleId(b.path);});};var createDefaultMetroSerializer=exports.createDefaultMetroSerializer=function createDefaultMetroSerializer(){return function(entryPoint,premodules,graph,options){var bundle=(baseJSBundle["default"]||baseJSBundle)(entryPoint,premodules,graph,options);var serializerOptions=options;if(serializerOptions.posthogBundleCallback&&!(0,_utils.isDevServerBuild)(graph,options)){bundle=serializerOptions.posthogBundleCallback(bundle);}var _ref2=(bundleToString["default"]||bundleToString)(bundle),code=_ref2.code;if((0,_utils.isDevServerBuild)(graph,options)){return code;}var sourceMapStringFunction;if(typeof sourceMapString==='function'){sourceMapStringFunction=sourceMapString;}else if((0,_typeof2["default"])(sourceMapString)==='object'&&sourceMapString!=null&&'sourceMapString'in sourceMapString&&typeof sourceMapString['sourceMapString']==='function'){sourceMapStringFunction=sourceMapString.sourceMapString;}else{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");}var map=(sourceMapStringFunction["default"]||sourceMapStringFunction)([].concat((0,_toConsumableArray2["default"])(premodules),(0,_toConsumableArray2["default"])(getSortedModules(graph,options))),{processModuleFilter:options.processModuleFilter,shouldAddToIgnoreList:options.shouldAddToIgnoreList||function(){return false;}});return{code:code,map:map};};};
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getSortedModules=exports.createDefaultMetroSerializer=void 0;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _utils=require("../../utils");var _a,_b;var baseJSBundleModule;try{baseJSBundleModule=require('metro/private/DeltaBundler/Serializers/baseJSBundle');}catch(_c){baseJSBundleModule=require('metro/src/DeltaBundler/Serializers/baseJSBundle');}var baseJSBundle=typeof baseJSBundleModule==='function'?baseJSBundleModule:(_a=baseJSBundleModule===null||baseJSBundleModule===void 0?void 0:baseJSBundleModule.baseJSBundle)!==null&&_a!==void 0?_a:baseJSBundleModule===null||baseJSBundleModule===void 0?void 0:baseJSBundleModule["default"];var sourceMapString;try{var sourceMapStringModule=require('metro/private/DeltaBundler/Serializers/sourceMapString');sourceMapString=sourceMapStringModule.sourceMapString;}catch(e){sourceMapString=require('metro/src/DeltaBundler/Serializers/sourceMapString');if('sourceMapString'in sourceMapString){sourceMapString=sourceMapString.sourceMapString;}}var bundleToStringModule;try{bundleToStringModule=require('metro/private/lib/bundleToString');}catch(_d){bundleToStringModule=require('metro/src/lib/bundleToString');}var bundleToString=typeof bundleToStringModule==='function'?bundleToStringModule:(_b=bundleToStringModule===null||bundleToStringModule===void 0?void 0:bundleToStringModule.bundleToString)!==null&&_b!==void 0?_b:bundleToStringModule===null||bundleToStringModule===void 0?void 0:bundleToStringModule["default"];var getSortedModules=exports.getSortedModules=function getSortedModules(graph,_ref){var createModuleId=_ref.createModuleId;var modules=(0,_toConsumableArray2["default"])(graph.dependencies.values());return modules.sort(function(a,b){return createModuleId(a.path)-createModuleId(b.path);});};var createDefaultMetroSerializer=exports.createDefaultMetroSerializer=function createDefaultMetroSerializer(){return function(entryPoint,premodules,graph,options){var bundle=(baseJSBundle["default"]||baseJSBundle)(entryPoint,premodules,graph,options);var serializerOptions=options;if(serializerOptions.posthogBundleCallback&&!(0,_utils.isDevServerBuild)(graph,options)){bundle=serializerOptions.posthogBundleCallback(bundle);}var _ref2=(bundleToString["default"]||bundleToString)(bundle),code=_ref2.code;if((0,_utils.isDevServerBuild)(graph,options)){return code;}var sourceMapStringFunction;if(typeof sourceMapString==='function'){sourceMapStringFunction=sourceMapString;}else if((0,_typeof2["default"])(sourceMapString)==='object'&&sourceMapString!=null&&'sourceMapString'in sourceMapString&&typeof sourceMapString['sourceMapString']==='function'){sourceMapStringFunction=sourceMapString.sourceMapString;}else{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");}var map=(sourceMapStringFunction["default"]||sourceMapStringFunction)([].concat((0,_toConsumableArray2["default"])(premodules),(0,_toConsumableArray2["default"])(getSortedModules(graph,options))),{processModuleFilter:options.processModuleFilter,shouldAddToIgnoreList:options.shouldAddToIgnoreList||function(){return false;}});return{code:code,map:map};};};
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/tooling/vendor/metro/utils.ts"],"names":[],"mappings":"AAAA,2CAA2C;;AA+B3C,OAAO,EAAE,gBAAgB,EAAqC,MAAM,aAAa,CAAA;AAEjF,IAAI,kBAAuB,CAAA;AAC3B,IAAI,CAAC;IACH,yDAAyD;IACzD,kBAAkB,GAAG,OAAO,CAAC,qDAAqD,CAAC,CAAA;AACrF,CAAC;AAAC,WAAM,CAAC;IACP,yDAAyD;IACzD,kBAAkB,GAAG,OAAO,CAAC,iDAAiD,CAAC,CAAA;AACjF,CAAC;AAED,MAAM,YAAY,GAChB,OAAO,kBAAkB,KAAK,UAAU;IACtC,CAAC,CAAC,kBAAkB;IACpB,CAAC,CAAC,8DAA8D;QAC9D,CAAC,MAAA,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,YAAY,mCAAI,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,OAAO,CAAC,CAAA;AAEvE,IAAI,eAA2C,CAAA;AAC/C,IAAI,CAAC;IACH,sDAAsD;IACtD,MAAM,qBAAqB,GAAG,OAAO,CAAC,wDAAwD,CAAC,CAAA;IAC/F,eAAe,GAAI,qBAAyE,CAAC,eAAe,CAAA;AAC9G,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,eAAe,GAAG,OAAO,CAAC,oDAAoD,CAAC,CAAA;IAC/E,IAAI,iBAAiB,IAAI,eAAe,EAAE,CAAC;QACz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{"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,CAAC,CACrF,C,SAAQ,CAENC,kBAAkB,CAAGD,OAAO,CAAC,iDAAiD,CAAC,CACjF,CAEA,GAAM,CAAAE,YAAY,CAChB,MAAO,CAAAD,kBAAkB,GAAK,UAAU,CACpCA,kBAAkB,CAElB,CAAAE,EAAA,CAACF,kBAAkB,SAAlBA,kBAAkB,iBAAlBA,kBAAkB,CAAEC,YAAY,UAAAC,EAAA,UAAAA,EAAA,CAAIF,kBAAkB,SAAlBA,kBAAkB,iBAAlBA,kBAAkB,WAAU,CAEvE,GAAI,CAAAG,eAA2C,CAC/C,GAAI,CAEF,GAAM,CAAAC,qBAAqB,CAAGL,OAAO,CAAC,wDAAwD,CAAC,CAC/FI,eAAe,CAAIC,qBAAyE,CAACD,eAAe,CAC9G,CAAE,MAAOE,CAAC,CAAE,CACVF,eAAe,CAAGJ,OAAO,CAAC,oDAAoD,CAAC,CAC/E,GAAI,iBAAiB,EAAI,CAAAI,eAAe,CAAE,CAGxCA,eAAe,CAAIA,eAAmE,CAACA,eAAe,CACxG,CACF,CAEA,GAAI,CAAAG,oBAAyB,CAC7B,GAAI,CACFA,oBAAoB,CAAGP,OAAO,CAAC,kCA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AAiB,CAACC,qBAAqB,CAACF,MAAM,CAAC,CAC1D,CAEA,IAAAI,KAAA,CAAiB,CAACvB,cAAc,WAAQ,EAAIA,cAAc,EAAEmB,MAAM,CAAC,CAA3DK,IAAI,CAAAD,KAAA,CAAJC,IAAI,CACZ,GAAI,GAAAF,uBAAgB,EAAClB,KAAK,CAAEc,OAAO,CAAC,CAAE,CAEpC,MAAO,CAAAM,IAAI,CACb,CAEA,GAAI,CAAAC,uBAA2D,CAC/D,GAAI,MAAO,CAAA7B,eAAe,GAAK,UAAU,CAAE,CACzC6B,uBAAuB,CAAG7B,eAAe,CAC3C,CAAC,IAAM,IACL,GAAA8B,QAAA,aAAO9B,eAAe,IAAK,QAAQ,EACnCA,eAAe,EAAI,IAAI,EACvB,iBAAiB,EAAI,CAAAA,eAAe,EACpC,MAAO,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/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["export type PostHogAutocaptureNavigationTrackerOptions = {\n routeToName?: (name: string, params: any) => string\n routeToProperties?: (name: string, params: any) => Record<string, any>\n}\n\n/**\n * @deprecated\n */\nexport type PostHogNavigationRef = {\n getCurrentRoute(): any | undefined\n isReady: () => boolean\n current?: PostHogNavigationRef | any | undefined\n}\n\nexport type PostHogRageClickConfig = {\n /**\n * Enable or disable rage click (rage tap) detection.\n *\n * When enabled the native SDK emits a `$rageclick` event whenever a user\n * taps the same area repeatedly in quick succession.\n *\n * @default true\n */\n enabled?: boolean\n /**\n * Number of consecutive taps required to trigger a rage click.\n *\n * @default 3\n */\n minimumTapCount?: number\n /**\n * Maximum pixel distance between consecutive taps for them to still\n * count toward a rage click.\n *\n * @default 30\n */\n thresholdPoints?: number\n /**\n * Maximum time in seconds allowed between consecutive taps.\n *\n * @default 1.0\n */\n timeoutInterval?: number\n}\n\nexport type PostHogAutocaptureOptions = {\n /**\n * Enable autocapture of touch events.\n *\n * On React Native Web this also captures `click` events — mouse, trackpad, keyboard\n * activation and programmatic clicks — emitted with `$event_type: 'click'`, since\n * browsers fire `touchend` only for touch input.\n *\n * @default false\n */\n captureTouches?: boolean\n /**\n * Custom prop name used to label elements for autocapture\n *\n * @default 'ph-label'\n */\n customLabelProp?: string\n /**\n * Prop name used to prevent autocapture on an element and its children\n *\n * @default 'ph-no-capture'\n */\n noCaptureProp?: string\n /**\n * Maximum number of elements to capture in the component tree hierarchy\n *\n * @default 20\n */\n maxElementsCaptured?: number\n /**\n * List of element labels to ignore during autocapture\n *\n * @default []\n */\n ignoreLabels?: string[]\n /**\n * List of prop names to capture from elements\n *\n * @default ['style', 'testID', 'accessibilityLabel', 'ph-label', 'children']\n */\n propsToCapture?: string[]\n\n /**\n * Capture the screen name (or route name) and properties\n *\n * Only used for expo-router, @react-navigation/native and react-native-navigation\n *\n * For react-native-navigation, you need to call initReactNativeNavigation before using this option\n * See example: https://posthog.com/docs/libraries/react-native#with-react-native-navigation-and-autocapture\n *\n * For @react-navigation/native v6 and below, you need to wrap the PostHogProvider within the NavigationContainer\n * See example: https://posthog.com/docs/libraries/react-native#with-react-navigationnative-and-autocapture\n *\n * For @react-navigation/native v7 and above, because of a library change, you'll need to capture the screens manually and disable this option\n * You can use the onStateChange callback from the NavigationContainer to capture the screens automatically using the screen capture method\n * You can use the 'usePostHog()' hook or your own posthog instance to capture the screens\n * Since captureScreens is disabled, you don't need to pass the navigationRef, the navigation mutation object is also ignored\n * See example: https://reactnavigation.org/docs/screen-tracking/ and https://posthog.com/docs/libraries/react-native#manually-capturing-screen-capture-events\n *\n * For expo-router, expo-router uses @react-navigation/native, but does not expose the NavigationContainer, you'll need to capture the screens manually and disable this option\n * expo-router always has access to a URL, you can use the URL to capture the screens automatically using the screen capture method\n * You can use the 'usePostHog()' hook or your own posthog instance to capture the screens\n * Since captureScreens is disabled, you don't need to pass the navigationRef, the navigation mutation object is also ignored\n * See example: https://docs.expo.dev/router/reference/screen-tracking/ and https://posthog.com/docs/libraries/react-native#manually-capturing-screen-capture-events\n *\n * @default true\n */\n captureScreens?: boolean\n /**\n * Used for mutating the screen name and properties\n * Only used if captureScreens is true\n *\n * @default Default to the route name and params\n */\n navigation?: PostHogAutocaptureNavigationTrackerOptions\n /**\n * If you create a navigation ref with createNavigationContainerRef, you need to pass the navigation ref\n * Only used for expo-router and @react-navigation/native if captureScreens is true\n *\n * @deprecated this is deprecated since it didn't work as expected, check out the `captureScreens` comments for capturing screen views semi-automatically\n */\n navigationRef?: PostHogNavigationRef\n}\n\nexport interface PostHogCustomAppProperties {\n /** Build number like \"1.2.2\" or \"122\" */\n $app_build?: string | null\n /** Name of the app as displayed below the icon like \"PostHog\" */\n $app_name?: string | null\n /** Namespace of the app usually like \"com.posthog.app\" */\n $app_namespace?: string | null\n /** Human friendly app version like what a user would see in the app store like \"1.2.2\" */\n $app_version?: string | null\n /** Manufacturer like \"Apple\", \"Samsung\" or \"Android\" */\n $device_manufacturer?: string | null\n /** Readable model name like \"iPhone 12\" or \"Samsung Galaxy S24\" */\n $device_name?: string | null\n /** Model identifier like \"iPhone13,2\" or \"SM-S921B\" */\n $device_model?: string | null\n /** Device type (\"Mobile\" | \"Desktop\") */\n $device_type?: string | null\n /** Operating system name like iOS or Android */\n $os_name?: string | null\n /** Operating system version \"14.0\" */\n $os_version?: string | null\n /** Locale (language) of the device like \"en-US\" */\n $locale?: string | null\n /** Timezone of the device like \"Europe/Berlin\" */\n $timezone?: string | null\n /** Whether the app is running on an emulator/simulator */\n $is_emulator?: boolean | null\n}\n\nexport type PostHogSessionReplayConfig = {\n /**\n * Capture touch coordinates in session replay. Set to false to keep screenshots\n * without recording taps that could reveal sensitive input on a known keypad layout.\n * Does not change masking or `PostHogProvider` touch autocapture.\n * Android and iOS only. Requires `@posthog/react-native-plugin` 2.9.0 or later;\n * older plugins and `posthog-react-native-session-replay` ignore this option.\n * Set before constructing PostHog. Changes after initialization do not update native state.\n *\n * @default true\n */\n captureTouches?: boolean\n /**\n * Enable masking of all text and text input fields\n *\n * @default true\n */\n maskAllTextInputs?: boolean\n /**\n * Enable masking of all images to a placeholder\n *\n * @default true\n */\n maskAllImages?: boolean\n /**\n * Enable masking of all sandboxed system views\n * These may include UIImagePickerController, PHPickerViewController and CNContactPickerViewController\n * iOS only\n *\n * @default true\n */\n maskAllSandboxedViews?: boolean\n /**\n * Enable capturing of logs as console events\n *\n * @default true\n */\n captureLog?: boolean\n /**\n * Deboucer delay used to reduce the number of snapshots captured and reduce performance impact\n * This is used for capturing the view as a screenshot\n * The lower the number more snapshots will be captured but higher the performance impact\n *\n * @default 1000\n * @deprecated please use throttleDelayMs instead\n */\n iOSdebouncerDelayMs?: number\n /**\n * Deboucer delay used to reduce the number of snapshots captured and reduce performance impact\n * This is used for capturing the view as a screenshot\n * The lower the number more snapshots will be captured but higher the performance impact\n * Ps: it was 500ms (0.5s) by default until version 3.3.7\n *\n * @default 1000\n * @deprecated please use throttleDelayMs instead\n */\n androidDebouncerDelayMs?: number\n /**\n * Throttling delay used to reduce the number of snapshots captured and reduce performance impact\n * This is used for capturing the view as a wireframe or screenshot\n * The lower the number more snapshots will be captured but higher the performance impact\n *\n * This value has precedence over iOSdebouncerDelayMs and androidDebouncerDelayMs\n * If this is not set, we will take the max number between iOSdebouncerDelayMs and androidDebouncerDelayMs for back compatibility\n *\n * @default 1000\n */\n throttleDelayMs?: number\n /**\n * Enable capturing network telemetry\n * iOS only\n *\n * @default true\n */\n captureNetworkTelemetry?: boolean\n /**\n * Verify that masks remain aligned while capturing session replay screenshots.\n * Android only. Requires `@posthog/react-native-plugin`.\n *\n * Enabling this can preserve screenshots during pixel-only redraws, including\n * continuously animated content, but performs additional view hierarchy walks\n * while a screenshot is captured.\n *\n * @default false\n */\n verifyScreenshotMaskAlignment?: boolean\n /**\n * Experimental. Multiplier for the physical width and height of screenshots, clamped to 0.1–1.0.\n * For example, 0.5 captures half the width and height, or one quarter of the pixels.\n * The logical replay viewport is unchanged. Non-finite values use the native default.\n * Android only. Requires `@posthog/react-native-plugin` 2.8.0 or later.\n * Does not enable session replay or change compression quality or color mode.\n *\n * @experimental\n * @default 1.0\n */\n screenshotScale?: number\n /**\n * Experimental. WebP compression quality, clamped to 0–100. Fractional values are truncated.\n * Higher values generally retain more detail and produce larger payloads.\n * Compression is lossy, except at quality 100 on Android 10, which uses lossless WebP.\n * Non-finite values use the native default. Does not change screenshot resolution.\n * Android only. Requires `@posthog/react-native-plugin` 2.8.0 or later.\n *\n * @experimental\n * @default 30\n */\n screenshotCompressionQuality?: number\n /**\n * Experimental. Screenshot bitmap pixel format. ARGB_8888 preserves transparency and color precision.\n * RGB_565 uses half the bitmap memory but reduces color precision and removes alpha,\n * making transparent window regions appear black. Unsupported devices fall back to ARGB_8888.\n * Android only. Requires `@posthog/react-native-plugin` 2.8.0 or later.\n *\n * @experimental\n * @default 'ARGB_8888'\n */\n screenshotColorMode?: 'ARGB_8888' | 'RGB_565'\n /**\n * Schedule screenshot image capture on a background queue.\n * iOS only\n * Experimental support\n *\n * Warning: Enabling this option will trigger Main Thread Checker warnings and may\n * briefly freeze the app the first time a screenshot is captured. Consider disabling\n * Main Thread Checker in your scheme's run diagnostics when enabling this.\n *\n * @default false\n */\n screenshotModeBackgroundCapture?: boolean\n /**\n * Session replay sample rate between 0 and 1\n * Local config has precedence over remote config when both are set.\n * If undefined, sampling is controlled by remote config (when available).\n */\n sampleRate?: number\n}\n\nexport interface PostHogCustomStorage {\n getItem: (key: string) => string | null | Promise<string | null>\n setItem: (key: string, value: string) => void | Promise<void>\n}\n\n/**\n * Mints a signed identity-verification token for a push subscription request.\n *\n * Called by the native SDK with the current `distinctId` and `appId`. Return\n * `null` to send the request without an identity token.\n */\nexport type PostHogPushIdentityProvider = (distinctId: string, appId: string) => Promise<string | null>\n"],"mappings":"","ignoreList":[]}
|
package/dist/utils.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.GLOBAL_OBJ=void 0;exports.getPlatformOS=getPlatformOS;Object.defineProperty(exports,"getRemoteConfigBool",{enumerable:true,get:function get(){return _core.getRemoteConfigBool;}});Object.defineProperty(exports,"getRemoteConfigNumber",{enumerable:true,get:function get(){return _core.getRemoteConfigNumber;}});exports.isHermes=void 0;exports.isMacOS=isMacOS;Object.defineProperty(exports,"isValidSampleRate",{enumerable:true,get:function get(){return _core.isValidSampleRate;}});exports.isWeb=isWeb;exports.isWindows=isWindows;var _reactNative=require("react-native");var _core=require("@posthog/core");var _global=typeof global!=='undefined'?global:undefined;var _globalThis=typeof globalThis!=='undefined'?globalThis:undefined;var GLOBAL_OBJ=exports.GLOBAL_OBJ=_globalThis!==null&&_globalThis!==void 0?_globalThis:_global;function getPlatformOS(){try{return _reactNative.Platform===null||_reactNative.Platform===void 0?void 0:_reactNative.Platform.OS;}catch(_a){return undefined;}}function isWeb(){return getPlatformOS()==='web';}function isMacOS(){return getPlatformOS()==='macos';}function isWindows(){return getPlatformOS()==='windows';}var isHermes=exports.isHermes=function isHermes(){return!!GLOBAL_OBJ.HermesInternal;};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.GLOBAL_OBJ=void 0;exports.getPlatformOS=getPlatformOS;Object.defineProperty(exports,"getRemoteConfigBool",{enumerable:true,get:function get(){return _core.getRemoteConfigBool;}});Object.defineProperty(exports,"getRemoteConfigNumber",{enumerable:true,get:function get(){return _core.getRemoteConfigNumber;}});exports.isHermes=void 0;exports.isMacOS=isMacOS;Object.defineProperty(exports,"isValidSampleRate",{enumerable:true,get:function get(){return _core.isValidSampleRate;}});exports.isWeb=isWeb;exports.isWindows=isWindows;var _reactNative=require("react-native");var _core=require("@posthog/core");var _global=typeof global!=='undefined'?global:undefined;var _globalThis=typeof globalThis!=='undefined'?globalThis:undefined;var GLOBAL_OBJ=exports.GLOBAL_OBJ=_globalThis!==null&&_globalThis!==void 0?_globalThis:_global;function getPlatformOS(){try{return _reactNative.Platform===null||_reactNative.Platform===void 0?void 0:_reactNative.Platform.OS;}catch(_a){return undefined;}}function isWeb(){return getPlatformOS()==='web';}function isMacOS(){return getPlatformOS()==='macos';}function isWindows(){return getPlatformOS()==='windows';}var isHermes=exports.isHermes=function isHermes(){return!!GLOBAL_OBJ.HermesInternal;};
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","
|
|
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.75.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +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.75.0";
|
|
2
|
+
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","
|
|
1
|
+
{"version":3,"file":"version.js","names":["version","exports"],"sources":["../src/version.ts"],"sourcesContent":["export const version = \"4.75.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.75.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/core": "^1.
|
|
38
|
-
"@posthog/types": "^1.412.
|
|
37
|
+
"@posthog/core": "^1.55.0",
|
|
38
|
+
"@posthog/types": "^1.412.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/cli": "^7.19.3",
|
|
@@ -70,7 +70,7 @@
|
|
|
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
76
|
"@posthog-tooling/rollup-utils": "1.1.1",
|
|
@@ -143,9 +143,10 @@
|
|
|
143
143
|
"lint": "oxlint --report-unused-disable-directives-severity error src test",
|
|
144
144
|
"lint:fix": "oxlint --report-unused-disable-directives-severity error src test --fix",
|
|
145
145
|
"test:unit": "vitest run",
|
|
146
|
+
"test:built": "node --test scripts/check-sourcemaps.mjs",
|
|
146
147
|
"test": "pnpm test:unit",
|
|
147
148
|
"prebuild": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts",
|
|
148
|
-
"build": "tsc -b && babel ./dist --out-dir dist --extensions '.js'",
|
|
149
|
+
"build": "tsc -b && babel ./dist --out-dir dist --extensions '.js' --source-maps",
|
|
149
150
|
"package": "pnpm pack --out $PACKAGE_DEST/%s.tgz",
|
|
150
151
|
"generate-references": "pnpm exec api-extractor run --config ./api-extractor.json --local && node scripts/generate-docs.cjs"
|
|
151
152
|
}
|