nextjs-ide-helper 1.5.3 → 1.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextjs-ide-helper",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "A Next.js plugin that automatically adds IDE buttons to React components for seamless IDE integration. Supports Cursor, VS Code, WebStorm, and Atom.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -261,13 +261,11 @@ export function MyModal() {
261
261
  const result = loader.call(mockContext, source);
262
262
 
263
263
  expect(result).toContain("import { withIdeButton } from 'nextjs-ide-helper';");
264
-
265
- // For function exports, the function should be declared first, then wrapped
266
- expect(result).toContain("function MyButton()");
267
- expect(result).toContain("function MyModal()");
268
- expect(result).toContain("const MyButton = withIdeButton(MyButton,");
269
- expect(result).toContain("const MyModal = withIdeButton(MyModal,");
270
-
264
+
265
+ // For function exports, the function is wrapped as an expression (preserves name for stack traces)
266
+ expect(result).toContain("export const MyButton = withIdeButton(function MyButton()");
267
+ expect(result).toContain("export const MyModal = withIdeButton(function MyModal()");
268
+
271
269
  // Verify file paths
272
270
  expect(result).toContain("'src/components/Button.tsx'");
273
271
  });
@@ -303,9 +301,8 @@ export default MainLayout;`;
303
301
  expect(result).toContain("export const PrimaryButton = withIdeButton(() => <button className=\"primary\">Primary</button>,");
304
302
  expect(result).toContain("export const SecondaryButton = withIdeButton(() => <button className=\"secondary\">Secondary</button>,");
305
303
 
306
- // Named function export
307
- expect(result).toContain("function DialogModal()");
308
- expect(result).toContain("const DialogModal = withIdeButton(DialogModal,");
304
+ // Named function export (wrapped as function expression)
305
+ expect(result).toContain("export const DialogModal = withIdeButton(function DialogModal()");
309
306
 
310
307
  // Default export
311
308
  expect(result).toContain("export default withIdeButton(MainLayout,");
@@ -346,7 +343,7 @@ export default MyButton;`;
346
343
  const result = loader.call(mockContext, source);
347
344
 
348
345
  expect(result).toContain("import { withIdeButton } from 'nextjs-ide-helper';");
349
- expect(result).toContain("export default withIdeButton(MyCoolComponent,");
346
+ expect(result).toContain("export default withIdeButton(function MyCoolComponent()");
350
347
  });
351
348
 
352
349
  it('should process direct export default arrow function expressions', function() {
@@ -407,7 +404,7 @@ export default class MyClassComponent extends React.Component {
407
404
  const result = loader.call(mockContext, source);
408
405
 
409
406
  expect(result).toContain("import { withIdeButton } from 'nextjs-ide-helper';");
410
- expect(result).toContain("export default withIdeButton(MyComplexComponent123WithNumbers,");
407
+ expect(result).toContain("export default withIdeButton(function MyComplexComponent123WithNumbers()");
411
408
  });
412
409
 
413
410
  it('should handle function components with TypeScript', function() {
@@ -422,8 +419,7 @@ export default function TypeScriptComponent(props: Props) {
422
419
  const result = loader.call(mockContext, source);
423
420
 
424
421
  expect(result).toContain("import { withIdeButton } from 'nextjs-ide-helper';");
425
- expect(result).toContain("export default withIdeButton(TypeScriptComponent,");
426
- expect(result).toContain("function TypeScriptComponent(props: Props)");
422
+ expect(result).toContain("export default withIdeButton(function TypeScriptComponent(props: Props)");
427
423
  });
428
424
 
429
425
  it('should handle class components with TypeScript', function() {
@@ -539,8 +535,7 @@ export default ComplexComponent;`;
539
535
 
540
536
  // Verify component transformations
541
537
  expect(result).toContain("export const InteractiveButton = withIdeButton(() => {");
542
- expect(result).toContain("function StatefulModal()");
543
- expect(result).toContain("const StatefulModal = withIdeButton(StatefulModal,");
538
+ expect(result).toContain("export const StatefulModal = withIdeButton(function StatefulModal()");
544
539
  expect(result).toContain("export default withIdeButton(ComplexComponent,");
545
540
  });
546
541