e17f5d09ed0caf09aaac5c13572f61f57be94046140aec946d822e455c9fc4547fa2b06b2983d08b3760eda38fc67f2cc4d359cc10632160d5f56fee7c8391 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. export { b as builtinPresets, d as createUnimport, a as resolveBuiltinPresets, r as resolvePreset, s as scanDirExports, c as scanExports } from './shared/unimport.3e17b72a.mjs';
  2. export { k as addImportToCode, b as dedupeImports, d as defineUnimportPreset, e as excludeRE, j as getMagicString, h as getString, i as importAsRE, m as matchRE, n as normalizeImports, r as resolveIdAbsolute, s as separatorRE, a as stripCommentsAndStrings, c as toExports, t as toImports, g as toTypeDeclarationFile, f as toTypeDeclarationItems } from './shared/unimport.db0843be.mjs';
  3. import 'fs';
  4. import 'fast-glob';
  5. import 'pathe';
  6. import 'mlly';
  7. import 'scule';
  8. import 'local-pkg';
  9. import 'os';
  10. import 'pkg-types';
  11. import 'magic-string';
  12. import 'strip-literal';
  13. async function installGlobalAutoImports(imports, options = {}) {
  14. const {
  15. globalObject = globalThis,
  16. overrides = false
  17. } = options;
  18. imports = Array.isArray(imports) ? imports : await imports.getImports();
  19. await Promise.all(
  20. imports.map(async (i) => {
  21. if (i.disabled) {
  22. return;
  23. }
  24. const as = i.as || i.name;
  25. if (overrides || !(as in globalObject)) {
  26. const module = await import(i.from);
  27. globalObject[as] = module[i.name];
  28. }
  29. })
  30. );
  31. return globalObject;
  32. }
  33. export { installGlobalAutoImports };