docgen-utils 1.0.18 → 1.0.19

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/cli.js CHANGED
@@ -73714,26 +73714,172 @@ async function createDocxBuffer(html, options = {}) {
73714
73714
  }
73715
73715
 
73716
73716
  // packages/shared/fetch-with-proxy.ts
73717
+ import * as http from "node:http";
73718
+ import * as tls from "node:tls";
73719
+ import { URL } from "node:url";
73717
73720
  var userAgent = "Mozilla/5.0 (compatible; Copilot/1.0)";
73718
- async function fetchWithProxy(url) {
73719
- const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || process.env.https_proxy || process.env.http_proxy;
73720
- if (proxyUrl) {
73721
- const undici = await import("undici");
73722
- const agent = new undici.ProxyAgent(proxyUrl);
73723
- const response = await undici.fetch(url, {
73724
- dispatcher: agent,
73725
- headers: {
73726
- "User-Agent": userAgent
73721
+ function connectThroughProxy(proxy, targetHost, targetPort) {
73722
+ return new Promise((resolve5, reject) => {
73723
+ const req = http.request({
73724
+ host: proxy.hostname,
73725
+ port: Number(proxy.port),
73726
+ method: "CONNECT",
73727
+ path: `${targetHost}:${targetPort}`
73728
+ });
73729
+ req.on("connect", (res, socket) => {
73730
+ if (res.statusCode === 200) {
73731
+ resolve5(socket);
73732
+ } else {
73733
+ socket.destroy();
73734
+ reject(
73735
+ new Error(`Proxy CONNECT failed with status ${res.statusCode}`)
73736
+ );
73727
73737
  }
73728
73738
  });
73729
- return response;
73730
- }
73731
- return fetch(url, {
73732
- headers: {
73733
- "User-Agent": userAgent
73739
+ req.on("error", reject);
73740
+ req.end();
73741
+ });
73742
+ }
73743
+ function upgradeTls(rawSocket, servername) {
73744
+ return new Promise((resolve5, reject) => {
73745
+ const tlsSocket = tls.connect(
73746
+ { socket: rawSocket, servername },
73747
+ () => {
73748
+ resolve5(tlsSocket);
73749
+ }
73750
+ );
73751
+ tlsSocket.on("error", reject);
73752
+ });
73753
+ }
73754
+ function parseHttpResponse(tlsSocket) {
73755
+ return new Promise((resolve5, reject) => {
73756
+ let headerDone = false;
73757
+ let raw = Buffer.alloc(0);
73758
+ let statusCode = 0;
73759
+ let statusText = "";
73760
+ const headers = {};
73761
+ const bodyChunks = [];
73762
+ let contentLength = -1;
73763
+ let isChunked = false;
73764
+ let bodyBytesRead = 0;
73765
+ let headerEndIndex = -1;
73766
+ function tryParseHeaders() {
73767
+ const str = raw.toString("utf-8");
73768
+ const idx = str.indexOf("\r\n\r\n");
73769
+ if (idx === -1) return false;
73770
+ headerEndIndex = Buffer.byteLength(str.slice(0, idx + 4), "utf-8");
73771
+ const headerSection = str.slice(0, idx);
73772
+ const lines = headerSection.split("\r\n");
73773
+ const statusLine = lines[0];
73774
+ const match = statusLine.match(/^HTTP\/\d\.\d\s+(\d+)\s*(.*)/);
73775
+ if (match) {
73776
+ statusCode = parseInt(match[1], 10);
73777
+ statusText = match[2];
73778
+ }
73779
+ for (let i = 1; i < lines.length; i++) {
73780
+ const colonIdx = lines[i].indexOf(":");
73781
+ if (colonIdx > 0) {
73782
+ const key2 = lines[i].slice(0, colonIdx).trim().toLowerCase();
73783
+ const val = lines[i].slice(colonIdx + 1).trim();
73784
+ headers[key2] = val;
73785
+ }
73786
+ }
73787
+ if (headers["transfer-encoding"]?.includes("chunked")) {
73788
+ isChunked = true;
73789
+ } else if (headers["content-length"]) {
73790
+ contentLength = parseInt(headers["content-length"], 10);
73791
+ }
73792
+ const bodyStart = raw.slice(headerEndIndex);
73793
+ if (bodyStart.length > 0) {
73794
+ bodyChunks.push(bodyStart);
73795
+ bodyBytesRead += bodyStart.length;
73796
+ }
73797
+ return true;
73734
73798
  }
73799
+ function decodeChunkedBody(buf) {
73800
+ const parts = [];
73801
+ let offset = 0;
73802
+ while (offset < buf.length) {
73803
+ const lineEnd = buf.indexOf(Buffer.from("\r\n"), offset);
73804
+ if (lineEnd === -1) break;
73805
+ const sizeHex = buf.slice(offset, lineEnd).toString("utf-8").trim();
73806
+ const chunkSize = parseInt(sizeHex, 16);
73807
+ if (chunkSize === 0) break;
73808
+ const chunkStart = lineEnd + 2;
73809
+ const chunkEnd = chunkStart + chunkSize;
73810
+ if (chunkEnd > buf.length) break;
73811
+ parts.push(buf.slice(chunkStart, chunkEnd));
73812
+ offset = chunkEnd + 2;
73813
+ }
73814
+ return Buffer.concat(parts);
73815
+ }
73816
+ tlsSocket.on("data", (chunk) => {
73817
+ if (!headerDone) {
73818
+ raw = Buffer.concat([raw, chunk]);
73819
+ if (tryParseHeaders()) {
73820
+ headerDone = true;
73821
+ if (!isChunked && contentLength >= 0 && bodyBytesRead >= contentLength) {
73822
+ tlsSocket.destroy();
73823
+ }
73824
+ }
73825
+ } else {
73826
+ bodyChunks.push(chunk);
73827
+ bodyBytesRead += chunk.length;
73828
+ if (!isChunked && contentLength >= 0 && bodyBytesRead >= contentLength) {
73829
+ tlsSocket.destroy();
73830
+ }
73831
+ }
73832
+ });
73833
+ tlsSocket.on("end", finish);
73834
+ tlsSocket.on("close", finish);
73835
+ let finished = false;
73836
+ function finish() {
73837
+ if (finished) return;
73838
+ finished = true;
73839
+ let body = Buffer.concat(bodyChunks);
73840
+ if (isChunked) {
73841
+ body = decodeChunkedBody(body);
73842
+ } else if (contentLength >= 0) {
73843
+ body = body.subarray(0, contentLength);
73844
+ }
73845
+ const responseHeaders = new Headers(headers);
73846
+ resolve5({
73847
+ ok: statusCode >= 200 && statusCode < 300,
73848
+ status: statusCode,
73849
+ statusText,
73850
+ headers: responseHeaders,
73851
+ arrayBuffer: () => Promise.resolve(
73852
+ body.buffer.slice(
73853
+ body.byteOffset,
73854
+ body.byteOffset + body.byteLength
73855
+ )
73856
+ ),
73857
+ text: () => Promise.resolve(body.toString("utf-8"))
73858
+ });
73859
+ }
73860
+ tlsSocket.on("error", (err) => {
73861
+ if (!finished) reject(err);
73862
+ });
73735
73863
  });
73736
73864
  }
73865
+ async function fetchWithProxy(url) {
73866
+ const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || process.env.https_proxy || process.env.http_proxy;
73867
+ if (proxyUrl) {
73868
+ const proxy = new URL(proxyUrl);
73869
+ const target = new URL(url);
73870
+ const rawSocket = await connectThroughProxy(proxy, target.hostname, 443);
73871
+ const tlsSocket = await upgradeTls(rawSocket, target.hostname);
73872
+ const requestLine = `GET ${target.pathname}${target.search} HTTP/1.1\r
73873
+ Host: ${target.hostname}\r
73874
+ User-Agent: ${userAgent}\r
73875
+ Connection: close\r
73876
+ \r
73877
+ `;
73878
+ tlsSocket.write(requestLine);
73879
+ return parseHttpResponse(tlsSocket);
73880
+ }
73881
+ return fetch(url, { headers: { "User-Agent": userAgent } });
73882
+ }
73737
73883
 
73738
73884
  // packages/cli/commands/export-docs.ts
73739
73885
  var MAX_IMAGE_WIDTH = 624;
@@ -1,13 +1,18 @@
1
+ interface ProxyResponse {
2
+ ok: boolean;
3
+ status: number;
4
+ statusText: string;
5
+ headers: Headers;
6
+ arrayBuffer(): Promise<ArrayBuffer>;
7
+ text(): Promise<string>;
8
+ }
1
9
  /**
2
- * HTTP fetch utility with proxy support for Node.js environments.
3
- * Uses undici ProxyAgent when HTTPS_PROXY or HTTP_PROXY environment variables are set.
4
- */
5
- /**
6
- * Fetch a URL with optional proxy support based on environment variables.
7
- * Checks HTTPS_PROXY, HTTP_PROXY, https_proxy, and http_proxy.
10
+ * Fetch a URL with optional proxy support.
11
+ * Uses only documented Node.js APIs: http.CONNECT, tls.connect(), raw HTTP write.
8
12
  *
9
13
  * @param url - The URL to fetch
10
- * @returns A Promise resolving to a Response object
14
+ * @returns A Promise resolving to a ProxyResponse or native Response
11
15
  */
12
- export declare function fetchWithProxy(url: string): Promise<Response>;
16
+ export declare function fetchWithProxy(url: string): Promise<ProxyResponse | Response>;
17
+ export {};
13
18
  //# sourceMappingURL=fetch-with-proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-with-proxy.d.ts","sourceRoot":"","sources":["../../../packages/shared/fetch-with-proxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqBnE"}
1
+ {"version":3,"file":"fetch-with-proxy.d.ts","sourceRoot":"","sources":["../../../packages/shared/fetch-with-proxy.ts"],"names":[],"mappings":"AASA,UAAU,aAAa;IACrB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAqMD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,aAAa,GAAG,QAAQ,CAAC,CAgCnC"}
@@ -1,33 +1,200 @@
1
+ import * as http from "node:http";
2
+ import * as tls from "node:tls";
3
+ import { URL } from "node:url";
4
+ const userAgent = "Mozilla/5.0 (compatible; Copilot/1.0)";
1
5
  /**
2
- * HTTP fetch utility with proxy support for Node.js environments.
3
- * Uses undici ProxyAgent when HTTPS_PROXY or HTTP_PROXY environment variables are set.
6
+ * Create a TCP tunnel through an HTTP proxy using the CONNECT method.
4
7
  */
5
- const userAgent = 'Mozilla/5.0 (compatible; Copilot/1.0)';
8
+ function connectThroughProxy(proxy, targetHost, targetPort) {
9
+ return new Promise((resolve, reject) => {
10
+ const req = http.request({
11
+ host: proxy.hostname,
12
+ port: Number(proxy.port),
13
+ method: "CONNECT",
14
+ path: `${targetHost}:${targetPort}`,
15
+ });
16
+ req.on("connect", (res, socket) => {
17
+ if (res.statusCode === 200) {
18
+ resolve(socket);
19
+ }
20
+ else {
21
+ socket.destroy();
22
+ reject(new Error(`Proxy CONNECT failed with status ${res.statusCode}`));
23
+ }
24
+ });
25
+ req.on("error", reject);
26
+ req.end();
27
+ });
28
+ }
29
+ /**
30
+ * Upgrade a raw TCP socket to TLS.
31
+ * Uses the documented tls.connect({ socket, servername }) API.
32
+ * @see https://nodejs.org/api/tls.html#tlsconnectoptions-callback
33
+ */
34
+ function upgradeTls(rawSocket, servername) {
35
+ return new Promise((resolve, reject) => {
36
+ const tlsSocket = tls.connect({ socket: rawSocket, servername }, () => {
37
+ resolve(tlsSocket);
38
+ });
39
+ tlsSocket.on("error", reject);
40
+ });
41
+ }
6
42
  /**
7
- * Fetch a URL with optional proxy support based on environment variables.
8
- * Checks HTTPS_PROXY, HTTP_PROXY, https_proxy, and http_proxy.
43
+ * Parse a raw HTTP/1.1 response from a TLS socket stream.
44
+ * Handles both Content-Length and chunked Transfer-Encoding.
45
+ */
46
+ function parseHttpResponse(tlsSocket) {
47
+ return new Promise((resolve, reject) => {
48
+ let headerDone = false;
49
+ let raw = Buffer.alloc(0);
50
+ let statusCode = 0;
51
+ let statusText = "";
52
+ const headers = {};
53
+ const bodyChunks = [];
54
+ let contentLength = -1;
55
+ let isChunked = false;
56
+ let bodyBytesRead = 0;
57
+ let headerEndIndex = -1;
58
+ function tryParseHeaders() {
59
+ const str = raw.toString("utf-8");
60
+ const idx = str.indexOf("\r\n\r\n");
61
+ if (idx === -1)
62
+ return false;
63
+ headerEndIndex = Buffer.byteLength(str.slice(0, idx + 4), "utf-8");
64
+ const headerSection = str.slice(0, idx);
65
+ const lines = headerSection.split("\r\n");
66
+ // Parse status line: HTTP/1.1 200 OK
67
+ const statusLine = lines[0];
68
+ const match = statusLine.match(/^HTTP\/\d\.\d\s+(\d+)\s*(.*)/);
69
+ if (match) {
70
+ statusCode = parseInt(match[1], 10);
71
+ statusText = match[2];
72
+ }
73
+ // Parse headers
74
+ for (let i = 1; i < lines.length; i++) {
75
+ const colonIdx = lines[i].indexOf(":");
76
+ if (colonIdx > 0) {
77
+ const key = lines[i].slice(0, colonIdx).trim().toLowerCase();
78
+ const val = lines[i].slice(colonIdx + 1).trim();
79
+ headers[key] = val;
80
+ }
81
+ }
82
+ if (headers["transfer-encoding"]?.includes("chunked")) {
83
+ isChunked = true;
84
+ }
85
+ else if (headers["content-length"]) {
86
+ contentLength = parseInt(headers["content-length"], 10);
87
+ }
88
+ // Push any leftover bytes after headers as body
89
+ const bodyStart = raw.slice(headerEndIndex);
90
+ if (bodyStart.length > 0) {
91
+ bodyChunks.push(bodyStart);
92
+ bodyBytesRead += bodyStart.length;
93
+ }
94
+ return true;
95
+ }
96
+ function decodeChunkedBody(buf) {
97
+ const parts = [];
98
+ let offset = 0;
99
+ while (offset < buf.length) {
100
+ const lineEnd = buf.indexOf(Buffer.from("\r\n"), offset);
101
+ if (lineEnd === -1)
102
+ break;
103
+ const sizeHex = buf.slice(offset, lineEnd).toString("utf-8").trim();
104
+ const chunkSize = parseInt(sizeHex, 16);
105
+ if (chunkSize === 0)
106
+ break;
107
+ const chunkStart = lineEnd + 2;
108
+ const chunkEnd = chunkStart + chunkSize;
109
+ if (chunkEnd > buf.length)
110
+ break;
111
+ parts.push(buf.slice(chunkStart, chunkEnd));
112
+ offset = chunkEnd + 2; // skip trailing \r\n
113
+ }
114
+ return Buffer.concat(parts);
115
+ }
116
+ tlsSocket.on("data", (chunk) => {
117
+ if (!headerDone) {
118
+ raw = Buffer.concat([raw, chunk]);
119
+ if (tryParseHeaders()) {
120
+ headerDone = true;
121
+ // Check if body is already complete
122
+ if (!isChunked &&
123
+ contentLength >= 0 &&
124
+ bodyBytesRead >= contentLength) {
125
+ tlsSocket.destroy();
126
+ }
127
+ }
128
+ }
129
+ else {
130
+ bodyChunks.push(chunk);
131
+ bodyBytesRead += chunk.length;
132
+ if (!isChunked &&
133
+ contentLength >= 0 &&
134
+ bodyBytesRead >= contentLength) {
135
+ tlsSocket.destroy();
136
+ }
137
+ }
138
+ });
139
+ tlsSocket.on("end", finish);
140
+ tlsSocket.on("close", finish);
141
+ let finished = false;
142
+ function finish() {
143
+ if (finished)
144
+ return;
145
+ finished = true;
146
+ let body = Buffer.concat(bodyChunks);
147
+ if (isChunked) {
148
+ body = decodeChunkedBody(body);
149
+ }
150
+ else if (contentLength >= 0) {
151
+ body = body.subarray(0, contentLength);
152
+ }
153
+ const responseHeaders = new Headers(headers);
154
+ resolve({
155
+ ok: statusCode >= 200 && statusCode < 300,
156
+ status: statusCode,
157
+ statusText,
158
+ headers: responseHeaders,
159
+ arrayBuffer: () => Promise.resolve(body.buffer.slice(body.byteOffset, body.byteOffset + body.byteLength)),
160
+ text: () => Promise.resolve(body.toString("utf-8")),
161
+ });
162
+ }
163
+ tlsSocket.on("error", (err) => {
164
+ if (!finished)
165
+ reject(err);
166
+ });
167
+ });
168
+ }
169
+ /**
170
+ * Fetch a URL with optional proxy support.
171
+ * Uses only documented Node.js APIs: http.CONNECT, tls.connect(), raw HTTP write.
9
172
  *
10
173
  * @param url - The URL to fetch
11
- * @returns A Promise resolving to a Response object
174
+ * @returns A Promise resolving to a ProxyResponse or native Response
12
175
  */
13
176
  export async function fetchWithProxy(url) {
14
- const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY ||
15
- process.env.https_proxy || process.env.http_proxy;
177
+ const proxyUrl = process.env.HTTPS_PROXY ||
178
+ process.env.HTTP_PROXY ||
179
+ process.env.https_proxy ||
180
+ process.env.http_proxy;
16
181
  if (proxyUrl) {
17
- const undici = await import('undici');
18
- const agent = new undici.ProxyAgent(proxyUrl);
19
- const response = await undici.fetch(url, {
20
- dispatcher: agent,
21
- headers: {
22
- 'User-Agent': userAgent,
23
- },
24
- });
25
- return response;
182
+ const proxy = new URL(proxyUrl);
183
+ const target = new URL(url);
184
+ // 1. Tunnel through proxy
185
+ const rawSocket = await connectThroughProxy(proxy, target.hostname, 443);
186
+ // 2. TLS handshake (documented: tls.connect with socket option)
187
+ const tlsSocket = await upgradeTls(rawSocket, target.hostname);
188
+ // 3. Write raw HTTP/1.1 request (per Node.js CONNECT docs pattern)
189
+ const requestLine = `GET ${target.pathname}${target.search} HTTP/1.1\r\n` +
190
+ `Host: ${target.hostname}\r\n` +
191
+ `User-Agent: ${userAgent}\r\n` +
192
+ `Connection: close\r\n` +
193
+ `\r\n`;
194
+ tlsSocket.write(requestLine);
195
+ // 4. Parse raw HTTP response
196
+ return parseHttpResponse(tlsSocket);
26
197
  }
27
- return fetch(url, {
28
- headers: {
29
- 'User-Agent': userAgent,
30
- },
31
- });
198
+ return fetch(url, { headers: { "User-Agent": userAgent } });
32
199
  }
33
200
  //# sourceMappingURL=fetch-with-proxy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-with-proxy.js","sourceRoot":"","sources":["../../../packages/shared/fetch-with-proxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,SAAS,GAAG,uCAAuC,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;QACjD,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAEnE,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;YACvC,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE;gBACP,YAAY,EAAE,SAAS;aACxB;SACF,CAAC,CAAC;QACH,OAAO,QAA+B,CAAC;IACzC,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,EAAE;QAChB,OAAO,EAAE;YACP,YAAY,EAAE,SAAS;SACxB;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"fetch-with-proxy.js","sourceRoot":"","sources":["../../../packages/shared/fetch-with-proxy.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f,OAAO,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,eAAe;YACrD,SAAS,MAAM,CAAC,QAAQ,MAAM;YAC9B,eAAe,SAAS,MAAM;YAC9B,uBAAuB;YACvB,MAAM,CAAC;QAET,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE7B,6BAA6B;QAC7B,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docgen-utils",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Utilities for converting HTML into DOCX and PPTX.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -43,8 +43,7 @@
43
43
  "jszip": "^3.10.1",
44
44
  "linkedom": "^0.16.8",
45
45
  "playwright": "^1.58.0",
46
- "rtf.js": "^3.0.9",
47
- "undici": "^7.22.0"
46
+ "rtf.js": "^3.0.9"
48
47
  },
49
48
  "devDependencies": {
50
49
  "@anthropic-ai/sdk": "^0.74.0",