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.
Files changed (56) hide show
  1. package/README.md +54 -0
  2. package/dist/core/transform-cjs.cjs +7014 -0
  3. package/dist/core/webpackPitchLoader-cjs.cjs +7032 -0
  4. package/dist/esbuild.cjs +7025 -295
  5. package/dist/esbuild.cjs.map +1 -1
  6. package/dist/esbuild.d.cts +38 -6
  7. package/dist/esbuild.d.ts +38 -6
  8. package/dist/esbuild.js +7025 -295
  9. package/dist/esbuild.js.map +1 -1
  10. package/dist/swc.cjs +7020 -293
  11. package/dist/swc.cjs.map +1 -1
  12. package/dist/swc.d.cts +43 -19
  13. package/dist/swc.d.ts +43 -19
  14. package/dist/swc.js +7020 -293
  15. package/dist/swc.js.map +1 -1
  16. package/dist/transform-CXh-m5Ez.d.cts +12 -0
  17. package/dist/transform-CXh-m5Ez.d.ts +12 -0
  18. package/dist/unplugin.cjs +7147 -0
  19. package/dist/unplugin.cjs.map +1 -0
  20. package/dist/unplugin.d.cts +41 -0
  21. package/dist/unplugin.d.ts +41 -0
  22. package/dist/unplugin.js +7118 -0
  23. package/dist/unplugin.js.map +1 -0
  24. package/dist/vite.cjs +7029 -304
  25. package/dist/vite.cjs.map +1 -1
  26. package/dist/vite.d.cts +39 -14
  27. package/dist/vite.d.ts +39 -14
  28. package/dist/vite.js +7029 -303
  29. package/dist/vite.js.map +1 -1
  30. package/dist/webpack.cjs +85 -61
  31. package/dist/webpack.cjs.map +1 -1
  32. package/dist/webpack.d.cts +55 -1
  33. package/dist/webpack.d.ts +55 -1
  34. package/dist/webpack.js +51 -71
  35. package/dist/webpack.js.map +1 -1
  36. package/dist/webpackLoader.cjs +7115 -0
  37. package/dist/webpackLoader.cjs.map +1 -0
  38. package/dist/webpackLoader.d.cts +15 -0
  39. package/dist/webpackLoader.d.ts +15 -0
  40. package/dist/webpackLoader.js +7092 -0
  41. package/dist/webpackLoader.js.map +1 -0
  42. package/package.json +26 -11
  43. package/dist/babel.cjs +0 -370
  44. package/dist/babel.cjs.map +0 -1
  45. package/dist/babel.d.cts +0 -13
  46. package/dist/babel.d.ts +0 -13
  47. package/dist/babel.js +0 -341
  48. package/dist/babel.js.map +0 -1
  49. package/dist/babelInjectComponentSource.cjs +0 -342
  50. package/dist/babelInjectComponentSource.cjs.map +0 -1
  51. package/dist/babelInjectComponentSource.d.cts +0 -15
  52. package/dist/babelInjectComponentSource.d.ts +0 -15
  53. package/dist/babelInjectComponentSource.js +0 -317
  54. package/dist/babelInjectComponentSource.js.map +0 -1
  55. package/dist/sourceAdapter-dPr5CgLi.d.cts +0 -14
  56. package/dist/sourceAdapter-dPr5CgLi.d.ts +0 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-code-locator",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -16,11 +16,6 @@
16
16
  "import": "./dist/client.js",
17
17
  "require": "./dist/client.cjs"
18
18
  },
19
- "./babel": {
20
- "types": "./dist/babel.d.ts",
21
- "import": "./dist/babel.js",
22
- "require": "./dist/babel.cjs"
23
- },
24
19
  "./vite": {
25
20
  "types": "./dist/vite.d.ts",
26
21
  "import": "./dist/vite.js",
@@ -39,6 +34,16 @@
39
34
  "./webpack": {
40
35
  "types": "./dist/webpack.d.cts",
41
36
  "require": "./dist/webpack.cjs"
37
+ },
38
+ "./webpack-plugin": {
39
+ "types": "./dist/webpack.d.ts",
40
+ "import": "./dist/webpack.js",
41
+ "require": "./dist/webpack.cjs"
42
+ },
43
+ "./unplugin": {
44
+ "types": "./dist/unplugin.d.ts",
45
+ "import": "./dist/unplugin.js",
46
+ "require": "./dist/unplugin.cjs"
42
47
  }
43
48
  },
44
49
  "files": [
@@ -51,20 +56,30 @@
51
56
  "prepublishOnly": "npm run build:lib",
52
57
  "typecheck": "tsc --noEmit"
53
58
  },
59
+ "dependencies": {
60
+ "acorn": "^8.16.0",
61
+ "astring": "^1.9.0"
62
+ },
54
63
  "peerDependencies": {
55
- "@babel/core": ">=7"
64
+ "unplugin": "^3.0.0",
65
+ "webpack": ">=5"
56
66
  },
57
67
  "peerDependenciesMeta": {
58
- "@babel/core": {
68
+ "unplugin": {
69
+ "optional": true
70
+ },
71
+ "webpack": {
59
72
  "optional": true
60
73
  }
61
74
  },
62
75
  "devDependencies": {
63
- "@babel/core": "^7.26.0",
64
- "@types/babel__core": "^7.20.5",
76
+ "@types/estree": "^1.0.8",
65
77
  "@types/node": "^22.13.10",
78
+ "@types/webpack": "^5.28.5",
66
79
  "tsup": "^8.5.1",
67
80
  "typescript": "^5.8.2",
68
- "vite": "^5.4.14"
81
+ "unplugin": "^3.0.0",
82
+ "vite": "^5.4.14",
83
+ "webpack": "^5.105.4"
69
84
  }
70
85
  }
package/dist/babel.cjs DELETED
@@ -1,370 +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/babel.ts
21
- var babel_exports = {};
22
- __export(babel_exports, {
23
- babelInjectComponentSource: () => babelInjectComponentSource,
24
- babelSourceAdapter: () => babelSourceAdapter,
25
- createBabelSourceAdapter: () => createBabelSourceAdapter
26
- });
27
- module.exports = __toCommonJS(babel_exports);
28
-
29
- // src/babelInjectComponentSource.ts
30
- var import_core = require("@babel/core");
31
-
32
- // src/constants.ts
33
- var SOURCE_PROP = "__componentSourceLoc";
34
- var JSX_SOURCE_REGISTRY_SYMBOL = "react-code-locator.jsxSourceRegistry";
35
-
36
- // src/sourceMetadata.ts
37
- function normalizeSlashes(value) {
38
- return value.replace(/\\/g, "/");
39
- }
40
- function trimTrailingSlash(value) {
41
- return value.replace(/\/+$/, "");
42
- }
43
- function splitPathSegments(value) {
44
- return normalizeSlashes(value).split("/").filter(Boolean);
45
- }
46
- function computeRelativePath(fromPath, toPath) {
47
- const fromSegments = splitPathSegments(fromPath);
48
- const toSegments = splitPathSegments(toPath);
49
- let sharedIndex = 0;
50
- while (sharedIndex < fromSegments.length && sharedIndex < toSegments.length && fromSegments[sharedIndex] === toSegments[sharedIndex]) {
51
- sharedIndex += 1;
52
- }
53
- const upSegments = new Array(Math.max(0, fromSegments.length - sharedIndex)).fill("..");
54
- const downSegments = toSegments.slice(sharedIndex);
55
- const relativeSegments = [...upSegments, ...downSegments];
56
- return relativeSegments.length > 0 ? relativeSegments.join("/") : ".";
57
- }
58
- function normalizeProjectRoot(projectRoot) {
59
- if (projectRoot) {
60
- return trimTrailingSlash(normalizeSlashes(projectRoot));
61
- }
62
- return "";
63
- }
64
- function toRelativeSource(filename, loc, projectRoot) {
65
- if (!filename || !loc) {
66
- return null;
67
- }
68
- const root = normalizeProjectRoot(projectRoot);
69
- const normalizedFilename = normalizeSlashes(filename);
70
- const relPath = root && normalizedFilename.startsWith(`${root}/`) ? normalizedFilename.slice(root.length + 1) : root ? computeRelativePath(root, normalizedFilename) : normalizedFilename;
71
- return `${relPath}:${loc.line}:${loc.column + 1}`;
72
- }
73
-
74
- // src/babelInjectComponentSource.ts
75
- function isComponentName(name) {
76
- return /^[A-Z]/.test(name);
77
- }
78
- function isElementFactoryIdentifier(name) {
79
- return name === "jsx" || name === "jsxs" || name === "jsxDEV" || name === "_jsx" || name === "_jsxs" || name === "_jsxDEV" || name === "createElement";
80
- }
81
- function isReactElementFactoryCall(pathNode) {
82
- const callee = pathNode.node.callee;
83
- if (import_core.types.isIdentifier(callee)) {
84
- return isElementFactoryIdentifier(callee.name);
85
- }
86
- return import_core.types.isMemberExpression(callee) && import_core.types.isIdentifier(callee.object, { name: "React" }) && import_core.types.isIdentifier(callee.property, { name: "createElement" });
87
- }
88
- function isSupportedComponentInit(node) {
89
- if (!node) {
90
- return false;
91
- }
92
- if (import_core.types.isArrowFunctionExpression(node) || import_core.types.isFunctionExpression(node)) {
93
- return true;
94
- }
95
- if (!import_core.types.isCallExpression(node)) {
96
- return false;
97
- }
98
- if (import_core.types.isIdentifier(node.callee) && (node.callee.name === "memo" || node.callee.name === "forwardRef")) {
99
- return true;
100
- }
101
- 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");
102
- }
103
- function getSourceValue(state, loc, projectRoot) {
104
- const filename = state.file?.opts?.filename;
105
- if (!filename || !loc) {
106
- return null;
107
- }
108
- return toRelativeSource(filename, loc, projectRoot);
109
- }
110
- function buildAssignment(name, sourceValue) {
111
- return import_core.types.expressionStatement(
112
- import_core.types.assignmentExpression(
113
- "=",
114
- import_core.types.memberExpression(import_core.types.identifier(name), import_core.types.identifier(SOURCE_PROP)),
115
- import_core.types.stringLiteral(sourceValue)
116
- )
117
- );
118
- }
119
- function buildElementSourceHelper() {
120
- return import_core.types.functionDeclaration(
121
- import_core.types.identifier("_markReactElementSource"),
122
- [import_core.types.identifier("element"), import_core.types.identifier("source")],
123
- import_core.types.blockStatement([
124
- import_core.types.variableDeclaration("const", [
125
- import_core.types.variableDeclarator(
126
- import_core.types.identifier("registryKey"),
127
- import_core.types.callExpression(
128
- import_core.types.memberExpression(import_core.types.identifier("Symbol"), import_core.types.identifier("for")),
129
- [import_core.types.stringLiteral(JSX_SOURCE_REGISTRY_SYMBOL)]
130
- )
131
- )
132
- ]),
133
- import_core.types.variableDeclaration("let", [
134
- import_core.types.variableDeclarator(
135
- import_core.types.identifier("registry"),
136
- import_core.types.memberExpression(import_core.types.identifier("globalThis"), import_core.types.identifier("registryKey"), true)
137
- )
138
- ]),
139
- import_core.types.ifStatement(
140
- import_core.types.unaryExpression(
141
- "!",
142
- import_core.types.binaryExpression("instanceof", import_core.types.identifier("registry"), import_core.types.identifier("WeakMap"))
143
- ),
144
- import_core.types.blockStatement([
145
- import_core.types.expressionStatement(
146
- import_core.types.assignmentExpression(
147
- "=",
148
- import_core.types.identifier("registry"),
149
- import_core.types.assignmentExpression(
150
- "=",
151
- import_core.types.memberExpression(import_core.types.identifier("globalThis"), import_core.types.identifier("registryKey"), true),
152
- import_core.types.newExpression(import_core.types.identifier("WeakMap"), [])
153
- )
154
- )
155
- )
156
- ])
157
- ),
158
- import_core.types.ifStatement(
159
- import_core.types.logicalExpression(
160
- "&&",
161
- import_core.types.identifier("element"),
162
- import_core.types.logicalExpression(
163
- "&&",
164
- import_core.types.binaryExpression("===", import_core.types.unaryExpression("typeof", import_core.types.identifier("element")), import_core.types.stringLiteral("object")),
165
- import_core.types.binaryExpression(
166
- "===",
167
- import_core.types.unaryExpression("typeof", import_core.types.memberExpression(import_core.types.identifier("element"), import_core.types.identifier("props"))),
168
- import_core.types.stringLiteral("object")
169
- )
170
- )
171
- ),
172
- import_core.types.blockStatement([
173
- import_core.types.expressionStatement(
174
- import_core.types.callExpression(
175
- import_core.types.memberExpression(import_core.types.identifier("registry"), import_core.types.identifier("set")),
176
- [import_core.types.memberExpression(import_core.types.identifier("element"), import_core.types.identifier("props")), import_core.types.identifier("source")]
177
- )
178
- )
179
- ])
180
- ),
181
- import_core.types.returnStatement(import_core.types.identifier("element"))
182
- ])
183
- );
184
- }
185
- function ensureElementSourceHelper(programPath, state) {
186
- if (state.injectedIntrinsicHelper) {
187
- return;
188
- }
189
- const alreadyExists = programPath.node.body.some(
190
- (node) => import_core.types.isFunctionDeclaration(node) && import_core.types.isIdentifier(node.id, { name: "_markReactElementSource" })
191
- );
192
- if (!alreadyExists) {
193
- programPath.unshiftContainer("body", buildElementSourceHelper());
194
- }
195
- state.injectedIntrinsicHelper = true;
196
- }
197
- function visitDeclaration(declarationPath, insertAfterPath, state, seen, projectRoot) {
198
- if (declarationPath.isFunctionDeclaration() || declarationPath.isClassDeclaration()) {
199
- const name = declarationPath.node.id?.name;
200
- if (!name || !isComponentName(name) || seen.has(name)) {
201
- return;
202
- }
203
- const sourceValue = getSourceValue(
204
- state,
205
- declarationPath.node.loc?.start,
206
- projectRoot
207
- );
208
- if (!sourceValue) {
209
- return;
210
- }
211
- seen.add(name);
212
- insertAfterPath.insertAfter(buildAssignment(name, sourceValue));
213
- return;
214
- }
215
- if (!declarationPath.isVariableDeclaration()) {
216
- return;
217
- }
218
- const assignments = declarationPath.node.declarations.flatMap(
219
- (declarator) => {
220
- if (!import_core.types.isIdentifier(declarator.id) || !isComponentName(declarator.id.name) || seen.has(declarator.id.name)) {
221
- return [];
222
- }
223
- if (!declarator.init) {
224
- return [];
225
- }
226
- if (!isSupportedComponentInit(declarator.init)) {
227
- return [];
228
- }
229
- const sourceValue = getSourceValue(
230
- state,
231
- declarator.loc?.start ?? declarator.init.loc?.start,
232
- projectRoot
233
- );
234
- if (!sourceValue) {
235
- return [];
236
- }
237
- seen.add(declarator.id.name);
238
- return [buildAssignment(declarator.id.name, sourceValue)];
239
- }
240
- );
241
- if (assignments.length > 0) {
242
- insertAfterPath.insertAfter(assignments);
243
- }
244
- }
245
- function babelInjectComponentSource(options = {}) {
246
- const {
247
- injectJsxSource = true,
248
- injectComponentSource = true,
249
- projectRoot
250
- } = options;
251
- return {
252
- name: "babel-inject-component-source",
253
- visitor: {
254
- CallExpression(pathNode, state) {
255
- if (!injectJsxSource) {
256
- return;
257
- }
258
- if (!isReactElementFactoryCall(pathNode)) {
259
- return;
260
- }
261
- if (pathNode.parentPath.isCallExpression() && import_core.types.isIdentifier(pathNode.parentPath.node.callee, {
262
- name: "_markReactElementSource"
263
- })) {
264
- return;
265
- }
266
- const sourceValue = getSourceValue(
267
- state,
268
- pathNode.node.loc?.start,
269
- projectRoot
270
- );
271
- if (!sourceValue) {
272
- return;
273
- }
274
- const programPath = pathNode.findParent((parent) => parent.isProgram());
275
- if (!programPath || !programPath.isProgram()) {
276
- return;
277
- }
278
- ensureElementSourceHelper(programPath, state);
279
- pathNode.replaceWith(
280
- import_core.types.callExpression(import_core.types.identifier("_markReactElementSource"), [
281
- pathNode.node,
282
- import_core.types.stringLiteral(sourceValue)
283
- ])
284
- );
285
- pathNode.skip();
286
- },
287
- JSXElement: {
288
- exit(pathNode, state) {
289
- if (!injectJsxSource) {
290
- return;
291
- }
292
- if (pathNode.parentPath.isCallExpression() && import_core.types.isIdentifier(pathNode.parentPath.node.callee, { name: "_markReactElementSource" })) {
293
- return;
294
- }
295
- const sourceValue = getSourceValue(
296
- state,
297
- pathNode.node.openingElement.loc?.start,
298
- projectRoot
299
- );
300
- if (!sourceValue) {
301
- return;
302
- }
303
- const programPath = pathNode.findParent((parent) => parent.isProgram());
304
- if (!programPath || !programPath.isProgram()) {
305
- return;
306
- }
307
- ensureElementSourceHelper(programPath, state);
308
- const wrappedNode = import_core.types.callExpression(import_core.types.identifier("_markReactElementSource"), [
309
- pathNode.node,
310
- import_core.types.stringLiteral(sourceValue)
311
- ]);
312
- if (pathNode.parentPath.isJSXElement() || pathNode.parentPath.isJSXFragment()) {
313
- pathNode.replaceWith(import_core.types.jsxExpressionContainer(wrappedNode));
314
- return;
315
- }
316
- if (pathNode.parentPath.isJSXExpressionContainer()) {
317
- pathNode.parentPath.replaceWith(import_core.types.jsxExpressionContainer(wrappedNode));
318
- return;
319
- }
320
- pathNode.replaceWith(wrappedNode);
321
- }
322
- },
323
- Program(programPath, state) {
324
- if (!injectComponentSource) {
325
- return;
326
- }
327
- const seen = /* @__PURE__ */ new Set();
328
- for (const childPath of programPath.get("body")) {
329
- if (childPath.isExportNamedDeclaration() || childPath.isExportDefaultDeclaration()) {
330
- const declarationPath = childPath.get("declaration");
331
- if (!Array.isArray(declarationPath) && declarationPath.node) {
332
- visitDeclaration(declarationPath, childPath, state, seen, projectRoot);
333
- }
334
- continue;
335
- }
336
- visitDeclaration(childPath, childPath, state, seen, projectRoot);
337
- }
338
- }
339
- }
340
- };
341
- }
342
-
343
- // src/sourceAdapter.ts
344
- function defineSourceAdapter(descriptor) {
345
- return descriptor;
346
- }
347
-
348
- // src/babel.ts
349
- function createBabelSourceAdapter(options = {}) {
350
- const resolvedOptions = {
351
- projectRoot: process.cwd(),
352
- ...options
353
- };
354
- return defineSourceAdapter({
355
- kind: "babel",
356
- name: "react-code-locator/babel",
357
- options: resolvedOptions,
358
- config: {
359
- plugins: [[babelInjectComponentSource, resolvedOptions]]
360
- }
361
- });
362
- }
363
- var babelSourceAdapter = createBabelSourceAdapter();
364
- // Annotate the CommonJS export names for ESM import in node:
365
- 0 && (module.exports = {
366
- babelInjectComponentSource,
367
- babelSourceAdapter,
368
- createBabelSourceAdapter
369
- });
370
- //# sourceMappingURL=babel.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/babel.ts","../src/babelInjectComponentSource.ts","../src/constants.ts","../src/sourceMetadata.ts","../src/sourceAdapter.ts"],"sourcesContent":["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","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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,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,YAAY,CAAC,KAAK;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,qBAAqB,WAAW;AA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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;;;AG3WO,SAAS,oBACd,YACA;AACA,SAAO;AACT;;;AJRO,SAAS,yBAAyB,UAA6C,CAAC,GAAG;AACxF,QAAM,kBAAkB;AAAA,IACtB,aAAa,QAAQ,IAAI;AAAA,IACzB,GAAG;AAAA,EACL;AAEA,SAAO,oBAAiF;AAAA,IACtF,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,SAAS,CAAC,CAAC,4BAA4B,eAAe,CAAC;AAAA,IACzD;AAAA,EACF,CAAC;AACH;AAEO,IAAM,qBAAqB,yBAAyB;","names":["t"]}
package/dist/babel.d.cts DELETED
@@ -1,13 +0,0 @@
1
- import { S as SourceAdapterDescriptor, a as SourceInjectionOptions } from './sourceAdapter-dPr5CgLi.cjs';
2
- export { b as SourceAdapterKind } from './sourceAdapter-dPr5CgLi.cjs';
3
- import { babelInjectComponentSource, BabelInjectComponentSourceOptions } from './babelInjectComponentSource.cjs';
4
- import '@babel/core';
5
-
6
- type BabelSourceAdapterConfig = {
7
- plugins: Array<[typeof babelInjectComponentSource, BabelInjectComponentSourceOptions]>;
8
- };
9
-
10
- declare function createBabelSourceAdapter(options?: BabelInjectComponentSourceOptions): SourceAdapterDescriptor<BabelSourceAdapterConfig, SourceInjectionOptions>;
11
- declare const babelSourceAdapter: SourceAdapterDescriptor<BabelSourceAdapterConfig, SourceInjectionOptions>;
12
-
13
- export { BabelInjectComponentSourceOptions, type BabelSourceAdapterConfig, SourceAdapterDescriptor, SourceInjectionOptions, babelInjectComponentSource, babelSourceAdapter, createBabelSourceAdapter };
package/dist/babel.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { S as SourceAdapterDescriptor, a as SourceInjectionOptions } from './sourceAdapter-dPr5CgLi.js';
2
- export { b as SourceAdapterKind } from './sourceAdapter-dPr5CgLi.js';
3
- import { babelInjectComponentSource, BabelInjectComponentSourceOptions } from './babelInjectComponentSource.js';
4
- import '@babel/core';
5
-
6
- type BabelSourceAdapterConfig = {
7
- plugins: Array<[typeof babelInjectComponentSource, BabelInjectComponentSourceOptions]>;
8
- };
9
-
10
- declare function createBabelSourceAdapter(options?: BabelInjectComponentSourceOptions): SourceAdapterDescriptor<BabelSourceAdapterConfig, SourceInjectionOptions>;
11
- declare const babelSourceAdapter: SourceAdapterDescriptor<BabelSourceAdapterConfig, SourceInjectionOptions>;
12
-
13
- export { BabelInjectComponentSourceOptions, type BabelSourceAdapterConfig, SourceAdapterDescriptor, SourceInjectionOptions, babelInjectComponentSource, babelSourceAdapter, createBabelSourceAdapter };