@parcel/types
Advanced tools
Comparing version 2.0.0-alpha.2.1 to 2.0.0-alpha.3
255
index.js
@@ -8,2 +8,4 @@ // @flow strict-local | ||
import type {PackageManager} from '@parcel/package-manager'; | ||
import type {Diagnostic} from '@parcel/diagnostic'; | ||
import type {PluginLogger} from '@parcel/logger'; | ||
@@ -17,2 +19,3 @@ import type {AST as _AST, ConfigResult as _ConfigResult} from './unsafe'; | ||
| null | ||
| void // ? Is this okay? | ||
| boolean | ||
@@ -35,3 +38,3 @@ | number | ||
export type ParcelConfigFile = { | ||
export type ParcelConfigFile = {| | ||
extends?: PackageName | FilePath | Array<PackageName | FilePath>, | ||
@@ -46,10 +49,10 @@ resolvers?: Array<PackageName>, | ||
reporters?: Array<PackageName>, | ||
validators?: {[Glob]: Array<PackageName>, ...}, | ||
... | ||
}; | ||
validators?: {[Glob]: Array<PackageName>, ...} | ||
|}; | ||
export type ResolvedParcelConfigFile = ParcelConfigFile & { | ||
export type ResolvedParcelConfigFile = {| | ||
...ParcelConfigFile, | ||
filePath: FilePath, | ||
... | ||
}; | ||
resolveFrom?: FilePath | ||
|}; | ||
@@ -64,8 +67,7 @@ export type Engines = { | ||
export type TargetSourceMapOptions = { | ||
export type TargetSourceMapOptions = {| | ||
sourceRoot?: string, | ||
inline?: boolean, | ||
inlineSources?: boolean, | ||
... | ||
}; | ||
inlineSources?: boolean | ||
|}; | ||
@@ -97,3 +99,4 @@ export interface Target { | ||
distDir?: FilePath, | ||
sourceMap?: TargetSourceMapOptions | ||
sourceMap?: TargetSourceMapOptions, | ||
isLibrary?: boolean | ||
|}; | ||
@@ -106,3 +109,3 @@ | ||
export type EnvironmentOpts = { | ||
export type EnvironmentOpts = {| | ||
context?: EnvironmentContext, | ||
@@ -112,5 +115,4 @@ engines?: Engines, | ||
outputFormat?: OutputFormat, | ||
isLibrary?: boolean, | ||
... | ||
}; | ||
isLibrary?: boolean | ||
|}; | ||
@@ -132,2 +134,3 @@ export type VersionMap = { | ||
isElectron(): boolean; | ||
isWorker(): boolean; | ||
isIsolated(): boolean; | ||
@@ -146,2 +149,3 @@ matchesEngines(minVersions: VersionMap): boolean; | ||
module?: FilePath, | ||
types?: FilePath, | ||
browser?: FilePath | {[FilePath]: FilePath | boolean, ...}, | ||
@@ -229,12 +233,10 @@ source?: FilePath | {[FilePath]: FilePath, ...}, | ||
filePath: string, | ||
start: { | ||
start: {| | ||
line: number, | ||
column: number, | ||
... | ||
}, | ||
end: { | ||
column: number | ||
|}, | ||
end: {| | ||
line: number, | ||
column: number, | ||
... | ||
} | ||
column: number | ||
|} | ||
|}; | ||
@@ -282,9 +284,8 @@ | ||
export type File = { | ||
export type File = {| | ||
filePath: FilePath, | ||
hash?: string, | ||
... | ||
}; | ||
hash?: string | ||
|}; | ||
interface BaseAsset { | ||
export interface BaseAsset { | ||
+ast: ?AST; | ||
@@ -312,7 +313,6 @@ +env: Environment; | ||
filePaths: Array<FilePath>, | ||
options: ?{ | ||
options: ?{| | ||
packageKey?: string, | ||
parse?: boolean, | ||
... | ||
} | ||
parse?: boolean | ||
|} | ||
): Promise<ConfigResult | null>; | ||
@@ -348,2 +348,3 @@ getPackage(): Promise<PackageJSON | null>; | ||
+env: Environment; | ||
+resolvedPath: ?FilePath; | ||
@@ -359,17 +360,15 @@ setResolvedPath(filePath: FilePath): void; | ||
filePaths: Array<FilePath>, | ||
options: ?{ | ||
options: ?{| | ||
packageKey?: string, | ||
parse?: boolean, | ||
exclude?: boolean, | ||
... | ||
} | ||
exclude?: boolean | ||
|} | ||
): Promise<ConfigResult | null>; | ||
getConfig( | ||
filePaths: Array<FilePath>, | ||
options: ?{ | ||
options: ?{| | ||
packageKey?: string, | ||
parse?: boolean, | ||
exclude?: boolean, | ||
... | ||
} | ||
exclude?: boolean | ||
|} | ||
): Promise<ConfigResult | null>; | ||
@@ -407,2 +406,3 @@ getPackage(): Promise<PackageJSON | null>; | ||
meta?: Meta; | ||
pipeline?: ?string; | ||
symbols?: Map<Symbol, Symbol>; | ||
@@ -413,5 +413,5 @@ sideEffects?: boolean; | ||
type Async<T> = T | Promise<T>; | ||
export type Async<T> = T | Promise<T>; | ||
type ResolveFn = (from: FilePath, to: string) => Promise<FilePath>; | ||
export type ResolveFn = (from: FilePath, to: string) => Promise<FilePath>; | ||
@@ -422,41 +422,50 @@ type ResolveConfigFn = ( | ||
export type ValidateResult = {| | ||
warnings: Array<Diagnostic>, | ||
errors: Array<Diagnostic> | ||
|}; | ||
export type Validator = {| | ||
validate({ | ||
validate({| | ||
asset: Asset, | ||
config: ConfigResult | void, | ||
options: PluginOptions, | ||
... | ||
}): Async<void>, | ||
getConfig?: ({ | ||
logger: PluginLogger | ||
|}): Async<ValidateResult | void>, | ||
getConfig?: ({| | ||
asset: Asset, | ||
resolveConfig: ResolveConfigFn, | ||
options: PluginOptions, | ||
... | ||
}) => Async<ConfigResult | void> | ||
logger: PluginLogger | ||
|}) => Async<ConfigResult | void> | ||
|}; | ||
export type Transformer = { | ||
export type Transformer = {| | ||
// TODO: deprecate getConfig | ||
getConfig?: ({ | ||
getConfig?: ({| | ||
asset: MutableAsset, | ||
resolve: ResolveFn, | ||
options: PluginOptions, | ||
... | ||
}) => Async<ConfigResult | void>, | ||
loadConfig?: ({ | ||
logger: PluginLogger | ||
|}) => Async<ConfigResult | void>, | ||
loadConfig?: ({| | ||
config: Config, | ||
options: PluginOptions, | ||
... | ||
}) => Async<void>, | ||
rehydrateConfig?: ({ | ||
logger: PluginLogger | ||
|}) => Async<void>, | ||
preSerializeConfig?: ({| | ||
config: Config, | ||
options: PluginOptions | ||
|}) => Async<void>, | ||
postDeserializeConfig?: ({| | ||
config: Config, | ||
options: PluginOptions, | ||
... | ||
}) => Async<void>, | ||
canReuseAST?: ({ | ||
logger: PluginLogger | ||
|}) => Async<void>, | ||
canReuseAST?: ({| | ||
ast: AST, | ||
options: PluginOptions, | ||
... | ||
}) => boolean, | ||
parse?: ({ | ||
logger: PluginLogger | ||
|}) => boolean, | ||
parse?: ({| | ||
asset: MutableAsset, | ||
@@ -466,5 +475,5 @@ config: ?ConfigResult, | ||
options: PluginOptions, | ||
... | ||
}) => Async<?AST>, | ||
transform({ | ||
logger: PluginLogger | ||
|}) => Async<?AST>, | ||
transform({| | ||
asset: MutableAsset, | ||
@@ -474,5 +483,5 @@ config: ?ConfigResult, | ||
options: PluginOptions, | ||
... | ||
}): Async<Array<TransformerResult | MutableAsset>>, | ||
generate?: ({ | ||
logger: PluginLogger | ||
|}): Async<Array<TransformerResult | MutableAsset>>, | ||
generate?: ({| | ||
asset: MutableAsset, | ||
@@ -482,5 +491,5 @@ config: ?ConfigResult, | ||
options: PluginOptions, | ||
... | ||
}) => Async<GenerateOutput>, | ||
postProcess?: ({ | ||
logger: PluginLogger | ||
|}) => Async<GenerateOutput>, | ||
postProcess?: ({| | ||
assets: Array<MutableAsset>, | ||
@@ -490,6 +499,5 @@ config: ?ConfigResult, | ||
options: PluginOptions, | ||
... | ||
}) => Async<Array<TransformerResult>>, | ||
... | ||
}; | ||
logger: PluginLogger | ||
|}) => Async<Array<TransformerResult>> | ||
|}; | ||
@@ -564,3 +572,2 @@ export interface TraversalActions { | ||
hasAsset(Asset): boolean; | ||
hasChildBundles(): boolean; | ||
getHash(): string; | ||
@@ -578,7 +585,6 @@ traverseAssets<TContext>(visit: GraphVisitor<Asset, TContext>): ?TContext; | ||
export type BundleGroup = { | ||
export type BundleGroup = {| | ||
target: Target, | ||
entryAssetId: string, | ||
... | ||
}; | ||
entryAssetId: string | ||
|}; | ||
@@ -613,8 +619,9 @@ export interface MutableBundleGraph { | ||
bundle: Bundle | ||
): Array<{ | ||
): Array<{| | ||
bundleGroup: BundleGroup, | ||
dependency: Dependency, | ||
... | ||
}>; | ||
dependency: Dependency | ||
|}>; | ||
getBundlesInBundleGroup(bundleGroup: BundleGroup): Array<Bundle>; | ||
getChildBundles(bundle: Bundle): Array<Bundle>; | ||
getSiblingBundles(bundle: Bundle): Array<Bundle>; | ||
getDependencies(asset: Asset): Array<Dependency>; | ||
@@ -649,21 +656,21 @@ getIncomingDependencies(asset: Asset): Array<Dependency>; | ||
export type Bundler = {| | ||
bundle({ | ||
bundle({| | ||
bundleGraph: MutableBundleGraph, | ||
options: PluginOptions, | ||
... | ||
}): Async<void>, | ||
optimize({ | ||
logger: PluginLogger | ||
|}): Async<void>, | ||
optimize({| | ||
bundleGraph: MutableBundleGraph, | ||
options: PluginOptions, | ||
... | ||
}): Async<void> | ||
logger: PluginLogger | ||
|}): Async<void> | ||
|}; | ||
export type Namer = {| | ||
name({ | ||
name({| | ||
bundle: Bundle, | ||
bundleGraph: BundleGraph, | ||
options: PluginOptions, | ||
... | ||
}): Async<?FilePath> | ||
logger: PluginLogger | ||
|}): Async<?FilePath> | ||
|}; | ||
@@ -679,12 +686,12 @@ | ||
export type Runtime = {| | ||
apply({ | ||
apply({| | ||
bundle: NamedBundle, | ||
bundleGraph: BundleGraph, | ||
options: PluginOptions, | ||
... | ||
}): Async<void | RuntimeAsset | Array<RuntimeAsset>> | ||
logger: PluginLogger | ||
|}): Async<void | RuntimeAsset | Array<RuntimeAsset>> | ||
|}; | ||
export type Packager = {| | ||
package({ | ||
package({| | ||
bundle: NamedBundle, | ||
@@ -694,12 +701,12 @@ bundleGraph: BundleGraph, | ||
getSourceMapReference: (map: SourceMap) => Promise<string> | string, | ||
logger: PluginLogger, | ||
getInlineBundleContents: ( | ||
Bundle, | ||
BundleGraph | ||
) => Async<{|contents: Blob, map: ?(Readable | string)|}>, | ||
... | ||
}): Async<BundleResult> | ||
) => Async<{|contents: Blob, map: ?(Readable | string)|}> | ||
|}): Async<BundleResult> | ||
|}; | ||
export type Optimizer = {| | ||
optimize({ | ||
optimize({| | ||
bundle: NamedBundle, | ||
@@ -709,12 +716,13 @@ contents: Blob, | ||
options: PluginOptions, | ||
... | ||
}): Async<BundleResult> | ||
logger: PluginLogger | ||
|}): Async<BundleResult> | ||
|}; | ||
export type Resolver = {| | ||
resolve({ | ||
resolve({| | ||
dependency: Dependency, | ||
options: PluginOptions, | ||
... | ||
}): Async<?ResolveResult> | ||
logger: PluginLogger, | ||
filePath: FilePath | ||
|}): Async<?ResolveResult> | ||
|}; | ||
@@ -728,15 +736,16 @@ | ||
export type LogEvent = | ||
| ProgressLogEvent | ||
| {| | ||
+type: 'log', | ||
+level: 'error' | 'warn', | ||
+message: string | Error | ||
|} | ||
| {| | ||
+type: 'log', | ||
+level: 'info' | 'success' | 'verbose', | ||
+message: string | ||
|}; | ||
export type DiagnosticLogEvent = {| | ||
+type: 'log', | ||
+level: 'error' | 'warn' | 'info' | 'verbose', | ||
+diagnostics: Array<Diagnostic> | ||
|}; | ||
export type TextLogEvent = {| | ||
+type: 'log', | ||
+level: 'success', | ||
+message: string | ||
|}; | ||
export type LogEvent = ProgressLogEvent | DiagnosticLogEvent | TextLogEvent; | ||
export type BuildStartEvent = {| | ||
@@ -799,3 +808,3 @@ type: 'buildStart' | ||
type: 'buildFailure', | ||
error: Error | ||
diagnostics: Array<Diagnostic> | ||
|}; | ||
@@ -821,3 +830,7 @@ | ||
export type Reporter = {| | ||
report(event: ReporterEvent, opts: PluginOptions): Async<void> | ||
report({| | ||
event: ReporterEvent, | ||
options: PluginOptions, | ||
logger: PluginLogger | ||
|}): Async<void> | ||
|}; | ||
@@ -824,0 +837,0 @@ |
{ | ||
"name": "@parcel/types", | ||
"version": "2.0.0-alpha.2.1", | ||
"version": "2.0.0-alpha.3", | ||
"license": "MIT", | ||
@@ -13,3 +13,3 @@ "main": "src/index.js", | ||
}, | ||
"gitHead": "2c01341d81c41a70cb33acb51fff621353b3e494" | ||
"gitHead": "0c8a00c0aa82569edf2c25dca2412c0d21de00ad" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20853
730