webpack 5.43.0 → 5.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

@@ -67,6 +67,9 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
67
67
  } = compilation;
68
68
  const fn = RuntimeGlobals.ensureChunkHandlers;
69
69
  const withBaseURI = this._runtimeRequirements.has(RuntimeGlobals.baseURI);
70
+ const withExternalInstallChunk = this._runtimeRequirements.has(
71
+ RuntimeGlobals.externalInstallChunk
72
+ );
70
73
  const withLoading = this._runtimeRequirements.has(
71
74
  RuntimeGlobals.ensureChunkHandlers
72
75
  );
@@ -110,6 +113,38 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
110
113
  ),
111
114
  "};",
112
115
  "",
116
+ withLoading || withExternalInstallChunk
117
+ ? `var installChunk = ${runtimeTemplate.basicFunction("data", [
118
+ runtimeTemplate.destructureObject(
119
+ ["ids", "modules", "runtime"],
120
+ "data"
121
+ ),
122
+ '// add "modules" to the modules object,',
123
+ '// then flag all "ids" as loaded and fire callback',
124
+ "var moduleId, chunkId, i = 0;",
125
+ "for(moduleId in modules) {",
126
+ Template.indent([
127
+ `if(${RuntimeGlobals.hasOwnProperty}(modules, moduleId)) {`,
128
+ Template.indent(
129
+ `${RuntimeGlobals.moduleFactories}[moduleId] = modules[moduleId];`
130
+ ),
131
+ "}"
132
+ ]),
133
+ "}",
134
+ "if(runtime) runtime(__webpack_require__);",
135
+ "for(;i < ids.length; i++) {",
136
+ Template.indent([
137
+ "chunkId = ids[i];",
138
+ `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`,
139
+ Template.indent("installedChunks[chunkId][0]();"),
140
+ "}",
141
+ "installedChunks[ids[i]] = 0;"
142
+ ]),
143
+ "}",
144
+ withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : ""
145
+ ])}`
146
+ : "// no install chunk",
147
+ "",
113
148
  withLoading
114
149
  ? Template.asString([
115
150
  `${fn}.j = ${runtimeTemplate.basicFunction(
@@ -137,45 +172,13 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
137
172
  rootOutputDir
138
173
  )} + ${
139
174
  RuntimeGlobals.getChunkScriptFilename
140
- }(chunkId)).then(${runtimeTemplate.basicFunction(
141
- "data",
175
+ }(chunkId)).then(installChunk, ${runtimeTemplate.basicFunction(
176
+ "e",
142
177
  [
143
- runtimeTemplate.destructureObject(
144
- ["ids", "modules", "runtime"],
145
- "data"
146
- ),
147
- '// add "modules" to the modules object,',
148
- '// then flag all "ids" as loaded and fire callback',
149
- "var moduleId, chunkId, i = 0;",
150
- "for(moduleId in modules) {",
151
- Template.indent([
152
- `if(${RuntimeGlobals.hasOwnProperty}(modules, moduleId)) {`,
153
- Template.indent(
154
- `${RuntimeGlobals.moduleFactories}[moduleId] = modules[moduleId];`
155
- ),
156
- "}"
157
- ]),
158
- "}",
159
- "if(runtime) runtime(__webpack_require__);",
160
- "for(;i < ids.length; i++) {",
161
- Template.indent([
162
- "chunkId = ids[i];",
163
- `if(${RuntimeGlobals.hasOwnProperty}(installedChunks, chunkId) && installedChunks[chunkId]) {`,
164
- Template.indent(
165
- "installedChunks[chunkId][0]();"
166
- ),
167
- "}",
168
- "installedChunks[ids[i]] = 0;"
169
- ]),
170
- "}",
171
- withOnChunkLoad
172
- ? `${RuntimeGlobals.onChunksLoaded}();`
173
- : ""
178
+ "if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;",
179
+ "throw e;"
174
180
  ]
175
- )}, ${runtimeTemplate.basicFunction("e", [
176
- "if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;",
177
- "throw e;"
178
- ])});`,
181
+ )});`,
179
182
  `var promise = Promise.race([promise, new Promise(${runtimeTemplate.expressionFunction(
180
183
  `installedChunkData = installedChunks[chunkId] = [resolve]`,
181
184
  "resolve"
@@ -193,6 +196,12 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
193
196
  ])
194
197
  : "// no chunk on demand loading",
195
198
  "",
199
+ withExternalInstallChunk
200
+ ? Template.asString([
201
+ `${RuntimeGlobals.externalInstallChunk} = installChunk;`
202
+ ])
203
+ : "// no external install chunk",
204
+ "",
196
205
  withOnChunkLoad
197
206
  ? `${
198
207
  RuntimeGlobals.onChunksLoaded
@@ -9,6 +9,7 @@ var $interceptModuleExecution$ = undefined;
9
9
  var $moduleCache$ = undefined;
10
10
  // eslint-disable-next-line no-unused-vars
11
11
  var $hmrModuleData$ = undefined;
12
+ /** @type {() => Promise} */
12
13
  var $hmrDownloadManifest$ = undefined;
13
14
  var $hmrDownloadUpdateHandlers$ = undefined;
14
15
  var $hmrInvalidateModuleHandlers$ = undefined;
@@ -209,8 +210,12 @@ module.exports = function () {
209
210
 
210
211
  function setStatus(newStatus) {
211
212
  currentStatus = newStatus;
213
+ var results = [];
214
+
212
215
  for (var i = 0; i < registeredStatusHandlers.length; i++)
213
- registeredStatusHandlers[i].call(null, newStatus);
216
+ results[i] = registeredStatusHandlers[i].call(null, newStatus);
217
+
218
+ return Promise.all(results);
214
219
  }
215
220
 
216
221
  function trackBlockingPromise(promise) {
@@ -219,7 +224,7 @@ module.exports = function () {
219
224
  setStatus("prepare");
220
225
  blockingPromises.push(promise);
221
226
  waitForBlockingPromises(function () {
222
- setStatus("ready");
227
+ return setStatus("ready");
223
228
  });
224
229
  return promise;
225
230
  case "prepare":
@@ -243,47 +248,47 @@ module.exports = function () {
243
248
  if (currentStatus !== "idle") {
244
249
  throw new Error("check() is only allowed in idle status");
245
250
  }
246
- setStatus("check");
247
- return $hmrDownloadManifest$().then(function (update) {
248
- if (!update) {
249
- setStatus(applyInvalidatedModules() ? "ready" : "idle");
250
- return null;
251
- }
252
-
253
- setStatus("prepare");
254
-
255
- var updatedModules = [];
256
- blockingPromises = [];
257
- currentUpdateApplyHandlers = [];
258
-
259
- return Promise.all(
260
- Object.keys($hmrDownloadUpdateHandlers$).reduce(function (
261
- promises,
262
- key
263
- ) {
264
- $hmrDownloadUpdateHandlers$[key](
265
- update.c,
266
- update.r,
267
- update.m,
268
- promises,
269
- currentUpdateApplyHandlers,
270
- updatedModules
271
- );
272
- return promises;
273
- },
274
- [])
275
- ).then(function () {
276
- return waitForBlockingPromises(function () {
277
- if (applyOnUpdate) {
278
- return internalApply(applyOnUpdate);
279
- } else {
280
- setStatus("ready");
251
+ return setStatus("check")
252
+ .then($hmrDownloadManifest$)
253
+ .then(function (update) {
254
+ if (!update) {
255
+ return setStatus(applyInvalidatedModules() ? "ready" : "idle");
256
+ }
281
257
 
282
- return updatedModules;
283
- }
258
+ return setStatus("prepare").then(function () {
259
+ var updatedModules = [];
260
+ blockingPromises = [];
261
+ currentUpdateApplyHandlers = [];
262
+
263
+ return Promise.all(
264
+ Object.keys($hmrDownloadUpdateHandlers$).reduce(function (
265
+ promises,
266
+ key
267
+ ) {
268
+ $hmrDownloadUpdateHandlers$[key](
269
+ update.c,
270
+ update.r,
271
+ update.m,
272
+ promises,
273
+ currentUpdateApplyHandlers,
274
+ updatedModules
275
+ );
276
+ return promises;
277
+ },
278
+ [])
279
+ ).then(function () {
280
+ return waitForBlockingPromises(function () {
281
+ if (applyOnUpdate) {
282
+ return internalApply(applyOnUpdate);
283
+ } else {
284
+ return setStatus("ready").then(function () {
285
+ return updatedModules;
286
+ });
287
+ }
288
+ });
289
+ });
284
290
  });
285
291
  });
286
- });
287
292
  }
288
293
 
289
294
  function hotApply(options) {
@@ -312,21 +317,20 @@ module.exports = function () {
312
317
  .filter(Boolean);
313
318
 
314
319
  if (errors.length > 0) {
315
- setStatus("abort");
316
- return Promise.resolve().then(function () {
320
+ return setStatus("abort").then(function () {
317
321
  throw errors[0];
318
322
  });
319
323
  }
320
324
 
321
325
  // Now in "dispose" phase
322
- setStatus("dispose");
326
+ var disposePromise = setStatus("dispose");
323
327
 
324
328
  results.forEach(function (result) {
325
329
  if (result.dispose) result.dispose();
326
330
  });
327
331
 
328
332
  // Now in "apply" phase
329
- setStatus("apply");
333
+ var applyPromise = setStatus("apply");
330
334
 
331
335
  var error;
332
336
  var reportError = function (err) {
@@ -345,25 +349,27 @@ module.exports = function () {
345
349
  }
346
350
  });
347
351
 
348
- // handle errors in accept handlers and self accepted module load
349
- if (error) {
350
- setStatus("fail");
351
- return Promise.resolve().then(function () {
352
- throw error;
353
- });
354
- }
352
+ return Promise.all([disposePromise, applyPromise]).then(function () {
353
+ // handle errors in accept handlers and self accepted module load
354
+ if (error) {
355
+ return setStatus("fail").then(function () {
356
+ throw error;
357
+ });
358
+ }
355
359
 
356
- if (queuedInvalidatedModules) {
357
- return internalApply(options).then(function (list) {
358
- outdatedModules.forEach(function (moduleId) {
359
- if (list.indexOf(moduleId) < 0) list.push(moduleId);
360
+ if (queuedInvalidatedModules) {
361
+ return internalApply(options).then(function (list) {
362
+ outdatedModules.forEach(function (moduleId) {
363
+ if (list.indexOf(moduleId) < 0) list.push(moduleId);
364
+ });
365
+ return list;
360
366
  });
361
- return list;
362
- });
363
- }
367
+ }
364
368
 
365
- setStatus("idle");
366
- return Promise.resolve(outdatedModules);
369
+ return setStatus("idle").then(function () {
370
+ return outdatedModules;
371
+ });
372
+ });
367
373
  }
368
374
 
369
375
  function applyInvalidatedModules() {
@@ -20,7 +20,7 @@ module.exports = (compiler, client, callback) => {
20
20
  const activeModules = new Map();
21
21
  const prefix = "/lazy-compilation-using-";
22
22
 
23
- const server = http.createServer((req, res) => {
23
+ const requestListener = (req, res) => {
24
24
  const keys = req.url.slice(prefix.length).split("@");
25
25
  req.socket.on("close", () => {
26
26
  setTimeout(() => {
@@ -51,7 +51,8 @@ module.exports = (compiler, client, callback) => {
51
51
  }
52
52
  }
53
53
  if (moduleActivated && compiler.watching) compiler.watching.invalidate();
54
- });
54
+ };
55
+ const server = http.createServer(requestListener);
55
56
  let isClosing = false;
56
57
  /** @type {Set<import("net").Socket>} */
57
58
  const sockets = new Set();
@@ -78,6 +79,8 @@ module.exports = (compiler, client, callback) => {
78
79
  callback(null, {
79
80
  dispose(callback) {
80
81
  isClosing = true;
82
+ // Removing the listener is a workaround for a memory leak in node.js
83
+ server.off("request", requestListener);
81
84
  server.close(err => {
82
85
  callback(err);
83
86
  });
@@ -834,7 +834,9 @@ class JavascriptModulesPlugin {
834
834
  }
835
835
  }
836
836
  if (runtimeRequirements.has(RuntimeGlobals.onChunksLoaded)) {
837
- startupSource.add(`${RuntimeGlobals.onChunksLoaded}();\n`);
837
+ startupSource.add(
838
+ `__webpack_exports__ = ${RuntimeGlobals.onChunksLoaded}(__webpack_exports__);\n`
839
+ );
838
840
  }
839
841
  source.add(
840
842
  hooks.renderStartup.call(startupSource, lastInlinedModule, {
@@ -72,7 +72,7 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin {
72
72
  render(source, { chunkGraph, moduleGraph, chunk }, { options, compilation }) {
73
73
  const modules = chunkGraph
74
74
  .getChunkModules(chunk)
75
- .filter(m => m instanceof ExternalModule);
75
+ .filter(m => m instanceof ExternalModule && m.externalType === "system");
76
76
  const externals = /** @type {ExternalModule[]} */ (modules);
77
77
 
78
78
  // The name this bundle should be registered as with System
@@ -32,16 +32,17 @@ class ChunkPrefetchStartupRuntimeModule extends RuntimeModule {
32
32
  `${RuntimeGlobals.onChunksLoaded}(0, ${JSON.stringify(
33
33
  // This need to include itself to delay execution after this chunk has been fully loaded
34
34
  onChunks.filter(c => c === chunk).map(c => c.id)
35
- )}, ${runtimeTemplate.expressionFunction(
35
+ )}, ${runtimeTemplate.basicFunction(
36
+ "",
36
37
  chunks.size < 3
37
38
  ? Array.from(
38
39
  chunks,
39
40
  c =>
40
- `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)})`
41
- ).join(", ")
41
+ `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});`
42
+ )
42
43
  : `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${
43
44
  RuntimeGlobals.prefetchChunk
44
- })`
45
+ });`
45
46
  )}, 5);`
46
47
  )
47
48
  );
@@ -58,7 +58,11 @@ class OnChunksLoadedRuntimeModule extends RuntimeModule {
58
58
  ]),
59
59
  "}",
60
60
  "if(fulfilled) {",
61
- Template.indent(["deferred.splice(i--, 1)", "result = fn();"]),
61
+ Template.indent([
62
+ "deferred.splice(i--, 1)",
63
+ "var r = fn();",
64
+ "if (r !== undefined) result = r;"
65
+ ]),
62
66
  "}"
63
67
  ]),
64
68
  "}",
@@ -11,15 +11,14 @@ const NormalModule = require("../NormalModule");
11
11
 
12
12
  // data URL scheme: "data:text/javascript;charset=utf-8;base64,some-string"
13
13
  // http://www.ietf.org/rfc/rfc2397.txt
14
- const URIRegEx = /^data:(?:[^;,]+)?(?:(?:;[^;,]+)*?)(;base64)?,(.*)$/i;
15
- const URIMetaRegEx = /^data:([^;,]+)?(?:(?:;[^;,]+)*?)(?:;(base64))?,/i;
14
+ const URIRegEx = /^data:([^;,]+)?((?:;[^;,]+)*?)(?:;(base64))?,(.*)$/i;
16
15
 
17
16
  const decodeDataURI = uri => {
18
17
  const match = URIRegEx.exec(uri);
19
18
  if (!match) return null;
20
19
 
21
- const isBase64 = match[1];
22
- const body = match[2];
20
+ const isBase64 = match[3];
21
+ const body = match[4];
23
22
  return isBase64
24
23
  ? Buffer.from(body, "base64")
25
24
  : Buffer.from(decodeURIComponent(body), "ascii");
@@ -38,10 +37,12 @@ class DataUriPlugin {
38
37
  normalModuleFactory.hooks.resolveForScheme
39
38
  .for("data")
40
39
  .tap("DataUriPlugin", resourceData => {
41
- const match = URIMetaRegEx.exec(resourceData.resource);
40
+ const match = URIRegEx.exec(resourceData.resource);
42
41
  if (match) {
43
42
  resourceData.data.mimetype = match[1] || "";
44
- resourceData.data.encoding = match[2] || false;
43
+ resourceData.data.parameters = match[2] || "";
44
+ resourceData.data.encoding = match[3] || false;
45
+ resourceData.data.encodedContent = match[4] || "";
45
46
  }
46
47
  });
47
48
  NormalModule.getCompilationHooks(compilation)
@@ -1182,11 +1182,14 @@ const SIMPLE_EXTRACTORS = {
1182
1182
  type,
1183
1183
  compilation: { moduleGraph }
1184
1184
  } = context;
1185
- object.reasons = factory.create(
1185
+ const groupsReasons = factory.create(
1186
1186
  `${type.slice(0, -8)}.reasons`,
1187
1187
  Array.from(moduleGraph.getIncomingConnections(module)),
1188
1188
  context
1189
1189
  );
1190
+ const limited = spaceLimited(groupsReasons, options.reasonsSpace);
1191
+ object.reasons = limited.children;
1192
+ object.filteredReasons = limited.filteredChildren;
1190
1193
  },
1191
1194
  usedExports: (
1192
1195
  object,
@@ -1764,6 +1767,16 @@ const moduleGroup = (children, modules) => {
1764
1767
  };
1765
1768
  };
1766
1769
 
1770
+ const reasonGroup = (children, reasons) => {
1771
+ let active = false;
1772
+ for (const reason of children) {
1773
+ active = active || reason.active;
1774
+ }
1775
+ return {
1776
+ active
1777
+ };
1778
+ };
1779
+
1767
1780
  /** @type {Record<string, (groupConfigs: GroupConfig[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} */
1768
1781
  const ASSETS_GROUPERS = {
1769
1782
  _: (groupConfigs, context, options) => {
@@ -2074,7 +2087,24 @@ const RESULT_GROUPERS = {
2074
2087
  "compilation.modules": MODULES_GROUPERS("module"),
2075
2088
  "chunk.modules": MODULES_GROUPERS("chunk"),
2076
2089
  "chunk.rootModules": MODULES_GROUPERS("root-of-chunk"),
2077
- "module.modules": MODULES_GROUPERS("nested")
2090
+ "module.modules": MODULES_GROUPERS("nested"),
2091
+ "module.reasons": {
2092
+ groupReasonsByOrigin: groupConfigs => {
2093
+ groupConfigs.push({
2094
+ getKeys: reason => {
2095
+ return [reason.module];
2096
+ },
2097
+ createGroup: (key, children, reasons) => {
2098
+ return {
2099
+ type: "from origin",
2100
+ module: key,
2101
+ children,
2102
+ ...reasonGroup(children, reasons)
2103
+ };
2104
+ }
2105
+ });
2106
+ }
2107
+ }
2078
2108
  };
2079
2109
 
2080
2110
  // remove a prefixed "!" that can be specified to reverse sort order
@@ -50,6 +50,7 @@ const NAMED_PRESETS = {
50
50
  modulesSpace: Infinity,
51
51
  chunkModulesSpace: Infinity,
52
52
  assetsSpace: Infinity,
53
+ reasonsSpace: Infinity,
53
54
  children: true
54
55
  },
55
56
  detailed: {
@@ -72,8 +73,9 @@ const NAMED_PRESETS = {
72
73
  logging: true,
73
74
  runtimeModules: true,
74
75
  exclude: false,
75
- modulesSpace: Infinity,
76
- assetsSpace: Infinity
76
+ modulesSpace: 1000,
77
+ assetsSpace: 1000,
78
+ reasonsSpace: 1000
77
79
  },
78
80
  minimal: {
79
81
  all: false,
@@ -194,6 +196,8 @@ const DEFAULTS = {
194
196
  depth: OFF_FOR_TO_STRING,
195
197
  cachedAssets: OFF_FOR_TO_STRING,
196
198
  reasons: OFF_FOR_TO_STRING,
199
+ reasonsSpace: (o, { forToString }) => (forToString ? 15 : Infinity),
200
+ groupReasonsByOrigin: ON_FOR_TO_STRING,
197
201
  usedExports: OFF_FOR_TO_STRING,
198
202
  providedExports: OFF_FOR_TO_STRING,
199
203
  optimizationBailout: OFF_FOR_TO_STRING,
@@ -374,6 +374,10 @@ const SIMPLE_PRINTERS = {
374
374
  "modules"
375
375
  )}`
376
376
  : undefined,
377
+ "module.filteredReasons": filteredReasons =>
378
+ filteredReasons > 0
379
+ ? `${filteredReasons} ${plural(filteredReasons, "reason", "reasons")}`
380
+ : undefined,
377
381
  "module.filteredChildren": filteredChildren =>
378
382
  filteredChildren > 0
379
383
  ? `${filteredChildren} ${plural(filteredChildren, "module", "modules")}`
@@ -393,6 +397,10 @@ const SIMPLE_PRINTERS = {
393
397
  "moduleReason.active": (active, { formatFlag }) =>
394
398
  active ? undefined : formatFlag("inactive"),
395
399
  "moduleReason.resolvedModule": (module, { magenta }) => magenta(module),
400
+ "moduleReason.filteredChildren": filteredChildren =>
401
+ filteredChildren > 0
402
+ ? `${filteredChildren} ${plural(filteredChildren, "reason", "reasons")}`
403
+ : undefined,
396
404
 
397
405
  "module.profile.total": (value, { formatTime }) => formatTime(value),
398
406
  "module.profile.resolving": (value, { formatTime }) =>
@@ -590,6 +598,7 @@ const ITEM_NAMES = {
590
598
  "module.modules[]": "module",
591
599
  "module.children[]": "module",
592
600
  "module.reasons[]": "moduleReason",
601
+ "moduleReason.children[]": "moduleReason",
593
602
  "module.issuerPath[]": "moduleIssuer",
594
603
  "chunk.origins[]": "chunkOrigin",
595
604
  "chunk.modules[]": "module",
@@ -721,6 +730,7 @@ const PREFERRED_ORDERS = {
721
730
  "usedExports",
722
731
  "optimizationBailout",
723
732
  "reasons",
733
+ "filteredReasons",
724
734
  "issuerPath",
725
735
  "profile",
726
736
  "modules",
@@ -734,7 +744,9 @@ const PREFERRED_ORDERS = {
734
744
  "module",
735
745
  "resolvedModule",
736
746
  "loc",
737
- "explanation"
747
+ "explanation",
748
+ "children",
749
+ "filteredChildren"
738
750
  ],
739
751
  "module.profile": [
740
752
  "total",
@@ -1019,10 +1031,32 @@ const SIMPLE_ELEMENT_JOINERS = {
1019
1031
  chunkGroupAsset: joinOneLine,
1020
1032
  chunkGroupChildGroup: joinOneLine,
1021
1033
  chunkGroupChild: joinOneLine,
1034
+ // moduleReason: (items, { moduleReason }) => {
1035
+ // let hasName = false;
1036
+ // return joinOneLine(
1037
+ // items.filter(item => {
1038
+ // switch (item.element) {
1039
+ // case "moduleId":
1040
+ // if (moduleReason.moduleId === moduleReason.module && item.content)
1041
+ // hasName = true;
1042
+ // break;
1043
+ // case "module":
1044
+ // if (hasName) return false;
1045
+ // break;
1046
+ // case "resolvedModule":
1047
+ // return (
1048
+ // moduleReason.module !== moduleReason.resolvedModule &&
1049
+ // item.content
1050
+ // );
1051
+ // }
1052
+ // return true;
1053
+ // })
1054
+ // );
1055
+ // },
1022
1056
  moduleReason: (items, { moduleReason }) => {
1023
1057
  let hasName = false;
1024
- return joinOneLine(
1025
- items.filter(item => {
1058
+ return joinExplicitNewLine(
1059
+ items.map(item => {
1026
1060
  switch (item.element) {
1027
1061
  case "moduleId":
1028
1062
  if (moduleReason.moduleId === moduleReason.module && item.content)
@@ -1032,13 +1066,21 @@ const SIMPLE_ELEMENT_JOINERS = {
1032
1066
  if (hasName) return false;
1033
1067
  break;
1034
1068
  case "resolvedModule":
1035
- return (
1036
- moduleReason.module !== moduleReason.resolvedModule &&
1037
- item.content
1038
- );
1069
+ if (moduleReason.module === moduleReason.resolvedModule)
1070
+ return false;
1071
+ break;
1072
+ case "children":
1073
+ if (item.content) {
1074
+ return {
1075
+ ...item,
1076
+ content: `\n${item.content}\n`
1077
+ };
1078
+ }
1079
+ break;
1039
1080
  }
1040
- return true;
1041
- })
1081
+ return item;
1082
+ }),
1083
+ " "
1042
1084
  );
1043
1085
  },
1044
1086
  "module.profile": joinInBrackets,