vxrn 1.26.0 → 1.26.1
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/plugins/reactNativeDevServer.mjs +123 -42
- package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
- package/dist/plugins/reactNativeDevServer.native.js +209 -44
- package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.mjs +29 -10
- package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.native.js +29 -10
- package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/utils/createNativeDevEngine.mjs +220 -83
- package/dist/utils/createNativeDevEngine.mjs.map +1 -1
- package/dist/utils/createNativeDevEngine.native.js +257 -84
- package/dist/utils/createNativeDevEngine.native.js.map +1 -1
- package/dist/utils/createNativeDevEngine.test.mjs +285 -23
- package/dist/utils/createNativeDevEngine.test.mjs.map +1 -1
- package/dist/utils/createNativeDevEngine.test.native.js +319 -23
- package/dist/utils/createNativeDevEngine.test.native.js.map +1 -1
- package/dist/utils/patches.test.mjs.map +1 -1
- package/dist/utils/patches.test.native.js.map +1 -1
- package/dist/utils/symbolicateNativeStack.mjs +66 -0
- package/dist/utils/symbolicateNativeStack.mjs.map +1 -0
- package/dist/utils/symbolicateNativeStack.native.js +70 -0
- package/dist/utils/symbolicateNativeStack.native.js.map +1 -0
- package/dist/utils/symbolicateNativeStack.test.mjs +96 -0
- package/dist/utils/symbolicateNativeStack.test.mjs.map +1 -0
- package/dist/utils/symbolicateNativeStack.test.native.js +96 -0
- package/dist/utils/symbolicateNativeStack.test.native.js.map +1 -0
- package/package.json +12 -11
- package/src/plugins/reactNativeDevServer.ts +162 -50
- package/src/rn-commands/bundle/buildBundle.ts +28 -9
- package/src/utils/createNativeDevEngine.test.ts +581 -193
- package/src/utils/createNativeDevEngine.ts +434 -115
- package/src/utils/patches.test.ts +1 -4
- package/src/utils/symbolicateNativeStack.test.ts +78 -0
- package/src/utils/symbolicateNativeStack.ts +129 -0
- package/types/plugins/reactNativeDevServer.d.ts.map +1 -1
- package/types/rn-commands/bundle/buildBundle.d.ts.map +1 -1
- package/types/utils/createNativeDevEngine.d.ts +23 -4
- package/types/utils/createNativeDevEngine.d.ts.map +1 -1
- package/types/utils/symbolicateNativeStack.d.ts +46 -0
- package/types/utils/symbolicateNativeStack.d.ts.map +1 -0
- package/types/utils/symbolicateNativeStack.test.d.ts +2 -0
- package/types/utils/symbolicateNativeStack.test.d.ts.map +1 -0
|
@@ -357,10 +357,7 @@ describe('applyDependencyPatches', () => {
|
|
|
357
357
|
join(pkgDir, 'package.json'),
|
|
358
358
|
makePkg('test-pkg', '1.0.0')
|
|
359
359
|
)
|
|
360
|
-
await FSExtra.writeFile(
|
|
361
|
-
join(pkgDir, 'index.js'),
|
|
362
|
-
'export default () => <div />'
|
|
363
|
-
)
|
|
360
|
+
await FSExtra.writeFile(join(pkgDir, 'index.js'), 'export default () => <div />')
|
|
364
361
|
},
|
|
365
362
|
})
|
|
366
363
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { GenMapping, addMapping, toEncodedMap } from '@jridgewell/gen-mapping'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
import {
|
|
4
|
+
getNativeFramePlatform,
|
|
5
|
+
isNativeBundleFrame,
|
|
6
|
+
symbolicateNativeStack,
|
|
7
|
+
} from './symbolicateNativeStack'
|
|
8
|
+
|
|
9
|
+
const BUNDLE_URL =
|
|
10
|
+
'http://10.0.0.7:8081/index.bundle//&platform=ios&dev=true&minify=false'
|
|
11
|
+
|
|
12
|
+
const SOURCE = ['function boom() {', " throw new Error('kaboom')", '}', ''].join('\n')
|
|
13
|
+
|
|
14
|
+
function mapOneFrame() {
|
|
15
|
+
const gen = new GenMapping({ file: 'bundle.js' })
|
|
16
|
+
addMapping(gen, {
|
|
17
|
+
generated: { line: 4102, column: 8 },
|
|
18
|
+
source: '/repo/app/routes/detail.tsx',
|
|
19
|
+
original: { line: 2, column: 2 },
|
|
20
|
+
})
|
|
21
|
+
const map = toEncodedMap(gen)
|
|
22
|
+
return JSON.stringify({ ...map, sourcesContent: [SOURCE] })
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('isNativeBundleFrame', () => {
|
|
26
|
+
it('accepts the bundle urls react native reports and rejects everything else', () => {
|
|
27
|
+
expect(isNativeBundleFrame(BUNDLE_URL)).toBe(true)
|
|
28
|
+
expect(isNativeBundleFrame('http://localhost:8081/index.bundle?platform=ios')).toBe(
|
|
29
|
+
true
|
|
30
|
+
)
|
|
31
|
+
expect(isNativeBundleFrame('[native code]')).toBe(false)
|
|
32
|
+
expect(isNativeBundleFrame('/Users/me/app/Foo.m')).toBe(false)
|
|
33
|
+
expect(isNativeBundleFrame(null)).toBe(false)
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('getNativeFramePlatform', () => {
|
|
38
|
+
it('reads the platform out of either query separator react native uses', () => {
|
|
39
|
+
expect(getNativeFramePlatform(BUNDLE_URL)).toBe('ios')
|
|
40
|
+
expect(
|
|
41
|
+
getNativeFramePlatform('http://h/index.bundle?platform=android&dev=true')
|
|
42
|
+
).toBe('android')
|
|
43
|
+
expect(getNativeFramePlatform('[native code]')).toBe(null)
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
describe('symbolicateNativeStack', () => {
|
|
48
|
+
it('resolves a bundle frame to the authored file and line', () => {
|
|
49
|
+
const { stack, codeFrame } = symbolicateNativeStack(
|
|
50
|
+
[{ file: BUNDLE_URL, lineNumber: 4102, column: 8, methodName: 'boom' }],
|
|
51
|
+
mapOneFrame()
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
expect(stack[0].file).toBe('/repo/app/routes/detail.tsx')
|
|
55
|
+
expect(stack[0].lineNumber).toBe(2)
|
|
56
|
+
expect(stack[0].column).toBe(2)
|
|
57
|
+
expect(stack[0].methodName).toBe('boom')
|
|
58
|
+
expect(codeFrame?.fileName).toBe('/repo/app/routes/detail.tsx')
|
|
59
|
+
expect(codeFrame?.location).toEqual({ row: 2, column: 2 })
|
|
60
|
+
expect(codeFrame?.content).toContain("> 2 | throw new Error('kaboom')")
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('hands back frames that did not come from the bundle', () => {
|
|
64
|
+
const frames = [
|
|
65
|
+
{ file: '[native code]', lineNumber: null, column: null, methodName: 'nativeCall' },
|
|
66
|
+
{ file: '/Users/me/app/AppDelegate.mm', lineNumber: 31, column: 4 },
|
|
67
|
+
]
|
|
68
|
+
const { stack, codeFrame } = symbolicateNativeStack(frames, mapOneFrame())
|
|
69
|
+
expect(stack).toEqual(frames)
|
|
70
|
+
expect(codeFrame).toBe(null)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('leaves a bundle frame alone when the map has no mapping for it', () => {
|
|
74
|
+
const frame = { file: BUNDLE_URL, lineNumber: 9, column: 0, methodName: 'unmapped' }
|
|
75
|
+
const { stack } = symbolicateNativeStack([frame], mapOneFrame())
|
|
76
|
+
expect(stack[0]).toEqual(frame)
|
|
77
|
+
})
|
|
78
|
+
})
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TraceMap,
|
|
3
|
+
originalPositionFor,
|
|
4
|
+
sourceContentFor,
|
|
5
|
+
} from '@jridgewell/trace-mapping'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A frame as React Native's LogBox posts it to /symbolicate, and as it expects
|
|
9
|
+
* one back. `lineNumber` is 1-based and `column` is 0-based, matching both the
|
|
10
|
+
* device's stack parser and the source-map spec.
|
|
11
|
+
*/
|
|
12
|
+
export type NativeStackFrame = {
|
|
13
|
+
file?: string | null
|
|
14
|
+
lineNumber?: number | null
|
|
15
|
+
column?: number | null
|
|
16
|
+
methodName?: string | null
|
|
17
|
+
collapse?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type NativeCodeFrame = {
|
|
21
|
+
content: string
|
|
22
|
+
location: { row: number; column: number }
|
|
23
|
+
fileName: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type SymbolicateResult = {
|
|
27
|
+
stack: NativeStackFrame[]
|
|
28
|
+
codeFrame: NativeCodeFrame | null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A frame is ours when it points at a JS bundle served over HTTP by this dev
|
|
33
|
+
* server. Every other frame (a native frame, `[native code]`, an HMR eval) is
|
|
34
|
+
* handed back untouched so the client still renders a complete stack.
|
|
35
|
+
*/
|
|
36
|
+
export function isNativeBundleFrame(file: string | null | undefined): boolean {
|
|
37
|
+
if (!file) return false
|
|
38
|
+
if (!/^https?:\/\//.test(file)) return false
|
|
39
|
+
// react native appends its query with `//&` in some versions and `?` in
|
|
40
|
+
// others, so cut at whichever separator comes first before testing the path.
|
|
41
|
+
const path = file.split(/[?#]|\/\/&/)[0]
|
|
42
|
+
return /\.(?:bundle|js)$/.test(path)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The platform a frame's bundle was built for. React Native always carries it
|
|
47
|
+
* in the bundle URL, and it is what decides which platform's map resolves the
|
|
48
|
+
* frame.
|
|
49
|
+
*/
|
|
50
|
+
export function getNativeFramePlatform(file: string | null | undefined): string | null {
|
|
51
|
+
return file?.match(/[?&/]platform=([a-z]+)/)?.[1] ?? null
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const CODE_FRAME_CONTEXT = 3
|
|
55
|
+
|
|
56
|
+
function buildCodeFrame(
|
|
57
|
+
source: string,
|
|
58
|
+
content: string,
|
|
59
|
+
line: number,
|
|
60
|
+
column: number
|
|
61
|
+
): NativeCodeFrame {
|
|
62
|
+
const lines = content.split('\n')
|
|
63
|
+
const first = Math.max(1, line - CODE_FRAME_CONTEXT)
|
|
64
|
+
const last = Math.min(lines.length, line + CODE_FRAME_CONTEXT)
|
|
65
|
+
const gutter = String(last).length
|
|
66
|
+
const rendered: string[] = []
|
|
67
|
+
for (let n = first; n <= last; n++) {
|
|
68
|
+
const marker = n === line ? '>' : ' '
|
|
69
|
+
rendered.push(`${marker} ${String(n).padStart(gutter)} | ${lines[n - 1]}`)
|
|
70
|
+
if (n === line) {
|
|
71
|
+
rendered.push(` ${' '.repeat(gutter)} | ${' '.repeat(column)}^`)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
content: rendered.join('\n'),
|
|
76
|
+
location: { row: line, column },
|
|
77
|
+
fileName: source,
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Resolve every bundle frame in a React Native stack back to the authored file,
|
|
83
|
+
* line, and column through the bundle's source map.
|
|
84
|
+
*
|
|
85
|
+
* `map` is the serialized map: it is parsed per request rather than kept
|
|
86
|
+
* resident, because a parsed map for a multi-megabyte bundle costs far more
|
|
87
|
+
* memory than a dev server should hold for something only a crash reads.
|
|
88
|
+
*/
|
|
89
|
+
export function symbolicateNativeStack(
|
|
90
|
+
stack: NativeStackFrame[],
|
|
91
|
+
map: string
|
|
92
|
+
): SymbolicateResult {
|
|
93
|
+
const traced = new TraceMap(JSON.parse(map))
|
|
94
|
+
let codeFrame: NativeCodeFrame | null = null
|
|
95
|
+
|
|
96
|
+
const symbolicated = stack.map((frame) => {
|
|
97
|
+
if (!isNativeBundleFrame(frame.file) || !frame.lineNumber) return frame
|
|
98
|
+
|
|
99
|
+
const original = originalPositionFor(traced, {
|
|
100
|
+
line: frame.lineNumber,
|
|
101
|
+
column: frame.column ?? 0,
|
|
102
|
+
})
|
|
103
|
+
if (!original.source) return frame
|
|
104
|
+
|
|
105
|
+
if (!codeFrame && original.line != null) {
|
|
106
|
+
const content = sourceContentFor(traced, original.source)
|
|
107
|
+
if (content) {
|
|
108
|
+
codeFrame = buildCodeFrame(
|
|
109
|
+
original.source,
|
|
110
|
+
content,
|
|
111
|
+
original.line,
|
|
112
|
+
original.column ?? 0
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
...frame,
|
|
119
|
+
file: original.source,
|
|
120
|
+
lineNumber: original.line ?? frame.lineNumber,
|
|
121
|
+
column: original.column ?? frame.column,
|
|
122
|
+
// the map's `names` come from the transform chain and are not function
|
|
123
|
+
// names here, so the device's own methodName stays authoritative.
|
|
124
|
+
methodName: frame.methodName,
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
return { stack: symbolicated, codeFrame }
|
|
129
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactNativeDevServer.d.ts","sourceRoot":"","sources":["../../src/plugins/reactNativeDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,MAAM,EAAiB,MAAM,MAAM,CAAA;AAO1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"reactNativeDevServer.d.ts","sourceRoot":"","sources":["../../src/plugins/reactNativeDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,MAAM,EAAiB,MAAM,MAAM,CAAA;AAO1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAwBnE,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA4B9D;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,CAAC,EAAE,OAAO,CACf,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,aAAa,GAAG,kBAAkB,GAAG,SAAS,CAAC,CACrF,GACA,MAAM,CAyZR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildBundle.d.ts","sourceRoot":"","sources":["../../../src/rn-commands/bundle/buildBundle.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,qCAAqC,CAAA;AAI5C,YAAY,EAAE,iBAAiB,EAAE,CAAA;AAEjC,wBAAsB,WAAW,CAC/B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,iBAAiB,EACvB,UAAU,GAAE,GAAU,GACrB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"buildBundle.d.ts","sourceRoot":"","sources":["../../../src/rn-commands/bundle/buildBundle.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,qCAAqC,CAAA;AAI5C,YAAY,EAAE,iBAAiB,EAAE,CAAA;AAEjC,wBAAsB,WAAW,CAC/B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,iBAAiB,EACvB,UAAU,GAAE,GAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CA0Ff"}
|
|
@@ -9,6 +9,11 @@ import type { Plugin } from 'rolldown';
|
|
|
9
9
|
import type { DevEngine } from 'rolldown/experimental';
|
|
10
10
|
/** SWC `env.include` for Hermes-compatible downleveling; see HERMES_CLASS_TRANSFORMS. */
|
|
11
11
|
export declare function getHermesSWCIncludes(dev: boolean): string[];
|
|
12
|
+
export interface NativePluginContext {
|
|
13
|
+
root: string;
|
|
14
|
+
platform: 'ios' | 'android';
|
|
15
|
+
dev: boolean;
|
|
16
|
+
}
|
|
12
17
|
interface NativeDevEngineOptions {
|
|
13
18
|
root: string;
|
|
14
19
|
port: number;
|
|
@@ -26,17 +31,25 @@ export type NativeHmrUpdate = {
|
|
|
26
31
|
seq: number;
|
|
27
32
|
} | {
|
|
28
33
|
type: 'hmr:reload';
|
|
29
|
-
clientId
|
|
34
|
+
clientId?: string;
|
|
30
35
|
} | {
|
|
31
36
|
type: 'hmr:error';
|
|
32
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* The served dev bundle and the map that resolves a frame in it back to the
|
|
40
|
+
* authored file. `map` is the serialized JSON, parsed only when a symbolicate
|
|
41
|
+
* request arrives.
|
|
42
|
+
*/
|
|
43
|
+
export interface NativeDevBundle {
|
|
44
|
+
code: string;
|
|
45
|
+
map: string;
|
|
46
|
+
}
|
|
33
47
|
interface NativeDevEngineResult {
|
|
34
48
|
engine: DevEngine;
|
|
35
|
-
getBundle: () => Promise<
|
|
36
|
-
code: string;
|
|
37
|
-
}>;
|
|
49
|
+
getBundle: () => Promise<NativeDevBundle>;
|
|
38
50
|
getAsset: (pathname: string, hash?: string) => NativeDevAsset | undefined;
|
|
39
51
|
close: () => Promise<void>;
|
|
52
|
+
handleAddedFile: (file: string) => Promise<void>;
|
|
40
53
|
}
|
|
41
54
|
export declare function getNativeTransformConfig(platform: 'ios' | 'android', dev: boolean, root: string): {
|
|
42
55
|
jsx: {
|
|
@@ -54,6 +67,7 @@ export declare function getNativeTransformConfig(platform: 'ios' | 'android', de
|
|
|
54
67
|
* - DevSettings stripping → stripDevSettingsPlugin
|
|
55
68
|
*/
|
|
56
69
|
export declare function normalizeNativeCommonJSInterop(code: string): string;
|
|
70
|
+
export declare function postProcessNativeBundle(code: string): string;
|
|
57
71
|
/**
|
|
58
72
|
* Wrap the dev bundle body in a function scope so module top-level
|
|
59
73
|
* `var`/`function` declarations don't leak onto the global object.
|
|
@@ -90,6 +104,11 @@ interface NativeBuildOptions {
|
|
|
90
104
|
plugins?: Plugin[];
|
|
91
105
|
/** only pass when the map is written somewhere — it costs a second copy of the bundle */
|
|
92
106
|
sourcemap?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Compress and mangle the output. Defaults to React Native's own rule for a
|
|
109
|
+
* bundle: on unless the build is a dev build.
|
|
110
|
+
*/
|
|
111
|
+
minify?: boolean;
|
|
93
112
|
}
|
|
94
113
|
export declare function buildNativeBundle(options: NativeBuildOptions): Promise<{
|
|
95
114
|
code: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNativeDevEngine.d.ts","sourceRoot":"","sources":["../../src/utils/createNativeDevEngine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"createNativeDevEngine.d.ts","sourceRoot":"","sources":["../../src/utils/createNativeDevEngine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,OAAO,KAAK,EAA+B,MAAM,EAAkB,MAAM,UAAU,CAAA;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AA6BtD,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAE3D;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAA;IAC3B,GAAG,EAAE,OAAO,CAAA;CACb;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAA;CAChD;AAED,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;CACZ,GAGD;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAA;AAEzB;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,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,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,CA4D1B;AAiED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,UAAQ,GAAG,MAAM,CA6C9E;AAED,eAAO,MAAM,kBAAkB,8BAAwB,CAAA;AAEvD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,UAAQ,GAAG,MAAM,CAuB5D;AAID,wBAAgB,mBAAmB,IAAI,MAAM,CA2O5C"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A frame as React Native's LogBox posts it to /symbolicate, and as it expects
|
|
3
|
+
* one back. `lineNumber` is 1-based and `column` is 0-based, matching both the
|
|
4
|
+
* device's stack parser and the source-map spec.
|
|
5
|
+
*/
|
|
6
|
+
export type NativeStackFrame = {
|
|
7
|
+
file?: string | null;
|
|
8
|
+
lineNumber?: number | null;
|
|
9
|
+
column?: number | null;
|
|
10
|
+
methodName?: string | null;
|
|
11
|
+
collapse?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type NativeCodeFrame = {
|
|
14
|
+
content: string;
|
|
15
|
+
location: {
|
|
16
|
+
row: number;
|
|
17
|
+
column: number;
|
|
18
|
+
};
|
|
19
|
+
fileName: string;
|
|
20
|
+
};
|
|
21
|
+
export type SymbolicateResult = {
|
|
22
|
+
stack: NativeStackFrame[];
|
|
23
|
+
codeFrame: NativeCodeFrame | null;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A frame is ours when it points at a JS bundle served over HTTP by this dev
|
|
27
|
+
* server. Every other frame (a native frame, `[native code]`, an HMR eval) is
|
|
28
|
+
* handed back untouched so the client still renders a complete stack.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isNativeBundleFrame(file: string | null | undefined): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The platform a frame's bundle was built for. React Native always carries it
|
|
33
|
+
* in the bundle URL, and it is what decides which platform's map resolves the
|
|
34
|
+
* frame.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getNativeFramePlatform(file: string | null | undefined): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve every bundle frame in a React Native stack back to the authored file,
|
|
39
|
+
* line, and column through the bundle's source map.
|
|
40
|
+
*
|
|
41
|
+
* `map` is the serialized map: it is parsed per request rather than kept
|
|
42
|
+
* resident, because a parsed map for a multi-megabyte bundle costs far more
|
|
43
|
+
* memory than a dev server should hold for something only a crash reads.
|
|
44
|
+
*/
|
|
45
|
+
export declare function symbolicateNativeStack(stack: NativeStackFrame[], map: string): SymbolicateResult;
|
|
46
|
+
//# sourceMappingURL=symbolicateNativeStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbolicateNativeStack.d.ts","sourceRoot":"","sources":["../../src/utils/symbolicateNativeStack.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IACzC,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,SAAS,EAAE,eAAe,GAAG,IAAI,CAAA;CAClC,CAAA;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAO5E;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAErF;AA6BD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,gBAAgB,EAAE,EACzB,GAAG,EAAE,MAAM,GACV,iBAAiB,CAqCnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbolicateNativeStack.test.d.ts","sourceRoot":"","sources":["../../src/utils/symbolicateNativeStack.test.ts"],"names":[],"mappings":""}
|