API
The remaining types specified in `@parcel/types`
AST parcel/packages/core/types/index.js:18
Plugin-specific AST, any
Type
type AST = _AST;
Referenced by:
BaseAsset, BundleResult, MutableAsset, Transformer, TransformerResultConfigResult parcel/packages/core/types/index.js:19
Type
type ConfigResult = _ConfigResult;
Referenced by:
MultiThreadValidatorConfigResultWithFilePath parcel/packages/core/types/index.js:21
Plugin-specific config result, any
type ConfigResultWithFilePath<T> = {|
contents: T,
filePath: FilePath,
|}
Referenced by:
ConfigEnvMap parcel/packages/core/types/index.js:26
process.env
Type
type EnvMap = typeof process.env;
Referenced by:
InitialParcelOptions, PluginOptionsJSONValue parcel/packages/core/types/index.js:28
Type
type JSONValue = null | void | boolean | number | string | Array<JSONValue> | JSONObject;
JSONObject parcel/packages/core/types/index.js:38
A JSON object (as in "map")
type JSONObject = {
}
Referenced by:
JSONValue, Meta, ResolveResultPackageName parcel/packages/core/types/index.js:40
Type
type PackageName = string;
Referenced by:
Environment, EnvironmentOptions, PackageJSON, PackageTargetDescriptor, RawParcelConfig, RawParcelConfigPipelineFilePath parcel/packages/core/types/index.js:41
Type
type FilePath = string;
Referenced by:
BaseAsset, BundleGraph, Config, ConfigResultWithFilePath, Dependency, DependencyOptions, DevDepOptions, File, FileAboveInvalidation, FileInvalidation, HTTPSOptions, InitialParcelOptions, MutableAsset, Namer, PackageJSON, PackageTargetDescriptor, PackagedBundle, PluginOptions, RawParcelConfig, ResolveConfigFn, ResolveConfigWithPathFn, ResolveFn, ResolveResult, ResolvedParcelConfigFile, Resolver, RuntimeAsset, ServerOptions, Target, TargetDescriptor, TransformingProgressEvent, ValidationEventGlob parcel/packages/core/types/index.js:42
Type
type Glob = string;
Referenced by:
GlobInvalidation, PackageJSON, RawParcelConfigSemver parcel/packages/core/types/index.js:43
Type
type Semver = string;
Referenced by:
ASTGenerator, PackageJSONSemverRange parcel/packages/core/types/index.js:44
Type
type SemverRange = string;
Referenced by:
DevDepOptions, EnginesDependencySpecifier parcel/packages/core/types/index.js:46
See Dependency
Type
type DependencySpecifier = string;
Referenced by:
Dependency, DependencyOptions, DevDepOptions, InitialParcelOptionsGlobMap parcel/packages/core/types/index.js:49
A pipeline as specified in the config mapping to T
type GlobMap<T> = {
}
RawParcelConfigPipeline parcel/packages/core/types/index.js:51
Type
type RawParcelConfigPipeline = Array<PackageName>;
Referenced by:
RawParcelConfigHMROptions parcel/packages/core/types/index.js:53
type HMROptions = {
port?: number,
host?: string,
}
Referenced by:
InitialParcelOptions, PluginOptionsRawParcelConfig parcel/packages/core/types/index.js:56
The format of .parcelrc
type RawParcelConfig = {|
extends?: PackageName | FilePath | Array<PackageName | FilePath>,
resolvers?: RawParcelConfigPipeline,
transformers?: {
[Glob]: RawParcelConfigPipeline,
...
},
bundler?: PackageName,
namers?: RawParcelConfigPipeline,
runtimes?: RawParcelConfigPipeline,
packagers?: {
[Glob]: PackageName,
...
},
optimizers?: {
[Glob]: RawParcelConfigPipeline,
...
},
compressors?: {
[Glob]: RawParcelConfigPipeline,
...
},
reporters?: RawParcelConfigPipeline,
validators?: {
[Glob]: RawParcelConfigPipeline,
...
},
|}
Referenced by:
ResolvedParcelConfigFileResolvedParcelConfigFile parcel/packages/core/types/index.js:71
A .parcelrc where all package names are resolved
type ResolvedParcelConfigFile = {|
...RawParcelConfig,
+filePath: FilePath,
+resolveFrom?: FilePath,
|}
Engines parcel/packages/core/types/index.js:78
Corresponds to pkg#engines
type Engines = {
+browsers?: string | Array<string>,
+electron?: SemverRange,
+node?: SemverRange,
+parcel?: SemverRange,
}
Referenced by:
Environment, EnvironmentOptions, InitialParcelOptions, PackageJSON, PackageTargetDescriptorTargetSourceMapOptions parcel/packages/core/types/index.js:87
Corresponds to pkg#targets.*.sourceMap
type TargetSourceMapOptions = {|
+sourceRoot?: string,
+inline?: boolean,
+inlineSources?: boolean,
|}
Referenced by:
Environment, EnvironmentOptions, PackageTargetDescriptorTarget parcel/packages/core/types/index.js:96
A parsed version of PackageTargetDescriptor
interface Target {
+distEntry: ?FilePath,
The output filename of the entry
+distDir: FilePath,
The output folder
+env: Environment,
+name: string,
+publicUrl: string,
+loc: ?SourceLocation,
The location that created this Target, e.g. package.json#main
}
Referenced by:
Bundle, BundleGraph, BundleGroup, CreateBundleOpts, Dependency, MutableBundleGraph, PackageTargetDescriptorEnvironmentContext parcel/packages/core/types/index.js:109
In which environment the output should run (influces e.g. bundle loaders)
Type
type EnvironmentContext = 'browser' | 'web-worker' | 'service-worker' | 'worklet' | 'node' | 'electron-main' | 'electron-renderer';
Referenced by:
Environment, EnvironmentOptions, PackageTargetDescriptorOutputFormat parcel/packages/core/types/index.js:119
The JS module format for the bundle output
Type
type OutputFormat = 'esmodule' | 'commonjs' | 'global';
Referenced by:
Environment, EnvironmentOptions, InitialParcelOptions, PackageTargetDescriptorPackageTargetDescriptor parcel/packages/core/types/index.js:126
The format of pkg#targets.*
See Environment and Target.
type PackageTargetDescriptor = {|
+context?: EnvironmentContext,
+engines?: Engines,
+includeNodeModules?: boolean | Array<PackageName> | {
[PackageName]: boolean,
...
},
+outputFormat?: OutputFormat,
+publicUrl?: string,
+distDir?: FilePath,
+sourceMap?: boolean | TargetSourceMapOptions,
+isLibrary?: boolean,
+optimize?: boolean,
+scopeHoist?: boolean,
+source?: FilePath | Array<FilePath>,
|}
Referenced by:
PackageJSON, Target, TargetDescriptorTargetDescriptor parcel/packages/core/types/index.js:148
The target format when using the JS API.
(Same as PackageTargetDescriptor, but distDir
is required.)
type TargetDescriptor = {|
...PackageTargetDescriptor,
+distDir: FilePath,
+distEntry?: FilePath,
|}
Referenced by:
InitialParcelOptionsSourceType parcel/packages/core/types/index.js:154
Type
type SourceType = 'script' | 'module';
Referenced by:
Environment, EnvironmentOptionsEnvironmentOptions parcel/packages/core/types/index.js:159
This is used when creating an Environment (see that).
type EnvironmentOptions = {|
+context?: EnvironmentContext,
+engines?: Engines,
+includeNodeModules?: boolean | Array<PackageName> | {
[PackageName]: boolean,
...
},
+outputFormat?: OutputFormat,
+sourceType?: SourceType,
+isLibrary?: boolean,
+shouldOptimize?: boolean,
+shouldScopeHoist?: boolean,
+sourceMap?: ?TargetSourceMapOptions,
+loc?: ?SourceLocation,
|}
Referenced by:
DependencyOptions, MutableAsset, RuntimeAsset, TransformerResultVersionMap parcel/packages/core/types/index.js:187
A resolved browserslist, e.g.:
{
edge: '76',
firefox: '67',
chrome: '63',
safari: '11.1',
opera: '50',
}
type VersionMap = {
}
Referenced by:
EnvironmentEnvironmentFeature parcel/packages/core/types/index.js:192
Type
type EnvironmentFeature = 'esmodules' | 'dynamic-import' | 'worker-module' | 'service-worker-module' | 'import-meta-url' | 'arrow-functions';
Referenced by:
EnvironmentEnvironment parcel/packages/core/types/index.js:203
Defines the environment in for the output bundle
interface Environment {
+id: string,
+context: EnvironmentContext,
+engines: Engines,
+includeNodeModules: boolean | Array<PackageName> | {
[PackageName]: boolean,
...
},
Whether to include all/none packages (true / false
), an array of package names to include, or an object (of a package is not specified, it's included).
+outputFormat: OutputFormat,
+sourceType: SourceType,
+isLibrary: boolean,
Whether this is a library build (e.g. less loaders)
+shouldOptimize: boolean,
Whether the output should be minified.
+shouldScopeHoist: boolean,
Whether scope hoisting is enabled.
+sourceMap: ?TargetSourceMapOptions,
+loc: ?SourceLocation,
isBrowser(): boolean,
Whether context
specifies a browser context.
isNode(): boolean,
Whether context
specifies a node context.
isElectron(): boolean,
Whether context
specifies an electron context.
isWorker(): boolean,
Whether context
specifies a worker context.
isWorklet(): boolean,
Whether context
specifies a worklet context.
isIsolated(): boolean,
Whether context
specifies an isolated context (can't access other loaded ancestor bundles).
matchesEngines(minVersions: VersionMap, defaultValue?: boolean): boolean,
supports(feature: EnvironmentFeature, defaultValue?: boolean): boolean,
}
Referenced by:
BaseAsset, Bundle, Config, CreateBundleOpts, Dependency, EnvironmentOptions, PackageTargetDescriptor, Target, TransformerResultPackageDependencies parcel/packages/core/types/index.js:245
Format of pkg#dependencies
, pkg#devDependencies
, pkg#peerDependencies
type PackageDependencies = {|
|}
Referenced by:
PackageJSONPackageJSON parcel/packages/core/types/index.js:252
Format of package.json
type PackageJSON = {
name: PackageName,
version: Semver,
type?: 'module',
main?: FilePath,
module?: FilePath,
types?: FilePath,
browser?: FilePath | {
[FilePath]: FilePath | boolean,
...
},
source?: FilePath | Array<FilePath>,
alias?: {
[PackageName | FilePath | Glob]: PackageName | FilePath,
...
},
browserslist?: Array<string> | {
[string]: Array<string>
},
engines?: Engines,
targets?: {
[string]: PackageTargetDescriptor,
...
},
dependencies?: PackageDependencies,
devDependencies?: PackageDependencies,
peerDependencies?: PackageDependencies,
sideEffects?: boolean | FilePath | Array<FilePath>,
bin?: string | {|
[string]: FilePath
|},
}
Referenced by:
ConfigLogLevel parcel/packages/core/types/index.js:273
Type
type LogLevel = 'none' | 'error' | 'warn' | 'info' | 'verbose';
Referenced by:
InitialParcelOptions, PluginOptionsBuildMode parcel/packages/core/types/index.js:274
Type
type BuildMode = 'development' | 'production' | string;
Referenced by:
InitialParcelOptions, PluginOptionsDetailedReportOptions parcel/packages/core/types/index.js:275
type DetailedReportOptions = {|
assetsPerBundle?: number,
|}
Referenced by:
InitialParcelOptions, PluginOptionsInitialParcelOptions parcel/packages/core/types/index.js:279
type InitialParcelOptions = {|
+entries?: FilePath | Array<FilePath>,
+config?: DependencySpecifier,
+defaultConfig?: DependencySpecifier,
+env?: EnvMap,
+targets?: ?(Array<string> | {
+[string]: TargetDescriptor,
...
}),
+shouldDisableCache?: boolean,
+cacheDir?: FilePath,
+mode?: BuildMode,
+hmrOptions?: ?HMROptions,
+shouldContentHash?: boolean,
+serveOptions?: InitialServerOptions | false,
+shouldAutoInstall?: boolean,
+logLevel?: LogLevel,
+shouldProfile?: boolean,
+shouldPatchConsole?: boolean,
+shouldBuildLazily?: boolean,
+inputFS?: FileSystem,
+outputFS?: FileSystem,
+cache?: Cache,
+workerFarm?: WorkerFarm,
+packageManager?: PackageManager,
+detailedReport?: ?DetailedReportOptions,
+defaultTargetOptions?: {|
+shouldOptimize?: boolean,
+shouldScopeHoist?: boolean,
+sourceMaps?: boolean,
+publicUrl?: string,
+distDir?: FilePath,
+engines?: Engines,
+outputFormat?: OutputFormat,
+isLibrary?: boolean,
|},
+additionalReporters?: Array<{|
packageName: DependencySpecifier,
resolveFrom: FilePath,
|}>,
|}
InitialServerOptions parcel/packages/core/types/index.js:325
type InitialServerOptions = {|
+publicUrl?: string,
+host?: string,
+port: number,
+https?: HTTPSOptions | boolean,
|}
Referenced by:
InitialParcelOptionsPluginOptions parcel/packages/core/types/index.js:332
interface PluginOptions {
+mode: BuildMode,
+env: EnvMap,
+hmrOptions: ?HMROptions,
+serveOptions: ServerOptions | false,
+shouldBuildLazily: boolean,
+shouldAutoInstall: boolean,
+logLevel: LogLevel,
+projectRoot: FilePath,
+cacheDir: FilePath,
+inputFS: FileSystem,
+outputFS: FileSystem,
+packageManager: PackageManager,
+instanceId: string,
+detailedReport: ?DetailedReportOptions,
}
Referenced by:
Bundler, Compressor, DedicatedThreadValidator, MultiThreadValidator, Namer, Optimizer, Packager, Reporter, Resolver, Runtime, TransformerServerOptions parcel/packages/core/types/index.js:349
type ServerOptions = {|
+distDir: FilePath,
+host?: string,
+port: number,
+https?: HTTPSOptions | boolean,
+publicUrl?: string,
|}
Referenced by:
PluginOptionsHTTPSOptions parcel/packages/core/types/index.js:357
type HTTPSOptions = {|
+cert: FilePath,
+key: FilePath,
|}
Referenced by:
InitialServerOptions, ServerOptionsSourceLocation parcel/packages/core/types/index.js:365
Source locations are 1-based, meaning lines and columns start at 1
type SourceLocation = {|
+filePath: string,
+start: {|
+line: number,
+column: number,
|},
inclusive
+end: {|
+line: number,
+column: number,
|},
exclusive
|}
Referenced by:
AssetSymbols, Dependency, DependencyOptions, Environment, EnvironmentOptions, MutableAssetSymbols, MutableDependencySymbols, SymbolResolution, Target, TransformerResultMeta parcel/packages/core/types/index.js:382
An object that plugins can write arbitatry data to.
Type
type Meta = JSONObject;
Referenced by:
AssetSymbols, BaseAsset, Dependency, DependencyOptions, MutableAssetSymbols, MutableDependencySymbols, TransformerResultSymbol parcel/packages/core/types/index.js:387
An identifier in an asset (likely imported/exported).
Type
type Symbol = string;
Referenced by:
AssetSymbols, BundleGraph, DependencyOptions, ExportSymbolResolution, MutableAssetSymbols, MutableDependencySymbols, SymbolResolution, TransformerResultAssetSymbols parcel/packages/core/types/index.js:392
A map of export names to the corresponding asset's local variable names.
interface AssetSymbols extends Iterable<[Symbol, {|
local: Symbol,
loc: ?SourceLocation,
meta?: ?Meta,
|}]> {
+isCleared: boolean,
The exports of the asset are unknown, rather than just empty. This is the default state.
get(exportSymbol: Symbol): ?{|
local: Symbol,
loc: ?SourceLocation,
meta?: ?Meta,
|},
hasExportSymbol(exportSymbol: Symbol): boolean,
hasLocalSymbol(local: Symbol): boolean,
exportSymbols(): Iterable<Symbol>,
}
Referenced by:
BaseAsset, MutableAssetSymbolsMutableAssetSymbols parcel/packages/core/types/index.js:411
interface MutableAssetSymbols extends AssetSymbols {
ensure(): void,
Initilizes the map, sets isCleared to false.
set(exportSymbol: Symbol, local: Symbol, loc: ?SourceLocation, meta?: ?Meta): void,
delete(exportSymbol: Symbol): void,
}
Referenced by:
MutableAssetMutableDependencySymbols parcel/packages/core/types/index.js:428
isWeak means: the symbol is not used by the parent asset itself and is merely reexported
interface MutableDependencySymbols extends Iterable<[Symbol, {|
local: Symbol,
loc: ?SourceLocation,
isWeak: boolean,
meta?: ?Meta,
|}]> {
ensure(): void,
Initilizes the map, sets isCleared to false.
+isCleared: boolean,
The symbols taht are imports are unknown, rather than just empty. This is the default state.
get(exportSymbol: Symbol): ?{|
local: Symbol,
loc: ?SourceLocation,
isWeak: boolean,
meta?: ?Meta,
|},
hasExportSymbol(exportSymbol: Symbol): boolean,
hasLocalSymbol(local: Symbol): boolean,
exportSymbols(): Iterable<Symbol>,
set(exportSymbol: Symbol, local: Symbol, loc: ?SourceLocation, isWeak: ?boolean): void,
delete(exportSymbol: Symbol): void,
}
Referenced by:
DependencyDependencyPriority parcel/packages/core/types/index.js:462
Type
type DependencyPriority = 'sync' | 'parallel' | 'lazy';
Referenced by:
Dependency, DependencyOptions, ResolveResultSpecifierType parcel/packages/core/types/index.js:463
Type
type SpecifierType = 'commonjs' | 'esm' | 'url' | 'custom';
Referenced by:
Dependency, DependencyOptionsBundleBehavior parcel/packages/core/types/index.js:619
Type
type BundleBehavior = 'inline' | 'isolated';
Referenced by:
BaseAsset, Bundle, CreateBundleOpts, Dependency, DependencyOptions, MutableAsset, TransformerResultDevDepOptions parcel/packages/core/types/index.js:765
type DevDepOptions = {|
specifier: DependencySpecifier,
resolveFrom: FilePath,
range?: ?SemverRange,
additionalInvalidations?: Array<{|
specifier: DependencySpecifier,
resolveFrom: FilePath,
range?: ?SemverRange,
|}>,
When this dev dependency is invalidated, also invalidate these dependencies. This is useful if the parcel plugin or another parent dependency has its own cache for this dev dependency other than Node's require cache.
|}
Referenced by:
ConfigStats parcel/packages/core/types/index.js:847
type Stats = {|
time: number,
size: number,
|}
Referenced by:
Asset, PackagedBundleBlob parcel/packages/core/types/index.js:860
Type
type Blob = string | Buffer | Readable;
Referenced by:
BundleResult, GenerateOutput, Optimizer, Packager, TransformerResultAsync parcel/packages/core/types/index.js:914
Type
type Async<T> = T | Promise<T>;
Referenced by:
Bundler, Compressor, DedicatedThreadValidator, MultiThreadValidator, Namer, Optimizer, Packager, Reporter, Resolver, Runtime, TransformerPackagedBundle parcel/packages/core/types/index.js:1283
interface PackagedBundle extends NamedBundle {
+filePath: FilePath,
The absolute file path of the written bundle, including the final content hash if any.
+stats: Stats,
Statistics about the bundle.
}
Referenced by:
BuildSuccessEventGlobInvalidation parcel/packages/core/types/index.js:1456
type GlobInvalidation = {|
glob: Glob,
|}
Referenced by:
FileCreateInvalidationFileInvalidation parcel/packages/core/types/index.js:1460
type FileInvalidation = {|
filePath: FilePath,
|}
Referenced by:
FileCreateInvalidationFileAboveInvalidation parcel/packages/core/types/index.js:1464
type FileAboveInvalidation = {|
fileName: string,
aboveFilePath: FilePath,
|}
Referenced by:
FileCreateInvalidationFileCreateInvalidation parcel/packages/core/types/index.js:1469
Type
type FileCreateInvalidation = FileInvalidation | GlobInvalidation | FileAboveInvalidation;
Referenced by:
Config, MutableAsset, ResolveResultErrorWithCode parcel/packages/core/types/index.js:1828
interface ErrorWithCode extends Error {
+code?: string,
}
AsyncSubscription parcel/packages/core/types/index.js:1836
type AsyncSubscription = {|
unsubscribe(): Promise<mixed>,
|}