Repository: parcel-bundler/parcel
File: packages/core/core/src/types.js (JavaScript)

Code before:
  extends?: PackageName | FilePath | Array<PackageName | FilePath>,
  resolvers?: PureParcelConfigPipeline,
  transformers?: {[Glob]: ExtendableParcelConfigPipeline, ...},
  bundler: ?ParcelPluginNode,
  namers?: PureParcelConfigPipeline,
  runtimes?: {[EnvironmentContext]: PureParcelConfigPipeline, ...},
  packagers?: {[Glob]: ParcelPluginNode, ...},
  optimizers?: {[Glob]: ExtendableParcelConfigPipeline, ...},
  reporters?: PureParcelConfigPipeline,
  validators?: {[Glob]: ExtendableParcelConfigPipeline, ...},
  filePath: FilePath,
  resolveFrom?: FilePath,
|};

export type Environment = {|
  context: EnvironmentContext,
  engines: Engines,
  includeNodeModules:
    | boolean
    | Array<PackageName>
    | {[PackageName]: boolean, ...},
  outputFormat: OutputFormat,
  isLibrary: boolean,
  minify: boolean,
  scopeHoist: boolean,
  unsafeInlining: boolean,
|};

export type Target = {|
  distEntry?: ?FilePath,
  distDir: FilePath,
  env: Environment,
  sourceMap?: TargetSourceMapOptions,
  name: string,
  publicUrl: string,
  loc?: ?SourceLocation,
  pipeline?: string,
|};

export type Dependency = {|
  id: string,
  moduleSpecifier: ModuleSpecifier,
  isAsync: boolean,
  isEntry: ?boolean,
  isOptional: boolean,
  isURL: boolean,
  isWeak: ?boolean,
  isIsolated: boolean,
  loc: ?SourceLocation,
  env: Environment,
  meta: Meta,

Review comment (suggestion):
Now I'm wondering whether this should really be in the environment or whether the JS transformer should have its own config for this, kinda like how we did it for the bundler? Maybe we'll want to allow more detailed options for this in the future. Could be something like this, in package.json:

```json
{
  "@parcel/transformer-js": {
    "inlineFS": true,
    "inlineEnvironment": true | ["NODE_ENV", "MY_CUSTOM_VAR"]
  }
}
```

Not really sure when you'd need to configure that per target...

Code after:
  extends?: PackageName | FilePath | Array<PackageName | FilePath>,
  resolvers?: PureParcelConfigPipeline,
  transformers?: {[Glob]: ExtendableParcelConfigPipeline, ...},
  bundler: ?ParcelPluginNode,
  namers?: PureParcelConfigPipeline,
  runtimes?: {[EnvironmentContext]: PureParcelConfigPipeline, ...},
  packagers?: {[Glob]: ParcelPluginNode, ...},
  optimizers?: {[Glob]: ExtendableParcelConfigPipeline, ...},
  reporters?: PureParcelConfigPipeline,
  validators?: {[Glob]: ExtendableParcelConfigPipeline, ...},
  filePath: FilePath,
  resolveFrom?: FilePath,
|};

export type Environment = {|
  context: EnvironmentContext,
  engines: Engines,
  includeNodeModules:
    | boolean
    | Array<PackageName>
    | {[PackageName]: boolean, ...},
  outputFormat: OutputFormat,
  isLibrary: boolean,
  minify: boolean,
  scopeHoist: boolean,
|};

export type Target = {|
  distEntry?: ?FilePath,
  distDir: FilePath,
  env: Environment,
  sourceMap?: TargetSourceMapOptions,
  name: string,
  publicUrl: string,
  loc?: ?SourceLocation,
  pipeline?: string,
|};

export type Dependency = {|
  id: string,
  moduleSpecifier: ModuleSpecifier,
  isAsync: boolean,
  isEntry: ?boolean,
  isOptional: boolean,
  isURL: boolean,
  isWeak: ?boolean,
  isIsolated: boolean,
  loc: ?SourceLocation,
  env: Environment,
  meta: Meta,
  target: ?Target,