@archie/devtools 0.0.12 → 0.0.13
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/dist/client/client.d.mts +38 -1
- package/dist/client/client.d.ts +38 -1
- package/dist/client/client.js +1460 -717
- package/dist/client/client.mjs +1420 -677
- package/dist/index.js +9 -3
- package/dist/index.mjs +9 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -234,6 +234,11 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
|
|
|
234
234
|
}
|
|
235
235
|
return "";
|
|
236
236
|
}
|
|
237
|
+
function isHostLikeMemberExpressionName(name) {
|
|
238
|
+
if (!t.isJSXMemberExpression(name)) return false;
|
|
239
|
+
const propertyName = name.property.name;
|
|
240
|
+
return propertyName[0] === propertyName[0].toLowerCase();
|
|
241
|
+
}
|
|
237
242
|
function computeNodeId(file, line, col, componentName) {
|
|
238
243
|
return `${file}:${line}:${col}:${componentName}`;
|
|
239
244
|
}
|
|
@@ -257,7 +262,7 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
|
|
|
257
262
|
const loc = opening.loc?.start;
|
|
258
263
|
if (loc) {
|
|
259
264
|
const tag = getJSXTagName(opening);
|
|
260
|
-
return computeNodeId(file, loc.line, loc.column, tag);
|
|
265
|
+
return computeNodeId(file, loc.line, loc.column + 1, tag);
|
|
261
266
|
}
|
|
262
267
|
return null;
|
|
263
268
|
}
|
|
@@ -405,9 +410,10 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
|
|
|
405
410
|
const root = state.file.opts.root ?? "";
|
|
406
411
|
const file = root ? nodePath.relative(root, filename) : filename;
|
|
407
412
|
const line = loc.line;
|
|
408
|
-
const col = loc.column;
|
|
413
|
+
const col = loc.column + 1;
|
|
409
414
|
const componentName = getJSXTagName(path.node);
|
|
410
415
|
if (!componentName) return;
|
|
416
|
+
const isHostLikeMemberExpression = isHostLikeMemberExpressionName(path.node.name);
|
|
411
417
|
const isHostElement = componentName[0] === componentName[0].toLowerCase();
|
|
412
418
|
sanitizeSpreadAttributes(path.node.attributes);
|
|
413
419
|
if (hasTruthyAsChildProp(path.node.attributes)) {
|
|
@@ -430,7 +436,7 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
|
|
|
430
436
|
const decl = bp.parentPath;
|
|
431
437
|
if (decl?.isImportDeclaration()) {
|
|
432
438
|
const src = decl.node.source.value;
|
|
433
|
-
if (isPackageImport(src)) return;
|
|
439
|
+
if (isPackageImport(src) && !isHostLikeMemberExpression) return;
|
|
434
440
|
}
|
|
435
441
|
}
|
|
436
442
|
const programScope = path.scope.getProgramParent();
|
package/dist/index.mjs
CHANGED
|
@@ -200,6 +200,11 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
|
|
|
200
200
|
}
|
|
201
201
|
return "";
|
|
202
202
|
}
|
|
203
|
+
function isHostLikeMemberExpressionName(name) {
|
|
204
|
+
if (!t.isJSXMemberExpression(name)) return false;
|
|
205
|
+
const propertyName = name.property.name;
|
|
206
|
+
return propertyName[0] === propertyName[0].toLowerCase();
|
|
207
|
+
}
|
|
203
208
|
function computeNodeId(file, line, col, componentName) {
|
|
204
209
|
return `${file}:${line}:${col}:${componentName}`;
|
|
205
210
|
}
|
|
@@ -223,7 +228,7 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
|
|
|
223
228
|
const loc = opening.loc?.start;
|
|
224
229
|
if (loc) {
|
|
225
230
|
const tag = getJSXTagName(opening);
|
|
226
|
-
return computeNodeId(file, loc.line, loc.column, tag);
|
|
231
|
+
return computeNodeId(file, loc.line, loc.column + 1, tag);
|
|
227
232
|
}
|
|
228
233
|
return null;
|
|
229
234
|
}
|
|
@@ -371,9 +376,10 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
|
|
|
371
376
|
const root = state.file.opts.root ?? "";
|
|
372
377
|
const file = root ? nodePath.relative(root, filename) : filename;
|
|
373
378
|
const line = loc.line;
|
|
374
|
-
const col = loc.column;
|
|
379
|
+
const col = loc.column + 1;
|
|
375
380
|
const componentName = getJSXTagName(path.node);
|
|
376
381
|
if (!componentName) return;
|
|
382
|
+
const isHostLikeMemberExpression = isHostLikeMemberExpressionName(path.node.name);
|
|
377
383
|
const isHostElement = componentName[0] === componentName[0].toLowerCase();
|
|
378
384
|
sanitizeSpreadAttributes(path.node.attributes);
|
|
379
385
|
if (hasTruthyAsChildProp(path.node.attributes)) {
|
|
@@ -396,7 +402,7 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
|
|
|
396
402
|
const decl = bp.parentPath;
|
|
397
403
|
if (decl?.isImportDeclaration()) {
|
|
398
404
|
const src = decl.node.source.value;
|
|
399
|
-
if (isPackageImport(src)) return;
|
|
405
|
+
if (isPackageImport(src) && !isHostLikeMemberExpression) return;
|
|
400
406
|
}
|
|
401
407
|
}
|
|
402
408
|
const programScope = path.scope.getProgramParent();
|