@nast/notion2typst 0.2.0 → 0.2.2

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
@@ -1,7 +1,7 @@
1
1
  import { Notion2NBT } from "@nast/notion2nbt";
2
2
  import { nbt2nast } from "@nast/nbt2nast";
3
3
  import { nast2typst } from "@nast/nast2typst";
4
- import { fetchImagesFromBlocks } from "@nast/nast-fetch-images";
4
+ import { fetchImagesFromBlocks, getExtensionFromContentType } from "@nast/nast-fetch-images";
5
5
 
6
6
  //#region src/index.ts
7
7
  /**
@@ -73,4 +73,4 @@ async function notion2typst(options) {
73
73
  }
74
74
 
75
75
  //#endregion
76
- export { Notion2NBT, fetchImagesFromBlocks, nast2typst, nbt2nast, notion2typst };
76
+ export { Notion2NBT, fetchImagesFromBlocks, getExtensionFromContentType, nast2typst, nbt2nast, notion2typst };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nast/notion2typst",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "description": "A wrapper around nbt2nast and nast2typst to convert Notion content directly to Typst",
6
6
  "keywords": [
7
7
  "notion",
@@ -29,17 +29,17 @@
29
29
  },
30
30
  "main": "./dist/index.js",
31
31
  "module": "./dist/index.js",
32
- "types": "./dist/index-CJVMSA--.d.ts",
32
+ "types": "./dist/index.d.ts",
33
33
  "files": [
34
34
  "dist",
35
35
  "README.md"
36
36
  ],
37
37
  "dependencies": {
38
- "@nast/nbt2nast": "0.4.0",
39
- "@nast/nast-fetch-images": "0.2.0",
40
- "@nast/nast2typst": "0.3.0",
41
- "@nast/notion2nbt": "0.6.0",
42
- "@nast/types": "0.1.0"
38
+ "@nast/nast-fetch-images": "^0.2.1",
39
+ "@nast/nbt2nast": "^0.4.0",
40
+ "@nast/nast2typst": "^0.3.0",
41
+ "@nast/notion2nbt": "^0.7.0",
42
+ "@nast/types": "^0.1.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsdown",
@@ -1,79 +0,0 @@
1
- import { Notion2NBT, NotionBlock } from "@nast/notion2nbt";
2
- import { nbt2nast } from "@nast/nbt2nast";
3
- import { nast2typst } from "@nast/nast2typst";
4
- import { fetchImagesFromBlocks } from "@nast/nast-fetch-images";
5
- import { DownloadedImage, DownloadedImage as DownloadedImage$1, NASTNode, NASTRoot, NASTRoot as NASTRoot$1, NBTBlock } from "@nast/types";
6
-
7
- //#region src/index.d.ts
8
-
9
- /**
10
- * Image data from the fetchImagesFromBlocks function
11
- * @deprecated Use DownloadedImage from @nast/types instead
12
- */
13
- type ImageData = DownloadedImage$1;
14
- /**
15
- * Options for the notion2typst function
16
- */
17
- interface Notion2TypstOptions {
18
- /** Notion API token */
19
- notionToken: string;
20
- /** Notion page ID to convert */
21
- pageId: string;
22
- /** Whether to fetch images from the page (default: true) */
23
- fetchImages?: boolean;
24
- /** Whether to preserve block IDs in NAST (default: false) */
25
- preserveBlockId?: boolean;
26
- /** Whether to enable caching in Notion2NBT (default: false) */
27
- enableCache?: boolean;
28
- }
29
- /**
30
- * Result of the notion2typst conversion
31
- */
32
- interface Notion2TypstResult {
33
- /** The generated Typst code */
34
- typstCode: string;
35
- /** Downloaded images (if fetchImages was true) */
36
- images: DownloadedImage$1[];
37
- /** Image fetch statistics (if fetchImages was true) */
38
- imageStats: {
39
- /** Total number of image blocks found */
40
- totalImages: number;
41
- /** Number of successfully downloaded images */
42
- downloaded: number;
43
- /** Number of expired images */
44
- expired: number;
45
- /** Number of external images */
46
- external: number;
47
- /** Number of file images */
48
- file: number;
49
- };
50
- /** The intermediate NAST representation */
51
- nast: NASTRoot$1;
52
- }
53
- /**
54
- * Main notion2typst function - converts a Notion page to Typst code
55
- *
56
- * This is a wrapper that combines:
57
- * 1. notion2nbt - fetch page from Notion API
58
- * 2. nbt2nast - convert Notion blocks to NAST
59
- * 3. nast2typst - convert NAST to Typst code
60
- * 4. fetchImagesFromBlocks - download images (optional)
61
- *
62
- * @param options - Configuration options
63
- * @returns Typst code and downloaded images
64
- *
65
- * @example
66
- * ```typescript
67
- * const result = await notion2typst({
68
- * notionToken: 'your-token',
69
- * pageId: 'your-page-id',
70
- * fetchImages: true
71
- * });
72
- *
73
- * console.log(result.typstCode);
74
- * console.log(`Downloaded ${result.images.length} images`);
75
- * ```
76
- */
77
- declare function notion2typst(options: Notion2TypstOptions): Promise<Notion2TypstResult>;
78
- //#endregion
79
- export { type DownloadedImage, ImageData, type NASTNode, type NASTRoot, type NBTBlock, Notion2NBT, Notion2TypstOptions, Notion2TypstResult, type NotionBlock, fetchImagesFromBlocks, nast2typst, nbt2nast, notion2typst };