node-pptx-parser 1.0.0 → 1.0.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/LICENSE +21 -21
- package/README.MD +212 -212
- package/dist/esm/index.d.mts +87 -0
- package/dist/esm/types.d.mts +26 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +11 -4
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Mirza-Glitch
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mirza-Glitch
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.MD
CHANGED
|
@@ -1,212 +1,212 @@
|
|
|
1
|
-
# node-pptx-parser
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
import
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
## Contributing
|
|
211
|
-
|
|
212
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
1
|
+
# node-pptx-parser
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/node-pptx-parser)
|
|
4
|
+
[](https://github.com/Mirza-Glitch/node-pptx-parser/blob/main/LICENSE)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
A Node.js library for parsing PowerPoint (PPTX) files and extracting text content. This library maintains text formatting, line breaks, and paragraph structures from the original presentation.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Extract text content from PPTX files with preserved formatting
|
|
12
|
+
|
|
13
|
+
- Parse PPTX structure into manageable JavaScript objects
|
|
14
|
+
|
|
15
|
+
- Access raw XML content of presentation components
|
|
16
|
+
|
|
17
|
+
- Written in TypeScript for type safety
|
|
18
|
+
|
|
19
|
+
- Promise-based API
|
|
20
|
+
|
|
21
|
+
- Preserves line breaks and paragraph formatting
|
|
22
|
+
|
|
23
|
+
- Minimal dependencies
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
|
|
29
|
+
npm install node-pptx-parser
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
Once the package is installed you can you it with `import` or `require` statements like this:
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
// ESM import:
|
|
38
|
+
import PptxParser from "node-pptx-parser";
|
|
39
|
+
|
|
40
|
+
// CommonJs require:
|
|
41
|
+
const PptxParser = require("node-pptx-parser").default;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Basic Text Extraction
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import PptxParser from "node-pptx-parser";
|
|
48
|
+
|
|
49
|
+
async function main() {
|
|
50
|
+
const parser = new PptxParser("presentation.pptx");
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
// Extract text from all slides
|
|
54
|
+
const textContent = await parser.extractText();
|
|
55
|
+
|
|
56
|
+
// Print text from each slide
|
|
57
|
+
textContent.forEach((slide) => {
|
|
58
|
+
console.log(`\nSlide ${slide.id}:`);
|
|
59
|
+
|
|
60
|
+
console.log(slide.text.join("\n"));
|
|
61
|
+
});
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error("Error:", error.message);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
main();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Advanced Usage - Full Presentation Parsing
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import PptxParser from "node-pptx-parser";
|
|
74
|
+
|
|
75
|
+
async function main() {
|
|
76
|
+
const parser = new PptxParser("presentation.pptx");
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
// Get complete parsed presentation content
|
|
80
|
+
const parsedContent = await parser.parse();
|
|
81
|
+
|
|
82
|
+
// Access presentation structure
|
|
83
|
+
console.log(parsedContent.presentation.parsed);
|
|
84
|
+
|
|
85
|
+
// Access individual slides
|
|
86
|
+
parsedContent.slides.forEach((slide) => {
|
|
87
|
+
console.log(`Slide ${slide.id}:`, slide.parsed);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Access raw XML if needed
|
|
91
|
+
console.log(parsedContent.presentation.xml);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error("Error:", error.message);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
main();
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## API Reference
|
|
101
|
+
|
|
102
|
+
### `PptxParser`
|
|
103
|
+
|
|
104
|
+
The main class for parsing PPTX files.
|
|
105
|
+
|
|
106
|
+
#### Constructor
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
|
|
110
|
+
constructor(filePath: string)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Creates a new instance of PptxParser.
|
|
114
|
+
|
|
115
|
+
- `filePath`: Path to the PPTX file to be parsed
|
|
116
|
+
|
|
117
|
+
#### Methods
|
|
118
|
+
|
|
119
|
+
##### `parse()`
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
|
|
123
|
+
async parse(): Promise<ParsedPresentation>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Parses the entire PPTX file and returns its content.
|
|
127
|
+
|
|
128
|
+
- Returns: Promise resolving to a `ParsedPresentation` object containing the complete presentation structure
|
|
129
|
+
|
|
130
|
+
##### `extractText()`
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
|
|
134
|
+
async extractText(): Promise<SlideTextContent[]>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Extracts formatted text content from all slides.
|
|
138
|
+
|
|
139
|
+
- Returns: Promise resolving to an array of `SlideTextContent` objects
|
|
140
|
+
|
|
141
|
+
### Types
|
|
142
|
+
|
|
143
|
+
#### `ParsedPresentation`
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
interface ParsedPresentation {
|
|
147
|
+
presentation: {
|
|
148
|
+
path: string;
|
|
149
|
+
xml: string;
|
|
150
|
+
parsed: any;
|
|
151
|
+
};
|
|
152
|
+
relationships: {
|
|
153
|
+
path: string;
|
|
154
|
+
xml: string;
|
|
155
|
+
parsed: any;
|
|
156
|
+
};
|
|
157
|
+
slides: ParsedSlide[];
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### `ParsedSlide`
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
interface ParsedSlide {
|
|
165
|
+
id: string;
|
|
166
|
+
path: string;
|
|
167
|
+
xml: string;
|
|
168
|
+
parsed: any;
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### `SlideTextContent`
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
interface SlideTextContent extends ParsedSlide {
|
|
176
|
+
text: string[];
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Error Handling
|
|
181
|
+
|
|
182
|
+
The library throws errors in the following cases:
|
|
183
|
+
|
|
184
|
+
- Invalid PPTX file structure
|
|
185
|
+
|
|
186
|
+
- File reading errors
|
|
187
|
+
|
|
188
|
+
- XML parsing errors
|
|
189
|
+
|
|
190
|
+
Example error handling:
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
try {
|
|
194
|
+
const parser = new PptxParser("presentation.ppt");
|
|
195
|
+
const content = await parser.extractText();
|
|
196
|
+
} catch (error) {
|
|
197
|
+
if (error.message.includes("Invalid PPTX file structure")) {
|
|
198
|
+
console.error("The PPTX file is corrupted or invalid");
|
|
199
|
+
} else {
|
|
200
|
+
console.error("An error occurred:", error.message);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Dependencies
|
|
206
|
+
|
|
207
|
+
- unzipper: For extracting PPTX files
|
|
208
|
+
- xml2js: For parsing XML content
|
|
209
|
+
|
|
210
|
+
## Contributing
|
|
211
|
+
|
|
212
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ParsedPresentation, SlideTextContent } from "./types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* PptxParser - A class for parsing PowerPoint (PPTX) files and extracting their content
|
|
4
|
+
*
|
|
5
|
+
* This parser can:
|
|
6
|
+
* - Extract raw XML content from PPTX files
|
|
7
|
+
* - Parse the XML into JavaScript objects
|
|
8
|
+
* - Extract formatted text content from slides
|
|
9
|
+
* - Preserve line breaks and paragraph formatting
|
|
10
|
+
*
|
|
11
|
+
* PPTX files are essentially ZIP archives containing XML files. The main files we care about are:
|
|
12
|
+
* - presentation.xml: Contains the main presentation structure
|
|
13
|
+
* - _rels/presentation.xml.rels: Contains relationships between presentation parts
|
|
14
|
+
* - slides/slide*.xml: Contains individual slide content
|
|
15
|
+
*/
|
|
16
|
+
export default class PptxParser {
|
|
17
|
+
private filePath;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new instance of PptxParser
|
|
20
|
+
* @param filePath - Path to the PPTX file to be parsed
|
|
21
|
+
*/
|
|
22
|
+
constructor(filePath: string);
|
|
23
|
+
/**
|
|
24
|
+
* Parses the entire PPTX file and returns its content
|
|
25
|
+
*
|
|
26
|
+
* This method:
|
|
27
|
+
* 1. Opens the PPTX file as a ZIP archive
|
|
28
|
+
* 2. Extracts and parses the presentation.xml
|
|
29
|
+
* 3. Extracts and parses the relationship file
|
|
30
|
+
* 4. Finds and parses all slides
|
|
31
|
+
*
|
|
32
|
+
* @returns Promise<ParsedPresentation> - Object containing parsed presentation data
|
|
33
|
+
* @throws Error if the PPTX file is invalid or cannot be parsed
|
|
34
|
+
*/
|
|
35
|
+
parse(): Promise<ParsedPresentation>;
|
|
36
|
+
/**
|
|
37
|
+
* Extracts content from a file within the PPTX archive
|
|
38
|
+
*
|
|
39
|
+
* @param file - A file from the unzipper library
|
|
40
|
+
* @returns Promise<string> - The file's content as a string
|
|
41
|
+
*/
|
|
42
|
+
private getFileContent;
|
|
43
|
+
/**
|
|
44
|
+
* Parses XML content into a JavaScript object
|
|
45
|
+
*
|
|
46
|
+
* @param xmlContent - Raw XML string to parse
|
|
47
|
+
* @returns Promise<any> - Parsed JavaScript object
|
|
48
|
+
*/
|
|
49
|
+
private parseXmlContent;
|
|
50
|
+
/**
|
|
51
|
+
* Extracts slide relations from the presentation relationships XML
|
|
52
|
+
*
|
|
53
|
+
* In PPTX files, slides are referenced by relationships in the presentation.xml.rels file.
|
|
54
|
+
* This method finds all slide references in these relationships.
|
|
55
|
+
*
|
|
56
|
+
* @param relationshipsData - Parsed relationship XML data
|
|
57
|
+
* @returns SlideRelation[] - Array of slide relations
|
|
58
|
+
*/
|
|
59
|
+
private getSlideRelations;
|
|
60
|
+
/**
|
|
61
|
+
* Extracts formatted text content from all slides
|
|
62
|
+
*
|
|
63
|
+
* This is a convenience method that:
|
|
64
|
+
* 1. Parses the entire presentation
|
|
65
|
+
* 2. Extracts text from each slide
|
|
66
|
+
* 3. Preserves formatting and line breaks
|
|
67
|
+
*
|
|
68
|
+
* @returns Promise<SlideTextContent[]> - Array of slide text content
|
|
69
|
+
*/
|
|
70
|
+
extractText(): Promise<SlideTextContent[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Extracts text content from a single slide while preserving formatting
|
|
73
|
+
*
|
|
74
|
+
* PowerPoint slide XML structure:
|
|
75
|
+
* - p:sp: Shape elements that can contain text
|
|
76
|
+
* - p:txBody: The text body within a shape
|
|
77
|
+
* - a:p: Individual paragraphs
|
|
78
|
+
* - a:r: Text runs within paragraphs
|
|
79
|
+
* - a:t: Actual text content
|
|
80
|
+
* - a:br: Line breaks
|
|
81
|
+
* - a:endParaRPr: Paragraph end markers
|
|
82
|
+
*
|
|
83
|
+
* @param slideData - Parsed slide XML data
|
|
84
|
+
* @returns string[] - Array of text blocks with preserved formatting
|
|
85
|
+
*/
|
|
86
|
+
private extractTextFromSlide;
|
|
87
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface SlideRelation {
|
|
2
|
+
id: string;
|
|
3
|
+
target: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ParsedSlide {
|
|
6
|
+
id: string;
|
|
7
|
+
path: string;
|
|
8
|
+
xml: string;
|
|
9
|
+
parsed: any;
|
|
10
|
+
}
|
|
11
|
+
export interface ParsedPresentation {
|
|
12
|
+
presentation: {
|
|
13
|
+
path: string;
|
|
14
|
+
xml: string;
|
|
15
|
+
parsed: any;
|
|
16
|
+
};
|
|
17
|
+
relationships: {
|
|
18
|
+
path: string;
|
|
19
|
+
xml: string;
|
|
20
|
+
parsed: any;
|
|
21
|
+
};
|
|
22
|
+
slides: ParsedSlide[];
|
|
23
|
+
}
|
|
24
|
+
export interface SlideTextContent extends ParsedSlide {
|
|
25
|
+
text: string[];
|
|
26
|
+
}
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-pptx-parser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A PowerPoint (PPTX) parser that extracts text content with preserved formatting",
|
|
5
5
|
"homepage": "https://github.com/Mirza-Glitch/node-pptx-parser.git",
|
|
6
6
|
"repository": {
|
|
@@ -20,8 +20,14 @@
|
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
|
-
"
|
|
24
|
-
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/esm/index.d.mts",
|
|
25
|
+
"default": "./dist/esm/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/types/index.d.ts",
|
|
29
|
+
"default": "./dist/cjs/index.js"
|
|
30
|
+
}
|
|
25
31
|
}
|
|
26
32
|
},
|
|
27
33
|
"scripts": {
|
|
@@ -29,7 +35,8 @@
|
|
|
29
35
|
"build:esm": "tsc -p tsconfig.esm.json && npm run rename:esm",
|
|
30
36
|
"build": "npm run build:cjs && npm run build:esm",
|
|
31
37
|
"clean": "rimraf dist",
|
|
32
|
-
"rename:esm": "
|
|
38
|
+
"rename:esm": "node ./scripts/fix-mjs.mjs",
|
|
39
|
+
"test:package": "npm run clean && npm run build && tsc -p tests/tsconfig.json && tsc -p tests/tsconfig.json --module node16 --moduleResolution node16 && node tests/runtime.mjs",
|
|
33
40
|
"prepack": "npm run clean && npm run build"
|
|
34
41
|
},
|
|
35
42
|
"dependencies": {
|