@rose42/feedback-capture 0.1.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/LICENSE +21 -0
- package/README.md +107 -0
- package/dist/clipboard.d.ts +7 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +33 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/context.d.ts +10 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/context.js.map +1 -0
- package/dist/crop.d.ts +61 -0
- package/dist/crop.d.ts.map +1 -0
- package/dist/crop.js +112 -0
- package/dist/crop.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/comment.d.ts +11 -0
- package/dist/plugins/comment.d.ts.map +1 -0
- package/dist/plugins/comment.js +14 -0
- package/dist/plugins/comment.js.map +1 -0
- package/dist/plugins/consoleLogs.d.ts +14 -0
- package/dist/plugins/consoleLogs.d.ts.map +1 -0
- package/dist/plugins/consoleLogs.js +98 -0
- package/dist/plugins/consoleLogs.js.map +1 -0
- package/dist/plugins/core.d.ts +24 -0
- package/dist/plugins/core.d.ts.map +1 -0
- package/dist/plugins/core.js +62 -0
- package/dist/plugins/core.js.map +1 -0
- package/dist/plugins/elementTarget.d.ts +156 -0
- package/dist/plugins/elementTarget.d.ts.map +1 -0
- package/dist/plugins/elementTarget.js +537 -0
- package/dist/plugins/elementTarget.js.map +1 -0
- package/dist/plugins/frameBurst.d.ts +60 -0
- package/dist/plugins/frameBurst.d.ts.map +1 -0
- package/dist/plugins/frameBurst.js +260 -0
- package/dist/plugins/frameBurst.js.map +1 -0
- package/dist/plugins/index.d.ts +17 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +9 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/pageContext.d.ts +13 -0
- package/dist/plugins/pageContext.d.ts.map +1 -0
- package/dist/plugins/pageContext.js +23 -0
- package/dist/plugins/pageContext.js.map +1 -0
- package/dist/plugins/screenshot.d.ts +34 -0
- package/dist/plugins/screenshot.d.ts.map +1 -0
- package/dist/plugins/screenshot.js +183 -0
- package/dist/plugins/screenshot.js.map +1 -0
- package/dist/plugins/version.d.ts +16 -0
- package/dist/plugins/version.d.ts.map +1 -0
- package/dist/plugins/version.js +21 -0
- package/dist/plugins/version.js.map +1 -0
- package/dist/session.d.ts +19 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +18 -0
- package/dist/session.js.map +1 -0
- package/dist/source/adapters/compose.d.ts +7 -0
- package/dist/source/adapters/compose.d.ts.map +1 -0
- package/dist/source/adapters/compose.js +21 -0
- package/dist/source/adapters/compose.js.map +1 -0
- package/dist/source/adapters/createSourceResolver.d.ts +28 -0
- package/dist/source/adapters/createSourceResolver.d.ts.map +1 -0
- package/dist/source/adapters/createSourceResolver.js +59 -0
- package/dist/source/adapters/createSourceResolver.js.map +1 -0
- package/dist/source/adapters/detect.d.ts +22 -0
- package/dist/source/adapters/detect.d.ts.map +1 -0
- package/dist/source/adapters/detect.js +133 -0
- package/dist/source/adapters/detect.js.map +1 -0
- package/dist/source/adapters/index.d.ts +18 -0
- package/dist/source/adapters/index.d.ts.map +1 -0
- package/dist/source/adapters/index.js +10 -0
- package/dist/source/adapters/index.js.map +1 -0
- package/dist/source/adapters/locator.d.ts +14 -0
- package/dist/source/adapters/locator.d.ts.map +1 -0
- package/dist/source/adapters/locator.js +69 -0
- package/dist/source/adapters/locator.js.map +1 -0
- package/dist/source/adapters/next.d.ts +46 -0
- package/dist/source/adapters/next.d.ts.map +1 -0
- package/dist/source/adapters/next.js +124 -0
- package/dist/source/adapters/next.js.map +1 -0
- package/dist/source/adapters/nextFlight.d.ts +19 -0
- package/dist/source/adapters/nextFlight.d.ts.map +1 -0
- package/dist/source/adapters/nextFlight.js +80 -0
- package/dist/source/adapters/nextFlight.js.map +1 -0
- package/dist/source/adapters/qwik.d.ts +16 -0
- package/dist/source/adapters/qwik.d.ts.map +1 -0
- package/dist/source/adapters/qwik.js +49 -0
- package/dist/source/adapters/qwik.js.map +1 -0
- package/dist/source/adapters/react.d.ts +46 -0
- package/dist/source/adapters/react.d.ts.map +1 -0
- package/dist/source/adapters/react.js +201 -0
- package/dist/source/adapters/react.js.map +1 -0
- package/dist/source/adapters/svelte.d.ts +23 -0
- package/dist/source/adapters/svelte.d.ts.map +1 -0
- package/dist/source/adapters/svelte.js +64 -0
- package/dist/source/adapters/svelte.js.map +1 -0
- package/dist/source/adapters/vue.d.ts +27 -0
- package/dist/source/adapters/vue.d.ts.map +1 -0
- package/dist/source/adapters/vue.js +76 -0
- package/dist/source/adapters/vue.js.map +1 -0
- package/dist/source/locateJsx.d.ts +25 -0
- package/dist/source/locateJsx.d.ts.map +1 -0
- package/dist/source/locateJsx.js +67 -0
- package/dist/source/locateJsx.js.map +1 -0
- package/dist/source/rankSourceHierarchy.d.ts +25 -0
- package/dist/source/rankSourceHierarchy.d.ts.map +1 -0
- package/dist/source/rankSourceHierarchy.js +60 -0
- package/dist/source/rankSourceHierarchy.js.map +1 -0
- package/dist/source/reactSourceResolver.d.ts +3 -0
- package/dist/source/reactSourceResolver.d.ts.map +1 -0
- package/dist/source/reactSourceResolver.js +3 -0
- package/dist/source/reactSourceResolver.js.map +1 -0
- package/dist/source/sourceMap.d.ts +41 -0
- package/dist/source/sourceMap.d.ts.map +1 -0
- package/dist/source/sourceMap.js +235 -0
- package/dist/source/sourceMap.js.map +1 -0
- package/dist/transport.d.ts +13 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +37 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { classNameOf, locateJsxInSource } from "../locateJsx.js";
|
|
2
|
+
import { isAppSourcePath, normalizeSourcePath } from "../sourceMap.js";
|
|
3
|
+
import { createFiberStackSourceResolver } from "./react.js";
|
|
4
|
+
import { flightPagePathToAppFile, parseNextFlightPagePaths, pickNextFlightPagePath, } from "./nextFlight.js";
|
|
5
|
+
export { flightPagePathMatchesUrl, flightPagePathToAppFile, parseNextFlightPagePaths, pickNextFlightPagePath, } from "./nextFlight.js";
|
|
6
|
+
/**
|
|
7
|
+
* Strip Turbopack `[project]/` and leading `apps/<pkg>/` so paths line up with
|
|
8
|
+
* an open-in-editor root pointed at the Next app (e.g. `apps/b2b`).
|
|
9
|
+
* Workspace packages (`packages/…`) stay monorepo-relative — pair with a
|
|
10
|
+
* workspace-rooted editor template when opening those files.
|
|
11
|
+
*/
|
|
12
|
+
export function normalizeNextSourcePath(fileName) {
|
|
13
|
+
let path = normalizeSourcePath(fileName);
|
|
14
|
+
path = path.replace(/^\[project\]\//, "");
|
|
15
|
+
const appsPkg = /^apps\/[^/]+\/(.+)$/.exec(path);
|
|
16
|
+
if (appsPkg?.[1])
|
|
17
|
+
return appsPkg[1];
|
|
18
|
+
return path;
|
|
19
|
+
}
|
|
20
|
+
function mapNextLocation(loc) {
|
|
21
|
+
return {
|
|
22
|
+
...loc,
|
|
23
|
+
fileName: normalizeNextSourcePath(loc.fileName),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function defaultFetchSourceFile(endpoint, fetchFn) {
|
|
27
|
+
const bases = [
|
|
28
|
+
...(endpoint ? [endpoint.replace(/\/$/, "")] : []),
|
|
29
|
+
"/api/t3-feedback",
|
|
30
|
+
"/__t3-feedback",
|
|
31
|
+
];
|
|
32
|
+
return async (appRelativeFile) => {
|
|
33
|
+
for (const base of bases) {
|
|
34
|
+
try {
|
|
35
|
+
const url = `${base}/source?file=${encodeURIComponent(appRelativeFile)}`;
|
|
36
|
+
const res = await fetchFn(url);
|
|
37
|
+
if (!res.ok)
|
|
38
|
+
continue;
|
|
39
|
+
return await res.text();
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// try next base
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async function enrichmentFromFlightPage(el, options) {
|
|
49
|
+
const doc = el.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
50
|
+
if (!doc)
|
|
51
|
+
return undefined;
|
|
52
|
+
const pathname = typeof location !== "undefined" ? location.pathname : (doc.location?.pathname ?? "/");
|
|
53
|
+
const pagePath = pickNextFlightPagePath(parseNextFlightPagePaths(doc), pathname);
|
|
54
|
+
if (!pagePath)
|
|
55
|
+
return undefined;
|
|
56
|
+
const fileName = normalizeNextSourcePath(flightPagePathToAppFile(pagePath));
|
|
57
|
+
let line = 1;
|
|
58
|
+
let column = 1;
|
|
59
|
+
const source = await options.fetchSourceFile(fileName);
|
|
60
|
+
if (source) {
|
|
61
|
+
const hints = {
|
|
62
|
+
tagName: el.tagName.toLowerCase(),
|
|
63
|
+
};
|
|
64
|
+
const className = classNameOf(el);
|
|
65
|
+
if (className)
|
|
66
|
+
hints.className = className;
|
|
67
|
+
const text = el.textContent?.trim();
|
|
68
|
+
if (text)
|
|
69
|
+
hints.textSnippet = text.slice(0, 80);
|
|
70
|
+
const href = el.getAttribute("href")?.trim();
|
|
71
|
+
if (href)
|
|
72
|
+
hints.href = href;
|
|
73
|
+
const hit = locateJsxInSource(source, hints);
|
|
74
|
+
if (hit) {
|
|
75
|
+
line = hit.line;
|
|
76
|
+
column = hit.column;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
component: {
|
|
81
|
+
fileName,
|
|
82
|
+
line,
|
|
83
|
+
column,
|
|
84
|
+
name: "page",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Next.js (Turbopack / webpack) source enrichment.
|
|
90
|
+
*
|
|
91
|
+
* Same fiber + `_debugStack` bridge as React, but:
|
|
92
|
+
* - walks stack frames until the mapped source is an app file (skips
|
|
93
|
+
* `react-jsx-runtime` / `node_modules` — React 19's `react-stack-top-frame`
|
|
94
|
+
* is created inside the JSX runtime, and Next serves it as a compiled chunk
|
|
95
|
+
* URL that passes a naive "first app frame" filter);
|
|
96
|
+
* - prefers the DOM node's host-fiber `_debugStack` (JSX call site) before the
|
|
97
|
+
* composite — Next client roots hydrated from RSC often lack a useful stack
|
|
98
|
+
* on the component fiber itself;
|
|
99
|
+
* - when there is no client fiber (pure Server Component HTML), falls back to
|
|
100
|
+
* the Flight `pagePath` and matches the element's tag/classes to a JSX line
|
|
101
|
+
* in that file (via optional `/source` bridge);
|
|
102
|
+
* - normalizes Turbopack `file:///…/apps/<pkg>/…` paths to app-relative paths
|
|
103
|
+
* for `cursor://` / open-in-editor templates rooted at the Next app.
|
|
104
|
+
*/
|
|
105
|
+
export function createNextSourceResolver(options = {}) {
|
|
106
|
+
const flightPageFallback = options.flightPageFallback !== false;
|
|
107
|
+
const fetchFn = options.fetchFn ?? fetch;
|
|
108
|
+
const fetchSourceFile = options.fetchSourceFile ?? defaultFetchSourceFile(options.sourceEndpoint, fetchFn);
|
|
109
|
+
const fiberResolver = createFiberStackSourceResolver({
|
|
110
|
+
...options,
|
|
111
|
+
acceptSource: isAppSourcePath,
|
|
112
|
+
mapLocation: mapNextLocation,
|
|
113
|
+
});
|
|
114
|
+
return async (el) => {
|
|
115
|
+
const fromFiber = await fiberResolver(el);
|
|
116
|
+
if (fromFiber?.component || (fromFiber?.owners && fromFiber.owners.length > 0)) {
|
|
117
|
+
return fromFiber;
|
|
118
|
+
}
|
|
119
|
+
if (!flightPageFallback)
|
|
120
|
+
return fromFiber;
|
|
121
|
+
return (await enrichmentFromFlightPage(el, { fetchSourceFile })) ?? fromFiber;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=next.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.js","sourceR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e;KAC7B,CAAC,CAAC;IAEH,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE;QAClB,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,EAAE,CAAC,CAAC;QAC1C,IAAI,SAAS,EAAE,SAAS,IAAI,CAAC,SAAS,EAAE,MAAM,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;YAC/E,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,kBAAkB;YAAE,OAAO,SAAS,CAAC;QAC1C,OAAO,CAAC,MAAM,wBAAwB,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC,IAAI,SAAS,CAAC;IAChF,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse Next.js Flight / RSC debug `pagePath` values from inline `__next_f` scripts.
|
|
3
|
+
* Used when the picked DOM node has no client fiber (pure Server Component HTML).
|
|
4
|
+
*/
|
|
5
|
+
/** Collect raw `pagePath` strings from Flight payloads in the document. */
|
|
6
|
+
export declare function parseNextFlightPagePaths(doc?: Document | null): string[];
|
|
7
|
+
/**
|
|
8
|
+
* Whether a Flight `pagePath` (e.g. `[locale]/annonces/[slug]/page.tsx`)
|
|
9
|
+
* matches the browser pathname (`/en/annonces/foo`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function flightPagePathMatchesUrl(pagePath: string, pathname: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Pick the best Flight `pagePath` for the current URL.
|
|
14
|
+
* Prefers a matching `…/page.tsx`, then the longest page path.
|
|
15
|
+
*/
|
|
16
|
+
export declare function pickNextFlightPagePath(paths: readonly string[], pathname?: string): string | undefined;
|
|
17
|
+
/** Turn a Flight pagePath into an app-relative file for open-in-editor. */
|
|
18
|
+
export declare function flightPagePathToAppFile(pagePath: string): string;
|
|
19
|
+
//# sourceMappingURL=nextFlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextFlight.d.ts","sourceRoot":"","sources":["../../../src/source/adapters/nextFlight.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,2EAA2E;AAC3E,wBAAgB,wBAAwB,CACtC,GAAG,GAAE,QAAQ,GAAG,IAAwD,GACvE,MAAM,EAAE,CA0BV;AAMD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAYpF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,GAAE,MAAkE,GAC3E,MAAM,GAAG,SAAS,CAOpB;AAED,2EAA2E;AAC3E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGhE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse Next.js Flight / RSC debug `pagePath` values from inline `__next_f` scripts.
|
|
3
|
+
* Used when the picked DOM node has no client fiber (pure Server Component HTML).
|
|
4
|
+
*/
|
|
5
|
+
/** Escaped JSON inside `self.__next_f.push([1,"…pagePath\":\"…\"…"])`. */
|
|
6
|
+
const PAGE_PATH_ESCAPED_RE = /pagePath\\":\\"([^"\\]+)\\"/g;
|
|
7
|
+
/** Plain JSON (some payloads / tests). */
|
|
8
|
+
const PAGE_PATH_PLAIN_RE = /"pagePath":"([^"]+)"/g;
|
|
9
|
+
/** Collect raw `pagePath` strings from Flight payloads in the document. */
|
|
10
|
+
export function parseNextFlightPagePaths(doc = typeof document !== "undefined" ? document : null) {
|
|
11
|
+
if (!doc)
|
|
12
|
+
return [];
|
|
13
|
+
const found = [];
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
const consider = (raw) => {
|
|
16
|
+
const path = raw.replace(/\\/g, "").trim();
|
|
17
|
+
if (!path || seen.has(path))
|
|
18
|
+
return;
|
|
19
|
+
// Ignore Next internal boundaries.
|
|
20
|
+
if (path.includes("@boundary"))
|
|
21
|
+
return;
|
|
22
|
+
seen.add(path);
|
|
23
|
+
found.push(path);
|
|
24
|
+
};
|
|
25
|
+
for (const script of Array.from(doc.querySelectorAll("script"))) {
|
|
26
|
+
const text = script.textContent ?? "";
|
|
27
|
+
if (!text.includes("pagePath"))
|
|
28
|
+
continue;
|
|
29
|
+
for (const re of [PAGE_PATH_ESCAPED_RE, PAGE_PATH_PLAIN_RE]) {
|
|
30
|
+
re.lastIndex = 0;
|
|
31
|
+
let match;
|
|
32
|
+
while ((match = re.exec(text))) {
|
|
33
|
+
if (match[1])
|
|
34
|
+
consider(match[1]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return found;
|
|
39
|
+
}
|
|
40
|
+
function isPageFile(path) {
|
|
41
|
+
return /\/page\.(tsx|ts|jsx|js)$/.test(path) || /^page\.(tsx|ts|jsx|js)$/.test(path);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether a Flight `pagePath` (e.g. `[locale]/annonces/[slug]/page.tsx`)
|
|
45
|
+
* matches the browser pathname (`/en/annonces/foo`).
|
|
46
|
+
*/
|
|
47
|
+
export function flightPagePathMatchesUrl(pagePath, pathname) {
|
|
48
|
+
const route = pagePath.replace(/\/page\.(tsx|ts|jsx|js)$/, "");
|
|
49
|
+
const routeParts = route.split("/").filter(Boolean);
|
|
50
|
+
const urlParts = pathname.split("/").filter(Boolean);
|
|
51
|
+
if (routeParts.length !== urlParts.length)
|
|
52
|
+
return false;
|
|
53
|
+
for (let i = 0; i < routeParts.length; i += 1) {
|
|
54
|
+
const routeSeg = routeParts[i];
|
|
55
|
+
const urlSeg = urlParts[i];
|
|
56
|
+
if (routeSeg.startsWith("[") && routeSeg.endsWith("]"))
|
|
57
|
+
continue;
|
|
58
|
+
if (routeSeg !== urlSeg)
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Pick the best Flight `pagePath` for the current URL.
|
|
65
|
+
* Prefers a matching `…/page.tsx`, then the longest page path.
|
|
66
|
+
*/
|
|
67
|
+
export function pickNextFlightPagePath(paths, pathname = typeof location !== "undefined" ? location.pathname : "/") {
|
|
68
|
+
const pages = paths.filter(isPageFile);
|
|
69
|
+
if (pages.length === 0)
|
|
70
|
+
return undefined;
|
|
71
|
+
const matching = pages.filter((p) => flightPagePathMatchesUrl(p, pathname));
|
|
72
|
+
const pool = matching.length > 0 ? matching : pages;
|
|
73
|
+
return [...pool].sort((a, b) => b.length - a.length)[0];
|
|
74
|
+
}
|
|
75
|
+
/** Turn a Flight pagePath into an app-relative file for open-in-editor. */
|
|
76
|
+
export function flightPagePathToAppFile(pagePath) {
|
|
77
|
+
const cleaned = pagePath.replace(/^\/+/, "");
|
|
78
|
+
return cleaned.startsWith("app/") ? cleaned : `app/${cleaned}`;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=nextFlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextFlight.js","sourceRoot":"","sources":["../../../src/source/adapters/nextFlight.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAC5D,0CAA0C;AAC1C,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAEnD,2EAA2E;AAC3E,MAAM,UAAU,wBAAwB,CACtC,MAAuB,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;IAExE,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,GAAG,CAAC,OA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CAAC,KAAK,CAAC;IACpD,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,OAAO,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentSourceLocation, ResolveElementSource } from "../../plugins/elementTarget.js";
|
|
2
|
+
export type QwikSourceResolverOptions = {
|
|
3
|
+
/** Override attribute read (tests). */
|
|
4
|
+
getInspectorValue?: (el: Element) => string | null;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Parse `file:line:column` (column optional). Paths may be absolute or repo-relative.
|
|
8
|
+
* Trailing junk after the last `:digits` pair is ignored.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseQwikInspectorValue(raw: string): ComponentSourceLocation | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Qwik DEV enrichment via `data-qwik-inspector` (injected by the Qwik Vite plugin).
|
|
13
|
+
* No framework internals or sourcemaps required — the attribute already holds file:line:col.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createQwikSourceResolver(options?: QwikSourceResolverOptions): ResolveElementSource;
|
|
16
|
+
//# sourceMappingURL=qwik.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qwik.d.ts","sourceRoot":"","sources":["../../../src/source/adapters/qwik.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EAEvB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAKxC,MAAM,MAAM,yBAAyB,GAAG;IACtC,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,MAAM,GAAG,IAAI,CAAC;CACpD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAiBxF;AAMD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,yBAA8B,GACtC,oBAAoB,CAetB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { normalizeSourcePath } from "../sourceMap.js";
|
|
2
|
+
const ATTR = "data-qwik-inspector";
|
|
3
|
+
/**
|
|
4
|
+
* Parse `file:line:column` (column optional). Paths may be absolute or repo-relative.
|
|
5
|
+
* Trailing junk after the last `:digits` pair is ignored.
|
|
6
|
+
*/
|
|
7
|
+
export function parseQwikInspectorValue(raw) {
|
|
8
|
+
const trimmed = raw.trim();
|
|
9
|
+
if (!trimmed || trimmed === "false")
|
|
10
|
+
return undefined;
|
|
11
|
+
// Match …:line:col at end (col optional).
|
|
12
|
+
const match = /^(.*?):(\d+)(?::(\d+))?$/.exec(trimmed);
|
|
13
|
+
if (!match)
|
|
14
|
+
return undefined;
|
|
15
|
+
const file = match[1]?.trim();
|
|
16
|
+
const line = Number(match[2]);
|
|
17
|
+
const column = match[3] != null ? Number(match[3]) : undefined;
|
|
18
|
+
if (!file || !Number.isFinite(line) || line < 1)
|
|
19
|
+
return undefined;
|
|
20
|
+
return {
|
|
21
|
+
fileName: normalizeSourcePath(file),
|
|
22
|
+
line,
|
|
23
|
+
...(column != null && Number.isFinite(column) ? { column } : {}),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function readAttr(el) {
|
|
27
|
+
return el.getAttribute(ATTR);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Qwik DEV enrichment via `data-qwik-inspector` (injected by the Qwik Vite plugin).
|
|
31
|
+
* No framework internals or sourcemaps required — the attribute already holds file:line:col.
|
|
32
|
+
*/
|
|
33
|
+
export function createQwikSourceResolver(options = {}) {
|
|
34
|
+
const getValue = options.getInspectorValue ?? readAttr;
|
|
35
|
+
return async (el) => {
|
|
36
|
+
let current = el;
|
|
37
|
+
for (let i = 0; i < 12 && current; i += 1) {
|
|
38
|
+
const raw = getValue(current);
|
|
39
|
+
if (raw) {
|
|
40
|
+
const component = parseQwikInspectorValue(raw);
|
|
41
|
+
if (component)
|
|
42
|
+
return { component };
|
|
43
|
+
}
|
|
44
|
+
current = current.parentElement;
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=qwik.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qwik.js","sourceRoot":"","sources":["../../../src/source/adapters/qwik.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,IAAI,GAAG,qBAAqB,CAAC;AAOnC;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IAEtD,0CAA0C;IAC1C,MAAM,KAAK,GAAG,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,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ource } from "../../plugins/elementTarget.js";
|
|
2
|
+
type ReactFiber = {
|
|
3
|
+
type?: unknown;
|
|
4
|
+
elementType?: unknown;
|
|
5
|
+
tag?: number;
|
|
6
|
+
return?: ReactFiber | null;
|
|
7
|
+
_debugOwner?: ReactFiber | null;
|
|
8
|
+
_debugStack?: Error | string | null;
|
|
9
|
+
pendingProps?: Record<string, unknown>;
|
|
10
|
+
memoizedProps?: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
export type ReactSourceResolverOptions = {
|
|
13
|
+
/** Max owner frames to attach (default: 5). */
|
|
14
|
+
maxOwners?: number;
|
|
15
|
+
/** Injected fetch (tests). */
|
|
16
|
+
fetchFn?: typeof fetch;
|
|
17
|
+
/**
|
|
18
|
+
* Override fiber lookup (tests). Default reads `__reactFiber$*` on the node.
|
|
19
|
+
*/
|
|
20
|
+
getFiber?: (el: Element) => ReactFiber | null;
|
|
21
|
+
};
|
|
22
|
+
/** Nearest composite fiber for a DOM node (walks `return` from the host fiber). */
|
|
23
|
+
export declare function findCompositeFiber(el: Element, getFiber?: (el: Element) => ReactFiber | null): ReactFiber | null;
|
|
24
|
+
export type ResolveStackLocationOptions = {
|
|
25
|
+
fetchFn?: typeof fetch;
|
|
26
|
+
/**
|
|
27
|
+
* When set, walk stack frames until a mapped source passes this check.
|
|
28
|
+
* Used by the Next adapter to skip jsx-runtime / `node_modules` hits.
|
|
29
|
+
*/
|
|
30
|
+
acceptSource?: (fileName: string) => boolean;
|
|
31
|
+
/** Optional rewrite of the accepted location (path normalization). */
|
|
32
|
+
mapLocation?: (loc: ComponentSourceLocation) => ComponentSourceLocation;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Shared fiber → `_debugStack` → Source Map V3 enrichment.
|
|
36
|
+
* {@link createReactSourceResolver} and {@link createNextSourceResolver} configure
|
|
37
|
+
* frame acceptance / path shaping.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createFiberStackSourceResolver(options?: ReactSourceResolverOptions & ResolveStackLocationOptions): ResolveElementSource;
|
|
40
|
+
/**
|
|
41
|
+
* Best-effort React 19 source enrichment: DOM → fiber → `_debugStack` → Source Map V3.
|
|
42
|
+
* No-ops when fibers / debug stacks are absent (production builds).
|
|
43
|
+
*/
|
|
44
|
+
export declare function createReactSourceResolver(options?: ReactSourceResolverOptions): ResolveElementSource;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/source/adapters/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EAEvB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAQxC,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,UAAU,GAAG,IAAI,CAAC;CAC/C,CAAC;AA8DF,mFAAmF;AACnF,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,OAAO,EACX,QAAQ,GAAE,CAAC,EAAE,EAAE,OAAO,KAAK,UAAU,GAAG,IAAwB,GAC/D,UAAU,GAAG,IAAI,CAOnB;AAeD,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7C,sEAAsE;IACtE,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,uBAAuB,KAAK,uBAAuB,CAAC;CACzE,CAAC;AA4CF;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,0BAA0B,GAAG,2BAAgC,GACrE,oBAAoB,CAyCtB;AAsCD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,0BAA+B,GACvC,oBAAoB,CAEtB"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { isAppFrame, parseStackFrames, resolveOriginalPosition, } from "../sourceMap.js";
|
|
2
|
+
const HOST_COMPONENT_TAGS = new Set([5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
|
|
3
|
+
// React fiber tags: HostComponent=5, HostText=6, … — composites are typically 0,1,2,11(memo) etc.
|
|
4
|
+
// Prefer typeof type === "function" / object over tag numbers for forward-compat.
|
|
5
|
+
function readFiberFromNode(el) {
|
|
6
|
+
const record = el;
|
|
7
|
+
for (const key of Object.keys(record)) {
|
|
8
|
+
if (key.startsWith("__reactFiber$") || key.startsWith("__reactInternalInstance$")) {
|
|
9
|
+
const fiber = record[key];
|
|
10
|
+
return fiber && typeof fiber === "object" ? fiber : null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
function displayNameFromType(type) {
|
|
16
|
+
if (typeof type === "string")
|
|
17
|
+
return type;
|
|
18
|
+
if (typeof type === "function") {
|
|
19
|
+
const fn = type;
|
|
20
|
+
return fn.displayName || fn.name || undefined;
|
|
21
|
+
}
|
|
22
|
+
if (type && typeof type === "object") {
|
|
23
|
+
const obj = type;
|
|
24
|
+
if (obj.displayName)
|
|
25
|
+
return obj.displayName;
|
|
26
|
+
if (obj.name)
|
|
27
|
+
return obj.name;
|
|
28
|
+
if (obj.render) {
|
|
29
|
+
return obj.render.displayName || obj.render.name || undefined;
|
|
30
|
+
}
|
|
31
|
+
// memo / forwardRef wrap
|
|
32
|
+
if ("type" in obj)
|
|
33
|
+
return displayNameFromType(obj.type);
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
function isCompositeFiber(fiber) {
|
|
38
|
+
const type = fiber.type ?? fiber.elementType;
|
|
39
|
+
if (typeof type === "string")
|
|
40
|
+
return false;
|
|
41
|
+
if (typeof type === "function")
|
|
42
|
+
return true;
|
|
43
|
+
if (type && typeof type === "object")
|
|
44
|
+
return true;
|
|
45
|
+
if (typeof fiber.tag === "number" && HOST_COMPONENT_TAGS.has(fiber.tag))
|
|
46
|
+
return false;
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
function fiberName(fiber) {
|
|
50
|
+
return displayNameFromType(fiber.type ?? fiber.elementType);
|
|
51
|
+
}
|
|
52
|
+
function stackFromFiber(fiber) {
|
|
53
|
+
const debug = fiber._debugStack;
|
|
54
|
+
if (!debug)
|
|
55
|
+
return undefined;
|
|
56
|
+
if (typeof debug === "string")
|
|
57
|
+
return debug;
|
|
58
|
+
if (debug instanceof Error && typeof debug.stack === "string")
|
|
59
|
+
return debug.stack;
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
/** Nearest composite fiber for a DOM node (walks `return` from the host fiber). */
|
|
63
|
+
export function findCompositeFiber(el, getFiber = readFiberFromNode) {
|
|
64
|
+
let fiber = getFiber(el);
|
|
65
|
+
while (fiber) {
|
|
66
|
+
if (isCompositeFiber(fiber))
|
|
67
|
+
return fiber;
|
|
68
|
+
fiber = fiber.return ?? null;
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function ownerChain(fiber, maxOwners) {
|
|
73
|
+
const chain = [];
|
|
74
|
+
let current = fiber._debugOwner ?? fiber.return;
|
|
75
|
+
const seen = new Set();
|
|
76
|
+
while (current && chain.length < maxOwners) {
|
|
77
|
+
if (seen.has(current))
|
|
78
|
+
break;
|
|
79
|
+
seen.add(current);
|
|
80
|
+
if (isCompositeFiber(current))
|
|
81
|
+
chain.push(current);
|
|
82
|
+
current = current._debugOwner ?? current.return;
|
|
83
|
+
}
|
|
84
|
+
return chain;
|
|
85
|
+
}
|
|
86
|
+
async function locationFromStack(stack, fallbackName, options = {}) {
|
|
87
|
+
if (!stack)
|
|
88
|
+
return undefined;
|
|
89
|
+
const fetchFn = options.fetchFn ?? fetch;
|
|
90
|
+
const frames = parseStackFrames(stack).filter(isAppFrame);
|
|
91
|
+
if (frames.length === 0)
|
|
92
|
+
return undefined;
|
|
93
|
+
const candidates = options.acceptSource ? frames : frames.slice(0, 1);
|
|
94
|
+
for (const frame of candidates) {
|
|
95
|
+
const original = await resolveOriginalPosition(frame, { fetchFn });
|
|
96
|
+
if (options.acceptSource && !options.acceptSource(original.fileName)) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const loc = {
|
|
100
|
+
fileName: original.fileName,
|
|
101
|
+
line: original.line,
|
|
102
|
+
column: original.column,
|
|
103
|
+
...(original.name || fallbackName || frame.name
|
|
104
|
+
? { name: original.name || fallbackName || frame.name }
|
|
105
|
+
: {}),
|
|
106
|
+
};
|
|
107
|
+
return options.mapLocation ? options.mapLocation(loc) : loc;
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
async function locationFromFiber(fiber, options) {
|
|
112
|
+
const name = fiberName(fiber);
|
|
113
|
+
const fromStack = await locationFromStack(stackFromFiber(fiber), name, options);
|
|
114
|
+
if (fromStack)
|
|
115
|
+
return fromStack;
|
|
116
|
+
// No stack / maps — still useful to surface the component name alone when we
|
|
117
|
+
// cannot invent a file path.
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Shared fiber → `_debugStack` → Source Map V3 enrichment.
|
|
122
|
+
* {@link createReactSourceResolver} and {@link createNextSourceResolver} configure
|
|
123
|
+
* frame acceptance / path shaping.
|
|
124
|
+
*/
|
|
125
|
+
export function createFiberStackSourceResolver(options = {}) {
|
|
126
|
+
const maxOwners = options.maxOwners ?? 5;
|
|
127
|
+
const fetchFn = options.fetchFn ?? fetch;
|
|
128
|
+
const getFiber = options.getFiber ?? readFiberFromNode;
|
|
129
|
+
const stackOpts = {
|
|
130
|
+
fetchFn,
|
|
131
|
+
...(options.acceptSource ? { acceptSource: options.acceptSource } : {}),
|
|
132
|
+
...(options.mapLocation ? { mapLocation: options.mapLocation } : {}),
|
|
133
|
+
};
|
|
134
|
+
return async (el) => {
|
|
135
|
+
const hostFiber = getFiber(el);
|
|
136
|
+
if (!hostFiber)
|
|
137
|
+
return undefined;
|
|
138
|
+
const composite = findCompositeFiber(el, () => hostFiber);
|
|
139
|
+
if (!composite)
|
|
140
|
+
return undefined;
|
|
141
|
+
// Prefer `_debugStack` on the host fiber (and intermediates) before the
|
|
142
|
+
// composite. Next.js client roots hydrated from RSC often lack a useful
|
|
143
|
+
// stack on the composite itself, while the DOM node's jsxDEV stack still
|
|
144
|
+
// points at the JSX site in the parent component file (e.g. Header.tsx).
|
|
145
|
+
let component = await locationFromFiberPath(hostFiber, composite, stackOpts);
|
|
146
|
+
const owners = [];
|
|
147
|
+
for (const owner of ownerChain(composite, maxOwners)) {
|
|
148
|
+
const loc = await locationFromFiber(owner, stackOpts);
|
|
149
|
+
if (loc)
|
|
150
|
+
owners.push(loc);
|
|
151
|
+
}
|
|
152
|
+
// Nearest composite is often a framework wrapper (e.g. Next `LinkStatusContext`).
|
|
153
|
+
// When its stack only maps to package internals, promote the first app owner.
|
|
154
|
+
if (!component && owners.length > 0) {
|
|
155
|
+
component = owners.shift();
|
|
156
|
+
}
|
|
157
|
+
if (!component && owners.length === 0)
|
|
158
|
+
return undefined;
|
|
159
|
+
return {
|
|
160
|
+
...(component ? { component } : {}),
|
|
161
|
+
...(owners.length > 0 ? { owners } : {}),
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Walk host → composite trying each fiber's `_debugStack`.
|
|
167
|
+
* Uses the composite's display name when a host/JSX stack hits.
|
|
168
|
+
*/
|
|
169
|
+
async function locationFromFiberPath(hostFiber, composite, options) {
|
|
170
|
+
const compositeName = fiberName(composite);
|
|
171
|
+
const path = [];
|
|
172
|
+
let current = hostFiber;
|
|
173
|
+
const seen = new Set();
|
|
174
|
+
while (current && !seen.has(current)) {
|
|
175
|
+
seen.add(current);
|
|
176
|
+
path.push(current);
|
|
177
|
+
if (current === composite)
|
|
178
|
+
break;
|
|
179
|
+
current = current.return ?? null;
|
|
180
|
+
}
|
|
181
|
+
if (!path.includes(composite))
|
|
182
|
+
path.push(composite);
|
|
183
|
+
for (const fiber of path) {
|
|
184
|
+
const loc = await locationFromStack(stackFromFiber(fiber), fiberName(fiber) ?? compositeName, options);
|
|
185
|
+
if (!loc)
|
|
186
|
+
continue;
|
|
187
|
+
return {
|
|
188
|
+
...loc,
|
|
189
|
+
...(compositeName || loc.name ? { name: compositeName || loc.name } : {}),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Best-effort React 19 source enrichment: DOM → fiber → `_debugStack` → Source Map V3.
|
|
196
|
+
* No-ops when fibers / debug stacks are absent (production builds).
|
|
197
|
+
*/
|
|
198
|
+
export function createReactSourceResolver(options = {}) {
|
|
199
|
+
return createFiberStackSourceResolver(options);
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/source/adapters/react.ts"],"names":[],"mappings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KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,MAAM,iBAAiB,CACjC,cAAc,CAAC,KAAK,CAAC,EACrB,SAAS,CAAC,KAAK,CAAC,IAAI,aAAa,EACjC,OAAO,CACR,CAAC;QACF,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,OAAO;YACL,GAAG,GAAG;YACN,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1E,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAsC,EAAE;IAExC,OAAO,8BAA8B,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ResolveElementSource } from "../../plugins/elementTarget.js";
|
|
2
|
+
/** Svelte 4/5 DEV compile metadata attached to DOM nodes. */
|
|
3
|
+
type SvelteMeta = {
|
|
4
|
+
loc?: {
|
|
5
|
+
file?: string;
|
|
6
|
+
line?: number;
|
|
7
|
+
column?: number;
|
|
8
|
+
};
|
|
9
|
+
component?: {
|
|
10
|
+
name?: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type SvelteSourceResolverOptions = {
|
|
14
|
+
maxOwners?: number;
|
|
15
|
+
getMeta?: (el: Element) => SvelteMeta | null;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Svelte DEV enrichment via `__svelte_meta` (present when compiled with `dev: true`).
|
|
19
|
+
* File/line often already point at the `.svelte` source — maps are optional.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createSvelteSourceResolver(options?: SvelteSourceResolverOptions): ResolveElementSource;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svelte.d.ts","sourceRoot":"","sources":["../../../src/source/adapters/svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAGxC,6DAA6D;AAC7D,KAAK,UAAU,GAAG;IAChB,GAAG,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,SAAS,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,UAAU,GAAG,IAAI,CAAC;CAC9C,CAAC;AAyCF;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,2BAAgC,GACxC,oBAAoB,CAqBtB"}
|