@forsakringskassan/docs-generator 3.8.0 → 3.10.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.
@@ -2,7 +2,7 @@ import { createRequire as $createRequire } from "node:module";
2
2
 
3
3
  const require = $createRequire(import.meta.url);
4
4
 
5
- import { r as runAsWorker, f as format2, a as resolveConfig } from './vendor-DqIMfP3a.mjs';
5
+ import { r as runAsWorker, f as format2, a as resolveConfig } from './vendor-DPuGyhL4.mjs';
6
6
  import 'node:url';
7
7
  import 'node:path';
8
8
  import 'fs';
@@ -54,4 +54,4 @@ async function formatCode(source, filepath) {
54
54
  runAsWorker(formatCode);
55
55
 
56
56
  export { formatCode };
57
- //# sourceMappingURL=format-code.worker-CB5zyf9p.mjs.map
57
+ //# sourceMappingURL=format-code.worker-BsG38cNK.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-code.worker-CB5zyf9p.mjs","sources":["../src/utils/format-code.worker.ts"],"sourcesContent":["import { type Options, format as prettier, resolveConfig } from \"prettier\";\nimport { runAsWorker } from \"synckit\";\n\nconst configCache = new Map<string, Options | null>();\n\nasync function getConfig(filepath: string): Promise<Options | null> {\n const cached = configCache.get(filepath);\n if (cached !== undefined) {\n return cached;\n }\n const options = await resolveConfig(filepath);\n configCache.set(filepath, options);\n return options;\n}\n\n/**\n * @internal\n */\nexport async function formatCode(\n source: string,\n filepath: string,\n): Promise<string> {\n const options = await getConfig(filepath);\n const formatted = await prettier(source, { ...options, filepath });\n return formatted.trim();\n}\n\n/* eslint-disable-next-line unicorn/no-top-level-side-effects -- required for worker to function */\nrunAsWorker(formatCode);\n"],"names":["prettier"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,WAAA,uBAAkB,GAAA,EAA4B;AAEpD,eAAe,UAAU,QAAA,EAA2C;AAChE,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,GAAA,CAAI,QAAQ,CAAA;AACvC,EAAA,IAAI,WAAW,MAAA,EAAW;AACtB,IAAA,OAAO,MAAA;AAAA,EACX;AACA,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,QAAQ,CAAA;AAC5C,EAAA,WAAA,CAAY,GAAA,CAAI,UAAU,OAAO,CAAA;AACjC,EAAA,OAAO,OAAA;AACX;AAKA,eAAsB,UAAA,CAClB,QACA,QAAA,EACe;AACf,EAAA,MAAM,OAAA,GAAU,MAAM,SAAA,CAAU,QAAQ,CAAA;AACxC,EAAA,MAAM,SAAA,GAAY,MAAMA,OAAA,CAAS,MAAA,EAAQ,EAAE,GAAG,OAAA,EAAS,UAAU,CAAA;AACjE,EAAA,OAAO,UAAU,IAAA,EAAK;AAC1B;AAGA,WAAA,CAAY,UAAU,CAAA;;"}
1
+ {"version":3,"file":"format-code.worker-BsG38cNK.mjs","sources":["../src/utils/format-code.worker.ts"],"sourcesContent":["import { type Options, format as prettier, resolveConfig } from \"prettier\";\nimport { runAsWorker } from \"synckit\";\n\nconst configCache = new Map<string, Options | null>();\n\nasync function getConfig(filepath: string): Promise<Options | null> {\n const cached = configCache.get(filepath);\n if (cached !== undefined) {\n return cached;\n }\n const options = await resolveConfig(filepath);\n configCache.set(filepath, options);\n return options;\n}\n\n/**\n * @internal\n */\nexport async function formatCode(\n source: string,\n filepath: string,\n): Promise<string> {\n const options = await getConfig(filepath);\n const formatted = await prettier(source, { ...options, filepath });\n return formatted.trim();\n}\n\n/* eslint-disable-next-line unicorn/no-top-level-side-effects -- required for worker to function */\nrunAsWorker(formatCode);\n"],"names":["prettier"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,WAAA,uBAAkB,GAAA,EAA4B;AAEpD,eAAe,UAAU,QAAA,EAA2C;AAChE,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,GAAA,CAAI,QAAQ,CAAA;AACvC,EAAA,IAAI,WAAW,MAAA,EAAW;AACtB,IAAA,OAAO,MAAA;AAAA,EACX;AACA,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,QAAQ,CAAA;AAC5C,EAAA,WAAA,CAAY,GAAA,CAAI,UAAU,OAAO,CAAA;AACjC,EAAA,OAAO,OAAA;AACX;AAKA,eAAsB,UAAA,CAClB,QACA,QAAA,EACe;AACf,EAAA,MAAM,OAAA,GAAU,MAAM,SAAA,CAAU,QAAQ,CAAA;AACxC,EAAA,MAAM,SAAA,GAAY,MAAMA,OAAA,CAAS,MAAA,EAAQ,EAAE,GAAG,OAAA,EAAS,UAAU,CAAA;AACjE,EAAA,OAAO,UAAU,IAAA,EAAK;AAC1B;AAGA,WAAA,CAAY,UAAU,CAAA;;"}
package/dist/index.d.mts CHANGED
@@ -213,6 +213,25 @@ export declare interface ExtractExamplesOptions extends ProcessorOptions {
213
213
  */
214
214
  export declare function extractExamplesProcessor(options: ExtractExamplesOptions): Processor;
215
215
 
216
+ /**
217
+ * Options for `extractMarkdownProcessor`.
218
+ *
219
+ * @public
220
+ */
221
+ export declare interface ExtractMarkdownOptions extends ProcessorOptions {
222
+ /**
223
+ * Folder to write docs to.
224
+ */
225
+ outputFolder: string;
226
+ }
227
+
228
+ /**
229
+ * Processor to extract and write examples to separate files.
230
+ *
231
+ * @public
232
+ */
233
+ export declare function extractMarkdownProcessor(options: ExtractMarkdownOptions): Processor;
234
+
216
235
  /**
217
236
  * @public
218
237
  */
@@ -298,6 +317,24 @@ declare class Generator_2 {
298
317
  format?: "iife" | "cjs" | "esm";
299
318
  define?: Record<string, string>;
300
319
  }): void;
320
+ /**
321
+ * Compile a worker script.
322
+ *
323
+ * This is mostly the same as {@link Generator.compileScript} with some differences:
324
+ *
325
+ * - The script is written directly to `outputFolder` instead of `assetFolder` (i.e. to the web root).
326
+ * - The output filename does not include a hash.
327
+ *
328
+ * @public
329
+ * @since %version%
330
+ * @param name - Asset name.
331
+ * @param src - Asset entrypoint.
332
+ * @param buildOptions - Options passed to `esbuild`.
333
+ */
334
+ compileWorker(name: string, src: string | URL, buildOptions?: {
335
+ format?: "iife" | "cjs" | "esm";
336
+ define?: Record<string, string>;
337
+ }): void;
301
338
  compileStyle(name: string, src: string | URL, options?: Partial<CompileOptions>): void;
302
339
  /**
303
340
  * @param dst - Destination directory relative to asset folder.
@@ -616,6 +653,15 @@ export declare interface PackageJson {
616
653
  };
617
654
  }
618
655
 
656
+ /* Excluded from this release type: PartialFile */
657
+
658
+ /**
659
+ * Read partial documents for insertion in other markdown documents.
660
+ *
661
+ * @public
662
+ */
663
+ export declare function partialFileReader(filePath: string): Promise<DocumentPartial[]>;
664
+
619
665
  /**
620
666
  * Generates links to code playgrounds.
621
667
  *
@@ -693,6 +739,8 @@ export declare interface ProcessorContext {
693
739
  readonly sidenav: NavigationSection;
694
740
  readonly resources: ResourceTask[];
695
741
  readonly outputFolder: string;
742
+ setState<K extends keyof StateMap>(key: K, value: StateMap[K]): void;
743
+ getState<K extends keyof StateMap>(key: K): StateMap[K] | null;
696
744
  addDocument(document: Document_2 | Document_2[]): void;
697
745
  addVendorAsset(asset: VendorAsset | VendorAsset[]): void;
698
746
  /**
@@ -899,6 +947,12 @@ export declare interface SourceUrlProcessorOptions extends ProcessorOptions {
899
947
  readonly componentFileExtension?: string;
900
948
  }
901
949
 
950
+ /**
951
+ * @public
952
+ */
953
+ export declare interface StateMap {
954
+ }
955
+
902
956
  /* Excluded from this release type: TemplateBlockData */
903
957
 
904
958
  /**