diff --git a/packages/core/core/src/requests/BundleGraphRequest.js b/packages/core/core/src/requests/BundleGraphRequest.js index 51d44f9c2..c0cfa8ddb 100644 --- a/packages/core/core/src/requests/BundleGraphRequest.js +++ b/packages/core/core/src/requests/BundleGraphRequest.js @@ -15,6 +15,7 @@ import type { } from '../types'; import type {ConfigAndCachePath} from './AtlaspackConfigRequest'; +import fs from 'fs'; import invariant from 'assert'; import assert from 'assert'; import nullthrows from 'nullthrows'; @@ -57,7 +58,11 @@ import createAssetGraphRequestJS from './AssetGraphRequest'; import {createAssetGraphRequestRust} from './AssetGraphRequestRust'; import {tracer, PluginTracer} from '@atlaspack/profiler'; import {requestTypes} from '../RequestTracker'; -import {assetGraphToDot, getDebugAssetGraphDotPath} from './asset-graph-dot'; +import { + assetGraphToDot, + getDebugAssetGraphDotPath, + getDebugAssetGraphDotOptions, +} from './asset-graph-dot'; type BundleGraphRequestInput = {| requestedAssetIds: Set, @@ -113,18 +118,18 @@ export default function createBundleGraphRequest( requestedAssetIds, }); - let result = await api.runRequest(request, { - force: options.shouldBuildLazily && requestedAssetIds.size > 0, - }); - - let {changedAssets, assetRequests} = result; - let assetGraph: AssetGraph = result.assetGraph; + let {assetGraph, changedAssets, assetRequests} = await api.runRequest( + request, + { + force: options.shouldBuildLazily && requestedAssetIds.size > 0, + }, + ); let debugAssetGraphDotPath = getDebugAssetGraphDotPath(); if (debugAssetGraphDotPath !== null) { - require('fs').writeFileSync( + await fs.promises.writeFile( debugAssetGraphDotPath, - assetGraphToDot(assetGraph), + assetGraphToDot(assetGraph, getDebugAssetGraphDotOptions()), 'utf8', ); } diff --git a/packages/core/core/src/requests/asset-graph-dot.js b/packages/core/core/src/requests/asset-graph-dot.js index 5d8c6598a..5e3865636 100644 --- a/packages/core/core/src/requests/asset-graph-dot.js +++ b/packages/core/core/src/requests/asset-graph-dot.js @@ -72,12 +72,12 @@ export function getDebugAssetGraphDotPath(): string | null { return debugAssetGraphDot; } -export function getDebugAssetGraphDotPathOptions(): AssetGraphToDotOptions { +export function getDebugAssetGraphDotOptions(): AssetGraphToDotOptions { const options: AssetGraphToDotOptions = {}; let style = process.env.DEBUG_ASSET_GRAPH_DOT_STYLE; if (style !== undefined) { - options.sort = style === 'true'; + options.style = style === 'true'; } let sort = process.env.DEBUG_ASSET_GRAPH_DOT_SORT; diff --git a/packages/runtimes/js/src/JSRuntime.js b/packages/runtimes/js/src/JSRuntime.js index 2c54c7293..612584bfd 100644 --- a/packages/runtimes/js/src/JSRuntime.js +++ b/packages/runtimes/js/src/JSRuntime.js @@ -322,7 +322,6 @@ export default (new Runtime({ )})(${getAbsoluteUrlExpr( relativePathExpr, bundle, - referencedBundle, config.domainSharding, )})`; assets.push({ @@ -497,7 +496,6 @@ function getLoaderRuntime({ absoluteUrlExpr = getAbsoluteUrlExpr( relativePathExpr, bundle, - to, shardingConfig, ); } @@ -696,7 +694,6 @@ function getHintLoaders( `require(${JSON.stringify(loader)})(${getAbsoluteUrlExpr( relativePathExpr, from, - bundleToPreload, )}, ${priority ? JSON.stringify(priority) : 'null'}, ${JSON.stringify( bundleToPreload.target.env.outputFormat === 'esmodule', )})`, @@ -759,7 +756,6 @@ function getURLRuntime( code = `module.exports = ${getAbsoluteUrlExpr( relativePathExpr, from, - to, shardingConfig, )};`; } @@ -834,7 +830,6 @@ function getRelativePathExpr( function getAbsoluteUrlExpr( relativePathExpr: string, fromBundle: NamedBundle, - toBundle: NamedBundle, shardingConfig: JSRuntimeConfig['domainSharding'], ) { if (