@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.
- package/CHANGELOG.md +36 -0
- package/dist/add/add-functions.js +25 -0
- package/dist/error-codes.d.ts +4 -16
- package/dist/error-codes.js +5 -18
- package/dist/inspector.js +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/utils/post-process.js +8 -0
- package/dist/utils/serialize-inspector-state.js +1 -0
- package/package.json +4 -4
- package/src/add/add-functions.ts +31 -0
- package/src/add/dynamic-import-check.test.ts +119 -0
- package/src/error-codes-emitted.test.ts +76 -0
- package/src/error-codes.ts +6 -20
- package/src/inspector.ts +1 -0
- package/src/types.ts +6 -0
- package/src/utils/compute-diagnostics.test.ts +43 -6
- package/src/utils/post-process.ts +8 -0
- package/src/utils/serialize-inspector-state.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -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),
|