lumide_import_assist 0.1.1
lumide_import_assist: ^0.1.1 copied to clipboard
Shared heuristic import sync engine for Lumide language plugins (Dart, JavaScript, Python, and custom ImportSyntax implementations).
lumide_import_assist #
Shared heuristic import sync engine for any Lumide language / framework plugin — not Dart-only.
Plugins define an [ImportPack](lib/src/import_pack.dart) (managed modules +
symbol detection) and an [ImportSyntax](lib/src/import_syntax.dart) for how
imports are written in that language. Built-ins:
| Syntax | Language |
|---|---|
dartImportSyntax |
Dart import / export / part |
javaScriptImportSyntax |
ESM import / export … from |
pythonImportSyntax |
import / from … import |
Custom languages implement ImportSyntax and return it from ImportPack.syntax.
Not a full analyzer Organize Imports — heuristics only.
Usage #
import 'package:lumide_import_assist/lumide_import_assist.dart';
class MyPack implements ImportPack {
@override
String get id => 'my-framework';
@override
ImportSyntax get syntax => dartImportSyntax; // or JS / Python / custom
@override
Set<String> get managedUris => {'package:foo/foo.dart'};
@override
Set<String> detectNeeded(String source, {String? path}) { /* … */ }
}
final result = syncImports(
source,
MyPack(),
path: filePath,
removeUnused: true,
);
License #
MIT.