@cj-tech-master/excelts 8.1.1 → 8.1.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/README.md +8 -19
- package/README_zh.md +15 -19
- package/dist/iife/excelts.iife.js +1 -1
- package/dist/iife/excelts.iife.min.js +1 -1
- package/package.json +19 -2
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ Streaming and buffered XML processing with query engine, namespace support, and
|
|
|
55
55
|
- [Documentation](src/modules/xml/README.md) | [中文](src/modules/xml/README_zh.md)
|
|
56
56
|
- [Examples](src/modules/xml/examples/)
|
|
57
57
|
|
|
58
|
-
### Archive —
|
|
58
|
+
### Archive — Create/Read/Edit Archives
|
|
59
59
|
|
|
60
60
|
ZIP and TAR archive creation, reading, editing, streaming, encryption, and compression utilities.
|
|
61
61
|
|
|
@@ -73,8 +73,14 @@ Node.js-compatible Readable/Writable/Transform/Duplex that works identically in
|
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
75
|
npm install @cj-tech-master/excelts
|
|
76
|
+
# or
|
|
77
|
+
pnpm add @cj-tech-master/excelts
|
|
78
|
+
# or
|
|
79
|
+
bun add @cj-tech-master/excelts
|
|
76
80
|
```
|
|
77
81
|
|
|
82
|
+
Each module is available as a standalone subpath export. All subpaths support `browser`, `import` (ESM), and `require` (CJS) conditions.
|
|
83
|
+
|
|
78
84
|
## Quick Start
|
|
79
85
|
|
|
80
86
|
```typescript
|
|
@@ -91,9 +97,7 @@ await workbook.xlsx.writeFile("output.xlsx");
|
|
|
91
97
|
const wb = new Workbook();
|
|
92
98
|
await wb.xlsx.readFile("output.xlsx");
|
|
93
99
|
wb.getWorksheet(1).eachRow((row, n) => console.log(n, row.values));
|
|
94
|
-
```
|
|
95
100
|
|
|
96
|
-
```typescript
|
|
97
101
|
// PDF — generate from data, no Workbook needed
|
|
98
102
|
import { pdf } from "@cj-tech-master/excelts/pdf";
|
|
99
103
|
const pdfBytes = pdf([
|
|
@@ -125,22 +129,6 @@ import { parseMarkdown, formatMarkdown } from "@cj-tech-master/excelts/markdown"
|
|
|
125
129
|
const table = parseMarkdown("| A | B |\n|---|---|\n| 1 | 2 |");
|
|
126
130
|
```
|
|
127
131
|
|
|
128
|
-
## Subpath Exports
|
|
129
|
-
|
|
130
|
-
Each module is available as a standalone subpath export:
|
|
131
|
-
|
|
132
|
-
```typescript
|
|
133
|
-
import { Workbook, WorkbookWriter } from "@cj-tech-master/excelts";
|
|
134
|
-
import { pdf, readPdf, excelToPdf } from "@cj-tech-master/excelts/pdf";
|
|
135
|
-
import { SaxParser, parseXml, XmlWriter, query } from "@cj-tech-master/excelts/xml";
|
|
136
|
-
import { zip, unzip, ZipArchive, compress } from "@cj-tech-master/excelts/zip";
|
|
137
|
-
import { parseCsv, formatCsv, CsvParserStream } from "@cj-tech-master/excelts/csv";
|
|
138
|
-
import { parseMarkdown, formatMarkdown, parseMarkdownAll } from "@cj-tech-master/excelts/markdown";
|
|
139
|
-
import { Readable, pipeline, createTransform } from "@cj-tech-master/excelts/stream";
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Each subpath supports `browser`, `import` (ESM), and `require` (CJS) conditions.
|
|
143
|
-
|
|
144
132
|
## Browser Support
|
|
145
133
|
|
|
146
134
|
ExcelTS has native browser support with **zero configuration** for modern bundlers.
|
|
@@ -161,6 +149,7 @@ For older browsers without native `CompressionStream` API, ExcelTS automatically
|
|
|
161
149
|
## Requirements
|
|
162
150
|
|
|
163
151
|
- **Node.js >= 22.0.0**
|
|
152
|
+
- **Bun >= 1.0**
|
|
164
153
|
|
|
165
154
|
| Browser | Minimum Version |
|
|
166
155
|
| ------- | ------------------ |
|
package/README_zh.md
CHANGED
|
@@ -29,7 +29,7 @@ ExcelTS 由七个独立模块组成,每个模块都有自己的文档和可运
|
|
|
29
29
|
|
|
30
30
|
### PDF — 零依赖 PDF 引擎
|
|
31
31
|
|
|
32
|
-
功能完整的 PDF
|
|
32
|
+
功能完整的 PDF 生成和读取。写入支持字体嵌入、AES-256 加密、图片和 Excel 转 PDF。读取支持从任意 PDF 提取文本、图片、注解、表单字段和元数据。
|
|
33
33
|
|
|
34
34
|
- [文档](src/modules/pdf/README.md) | [中文](src/modules/pdf/README_zh.md)
|
|
35
35
|
- [示例](src/modules/pdf/examples/)
|
|
@@ -55,7 +55,7 @@ ExcelTS 由七个独立模块组成,每个模块都有自己的文档和可运
|
|
|
55
55
|
- [文档](src/modules/xml/README.md) | [中文](src/modules/xml/README_zh.md)
|
|
56
56
|
- [示例](src/modules/xml/examples/)
|
|
57
57
|
|
|
58
|
-
### Archive —
|
|
58
|
+
### Archive — 归档创建/读取/编辑
|
|
59
59
|
|
|
60
60
|
ZIP 和 TAR 归档创建、读取、编辑、流式处理、加密和压缩工具。
|
|
61
61
|
|
|
@@ -73,8 +73,14 @@ ZIP 和 TAR 归档创建、读取、编辑、流式处理、加密和压缩工
|
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
75
|
npm install @cj-tech-master/excelts
|
|
76
|
+
# or
|
|
77
|
+
pnpm add @cj-tech-master/excelts
|
|
78
|
+
# or
|
|
79
|
+
bun add @cj-tech-master/excelts
|
|
76
80
|
```
|
|
77
81
|
|
|
82
|
+
每个模块都可以作为独立的子路径导出使用。所有子路径均支持 `browser`、`import`(ESM)和 `require`(CJS)条件导出。
|
|
83
|
+
|
|
78
84
|
## 快速开始
|
|
79
85
|
|
|
80
86
|
```typescript
|
|
@@ -91,9 +97,7 @@ await workbook.xlsx.writeFile("output.xlsx");
|
|
|
91
97
|
const wb = new Workbook();
|
|
92
98
|
await wb.xlsx.readFile("output.xlsx");
|
|
93
99
|
wb.getWorksheet(1).eachRow((row, n) => console.log(n, row.values));
|
|
94
|
-
```
|
|
95
100
|
|
|
96
|
-
```typescript
|
|
97
101
|
// PDF — 直接从数据生成,无需 Workbook
|
|
98
102
|
import { pdf } from "@cj-tech-master/excelts/pdf";
|
|
99
103
|
const pdfBytes = pdf([
|
|
@@ -101,6 +105,12 @@ const pdfBytes = pdf([
|
|
|
101
105
|
["小工具", 1000]
|
|
102
106
|
]);
|
|
103
107
|
|
|
108
|
+
// PDF — 读取任意 PDF 的文本、图片和元数据
|
|
109
|
+
import { readPdf } from "@cj-tech-master/excelts/pdf";
|
|
110
|
+
const result = readPdf(pdfBytes);
|
|
111
|
+
console.log(result.text); // 提取的文本
|
|
112
|
+
console.log(result.metadata); // 标题、作者等
|
|
113
|
+
|
|
104
114
|
// CSV — 解析和格式化
|
|
105
115
|
import { parseCsv, formatCsv } from "@cj-tech-master/excelts/csv";
|
|
106
116
|
const rows = parseCsv("name,age\nAlice,30", { headers: true });
|
|
@@ -119,21 +129,6 @@ import { parseMarkdown, formatMarkdown } from "@cj-tech-master/excelts/markdown"
|
|
|
119
129
|
const table = parseMarkdown("| A | B |\n|---|---|\n| 1 | 2 |");
|
|
120
130
|
```
|
|
121
131
|
|
|
122
|
-
## 子路径导出
|
|
123
|
-
|
|
124
|
-
每个模块都可以作为独立的子路径导出使用:
|
|
125
|
-
|
|
126
|
-
```typescript
|
|
127
|
-
import { Workbook, WorkbookWriter } from "@cj-tech-master/excelts";
|
|
128
|
-
import { SaxParser, parseXml, XmlWriter, query } from "@cj-tech-master/excelts/xml";
|
|
129
|
-
import { zip, unzip, ZipArchive, compress } from "@cj-tech-master/excelts/zip";
|
|
130
|
-
import { parseCsv, formatCsv, CsvParserStream } from "@cj-tech-master/excelts/csv";
|
|
131
|
-
import { parseMarkdown, formatMarkdown, parseMarkdownAll } from "@cj-tech-master/excelts/markdown";
|
|
132
|
-
import { Readable, pipeline, createTransform } from "@cj-tech-master/excelts/stream";
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
每个子路径均支持 `browser`、`import`(ESM)和 `require`(CJS)条件导出。
|
|
136
|
-
|
|
137
132
|
## 浏览器支持
|
|
138
133
|
|
|
139
134
|
ExcelTS 原生支持浏览器,现代打包工具**零配置**即可使用。
|
|
@@ -154,6 +149,7 @@ const buffer = await new Workbook().addWorksheet("S1").workbook.xlsx.writeBuffer
|
|
|
154
149
|
## 系统要求
|
|
155
150
|
|
|
156
151
|
- **Node.js >= 22.0.0**
|
|
152
|
+
- **Bun >= 1.0**
|
|
157
153
|
|
|
158
154
|
| 浏览器 | 最低版本 |
|
|
159
155
|
| ------- | ------------------ |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cj-tech-master/excelts",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.2",
|
|
4
4
|
"description": "Zero-dependency TypeScript toolkit — Excel (XLSX), PDF, CSV, Markdown, XML, ZIP/TAR, and streaming.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -107,6 +107,20 @@
|
|
|
107
107
|
"default": "./dist/cjs/modules/stream/index.js"
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
+
"./pdf": {
|
|
111
|
+
"browser": {
|
|
112
|
+
"types": "./dist/browser/modules/pdf/index.d.ts",
|
|
113
|
+
"default": "./dist/browser/modules/pdf/index.js"
|
|
114
|
+
},
|
|
115
|
+
"import": {
|
|
116
|
+
"types": "./dist/types/modules/pdf/index.d.ts",
|
|
117
|
+
"default": "./dist/esm/modules/pdf/index.js"
|
|
118
|
+
},
|
|
119
|
+
"require": {
|
|
120
|
+
"types": "./dist/types/modules/pdf/index.d.ts",
|
|
121
|
+
"default": "./dist/cjs/modules/pdf/index.js"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
110
124
|
"./xml": {
|
|
111
125
|
"browser": {
|
|
112
126
|
"types": "./dist/browser/modules/xml/index.d.ts",
|
|
@@ -145,6 +159,9 @@
|
|
|
145
159
|
"stream": [
|
|
146
160
|
"dist/types/modules/stream/index.d.ts"
|
|
147
161
|
],
|
|
162
|
+
"pdf": [
|
|
163
|
+
"dist/types/modules/pdf/index.d.ts"
|
|
164
|
+
],
|
|
148
165
|
"xml": [
|
|
149
166
|
"dist/types/modules/xml/index.d.ts"
|
|
150
167
|
],
|
|
@@ -229,7 +246,7 @@
|
|
|
229
246
|
"test:browser": "npm run generate:csv-worker && rimraf dist && npm run build:browser:bundle && vitest run --config vitest.browser.config.ts",
|
|
230
247
|
"test:watch": "vitest",
|
|
231
248
|
"build": "npm run generate:csv-worker && rimraf dist && concurrently \"npm run build:esm\" \"npm run build:cjs\" \"npm run build:browser\" \"npm run build:browser:bundle\" && npm run build:verify",
|
|
232
|
-
"build:verify": "tsc --noEmit --ignoreConfig --module NodeNext --moduleResolution NodeNext --lib ESNext,DOM --types node dist/types/index.d.ts dist/types/modules/archive/index.d.ts dist/types/modules/csv/index.d.ts dist/types/modules/markdown/index.d.ts dist/types/modules/stream/index.d.ts dist/types/modules/xml/index.d.ts",
|
|
249
|
+
"build:verify": "tsc --noEmit --ignoreConfig --module NodeNext --moduleResolution NodeNext --lib ESNext,DOM --types node dist/types/index.d.ts dist/types/modules/archive/index.d.ts dist/types/modules/csv/index.d.ts dist/types/modules/markdown/index.d.ts dist/types/modules/pdf/index.d.ts dist/types/modules/stream/index.d.ts dist/types/modules/xml/index.d.ts",
|
|
233
250
|
"verify:treeshake": "node scripts/treeshake-verify.ts",
|
|
234
251
|
"analyze:browser": "rimraf dist && node --input-type=module -e \"import { execSync } from 'node:child_process'; process.env.ANALYZE='true'; execSync('rolldown -c rolldown.config.ts', { stdio: 'inherit' });\"",
|
|
235
252
|
"clean": "pnpm dlx --reporter=silent rimraf \"**/node_modules\" pnpm-lock.yaml \"**/dist\" -g && pnpm i",
|