@forsakringskassan/docs-generator 2.21.1 → 2.21.3

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.
package/dist/index.js CHANGED
@@ -2198,10 +2198,14 @@ function cache(cacheFolder, outputFolder) {
2198
2198
  };
2199
2199
  }
2200
2200
  async function compileExamples(options) {
2201
- const { fileInfo, tasks, vendors } = options;
2201
+ const { fileInfo, tasks, assets, vendors } = options;
2202
2202
  if (tasks.length === 0) {
2203
2203
  return;
2204
2204
  }
2205
+ const external = [
2206
+ ...assets.map((it) => it.name),
2207
+ ...vendors.map((it) => it.package)
2208
+ ];
2205
2209
  const cacheFolder = path$1.posix.join(options.cacheFolder, fileInfo.path);
2206
2210
  const outputFolder = path$1.posix.join(options.outputFolder, fileInfo.path);
2207
2211
  const cacheMiss = cache(cacheFolder, outputFolder);
@@ -2211,7 +2215,7 @@ async function compileExamples(options) {
2211
2215
  }
2212
2216
  const batch = {
2213
2217
  outputFolder,
2214
- external: vendors.map((it) => it.package),
2218
+ external,
2215
2219
  tasks: dirtyTasks
2216
2220
  };
2217
2221
  const result = await vendor.spawn("node", [scriptPath], {
@@ -2395,11 +2399,15 @@ async function render(doc, docs, nav, vendors, options) {
2395
2399
  });
2396
2400
  const writeFile = fs.writeFile(expandedDst, content ?? "null", "utf-8");
2397
2401
  try {
2402
+ const assets = Object.values(templateData.assets).filter(
2403
+ (it) => it.importmap
2404
+ );
2398
2405
  await compileExamples({
2399
2406
  fileInfo,
2400
2407
  cacheFolder,
2401
2408
  outputFolder,
2402
2409
  tasks: generatedExamples,
2410
+ assets,
2403
2411
  vendors
2404
2412
  });
2405
2413
  } catch (err) {