@logbrew/react-native 0.1.15 → 0.1.16

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/README.md CHANGED
@@ -869,7 +869,7 @@ uploadLogBrewReactNativeReleaseArtifacts({
869
869
  environment: "production",
870
870
  service: "checkout-mobile",
871
871
  root: process.cwd(),
872
- endpoint: "https://api.logbrew.com/api/release-artifacts",
872
+ endpoint: "https://api.logbrew.co/api/release-artifacts",
873
873
  allowHostedUpload: true,
874
874
  tokenEnv: "LOGBREW_RELEASE_ARTIFACT_AUTH"
875
875
  });
package/index.cjs CHANGED
@@ -16,7 +16,7 @@ const {
16
16
  } = require("./metadata.cjs");
17
17
 
18
18
  const DEFAULT_SDK_NAME = "logbrew-react-native";
19
- const DEFAULT_SDK_VERSION = "0.1.15";
19
+ const DEFAULT_SDK_VERSION = "0.1.16";
20
20
  const DEFAULT_ENDPOINT = "https://api.logbrew.co/v1/events";
21
21
  const MAX_ACTION_NAME_LENGTH = 64;
22
22
  const MAX_PRODUCT_ANALYTICS_SURFACE_LENGTH = 256;
package/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  } from "./metadata.js";
17
17
 
18
18
  const DEFAULT_SDK_NAME = "logbrew-react-native";
19
- const DEFAULT_SDK_VERSION = "0.1.15";
19
+ const DEFAULT_SDK_VERSION = "0.1.16";
20
20
  const DEFAULT_ENDPOINT = "https://api.logbrew.co/v1/events";
21
21
  const MAX_ACTION_NAME_LENGTH = 64;
22
22
  const MAX_PRODUCT_ANALYTICS_SURFACE_LENGTH = 256;
@@ -3,7 +3,7 @@ import Foundation
3
3
  @objc(LBRNAppleNativeDiagnostics)
4
4
  public final class LBRNAppleNativeDiagnostics: NSObject, @unchecked Sendable {
5
5
  private static let shared = LBRNAppleNativeDiagnostics()
6
- private static let sdkVersion = "0.1.15"
6
+ private static let sdkVersion = "0.1.16"
7
7
 
8
8
  private let lock = NSLock()
9
9
  private let replayQueue = DispatchQueue(label: "co.logbrew.react-native.apple-diagnostics-replay")
package/metro.cjs CHANGED
@@ -275,24 +275,43 @@ function sortedModules(graph, options) {
275
275
  }
276
276
 
277
277
  function createMetroSourceMapSerializer() {
278
- const sourceMapModule = requireMetroModule(
279
- "metro/private/DeltaBundler/Serializers/sourceMapString",
280
- "metro/src/DeltaBundler/Serializers/sourceMapString",
278
+ const getSourceMapInfo = moduleFunction(
279
+ requireMetroModule(
280
+ "metro/private/DeltaBundler/Serializers/helpers/getSourceMapInfo",
281
+ "metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo",
282
+ ),
283
+ ["default"],
284
+ "getSourceMapInfo",
281
285
  );
282
- const sourceMapString = moduleFunction(
283
- sourceMapModule,
284
- ["sourceMapStringNonBlocking", "sourceMapString", "default"],
285
- "sourceMapString",
286
+ const isJsModule = moduleFunction(
287
+ requireMetroModule(
288
+ "metro/private/DeltaBundler/Serializers/helpers/js",
289
+ "metro/src/DeltaBundler/Serializers/helpers/js",
290
+ ),
291
+ ["isJsModule"],
292
+ "isJsModule",
293
+ );
294
+ const metroRequire = createRequire(require.resolve("metro/package.json"));
295
+ const fromRawMappings = moduleFunction(
296
+ metroRequire("metro-source-map"),
297
+ ["fromRawMappings"],
298
+ "fromRawMappings",
286
299
  );
287
300
 
288
- return (preModules, graph, options) =>
289
- sourceMapString([...preModules, ...sortedModules(graph, options)], {
301
+ return (preModules, graph, options) => {
302
+ const sourceMapOptions = {
290
303
  excludeSource: options?.excludeSource === true,
291
304
  getSourceUrl: typeof options?.getSourceUrl === "function" ? options.getSourceUrl : null,
292
305
  processModuleFilter: typeof options?.processModuleFilter === "function" ? options.processModuleFilter : () => true,
293
306
  shouldAddToIgnoreList:
294
307
  typeof options?.shouldAddToIgnoreList === "function" ? options.shouldAddToIgnoreList : () => false,
295
- });
308
+ };
309
+ const modules = [...preModules, ...sortedModules(graph, options)]
310
+ .filter(isJsModule)
311
+ .filter(sourceMapOptions.processModuleFilter)
312
+ .map((module) => getSourceMapInfo(module, sourceMapOptions));
313
+ return fromRawMappings(modules).toString(undefined, sourceMapOptions);
314
+ };
296
315
  }
297
316
 
298
317
  function createDefaultMetroSerializer() {
@@ -335,10 +354,6 @@ function createLogBrewMetroSerializer(customSerializer) {
335
354
  serializerSource ??= createDefaultMetroSerializer();
336
355
  return serializerSource;
337
356
  };
338
- const resolveFallbackSerializer = () => {
339
- fallbackSerializer ??= createDefaultMetroSerializer();
340
- return fallbackSerializer;
341
- };
342
357
 
343
358
  const serializer = async (entryPoint, preModules, graph, options) => {
344
359
  const source = resolveSerializer();
@@ -348,7 +363,8 @@ function createLogBrewMetroSerializer(customSerializer) {
348
363
  const releaseModules = prependDebugIdModule(preModules);
349
364
  const result = await source(entryPoint, releaseModules, graph, options);
350
365
  if (typeof result === "string") {
351
- const fallbackResult = await resolveFallbackSerializer()(entryPoint, releaseModules, graph, options);
366
+ fallbackSerializer ??= createDefaultMetroSerializer();
367
+ const fallbackResult = await fallbackSerializer(entryPoint, releaseModules, graph, options);
352
368
  if (typeof fallbackResult === "string" || fallbackResult.code !== result) {
353
369
  throw configurationError(
354
370
  "LogBrew Metro string-returning custom serializer changed bundle code; return { code, map } to preserve source-map accuracy",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logbrew/react-native",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "React Native offline delivery, Apple native diagnostics, screen, error, trace, action, and network timeline helpers for LogBrew.",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
@@ -240,7 +240,7 @@
240
240
  "url": "git+https://github.com/LogBrewCo/sdk.git"
241
241
  },
242
242
  "peerDependencies": {
243
- "@logbrew/sdk": "^0.1.7",
243
+ "@logbrew/sdk": "^0.1.12",
244
244
  "expo": ">=49",
245
245
  "react": ">=18",
246
246
  "react-native": ">=0.72"
@@ -7,6 +7,7 @@ const path = require("node:path");
7
7
 
8
8
  const PACKAGE_DIR = path.dirname(require.resolve("./package.json"));
9
9
  const DEFAULT_MANIFEST_NAME = "logbrew-release-artifacts.json";
10
+ const HOSTED_UPLOAD_ENDPOINT = "https://api.logbrew.co/api/release-artifacts";
10
11
  const SUPPORTED_PLATFORMS = new Set(["android", "ios"]);
11
12
  const SOURCE_MAPPING_COMMENT_RE = /(?:\/\/#|\/\*#)\s*sourceMappingURL=[^\r\n]*/giu;
12
13
 
@@ -123,14 +124,8 @@ function requireUploadEndpoint(endpoint, allowHosted) {
123
124
  if (!allowHosted) {
124
125
  throw new Error("release artifact hosted upload requires explicit allowHostedUpload; use loopback endpoints for local proof");
125
126
  }
126
- if (parsed.protocol !== "https:") {
127
- throw new Error("hosted release artifact upload endpoints must use https");
128
- }
129
- if (parsed.username || parsed.password) {
130
- throw new Error("hosted release artifact upload endpoints must not include embedded auth values");
131
- }
132
- if (parsed.search || parsed.hash) {
133
- throw new Error("hosted release artifact upload endpoints must not include query strings or fragments");
127
+ if (endpoint !== HOSTED_UPLOAD_ENDPOINT) {
128
+ throw new Error(`hosted release artifact uploads must use ${HOSTED_UPLOAD_ENDPOINT}`);
134
129
  }
135
130
  }
136
131