@pikku/inspector 0.12.38 → 0.12.40

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.
@@ -719,6 +719,14 @@ export function computeDiagnostics(state: InspectorState): void {
719
719
  position: 0,
720
720
  })
721
721
  }
722
+ if (state.functions.dynamicImportIds.has(id)) {
723
+ diagnostics.push({
724
+ code: ErrorCode.FUNCTION_DYNAMIC_IMPORT,
725
+ message: `Function '${id}' performs a runtime dynamic 'import(...)' in its body. Move the import to the top of the module (static import) or into your services/wireServices setup — function bodies run on every invocation, so a dynamic import there adds latency and defeats bundling/tree-shaking.`,
726
+ sourceFile: meta.pikkuFuncId,
727
+ position: 0,
728
+ })
729
+ }
722
730
  }
723
731
 
724
732
  for (const [id, def] of Object.entries(state.middleware.definitions)) {
@@ -529,6 +529,7 @@ export function deserializeInspectorState(
529
529
  meta: data.functions.meta,
530
530
  files: new Map(data.functions.files),
531
531
  approvalDescriptions: (data.functions as any).approvalDescriptions || {},
532
+ dynamicImportIds: new Set(),
532
533
  },
533
534
  http: {
534
535
  metaInputTypes: new Map(data.http.metaInputTypes),