react-on-rails-pro-node-renderer 17.0.0-rc.3 → 17.0.0-rc.4

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.
@@ -0,0 +1,110 @@
1
+ export interface BundleSourceMapRegistration {
2
+ bundleFilePath: string;
3
+ /**
4
+ * Column correction for frames on line 1 of the bundle. When the bundle is
5
+ * evaluated wrapped in `Module.wrap` (the `supportModules` /
6
+ * `additionalContext` path), the wrapper prefix shifts every first-line
7
+ * column by its length.
8
+ */
9
+ firstLineColumnOffset: number;
10
+ /**
11
+ * `undefined` means the bundle text was not available at registration time
12
+ * and must be checked lazily. `null` means it was checked and no
13
+ * sourceMappingURL comment was present.
14
+ */
15
+ sourceMappingUrl?: string | null;
16
+ /**
17
+ * `undefined` keeps lazy synchronous lookup behavior. `null` means registration
18
+ * time lookup found no usable source map. A string freezes the source-map JSON
19
+ * for this VM generation so same-path rebuilds cannot remap old bytecode with
20
+ * a newer map.
21
+ */
22
+ sourceMapJson?: string | null;
23
+ realBundleDirectory: string;
24
+ /**
25
+ * External source maps can arrive after a bundle first becomes visible. When
26
+ * true, a missing external map is retried briefly before caching the miss.
27
+ */
28
+ retryMissingSourceMap?: boolean;
29
+ }
30
+ interface SourceMapLookupAttempt {
31
+ missingSourceMaps: WeakSet<BundleSourceMapRegistration>;
32
+ }
33
+ export declare function retireMissingSourceMapRetry(registration: BundleSourceMapRegistration): void;
34
+ export declare function createSourceMapLookupAttempt(): SourceMapLookupAttempt;
35
+ /**
36
+ * Name of the host-callback global injected into the VM context. Used by
37
+ * {@link PREPARE_STACK_TRACE_INSTALL_SCRIPT}.
38
+ */
39
+ export declare const SOURCE_MAP_RESOLVER_CONTEXT_KEY = "__reactOnRailsProResolveOriginalSourcePosition";
40
+ /**
41
+ * Name of the host-callback global used to group resolver calls that belong to
42
+ * one `.stack` formatting attempt.
43
+ */
44
+ export declare const SOURCE_MAP_LOOKUP_ATTEMPT_CONTEXT_KEY = "__reactOnRailsProCreateSourceMapLookupAttempt";
45
+ /**
46
+ * Name of the host-callback global injected into the VM context for stacks
47
+ * serialized by react-on-rails before they can escape to the host formatter.
48
+ */
49
+ export declare const SOURCE_MAP_STACK_REMAPPER_CONTEXT_KEY = "__reactOnRailsProRemapStackTrace";
50
+ /** @internal Used by VM build to avoid synchronous external-map reads. */
51
+ export declare function preloadSourceMapJsonForBundle(bundleFilePath: string, bundleContents: string): Promise<{
52
+ retryMissingSourceMap: boolean;
53
+ sourceMapJson: string | null;
54
+ } | {
55
+ retryMissingSourceMap: boolean;
56
+ sourceMapJson: string | undefined;
57
+ }>;
58
+ /**
59
+ * Registers a bundle file so stack frames pointing into it can be remapped.
60
+ * Pass `bundleContents` when available; omitting it makes the first error-path
61
+ * lookup synchronously re-read the bundle to find its `sourceMappingURL`.
62
+ * `preloadedSourceMapJson` supplies known JSON/null for this VM generation;
63
+ * `retryMissingSourceMap` keeps external preload misses retryable until a map is
64
+ * found, the retry cap is reached, or a same-path generation replaces the registration.
65
+ */
66
+ export declare function registerBundleForSourceMaps(bundleFilePath: string, firstLineColumnOffset?: number, bundleContents?: string, preloadedSourceMapJson?: string | null, retryMissingSourceMap?: boolean): {
67
+ bundleFilePath: string;
68
+ firstLineColumnOffset: number;
69
+ realBundleDirectory: string;
70
+ sourceMappingUrl: string | null | undefined;
71
+ sourceMapJson: string | null | undefined;
72
+ retryMissingSourceMap: boolean;
73
+ };
74
+ /**
75
+ * Drops the registration and any cached source map for a bundle.
76
+ */
77
+ export declare function unregisterBundleForSourceMaps(bundleOrRegistration: string | BundleSourceMapRegistration): void;
78
+ /** @internal Used in tests */
79
+ export declare function resetSourceMapSupport(): void;
80
+ export interface ResolvedSourcePosition {
81
+ source: string;
82
+ line: number;
83
+ column: number;
84
+ }
85
+ /**
86
+ * Resolves a 1-based generated position in a registered bundle to its original
87
+ * source position. Returns null when the position cannot be mapped.
88
+ *
89
+ * SECURITY: this function is exposed to untrusted bundle code inside the VM
90
+ * context, so it validates its inputs and only operates on registered bundle
91
+ * paths.
92
+ *
93
+ * @param lineNumber 1-based generated line number, matching V8 CallSite values.
94
+ * @param columnNumber 1-based generated column number, matching V8 CallSite values.
95
+ */
96
+ export declare function resolveOriginalPositionForRegistration(registration: BundleSourceMapRegistration, fileName: unknown, lineNumber: unknown, columnNumber: unknown, lookupAttempt?: unknown): ResolvedSourcePosition | null;
97
+ export declare function remapStackTrace(stack: unknown, registration?: BundleSourceMapRegistration): string | undefined;
98
+ export declare function remapErrorStack(error: unknown, registration?: BundleSourceMapRegistration): void;
99
+ /**
100
+ * Script run inside the VM context (before the bundle is evaluated) that
101
+ * installs an `Error.prepareStackTrace` mirroring V8's default format but
102
+ * rewriting `file:line:column` locations through the host-side resolver when a
103
+ * source-mapped position is available. Bundle code can replace
104
+ * `Error.prepareStackTrace` after this script runs; if it does, source mapping
105
+ * is disabled for that VM context. Any failure falls back to the original frame
106
+ * text.
107
+ */
108
+ export declare const PREPARE_STACK_TRACE_INSTALL_SCRIPT = "\nError.prepareStackTrace = function (error, callSites) {\n var header;\n try {\n header = String(error);\n } catch (formatError) {\n header = '<error>';\n }\n var parts = [header];\n var sourceMapLookupAttempt;\n try {\n if (typeof __reactOnRailsProCreateSourceMapLookupAttempt === 'function') {\n sourceMapLookupAttempt = __reactOnRailsProCreateSourceMapLookupAttempt();\n }\n } catch (lookupAttemptError) {\n sourceMapLookupAttempt = undefined;\n }\n for (var i = 0; i < callSites.length; i++) {\n var frameText;\n try {\n frameText = String(callSites[i]);\n } catch (formatFrameError) {\n frameText = '<frame>';\n }\n try {\n var fileName = callSites[i].getFileName();\n var line = callSites[i].getLineNumber();\n var column = callSites[i].getColumnNumber();\n if (\n fileName != null &&\n line != null &&\n column != null &&\n typeof __reactOnRailsProResolveOriginalSourcePosition === 'function'\n ) {\n var position = __reactOnRailsProResolveOriginalSourcePosition(fileName, line, column, sourceMapLookupAttempt);\n if (position) {\n var generatedLocation = fileName + ':' + line + ':' + column;\n var originalLocation = position.source + ':' + position.line + ':' + position.column;\n if (frameText.indexOf(generatedLocation) !== -1) {\n // String first-arg: replace only the frame's canonical location once.\n // Do not use a /g regex here; a repeated numeric location elsewhere\n // in the frame text should not be rewritten.\n frameText = frameText.replace(generatedLocation, function () { return originalLocation; });\n } else {\n frameText = frameText + ' -> ' + originalLocation;\n }\n }\n }\n } catch (resolveError) {\n // Keep the original frame text.\n }\n parts.push(' at ' + frameText);\n }\n return parts.join('\\n');\n};\n";
109
+ export {};
110
+ //# sourceMappingURL=vmSourceMapSupport.d.ts.map