react-code-locator 0.1.15 → 0.1.17
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 +54 -0
- package/dist/core/transform-cjs.cjs +7014 -0
- package/dist/core/webpackPitchLoader-cjs.cjs +7032 -0
- package/dist/esbuild.cjs +7025 -295
- package/dist/esbuild.cjs.map +1 -1
- package/dist/esbuild.d.cts +38 -6
- package/dist/esbuild.d.ts +38 -6
- package/dist/esbuild.js +7025 -295
- package/dist/esbuild.js.map +1 -1
- package/dist/swc.cjs +7020 -293
- package/dist/swc.cjs.map +1 -1
- package/dist/swc.d.cts +43 -19
- package/dist/swc.d.ts +43 -19
- package/dist/swc.js +7020 -293
- package/dist/swc.js.map +1 -1
- package/dist/transform-CXh-m5Ez.d.cts +12 -0
- package/dist/transform-CXh-m5Ez.d.ts +12 -0
- package/dist/unplugin.cjs +7147 -0
- package/dist/unplugin.cjs.map +1 -0
- package/dist/unplugin.d.cts +41 -0
- package/dist/unplugin.d.ts +41 -0
- package/dist/unplugin.js +7118 -0
- package/dist/unplugin.js.map +1 -0
- package/dist/vite.cjs +7029 -304
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.cts +39 -14
- package/dist/vite.d.ts +39 -14
- package/dist/vite.js +7029 -303
- package/dist/vite.js.map +1 -1
- package/dist/webpack.cjs +85 -61
- package/dist/webpack.cjs.map +1 -1
- package/dist/webpack.d.cts +55 -1
- package/dist/webpack.d.ts +55 -1
- package/dist/webpack.js +51 -71
- package/dist/webpack.js.map +1 -1
- package/dist/webpackLoader.cjs +7115 -0
- package/dist/webpackLoader.cjs.map +1 -0
- package/dist/webpackLoader.d.cts +15 -0
- package/dist/webpackLoader.d.ts +15 -0
- package/dist/webpackLoader.js +7092 -0
- package/dist/webpackLoader.js.map +1 -0
- package/package.json +26 -11
- package/dist/babel.cjs +0 -370
- package/dist/babel.cjs.map +0 -1
- package/dist/babel.d.cts +0 -13
- package/dist/babel.d.ts +0 -13
- package/dist/babel.js +0 -341
- package/dist/babel.js.map +0 -1
- package/dist/babelInjectComponentSource.cjs +0 -342
- package/dist/babelInjectComponentSource.cjs.map +0 -1
- package/dist/babelInjectComponentSource.d.cts +0 -15
- package/dist/babelInjectComponentSource.d.ts +0 -15
- package/dist/babelInjectComponentSource.js +0 -317
- package/dist/babelInjectComponentSource.js.map +0 -1
- package/dist/sourceAdapter-dPr5CgLi.d.cts +0 -14
- package/dist/sourceAdapter-dPr5CgLi.d.ts +0 -14
package/dist/babel.js
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
// src/babelInjectComponentSource.ts
|
|
2
|
-
import { types as t } from "@babel/core";
|
|
3
|
-
|
|
4
|
-
// src/constants.ts
|
|
5
|
-
var SOURCE_PROP = "__componentSourceLoc";
|
|
6
|
-
var JSX_SOURCE_REGISTRY_SYMBOL = "react-code-locator.jsxSourceRegistry";
|
|
7
|
-
|
|
8
|
-
// src/sourceMetadata.ts
|
|
9
|
-
function normalizeSlashes(value) {
|
|
10
|
-
return value.replace(/\\/g, "/");
|
|
11
|
-
}
|
|
12
|
-
function trimTrailingSlash(value) {
|
|
13
|
-
return value.replace(/\/+$/, "");
|
|
14
|
-
}
|
|
15
|
-
function splitPathSegments(value) {
|
|
16
|
-
return normalizeSlashes(value).split("/").filter(Boolean);
|
|
17
|
-
}
|
|
18
|
-
function computeRelativePath(fromPath, toPath) {
|
|
19
|
-
const fromSegments = splitPathSegments(fromPath);
|
|
20
|
-
const toSegments = splitPathSegments(toPath);
|
|
21
|
-
let sharedIndex = 0;
|
|
22
|
-
while (sharedIndex < fromSegments.length && sharedIndex < toSegments.length && fromSegments[sharedIndex] === toSegments[sharedIndex]) {
|
|
23
|
-
sharedIndex += 1;
|
|
24
|
-
}
|
|
25
|
-
const upSegments = new Array(Math.max(0, fromSegments.length - sharedIndex)).fill("..");
|
|
26
|
-
const downSegments = toSegments.slice(sharedIndex);
|
|
27
|
-
const relativeSegments = [...upSegments, ...downSegments];
|
|
28
|
-
return relativeSegments.length > 0 ? relativeSegments.join("/") : ".";
|
|
29
|
-
}
|
|
30
|
-
function normalizeProjectRoot(projectRoot) {
|
|
31
|
-
if (projectRoot) {
|
|
32
|
-
return trimTrailingSlash(normalizeSlashes(projectRoot));
|
|
33
|
-
}
|
|
34
|
-
return "";
|
|
35
|
-
}
|
|
36
|
-
function toRelativeSource(filename, loc, projectRoot) {
|
|
37
|
-
if (!filename || !loc) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
const root = normalizeProjectRoot(projectRoot);
|
|
41
|
-
const normalizedFilename = normalizeSlashes(filename);
|
|
42
|
-
const relPath = root && normalizedFilename.startsWith(`${root}/`) ? normalizedFilename.slice(root.length + 1) : root ? computeRelativePath(root, normalizedFilename) : normalizedFilename;
|
|
43
|
-
return `${relPath}:${loc.line}:${loc.column + 1}`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/babelInjectComponentSource.ts
|
|
47
|
-
function isComponentName(name) {
|
|
48
|
-
return /^[A-Z]/.test(name);
|
|
49
|
-
}
|
|
50
|
-
function isElementFactoryIdentifier(name) {
|
|
51
|
-
return name === "jsx" || name === "jsxs" || name === "jsxDEV" || name === "_jsx" || name === "_jsxs" || name === "_jsxDEV" || name === "createElement";
|
|
52
|
-
}
|
|
53
|
-
function isReactElementFactoryCall(pathNode) {
|
|
54
|
-
const callee = pathNode.node.callee;
|
|
55
|
-
if (t.isIdentifier(callee)) {
|
|
56
|
-
return isElementFactoryIdentifier(callee.name);
|
|
57
|
-
}
|
|
58
|
-
return t.isMemberExpression(callee) && t.isIdentifier(callee.object, { name: "React" }) && t.isIdentifier(callee.property, { name: "createElement" });
|
|
59
|
-
}
|
|
60
|
-
function isSupportedComponentInit(node) {
|
|
61
|
-
if (!node) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
if (t.isArrowFunctionExpression(node) || t.isFunctionExpression(node)) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
if (!t.isCallExpression(node)) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
if (t.isIdentifier(node.callee) && (node.callee.name === "memo" || node.callee.name === "forwardRef")) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
return t.isMemberExpression(node.callee) && t.isIdentifier(node.callee.object, { name: "React" }) && t.isIdentifier(node.callee.property) && (node.callee.property.name === "memo" || node.callee.property.name === "forwardRef");
|
|
74
|
-
}
|
|
75
|
-
function getSourceValue(state, loc, projectRoot) {
|
|
76
|
-
const filename = state.file?.opts?.filename;
|
|
77
|
-
if (!filename || !loc) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return toRelativeSource(filename, loc, projectRoot);
|
|
81
|
-
}
|
|
82
|
-
function buildAssignment(name, sourceValue) {
|
|
83
|
-
return t.expressionStatement(
|
|
84
|
-
t.assignmentExpression(
|
|
85
|
-
"=",
|
|
86
|
-
t.memberExpression(t.identifier(name), t.identifier(SOURCE_PROP)),
|
|
87
|
-
t.stringLiteral(sourceValue)
|
|
88
|
-
)
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
function buildElementSourceHelper() {
|
|
92
|
-
return t.functionDeclaration(
|
|
93
|
-
t.identifier("_markReactElementSource"),
|
|
94
|
-
[t.identifier("element"), t.identifier("source")],
|
|
95
|
-
t.blockStatement([
|
|
96
|
-
t.variableDeclaration("const", [
|
|
97
|
-
t.variableDeclarator(
|
|
98
|
-
t.identifier("registryKey"),
|
|
99
|
-
t.callExpression(
|
|
100
|
-
t.memberExpression(t.identifier("Symbol"), t.identifier("for")),
|
|
101
|
-
[t.stringLiteral(JSX_SOURCE_REGISTRY_SYMBOL)]
|
|
102
|
-
)
|
|
103
|
-
)
|
|
104
|
-
]),
|
|
105
|
-
t.variableDeclaration("let", [
|
|
106
|
-
t.variableDeclarator(
|
|
107
|
-
t.identifier("registry"),
|
|
108
|
-
t.memberExpression(t.identifier("globalThis"), t.identifier("registryKey"), true)
|
|
109
|
-
)
|
|
110
|
-
]),
|
|
111
|
-
t.ifStatement(
|
|
112
|
-
t.unaryExpression(
|
|
113
|
-
"!",
|
|
114
|
-
t.binaryExpression("instanceof", t.identifier("registry"), t.identifier("WeakMap"))
|
|
115
|
-
),
|
|
116
|
-
t.blockStatement([
|
|
117
|
-
t.expressionStatement(
|
|
118
|
-
t.assignmentExpression(
|
|
119
|
-
"=",
|
|
120
|
-
t.identifier("registry"),
|
|
121
|
-
t.assignmentExpression(
|
|
122
|
-
"=",
|
|
123
|
-
t.memberExpression(t.identifier("globalThis"), t.identifier("registryKey"), true),
|
|
124
|
-
t.newExpression(t.identifier("WeakMap"), [])
|
|
125
|
-
)
|
|
126
|
-
)
|
|
127
|
-
)
|
|
128
|
-
])
|
|
129
|
-
),
|
|
130
|
-
t.ifStatement(
|
|
131
|
-
t.logicalExpression(
|
|
132
|
-
"&&",
|
|
133
|
-
t.identifier("element"),
|
|
134
|
-
t.logicalExpression(
|
|
135
|
-
"&&",
|
|
136
|
-
t.binaryExpression("===", t.unaryExpression("typeof", t.identifier("element")), t.stringLiteral("object")),
|
|
137
|
-
t.binaryExpression(
|
|
138
|
-
"===",
|
|
139
|
-
t.unaryExpression("typeof", t.memberExpression(t.identifier("element"), t.identifier("props"))),
|
|
140
|
-
t.stringLiteral("object")
|
|
141
|
-
)
|
|
142
|
-
)
|
|
143
|
-
),
|
|
144
|
-
t.blockStatement([
|
|
145
|
-
t.expressionStatement(
|
|
146
|
-
t.callExpression(
|
|
147
|
-
t.memberExpression(t.identifier("registry"), t.identifier("set")),
|
|
148
|
-
[t.memberExpression(t.identifier("element"), t.identifier("props")), t.identifier("source")]
|
|
149
|
-
)
|
|
150
|
-
)
|
|
151
|
-
])
|
|
152
|
-
),
|
|
153
|
-
t.returnStatement(t.identifier("element"))
|
|
154
|
-
])
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
function ensureElementSourceHelper(programPath, state) {
|
|
158
|
-
if (state.injectedIntrinsicHelper) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const alreadyExists = programPath.node.body.some(
|
|
162
|
-
(node) => t.isFunctionDeclaration(node) && t.isIdentifier(node.id, { name: "_markReactElementSource" })
|
|
163
|
-
);
|
|
164
|
-
if (!alreadyExists) {
|
|
165
|
-
programPath.unshiftContainer("body", buildElementSourceHelper());
|
|
166
|
-
}
|
|
167
|
-
state.injectedIntrinsicHelper = true;
|
|
168
|
-
}
|
|
169
|
-
function visitDeclaration(declarationPath, insertAfterPath, state, seen, projectRoot) {
|
|
170
|
-
if (declarationPath.isFunctionDeclaration() || declarationPath.isClassDeclaration()) {
|
|
171
|
-
const name = declarationPath.node.id?.name;
|
|
172
|
-
if (!name || !isComponentName(name) || seen.has(name)) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
const sourceValue = getSourceValue(
|
|
176
|
-
state,
|
|
177
|
-
declarationPath.node.loc?.start,
|
|
178
|
-
projectRoot
|
|
179
|
-
);
|
|
180
|
-
if (!sourceValue) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
seen.add(name);
|
|
184
|
-
insertAfterPath.insertAfter(buildAssignment(name, sourceValue));
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (!declarationPath.isVariableDeclaration()) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const assignments = declarationPath.node.declarations.flatMap(
|
|
191
|
-
(declarator) => {
|
|
192
|
-
if (!t.isIdentifier(declarator.id) || !isComponentName(declarator.id.name) || seen.has(declarator.id.name)) {
|
|
193
|
-
return [];
|
|
194
|
-
}
|
|
195
|
-
if (!declarator.init) {
|
|
196
|
-
return [];
|
|
197
|
-
}
|
|
198
|
-
if (!isSupportedComponentInit(declarator.init)) {
|
|
199
|
-
return [];
|
|
200
|
-
}
|
|
201
|
-
const sourceValue = getSourceValue(
|
|
202
|
-
state,
|
|
203
|
-
declarator.loc?.start ?? declarator.init.loc?.start,
|
|
204
|
-
projectRoot
|
|
205
|
-
);
|
|
206
|
-
if (!sourceValue) {
|
|
207
|
-
return [];
|
|
208
|
-
}
|
|
209
|
-
seen.add(declarator.id.name);
|
|
210
|
-
return [buildAssignment(declarator.id.name, sourceValue)];
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
if (assignments.length > 0) {
|
|
214
|
-
insertAfterPath.insertAfter(assignments);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function babelInjectComponentSource(options = {}) {
|
|
218
|
-
const {
|
|
219
|
-
injectJsxSource = true,
|
|
220
|
-
injectComponentSource = true,
|
|
221
|
-
projectRoot
|
|
222
|
-
} = options;
|
|
223
|
-
return {
|
|
224
|
-
name: "babel-inject-component-source",
|
|
225
|
-
visitor: {
|
|
226
|
-
CallExpression(pathNode, state) {
|
|
227
|
-
if (!injectJsxSource) {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
if (!isReactElementFactoryCall(pathNode)) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
if (pathNode.parentPath.isCallExpression() && t.isIdentifier(pathNode.parentPath.node.callee, {
|
|
234
|
-
name: "_markReactElementSource"
|
|
235
|
-
})) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
const sourceValue = getSourceValue(
|
|
239
|
-
state,
|
|
240
|
-
pathNode.node.loc?.start,
|
|
241
|
-
projectRoot
|
|
242
|
-
);
|
|
243
|
-
if (!sourceValue) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
const programPath = pathNode.findParent((parent) => parent.isProgram());
|
|
247
|
-
if (!programPath || !programPath.isProgram()) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
ensureElementSourceHelper(programPath, state);
|
|
251
|
-
pathNode.replaceWith(
|
|
252
|
-
t.callExpression(t.identifier("_markReactElementSource"), [
|
|
253
|
-
pathNode.node,
|
|
254
|
-
t.stringLiteral(sourceValue)
|
|
255
|
-
])
|
|
256
|
-
);
|
|
257
|
-
pathNode.skip();
|
|
258
|
-
},
|
|
259
|
-
JSXElement: {
|
|
260
|
-
exit(pathNode, state) {
|
|
261
|
-
if (!injectJsxSource) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
if (pathNode.parentPath.isCallExpression() && t.isIdentifier(pathNode.parentPath.node.callee, { name: "_markReactElementSource" })) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
const sourceValue = getSourceValue(
|
|
268
|
-
state,
|
|
269
|
-
pathNode.node.openingElement.loc?.start,
|
|
270
|
-
projectRoot
|
|
271
|
-
);
|
|
272
|
-
if (!sourceValue) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
const programPath = pathNode.findParent((parent) => parent.isProgram());
|
|
276
|
-
if (!programPath || !programPath.isProgram()) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
ensureElementSourceHelper(programPath, state);
|
|
280
|
-
const wrappedNode = t.callExpression(t.identifier("_markReactElementSource"), [
|
|
281
|
-
pathNode.node,
|
|
282
|
-
t.stringLiteral(sourceValue)
|
|
283
|
-
]);
|
|
284
|
-
if (pathNode.parentPath.isJSXElement() || pathNode.parentPath.isJSXFragment()) {
|
|
285
|
-
pathNode.replaceWith(t.jsxExpressionContainer(wrappedNode));
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
if (pathNode.parentPath.isJSXExpressionContainer()) {
|
|
289
|
-
pathNode.parentPath.replaceWith(t.jsxExpressionContainer(wrappedNode));
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
pathNode.replaceWith(wrappedNode);
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
Program(programPath, state) {
|
|
296
|
-
if (!injectComponentSource) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const seen = /* @__PURE__ */ new Set();
|
|
300
|
-
for (const childPath of programPath.get("body")) {
|
|
301
|
-
if (childPath.isExportNamedDeclaration() || childPath.isExportDefaultDeclaration()) {
|
|
302
|
-
const declarationPath = childPath.get("declaration");
|
|
303
|
-
if (!Array.isArray(declarationPath) && declarationPath.node) {
|
|
304
|
-
visitDeclaration(declarationPath, childPath, state, seen, projectRoot);
|
|
305
|
-
}
|
|
306
|
-
continue;
|
|
307
|
-
}
|
|
308
|
-
visitDeclaration(childPath, childPath, state, seen, projectRoot);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// src/sourceAdapter.ts
|
|
316
|
-
function defineSourceAdapter(descriptor) {
|
|
317
|
-
return descriptor;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// src/babel.ts
|
|
321
|
-
function createBabelSourceAdapter(options = {}) {
|
|
322
|
-
const resolvedOptions = {
|
|
323
|
-
projectRoot: process.cwd(),
|
|
324
|
-
...options
|
|
325
|
-
};
|
|
326
|
-
return defineSourceAdapter({
|
|
327
|
-
kind: "babel",
|
|
328
|
-
name: "react-code-locator/babel",
|
|
329
|
-
options: resolvedOptions,
|
|
330
|
-
config: {
|
|
331
|
-
plugins: [[babelInjectComponentSource, resolvedOptions]]
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
var babelSourceAdapter = createBabelSourceAdapter();
|
|
336
|
-
export {
|
|
337
|
-
babelInjectComponentSource,
|
|
338
|
-
babelSourceAdapter,
|
|
339
|
-
createBabelSourceAdapter
|
|
340
|
-
};
|
|
341
|
-
//# sourceMappingURL=babel.js.map
|
package/dist/babel.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/babelInjectComponentSource.ts","../src/constants.ts","../src/sourceMetadata.ts","../src/sourceAdapter.ts","../src/babel.ts"],"sourcesContent":["import { types as t, type NodePath, type PluginObj } from \"@babel/core\";\nimport { JSX_SOURCE_REGISTRY_SYMBOL, SOURCE_PROP } from \"./constants\";\nimport type { SourceInjectionOptions } from \"./sourceAdapter\";\nimport { toRelativeSource } from \"./sourceMetadata\";\n\nexport type BabelInjectComponentSourceOptions = SourceInjectionOptions;\n\ntype BabelState = {\n file?: {\n opts?: {\n filename?: string;\n };\n };\n injectedIntrinsicHelper?: boolean;\n};\n\nfunction isComponentName(name: string) {\n return /^[A-Z]/.test(name);\n}\n\nfunction isElementFactoryIdentifier(name: string) {\n return (\n name === \"jsx\" ||\n name === \"jsxs\" ||\n name === \"jsxDEV\" ||\n name === \"_jsx\" ||\n name === \"_jsxs\" ||\n name === \"_jsxDEV\" ||\n name === \"createElement\"\n );\n}\n\nfunction isReactElementFactoryCall(pathNode: NodePath<t.CallExpression>) {\n const callee = pathNode.node.callee;\n\n if (t.isIdentifier(callee)) {\n return isElementFactoryIdentifier(callee.name);\n }\n\n return (\n t.isMemberExpression(callee) &&\n t.isIdentifier(callee.object, { name: \"React\" }) &&\n t.isIdentifier(callee.property, { name: \"createElement\" })\n );\n}\n\nfunction isSupportedComponentInit(\n node: t.Expression | null | undefined,\n): boolean {\n if (!node) {\n return false;\n }\n\n if (t.isArrowFunctionExpression(node) || t.isFunctionExpression(node)) {\n return true;\n }\n\n if (!t.isCallExpression(node)) {\n return false;\n }\n\n if (\n t.isIdentifier(node.callee) &&\n (node.callee.name === \"memo\" || node.callee.name === \"forwardRef\")\n ) {\n return true;\n }\n\n return (\n t.isMemberExpression(node.callee) &&\n t.isIdentifier(node.callee.object, { name: \"React\" }) &&\n t.isIdentifier(node.callee.property) &&\n (node.callee.property.name === \"memo\" ||\n node.callee.property.name === \"forwardRef\")\n );\n}\n\nfunction getSourceValue(\n state: BabelState,\n loc: { line: number; column: number } | null | undefined,\n projectRoot?: string,\n) {\n const filename = state.file?.opts?.filename;\n if (!filename || !loc) {\n return null;\n }\n\n return toRelativeSource(filename, loc, projectRoot);\n}\n\nfunction buildAssignment(name: string, sourceValue: string) {\n return t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.identifier(name), t.identifier(SOURCE_PROP)),\n t.stringLiteral(sourceValue),\n ),\n );\n}\n\nfunction buildElementSourceHelper() {\n return t.functionDeclaration(\n t.identifier(\"_markReactElementSource\"),\n [t.identifier(\"element\"), t.identifier(\"source\")],\n t.blockStatement([\n t.variableDeclaration(\"const\", [\n t.variableDeclarator(\n t.identifier(\"registryKey\"),\n t.callExpression(\n t.memberExpression(t.identifier(\"Symbol\"), t.identifier(\"for\")),\n [t.stringLiteral(JSX_SOURCE_REGISTRY_SYMBOL)],\n ),\n ),\n ]),\n t.variableDeclaration(\"let\", [\n t.variableDeclarator(\n t.identifier(\"registry\"),\n t.memberExpression(t.identifier(\"globalThis\"), t.identifier(\"registryKey\"), true),\n ),\n ]),\n t.ifStatement(\n t.unaryExpression(\n \"!\",\n t.binaryExpression(\"instanceof\", t.identifier(\"registry\"), t.identifier(\"WeakMap\")),\n ),\n t.blockStatement([\n t.expressionStatement(\n t.assignmentExpression(\n \"=\",\n t.identifier(\"registry\"),\n t.assignmentExpression(\n \"=\",\n t.memberExpression(t.identifier(\"globalThis\"), t.identifier(\"registryKey\"), true),\n t.newExpression(t.identifier(\"WeakMap\"), []),\n ),\n ),\n ),\n ]),\n ),\n t.ifStatement(\n t.logicalExpression(\n \"&&\",\n t.identifier(\"element\"),\n t.logicalExpression(\n \"&&\",\n t.binaryExpression(\"===\", t.unaryExpression(\"typeof\", t.identifier(\"element\")), t.stringLiteral(\"object\")),\n t.binaryExpression(\n \"===\",\n t.unaryExpression(\"typeof\", t.memberExpression(t.identifier(\"element\"), t.identifier(\"props\"))),\n t.stringLiteral(\"object\"),\n ),\n ),\n ),\n t.blockStatement([\n t.expressionStatement(\n t.callExpression(\n t.memberExpression(t.identifier(\"registry\"), t.identifier(\"set\")),\n [t.memberExpression(t.identifier(\"element\"), t.identifier(\"props\")), t.identifier(\"source\")],\n ),\n ),\n ]),\n ),\n t.returnStatement(t.identifier(\"element\")),\n ]),\n );\n}\n\nfunction ensureElementSourceHelper(programPath: NodePath<t.Program>, state: BabelState) {\n if (state.injectedIntrinsicHelper) {\n return;\n }\n\n const alreadyExists = programPath.node.body.some(\n (node: t.Statement) =>\n t.isFunctionDeclaration(node) && t.isIdentifier(node.id, { name: \"_markReactElementSource\" }),\n );\n if (!alreadyExists) {\n programPath.unshiftContainer(\"body\", buildElementSourceHelper());\n }\n\n state.injectedIntrinsicHelper = true;\n}\n\nfunction visitDeclaration(\n declarationPath: NodePath,\n insertAfterPath: NodePath,\n state: BabelState,\n seen: Set<string>,\n projectRoot?: string,\n) {\n if (\n declarationPath.isFunctionDeclaration() ||\n declarationPath.isClassDeclaration()\n ) {\n const name = declarationPath.node.id?.name;\n if (!name || !isComponentName(name) || seen.has(name)) {\n return;\n }\n\n const sourceValue = getSourceValue(\n state,\n declarationPath.node.loc?.start,\n projectRoot,\n );\n if (!sourceValue) {\n return;\n }\n\n seen.add(name);\n insertAfterPath.insertAfter(buildAssignment(name, sourceValue));\n return;\n }\n\n if (!declarationPath.isVariableDeclaration()) {\n return;\n }\n\n const assignments = declarationPath.node.declarations.flatMap(\n (declarator: t.VariableDeclarator) => {\n if (\n !t.isIdentifier(declarator.id) ||\n !isComponentName(declarator.id.name) ||\n seen.has(declarator.id.name)\n ) {\n return [];\n }\n\n if (!declarator.init) {\n return [];\n }\n\n if (!isSupportedComponentInit(declarator.init)) {\n return [];\n }\n\n const sourceValue = getSourceValue(\n state,\n declarator.loc?.start ?? declarator.init.loc?.start,\n projectRoot,\n );\n if (!sourceValue) {\n return [];\n }\n\n seen.add(declarator.id.name);\n return [buildAssignment(declarator.id.name, sourceValue)];\n },\n );\n\n if (assignments.length > 0) {\n insertAfterPath.insertAfter(assignments);\n }\n}\n\nexport function babelInjectComponentSource(\n options: BabelInjectComponentSourceOptions = {},\n): PluginObj<BabelState> {\n const {\n injectJsxSource = true,\n injectComponentSource = true,\n projectRoot,\n } = options;\n\n return {\n name: \"babel-inject-component-source\",\n visitor: {\n CallExpression(pathNode: NodePath<t.CallExpression>, state: BabelState) {\n if (!injectJsxSource) {\n return;\n }\n\n if (!isReactElementFactoryCall(pathNode)) {\n return;\n }\n\n if (\n pathNode.parentPath.isCallExpression() &&\n t.isIdentifier(pathNode.parentPath.node.callee, {\n name: \"_markReactElementSource\",\n })\n ) {\n return;\n }\n\n const sourceValue = getSourceValue(\n state,\n pathNode.node.loc?.start,\n projectRoot,\n );\n if (!sourceValue) {\n return;\n }\n\n const programPath = pathNode.findParent((parent: NodePath) => parent.isProgram());\n if (!programPath || !programPath.isProgram()) {\n return;\n }\n\n ensureElementSourceHelper(programPath, state);\n pathNode.replaceWith(\n t.callExpression(t.identifier(\"_markReactElementSource\"), [\n pathNode.node,\n t.stringLiteral(sourceValue),\n ]),\n );\n pathNode.skip();\n },\n JSXElement: {\n exit(pathNode: NodePath<t.JSXElement>, state: BabelState) {\n if (!injectJsxSource) {\n return;\n }\n\n if (\n pathNode.parentPath.isCallExpression() &&\n t.isIdentifier(pathNode.parentPath.node.callee, { name: \"_markReactElementSource\" })\n ) {\n return;\n }\n\n const sourceValue = getSourceValue(\n state,\n pathNode.node.openingElement.loc?.start,\n projectRoot,\n );\n if (!sourceValue) {\n return;\n }\n\n const programPath = pathNode.findParent((parent: NodePath) => parent.isProgram());\n if (!programPath || !programPath.isProgram()) {\n return;\n }\n\n ensureElementSourceHelper(programPath, state);\n\n const wrappedNode = t.callExpression(t.identifier(\"_markReactElementSource\"), [\n pathNode.node,\n t.stringLiteral(sourceValue),\n ]);\n\n if (pathNode.parentPath.isJSXElement() || pathNode.parentPath.isJSXFragment()) {\n pathNode.replaceWith(t.jsxExpressionContainer(wrappedNode));\n return;\n }\n\n if (pathNode.parentPath.isJSXExpressionContainer()) {\n pathNode.parentPath.replaceWith(t.jsxExpressionContainer(wrappedNode));\n return;\n }\n\n pathNode.replaceWith(wrappedNode);\n },\n },\n Program(programPath: NodePath<t.Program>, state: BabelState) {\n if (!injectComponentSource) {\n return;\n }\n\n const seen = new Set<string>();\n\n for (const childPath of programPath.get(\"body\")) {\n if (\n childPath.isExportNamedDeclaration() ||\n childPath.isExportDefaultDeclaration()\n ) {\n const declarationPath = childPath.get(\"declaration\");\n if (!Array.isArray(declarationPath) && declarationPath.node) {\n visitDeclaration(declarationPath, childPath, state, seen, projectRoot);\n }\n continue;\n }\n\n visitDeclaration(childPath, childPath, state, seen, projectRoot);\n }\n },\n },\n };\n}\n","export const SOURCE_PROP = \"__componentSourceLoc\";\nexport const JSX_SOURCE_PROP = \"$componentSourceLoc\";\nexport const JSX_SOURCE_REGISTRY_SYMBOL = \"react-code-locator.jsxSourceRegistry\";\n","export type SourceLocation = {\n line: number;\n column: number;\n};\n\nfunction normalizeSlashes(value: string) {\n return value.replace(/\\\\/g, \"/\");\n}\n\nfunction trimTrailingSlash(value: string) {\n return value.replace(/\\/+$/, \"\");\n}\n\nfunction splitPathSegments(value: string) {\n return normalizeSlashes(value).split(\"/\").filter(Boolean);\n}\n\nfunction computeRelativePath(fromPath: string, toPath: string) {\n const fromSegments = splitPathSegments(fromPath);\n const toSegments = splitPathSegments(toPath);\n\n let sharedIndex = 0;\n while (\n sharedIndex < fromSegments.length &&\n sharedIndex < toSegments.length &&\n fromSegments[sharedIndex] === toSegments[sharedIndex]\n ) {\n sharedIndex += 1;\n }\n\n const upSegments = new Array(Math.max(0, fromSegments.length - sharedIndex)).fill(\"..\");\n const downSegments = toSegments.slice(sharedIndex);\n const relativeSegments = [...upSegments, ...downSegments];\n return relativeSegments.length > 0 ? relativeSegments.join(\"/\") : \".\";\n}\n\nexport function normalizeProjectRoot(projectRoot?: string) {\n if (projectRoot) {\n return trimTrailingSlash(normalizeSlashes(projectRoot));\n }\n return \"\";\n}\n\nexport function toRelativeSource(\n filename: string | undefined,\n loc: SourceLocation | null | undefined,\n projectRoot?: string,\n) {\n if (!filename || !loc) {\n return null;\n }\n\n const root = normalizeProjectRoot(projectRoot);\n const normalizedFilename = normalizeSlashes(filename);\n const relPath =\n root && normalizedFilename.startsWith(`${root}/`)\n ? normalizedFilename.slice(root.length + 1)\n : root\n ? computeRelativePath(root, normalizedFilename)\n : normalizedFilename;\n return `${relPath}:${loc.line}:${loc.column + 1}`;\n}\n\nexport function getSourceFile(source: string | null) {\n if (!source) {\n return null;\n }\n\n const match = source.match(/^(.*):\\d+:\\d+$/);\n return match?.[1] ?? null;\n}\n\nexport function isProjectLocalFile(filename: string | undefined, projectRoot?: string) {\n if (!filename) {\n return false;\n }\n\n const root = normalizeProjectRoot(projectRoot);\n const normalizedFilename = normalizeSlashes(filename);\n\n if (!root) {\n return (\n !normalizedFilename.startsWith(\"../\") &&\n !normalizedFilename.startsWith(\"/\") &&\n !/^[A-Za-z]:\\//.test(normalizedFilename)\n );\n }\n\n if (normalizedFilename.startsWith(`${root}/`) || normalizedFilename === root) {\n return true;\n }\n\n const relativePath = computeRelativePath(root, normalizedFilename);\n return !relativePath.startsWith(\"../\");\n}\n\nexport function isExternalToProjectRoot(filename: string | undefined, projectRoot?: string) {\n return !isProjectLocalFile(filename, projectRoot);\n}\n\nexport function isProjectLocalSource(source: string, projectRoot?: string) {\n const file = getSourceFile(source);\n return isProjectLocalFile(file ?? undefined, projectRoot);\n}\n","export type SourceInjectionOptions = {\n injectJsxSource?: boolean;\n injectComponentSource?: boolean;\n projectRoot?: string;\n};\n\nexport type SourceAdapterKind = \"babel\" | \"vite\" | \"esbuild\" | \"swc\";\n\nexport type SourceAdapterDescriptor<TConfig = unknown, TOptions = SourceInjectionOptions> = {\n kind: SourceAdapterKind;\n name: string;\n options: TOptions;\n config: TConfig;\n};\n\nexport function defineSourceAdapter<TConfig = unknown, TOptions = SourceInjectionOptions>(\n descriptor: SourceAdapterDescriptor<TConfig, TOptions>,\n) {\n return descriptor;\n}\n","import { babelInjectComponentSource, type BabelInjectComponentSourceOptions } from \"./babelInjectComponentSource\";\nimport { defineSourceAdapter } from \"./sourceAdapter\";\n\nexport type BabelSourceAdapterConfig = {\n plugins: Array<[typeof babelInjectComponentSource, BabelInjectComponentSourceOptions]>;\n};\n\nexport { babelInjectComponentSource } from \"./babelInjectComponentSource\";\nexport type { BabelInjectComponentSourceOptions } from \"./babelInjectComponentSource\";\nexport type { SourceAdapterDescriptor, SourceAdapterKind, SourceInjectionOptions } from \"./sourceAdapter\";\n\nexport function createBabelSourceAdapter(options: BabelInjectComponentSourceOptions = {}) {\n const resolvedOptions = {\n projectRoot: process.cwd(),\n ...options,\n };\n\n return defineSourceAdapter<BabelSourceAdapterConfig, BabelInjectComponentSourceOptions>({\n kind: \"babel\",\n name: \"react-code-locator/babel\",\n options: resolvedOptions,\n config: {\n plugins: [[babelInjectComponentSource, resolvedOptions]],\n },\n });\n}\n\nexport const babelSourceAdapter = createBabelSourceAdapter();\n"],"mappings":";AAAA,SAAS,SAAS,SAAwC;;;ACAnD,IAAM,cAAc;AAEpB,IAAM,6BAA6B;;;ACG1C,SAAS,iBAAiB,OAAe;AACvC,SAAO,MAAM,QAAQ,OAAO,GAAG;AACjC;AAEA,SAAS,kBAAkB,OAAe;AACxC,SAAO,MAAM,QAAQ,QAAQ,EAAE;AACjC;AAEA,SAAS,kBAAkB,OAAe;AACxC,SAAO,iBAAiB,KAAK,EAAE,MAAM,GAAG,EAAE,OAAO,OAAO;AAC1D;AAEA,SAAS,oBAAoB,UAAkB,QAAgB;AAC7D,QAAM,eAAe,kBAAkB,QAAQ;AAC/C,QAAM,aAAa,kBAAkB,MAAM;AAE3C,MAAI,cAAc;AAClB,SACE,cAAc,aAAa,UAC3B,cAAc,WAAW,UACzB,aAAa,WAAW,MAAM,WAAW,WAAW,GACpD;AACA,mBAAe;AAAA,EACjB;AAEA,QAAM,aAAa,IAAI,MAAM,KAAK,IAAI,GAAG,aAAa,SAAS,WAAW,CAAC,EAAE,KAAK,IAAI;AACtF,QAAM,eAAe,WAAW,MAAM,WAAW;AACjD,QAAM,mBAAmB,CAAC,GAAG,YAAY,GAAG,YAAY;AACxD,SAAO,iBAAiB,SAAS,IAAI,iBAAiB,KAAK,GAAG,IAAI;AACpE;AAEO,SAAS,qBAAqB,aA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