index.mjs 1.6 KB

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