react-code-locator 0.1.16 → 0.1.18
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 -279
- 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/index.cjs +7132 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7126 -15
- package/dist/index.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 +6850 -8
- package/dist/unplugin.cjs.map +1 -1
- package/dist/unplugin.d.cts +4 -13
- package/dist/unplugin.d.ts +4 -13
- package/dist/unplugin.js +6848 -6
- package/dist/unplugin.js.map +1 -1
- 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/package.json +5 -51
- 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/webpack.cjs +0 -68
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.d.cts +0 -2
- package/dist/webpack.d.ts +0 -2
- package/dist/webpack.js +0 -82
- package/dist/webpack.js.map +0 -1
- package/dist/webpackRuntimeEntry.cjs +0 -375
- package/dist/webpackRuntimeEntry.cjs.map +0 -1
- package/dist/webpackRuntimeEntry.d.cts +0 -2
- package/dist/webpackRuntimeEntry.d.ts +0 -2
- package/dist/webpackRuntimeEntry.js +0 -373
- package/dist/webpackRuntimeEntry.js.map +0 -1
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/babelInjectComponentSource.ts
|
|
21
|
-
var babelInjectComponentSource_exports = {};
|
|
22
|
-
__export(babelInjectComponentSource_exports, {
|
|
23
|
-
babelInjectComponentSource: () => babelInjectComponentSource
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(babelInjectComponentSource_exports);
|
|
26
|
-
var import_core = require("@babel/core");
|
|
27
|
-
|
|
28
|
-
// src/constants.ts
|
|
29
|
-
var SOURCE_PROP = "__componentSourceLoc";
|
|
30
|
-
var JSX_SOURCE_REGISTRY_SYMBOL = "react-code-locator.jsxSourceRegistry";
|
|
31
|
-
|
|
32
|
-
// src/sourceMetadata.ts
|
|
33
|
-
function normalizeSlashes(value) {
|
|
34
|
-
return value.replace(/\\/g, "/");
|
|
35
|
-
}
|
|
36
|
-
function trimTrailingSlash(value) {
|
|
37
|
-
return value.replace(/\/+$/, "");
|
|
38
|
-
}
|
|
39
|
-
function splitPathSegments(value) {
|
|
40
|
-
return normalizeSlashes(value).split("/").filter(Boolean);
|
|
41
|
-
}
|
|
42
|
-
function computeRelativePath(fromPath, toPath) {
|
|
43
|
-
const fromSegments = splitPathSegments(fromPath);
|
|
44
|
-
const toSegments = splitPathSegments(toPath);
|
|
45
|
-
let sharedIndex = 0;
|
|
46
|
-
while (sharedIndex < fromSegments.length && sharedIndex < toSegments.length && fromSegments[sharedIndex] === toSegments[sharedIndex]) {
|
|
47
|
-
sharedIndex += 1;
|
|
48
|
-
}
|
|
49
|
-
const upSegments = new Array(Math.max(0, fromSegments.length - sharedIndex)).fill("..");
|
|
50
|
-
const downSegments = toSegments.slice(sharedIndex);
|
|
51
|
-
const relativeSegments = [...upSegments, ...downSegments];
|
|
52
|
-
return relativeSegments.length > 0 ? relativeSegments.join("/") : ".";
|
|
53
|
-
}
|
|
54
|
-
function normalizeProjectRoot(projectRoot) {
|
|
55
|
-
if (projectRoot) {
|
|
56
|
-
return trimTrailingSlash(normalizeSlashes(projectRoot));
|
|
57
|
-
}
|
|
58
|
-
return "";
|
|
59
|
-
}
|
|
60
|
-
function toRelativeSource(filename, loc, projectRoot) {
|
|
61
|
-
if (!filename || !loc) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
const root = normalizeProjectRoot(projectRoot);
|
|
65
|
-
const normalizedFilename = normalizeSlashes(filename);
|
|
66
|
-
const relPath = root && normalizedFilename.startsWith(`${root}/`) ? normalizedFilename.slice(root.length + 1) : root ? computeRelativePath(root, normalizedFilename) : normalizedFilename;
|
|
67
|
-
return `${relPath}:${loc.line}:${loc.column + 1}`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/babelInjectComponentSource.ts
|
|
71
|
-
function isComponentName(name) {
|
|
72
|
-
return /^[A-Z]/.test(name);
|
|
73
|
-
}
|
|
74
|
-
function isElementFactoryIdentifier(name) {
|
|
75
|
-
return name === "jsx" || name === "jsxs" || name === "jsxDEV" || name === "_jsx" || name === "_jsxs" || name === "_jsxDEV" || name === "createElement";
|
|
76
|
-
}
|
|
77
|
-
function isReactElementFactoryCall(pathNode) {
|
|
78
|
-
const callee = pathNode.node.callee;
|
|
79
|
-
if (import_core.types.isIdentifier(callee)) {
|
|
80
|
-
return isElementFactoryIdentifier(callee.name);
|
|
81
|
-
}
|
|
82
|
-
return import_core.types.isMemberExpression(callee) && import_core.types.isIdentifier(callee.object, { name: "React" }) && import_core.types.isIdentifier(callee.property, { name: "createElement" });
|
|
83
|
-
}
|
|
84
|
-
function isSupportedComponentInit(node) {
|
|
85
|
-
if (!node) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
if (import_core.types.isArrowFunctionExpression(node) || import_core.types.isFunctionExpression(node)) {
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
if (!import_core.types.isCallExpression(node)) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
if (import_core.types.isIdentifier(node.callee) && (node.callee.name === "memo" || node.callee.name === "forwardRef")) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
return import_core.types.isMemberExpression(node.callee) && import_core.types.isIdentifier(node.callee.object, { name: "React" }) && import_core.types.isIdentifier(node.callee.property) && (node.callee.property.name === "memo" || node.callee.property.name === "forwardRef");
|
|
98
|
-
}
|
|
99
|
-
function getSourceValue(state, loc, projectRoot) {
|
|
100
|
-
const filename = state.file?.opts?.filename;
|
|
101
|
-
if (!filename || !loc) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
return toRelativeSource(filename, loc, projectRoot);
|
|
105
|
-
}
|
|
106
|
-
function buildAssignment(name, sourceValue) {
|
|
107
|
-
return import_core.types.expressionStatement(
|
|
108
|
-
import_core.types.assignmentExpression(
|
|
109
|
-
"=",
|
|
110
|
-
import_core.types.memberExpression(import_core.types.identifier(name), import_core.types.identifier(SOURCE_PROP)),
|
|
111
|
-
import_core.types.stringLiteral(sourceValue)
|
|
112
|
-
)
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
function buildElementSourceHelper() {
|
|
116
|
-
return import_core.types.functionDeclaration(
|
|
117
|
-
import_core.types.identifier("_markReactElementSource"),
|
|
118
|
-
[import_core.types.identifier("element"), import_core.types.identifier("source")],
|
|
119
|
-
import_core.types.blockStatement([
|
|
120
|
-
import_core.types.variableDeclaration("const", [
|
|
121
|
-
import_core.types.variableDeclarator(
|
|
122
|
-
import_core.types.identifier("registryKey"),
|
|
123
|
-
import_core.types.callExpression(
|
|
124
|
-
import_core.types.memberExpression(import_core.types.identifier("Symbol"), import_core.types.identifier("for")),
|
|
125
|
-
[import_core.types.stringLiteral(JSX_SOURCE_REGISTRY_SYMBOL)]
|
|
126
|
-
)
|
|
127
|
-
)
|
|
128
|
-
]),
|
|
129
|
-
import_core.types.variableDeclaration("let", [
|
|
130
|
-
import_core.types.variableDeclarator(
|
|
131
|
-
import_core.types.identifier("registry"),
|
|
132
|
-
import_core.types.memberExpression(import_core.types.identifier("globalThis"), import_core.types.identifier("registryKey"), true)
|
|
133
|
-
)
|
|
134
|
-
]),
|
|
135
|
-
import_core.types.ifStatement(
|
|
136
|
-
import_core.types.unaryExpression(
|
|
137
|
-
"!",
|
|
138
|
-
import_core.types.binaryExpression("instanceof", import_core.types.identifier("registry"), import_core.types.identifier("WeakMap"))
|
|
139
|
-
),
|
|
140
|
-
import_core.types.blockStatement([
|
|
141
|
-
import_core.types.expressionStatement(
|
|
142
|
-
import_core.types.assignmentExpression(
|
|
143
|
-
"=",
|
|
144
|
-
import_core.types.identifier("registry"),
|
|
145
|
-
import_core.types.assignmentExpression(
|
|
146
|
-
"=",
|
|
147
|
-
import_core.types.memberExpression(import_core.types.identifier("globalThis"), import_core.types.identifier("registryKey"), true),
|
|
148
|
-
import_core.types.newExpression(import_core.types.identifier("WeakMap"), [])
|
|
149
|
-
)
|
|
150
|
-
)
|
|
151
|
-
)
|
|
152
|
-
])
|
|
153
|
-
),
|
|
154
|
-
import_core.types.ifStatement(
|
|
155
|
-
import_core.types.logicalExpression(
|
|
156
|
-
"&&",
|
|
157
|
-
import_core.types.identifier("element"),
|
|
158
|
-
import_core.types.logicalExpression(
|
|
159
|
-
"&&",
|
|
160
|
-
import_core.types.binaryExpression("===", import_core.types.unaryExpression("typeof", import_core.types.identifier("element")), import_core.types.stringLiteral("object")),
|
|
161
|
-
import_core.types.binaryExpression(
|
|
162
|
-
"===",
|
|
163
|
-
import_core.types.unaryExpression("typeof", import_core.types.memberExpression(import_core.types.identifier("element"), import_core.types.identifier("props"))),
|
|
164
|
-
import_core.types.stringLiteral("object")
|
|
165
|
-
)
|
|
166
|
-
)
|
|
167
|
-
),
|
|
168
|
-
import_core.types.blockStatement([
|
|
169
|
-
import_core.types.expressionStatement(
|
|
170
|
-
import_core.types.callExpression(
|
|
171
|
-
import_core.types.memberExpression(import_core.types.identifier("registry"), import_core.types.identifier("set")),
|
|
172
|
-
[import_core.types.memberExpression(import_core.types.identifier("element"), import_core.types.identifier("props")), import_core.types.identifier("source")]
|
|
173
|
-
)
|
|
174
|
-
)
|
|
175
|
-
])
|
|
176
|
-
),
|
|
177
|
-
import_core.types.returnStatement(import_core.types.identifier("element"))
|
|
178
|
-
])
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
function ensureElementSourceHelper(programPath, state) {
|
|
182
|
-
if (state.injectedIntrinsicHelper) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const alreadyExists = programPath.node.body.some(
|
|
186
|
-
(node) => import_core.types.isFunctionDeclaration(node) && import_core.types.isIdentifier(node.id, { name: "_markReactElementSource" })
|
|
187
|
-
);
|
|
188
|
-
if (!alreadyExists) {
|
|
189
|
-
programPath.unshiftContainer("body", buildElementSourceHelper());
|
|
190
|
-
}
|
|
191
|
-
state.injectedIntrinsicHelper = true;
|
|
192
|
-
}
|
|
193
|
-
function visitDeclaration(declarationPath, insertAfterPath, state, seen, projectRoot) {
|
|
194
|
-
if (declarationPath.isFunctionDeclaration() || declarationPath.isClassDeclaration()) {
|
|
195
|
-
const name = declarationPath.node.id?.name;
|
|
196
|
-
if (!name || !isComponentName(name) || seen.has(name)) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const sourceValue = getSourceValue(
|
|
200
|
-
state,
|
|
201
|
-
declarationPath.node.loc?.start,
|
|
202
|
-
projectRoot
|
|
203
|
-
);
|
|
204
|
-
if (!sourceValue) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
seen.add(name);
|
|
208
|
-
insertAfterPath.insertAfter(buildAssignment(name, sourceValue));
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (!declarationPath.isVariableDeclaration()) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const assignments = declarationPath.node.declarations.flatMap(
|
|
215
|
-
(declarator) => {
|
|
216
|
-
if (!import_core.types.isIdentifier(declarator.id) || !isComponentName(declarator.id.name) || seen.has(declarator.id.name)) {
|
|
217
|
-
return [];
|
|
218
|
-
}
|
|
219
|
-
if (!declarator.init) {
|
|
220
|
-
return [];
|
|
221
|
-
}
|
|
222
|
-
if (!isSupportedComponentInit(declarator.init)) {
|
|
223
|
-
return [];
|
|
224
|
-
}
|
|
225
|
-
const sourceValue = getSourceValue(
|
|
226
|
-
state,
|
|
227
|
-
declarator.loc?.start ?? declarator.init.loc?.start,
|
|
228
|
-
projectRoot
|
|
229
|
-
);
|
|
230
|
-
if (!sourceValue) {
|
|
231
|
-
return [];
|
|
232
|
-
}
|
|
233
|
-
seen.add(declarator.id.name);
|
|
234
|
-
return [buildAssignment(declarator.id.name, sourceValue)];
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
if (assignments.length > 0) {
|
|
238
|
-
insertAfterPath.insertAfter(assignments);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
function babelInjectComponentSource(options = {}) {
|
|
242
|
-
const {
|
|
243
|
-
injectJsxSource = true,
|
|
244
|
-
injectComponentSource = true,
|
|
245
|
-
projectRoot
|
|
246
|
-
} = options;
|
|
247
|
-
return {
|
|
248
|
-
name: "babel-inject-component-source",
|
|
249
|
-
visitor: {
|
|
250
|
-
CallExpression(pathNode, state) {
|
|
251
|
-
if (!injectJsxSource) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
if (!isReactElementFactoryCall(pathNode)) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (pathNode.parentPath.isCallExpression() && import_core.types.isIdentifier(pathNode.parentPath.node.callee, {
|
|
258
|
-
name: "_markReactElementSource"
|
|
259
|
-
})) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
const sourceValue = getSourceValue(
|
|
263
|
-
state,
|
|
264
|
-
pathNode.node.loc?.start,
|
|
265
|
-
projectRoot
|
|
266
|
-
);
|
|
267
|
-
if (!sourceValue) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
const programPath = pathNode.findParent((parent) => parent.isProgram());
|
|
271
|
-
if (!programPath || !programPath.isProgram()) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
ensureElementSourceHelper(programPath, state);
|
|
275
|
-
pathNode.replaceWith(
|
|
276
|
-
import_core.types.callExpression(import_core.types.identifier("_markReactElementSource"), [
|
|
277
|
-
pathNode.node,
|
|
278
|
-
import_core.types.stringLiteral(sourceValue)
|
|
279
|
-
])
|
|
280
|
-
);
|
|
281
|
-
pathNode.skip();
|
|
282
|
-
},
|
|
283
|
-
JSXElement: {
|
|
284
|
-
exit(pathNode, state) {
|
|
285
|
-
if (!injectJsxSource) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
if (pathNode.parentPath.isCallExpression() && import_core.types.isIdentifier(pathNode.parentPath.node.callee, { name: "_markReactElementSource" })) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
const sourceValue = getSourceValue(
|
|
292
|
-
state,
|
|
293
|
-
pathNode.node.openingElement.loc?.start,
|
|
294
|
-
projectRoot
|
|
295
|
-
);
|
|
296
|
-
if (!sourceValue) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const programPath = pathNode.findParent((parent) => parent.isProgram());
|
|
300
|
-
if (!programPath || !programPath.isProgram()) {
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
ensureElementSourceHelper(programPath, state);
|
|
304
|
-
const wrappedNode = import_core.types.callExpression(import_core.types.identifier("_markReactElementSource"), [
|
|
305
|
-
pathNode.node,
|
|
306
|
-
import_core.types.stringLiteral(sourceValue)
|
|
307
|
-
]);
|
|
308
|
-
if (pathNode.parentPath.isJSXElement() || pathNode.parentPath.isJSXFragment()) {
|
|
309
|
-
pathNode.replaceWith(import_core.types.jsxExpressionContainer(wrappedNode));
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
if (pathNode.parentPath.isJSXExpressionContainer()) {
|
|
313
|
-
pathNode.parentPath.replaceWith(import_core.types.jsxExpressionContainer(wrappedNode));
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
pathNode.replaceWith(wrappedNode);
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
Program(programPath, state) {
|
|
320
|
-
if (!injectComponentSource) {
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
const seen = /* @__PURE__ */ new Set();
|
|
324
|
-
for (const childPath of programPath.get("body")) {
|
|
325
|
-
if (childPath.isExportNamedDeclaration() || childPath.isExportDefaultDeclaration()) {
|
|
326
|
-
const declarationPath = childPath.get("declaration");
|
|
327
|
-
if (!Array.isArray(declarationPath) && declarationPath.node) {
|
|
328
|
-
visitDeclaration(declarationPath, childPath, state, seen, projectRoot);
|
|
329
|
-
}
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
visitDeclaration(childPath, childPath, state, seen, projectRoot);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
339
|
-
0 && (module.exports = {
|
|
340
|
-
babelInjectComponentSource
|
|
341
|
-
});
|
|
342
|
-
//# sourceMappingURL=babelInjectComponentSource.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/babelInjectComponentSource.ts","../src/constants.ts","../src/sourceMetadata.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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0D;;;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,aAAsB;AACzD,MAAI,aAAa;AACf,WAAO,kBAAkB,iBAAiB,WAAW,CAAC;AAAA,EACxD;AACA,SAAO;AACT;AAEO,SAAS,iBACd,UACA,KACA,aACA;AACA,MAAI,CAAC,YAA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AAW,yBAAyB,GAAG;AAClD,qBAAS,WAAW,YAAY,YAAAA,MAAE,uBAAuB,WAAW,CAAC;AACrE;AAAA,UACF;AAEA,mBAAS,YAAY,WAAW;AAAA,QAClC;AAAA,MACF;AAAA,MACA,QAAQ,aAAkC,OAAmB;AAC3D,YAAI,CAAC,uBAAuB;AAC1B;AAAA,QACF;AAEA,cAAM,OAAO,oBAAI,IAAY;AAE7B,mBAAW,aAAa,YAAY,IAAI,MAAM,GAAG;AAC/C,cACE,UAAU,yBAAyB,KACnC,UAAU,2BAA2B,GACrC;AACA,kBAAM,kBAAkB,UAAU,IAAI,aAAa;AACnD,gBAAI,CAAC,MAAM,QAAQ,eAAe,KAAK,gBAAgB,MAAM;AAC3D,+BAAiB,iBAAiB,WAAW,OAAO,MAAM,WAAW;AAAA,YACvE;AACA;AAAA,UACF;AAEA,2BAAiB,WAAW,WAAW,OAAO,MAAM,WAAW;AAAA,QACjE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["t"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PluginObj } from '@babel/core';
|
|
2
|
-
import { a as SourceInjectionOptions } from './sourceAdapter-dPr5CgLi.cjs';
|
|
3
|
-
|
|
4
|
-
type BabelInjectComponentSourceOptions = SourceInjectionOptions;
|
|
5
|
-
type BabelState = {
|
|
6
|
-
file?: {
|
|
7
|
-
opts?: {
|
|
8
|
-
filename?: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
injectedIntrinsicHelper?: boolean;
|
|
12
|
-
};
|
|
13
|
-
declare function babelInjectComponentSource(options?: BabelInjectComponentSourceOptions): PluginObj<BabelState>;
|
|
14
|
-
|
|
15
|
-
export { type BabelInjectComponentSourceOptions, babelInjectComponentSource };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PluginObj } from '@babel/core';
|
|
2
|
-
import { a as SourceInjectionOptions } from './sourceAdapter-dPr5CgLi.js';
|
|
3
|
-
|
|
4
|
-
type BabelInjectComponentSourceOptions = SourceInjectionOptions;
|
|
5
|
-
type BabelState = {
|
|
6
|
-
file?: {
|
|
7
|
-
opts?: {
|
|
8
|
-
filename?: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
injectedIntrinsicHelper?: boolean;
|
|
12
|
-
};
|
|
13
|
-
declare function babelInjectComponentSource(options?: BabelInjectComponentSourceOptions): PluginObj<BabelState>;
|
|
14
|
-
|
|
15
|
-
export { type BabelInjectComponentSourceOptions, babelInjectComponentSource };
|