ember-auto-import
Version:
Zero-config import from NPM packages
103 lines (102 loc) • 3.62 kB
TypeScript
import type { Configuration } from 'webpack';
import { AddonInstance } from '@embroider/shared-internals';
import type { TransformOptions } from '@babel/core';
import type { Import } from './analyzer';
export declare function reloadDevPackages(): void;
export interface Options {
exclude?: string[];
alias?: {
[fromName: string]: string;
};
webpack?: Configuration;
publicAssetURL?: string;
styleLoaderOptions?: Record<string, unknown>;
cssLoaderOptions?: Record<string, unknown>;
miniCssExtractPluginOptions?: Record<string, unknown>;
forbidEval?: boolean;
skipBabel?: {
package: string;
semverRange?: string;
}[];
watchDependencies?: (string | string[])[];
allowAppImports?: string[];
insertScriptsAt?: string;
insertStylesAt?: string;
}
export interface DepResolution {
type: 'package';
packageName: string;
packageRoot: string;
resolvedSpecifier: string;
}
interface LocalResolution {
type: 'local';
local: string;
}
interface URLResolution {
type: 'url';
url: string;
}
interface ImpreciseResolution {
type: 'imprecise';
}
type Resolution = DepResolution | LocalResolution | URLResolution | ImpreciseResolution;
export type V2AddonResolver = {
hasV2Addon(name: string): boolean;
v2AddonRoot(name: string): string | undefined;
handleRenaming(name: string): string;
implicitImports(kind: 'implicit-modules' | 'implicit-test-modules', root: string): string[];
};
export default class Package {
name: string;
root: string;
private pkgRoot;
isAddon: boolean;
private _options;
private _parent;
private _hasBabelDetails;
private _babelMajorVersion?;
private _babelOptions;
private _emberCLIBabelExtensions?;
private autoImportOptions;
private isDeveloping;
private pkgGeneration;
private pkgCache;
private macrosConfig;
private extraResolve;
static lookupParentOf(child: AddonInstance, extraResolve: V2AddonResolver): Package;
constructor(child: AddonInstance, extraResolve: V2AddonResolver);
_ensureBabelDetails(): void;
get babelOptions(): TransformOptions;
get babelMajorVersion(): number | undefined;
get isFastBootEnabled(): boolean;
get implicitImports(): Import[];
private buildBabelOptions;
private get pkg();
get namespace(): string;
hasDependency(name: string): boolean;
requestedRange(packageName: string): string | undefined;
private hasNonDevDependency;
static categorize(importedPath: string, partial?: boolean): "local" | "url" | "imprecise" | "dep";
resolve(importedPath: string, fromPath: string): DepResolution | LocalResolution | URLResolution | undefined;
resolve(importedPath: string, fromPath: string, partial: true): Resolution | undefined;
private assertAllowedDependency;
private excludesDependency;
get webpackConfig(): any;
get skipBabel(): Options['skipBabel'];
get aliases(): Record<string, string> | undefined;
private aliasFor;
get fileExtensions(): string[];
publicAssetURL(): string;
get styleLoaderOptions(): Record<string, unknown> | undefined;
get cssLoaderOptions(): Record<string, unknown> | undefined;
get miniCssExtractPluginOptions(): Record<string, unknown> | undefined;
get forbidsEval(): boolean;
get insertScriptsAt(): string | undefined;
get insertStylesAt(): string | undefined;
get watchedDirectories(): string[] | undefined;
get allowAppImports(): string[];
cleanBabelConfig(): TransformOptions;
browserslist(): string;
}
export {};