Repository: parcel-bundler/parcel
File: packages/dev/query/src/deep-imports.js (JavaScript)

Code before:
} from '@parcel/core/src/types.js';

module.exports = ((process.env.PARCEL_BUILD_ENV === 'production'
  ? {
      // Split up require specifier to outsmart packages/dev/babel-register/babel-plugin-module-translate.js
      // $FlowFixMe(unsupported-syntax)
      AssetGraph: require('@parcel/core' + '/lib/AssetGraph.js').default,
      // $FlowFixMe(unsupported-syntax)
      BundleGraph: require('@parcel/core' + '/lib/BundleGraph.js'),
      // $FlowFixMe(unsupported-syntax)
      RequestTracker: require('@parcel/core' + '/lib/RequestTracker.js'),
      // $FlowFixMe(unsupported-syntax)
      LMDBCache: require('@parcel/cache' + '/lib/LMDBCache.js').LMDBCache,
      // $FlowFixMe(unsupported-syntax)
      Types: require('@parcel/core' + '/lib/types.js'),
      // $FlowFixMe(unsupported-syntax)
      fromProjectPathRelative: require('@parcel/core' + '/lib/projectPath.js')
        .fromProjectPathRelative,
    }
  : {
      AssetGraph: require('@parcel/core/src/AssetGraph.js').default,
      // $FlowFixMe(incompatible-cast)
      BundleGraph: require('@parcel/core/src/BundleGraph.js'),
      RequestTracker: require('@parcel/core/src/RequestTracker.js'),
      LMDBCache: require('@parcel/cache/src/LMDBCache.js').LMDBCache,
      // $FlowFixMe(incompatible-cast)
      Types: require('@parcel/core/src/types.js'),
      fromProjectPathRelative: require('@parcel/core/src/projectPath.js')
        .fromProjectPathRelative,
    }): {|
  AssetGraph: AssetGraph,
  BundleGraph: {
    default: BundleGraph,
    bundleGraphEdgeTypes: bundleGraphEdgeTypes,
    BundleGraphEdgeType: BundleGraphEdgeType,
    ...
  },
  RequestTracker: {
    default: RequestTracker,
    RequestGraph: RequestGraph,
    requestGraphEdgeTypes: requestGraphEdgeTypes,
    requestTypes: requestTypes,
    ...
  },
  LMDBCache: LMDBCache,
  Types: {
    Priority: Priority,
    AssetGraphNode: AssetGraphNode,
    BundleGraphNode: BundleGraphNode,
    PackagedBundleInfo: PackagedBundleInfo,
    ...

Review comment (suggestion):
Added these $FlowFixMe's for cases where there's `import type` instead of `import typeof`, I was running into some incompatible call errors that I wasn't sure how to resolve..

Code after:
        AssetGraph: require('@parcel/core' + '/lib/AssetGraph.js').default,
        // $FlowFixMe(unsupported-syntax)
        BundleGraph: require('@parcel/core' + '/lib/BundleGraph.js'),
        // $FlowFixMe(unsupported-syntax)
        RequestTracker: require('@parcel/core' + '/lib/RequestTracker.js'),
        // $FlowFixMe(unsupported-syntax)
        LMDBCache: require('@parcel/cache' + '/lib/LMDBCache.js').LMDBCache,
        // $FlowFixMe(unsupported-syntax)
        Priority: require('@parcel/core' + '/lib/types.js').Priority,
        // $FlowFixMe(unsupported-syntax)
        fromProjectPathRelative: require('@parcel/core' + '/lib/projectPath.js')
          .fromProjectPathRelative,
      }
    : {
        AssetGraph: require('@parcel/core/src/AssetGraph.js').default,
        BundleGraph: require('@parcel/core/src/BundleGraph.js'),
        RequestTracker: require('@parcel/core/src/RequestTracker.js'),
        LMDBCache: require('@parcel/cache/src/LMDBCache.js').LMDBCache,
        Priority: require('@parcel/core/src/types.js').Priority,
        fromProjectPathRelative: require('@parcel/core/src/projectPath.js')
          .fromProjectPathRelative,
      };

module.exports = (v: {|
  AssetGraph: AssetGraph,
  BundleGraph: {
    default: BundleGraph,
    bundleGraphEdgeTypes: bundleGraphEdgeTypes,
    ...
  },
  RequestTracker: {
    default: RequestTracker,
    RequestGraph: RequestGraph,
    requestGraphEdgeTypes: requestGraphEdgeTypes,
    ...
  },
  LMDBCache: LMDBCache,
  Priority: Priority,
  fromProjectPathRelative: fromProjectPathRelative,
|});