@@ -9,7 +9,6 @@ const util = require("util");
99const Entrypoint = require ( "./Entrypoint" ) ;
1010const ModuleGraphConnection = require ( "./ModuleGraphConnection" ) ;
1111const { DEFAULTS } = require ( "./config/defaults" ) ;
12- const { isExportInlined } = require ( "./optimize/InlineExports" ) ;
1312const { first } = require ( "./util/SetHelpers" ) ;
1413const SortableSet = require ( "./util/SortableSet" ) ;
1514const {
@@ -22,7 +21,6 @@ const {
2221} = require ( "./util/comparators" ) ;
2322const createHash = require ( "./util/createHash" ) ;
2423const findGraphRoots = require ( "./util/findGraphRoots" ) ;
25- const memoize = require ( "./util/memoize" ) ;
2624const {
2725 RuntimeSpecMap,
2826 RuntimeSpecSet,
@@ -31,10 +29,6 @@ const {
3129 runtimeToString
3230} = require ( "./util/runtime" ) ;
3331
34- const getHarmonyImportSpecifierDependency = memoize ( ( ) =>
35- require ( "./dependencies/HarmonyImportSpecifierDependency" )
36- ) ;
37-
3832/** @import AsyncDependenciesBlock from "./AsyncDependenciesBlock" */
3933/** @import Chunk, { Chunks, Entrypoints, ChunkId } from "./Chunk" */
4034/** @import ChunkGroup from "./ChunkGroup" */
@@ -66,32 +60,16 @@ const ZERO_BIG_INT = BigInt(0);
6660 * Active state to string. Module-level (depends only on ModuleGraphConnection)
6761 * so it isn't re-allocated on every getModuleGraphHash call, incl. cache hits.
6862 * @param {ConnectionState } state state
69- * @returns {"F" | "T" | "O" } result
63+ * @returns {"F" | "T" | "O" | "I" } result
7064 */
7165const activeStateToString = ( state ) => {
7266 if ( state === false ) return "F" ;
7367 if ( state === true ) return "T" ;
7468 if ( state === ModuleGraphConnection . TRANSITIVE_ONLY ) return "O" ;
69+ if ( state === ModuleGraphConnection . INACTIVE_INLINED ) return "I" ;
7570 throw new Error ( "Not implemented active state" ) ;
7671} ;
7772
78- /**
79- * True when an inactive connection still embeds an inlined export literal
80- * in the referencing module's generated code (must stay in its hash).
81- * @param {ModuleGraph } moduleGraph module graph
82- * @param {ModuleGraphConnection } connection connection
83- * @param {RuntimeSpec } runtime runtime
84- * @returns {boolean } true when the connection contributes an inlined literal
85- */
86- const connectionInactiveDueToInlining = ( moduleGraph , connection , runtime ) => {
87- const module = connection . module ;
88- if ( ! module ) return false ;
89- const dep = connection . dependency ;
90- // Lazy: top-level require cycles Module → ChunkGraph → dependency → Module.
91- if ( ! ( dep instanceof getHarmonyImportSpecifierDependency ( ) ) ) return false ;
92- return isExportInlined ( moduleGraph , module , dep . getIds ( moduleGraph ) , runtime ) ;
93- } ;
94-
9573const compareModuleIterables = compareIterables ( compareModulesByIdentifier ) ;
9674
9775/** @typedef {(c: Chunk, chunkGraph: ChunkGraph) => boolean } ChunkFilterPredicate */
@@ -415,7 +393,9 @@ class ChunkGraph {
415393 for ( const connection of moduleGraph . getOutgoingConnections ( module ) ) {
416394 if ( ! connection . module ) continue ;
417395 const activeState = connection . getActiveState ( undefined ) ;
418- if ( activeState === false ) continue ;
396+ if ( ModuleGraphConnection . isInactiveForInclusion ( activeState ) ) {
397+ continue ;
398+ }
419399 if ( activeState === ModuleGraphConnection . TRANSITIVE_ONLY ) {
420400 addDependencies ( connection . module ) ;
421401 continue ;
@@ -1908,18 +1888,9 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
19081888 if ( runtime === undefined || typeof runtime === "string" ) {
19091889 for ( const connection of connections ) {
19101890 const state = connection . getActiveState ( runtime ) ;
1911- if ( state === false ) {
1912- // Keep inlined imports in the hash: their literals are
1913- // embedded in this module's codegen (#22019).
1914- if (
1915- connectionInactiveDueToInlining (
1916- this . moduleGraph ,
1917- connection ,
1918- runtime
1919- )
1920- ) {
1921- processConnection ( connection , "I" ) ;
1922- }
1891+ if ( state === false ) continue ;
1892+ if ( state === ModuleGraphConnection . INACTIVE_INLINED ) {
1893+ processConnection ( connection , "I" ) ;
19231894 continue ;
19241895 }
19251896 processConnection ( connection , state === true ? "T" : "O" ) ;
@@ -1941,16 +1912,9 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
19411912 ) ;
19421913 if ( states . size === 1 ) {
19431914 const state = first ( states ) ;
1944- if ( state === false ) {
1945- if (
1946- connectionInactiveDueToInlining (
1947- this . moduleGraph ,
1948- connection ,
1949- runtime
1950- )
1951- ) {
1952- processConnection ( connection , "I" ) ;
1953- }
1915+ if ( state === false ) continue ;
1916+ if ( state === ModuleGraphConnection . INACTIVE_INLINED ) {
1917+ processConnection ( connection , "I" ) ;
19541918 continue ;
19551919 }
19561920 stateInfo = activeStateToString (
0 commit comments