@wenyan-md/core 1.0.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.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/atom-one-dark.min-hABhDLRj.js +5 -0
- package/dist/atom-one-dark.min-hABhDLRj.js.map +1 -0
- package/dist/atom-one-light.min-CwiVhPEv.js +5 -0
- package/dist/atom-one-light.min-CwiVhPEv.js.map +1 -0
- package/dist/core.js +428 -0
- package/dist/core.js.map +1 -0
- package/dist/default-D-dyLptq.js +185 -0
- package/dist/default-D-dyLptq.js.map +1 -0
- package/dist/dracula.min-OeyC4Nkp.js +12 -0
- package/dist/dracula.min-OeyC4Nkp.js.map +1 -0
- package/dist/github-dark.min-DOlD5Ewr.js +14 -0
- package/dist/github-dark.min-DOlD5Ewr.js.map +1 -0
- package/dist/github.min-BZ2GvPsn.js +15 -0
- package/dist/github.min-BZ2GvPsn.js.map +1 -0
- package/dist/lapis-dRySN5pK.js +195 -0
- package/dist/lapis-dRySN5pK.js.map +1 -0
- package/dist/maize-DFW0x6O3.js +195 -0
- package/dist/maize-DFW0x6O3.js.map +1 -0
- package/dist/monokai.min-CH2iHqHz.js +5 -0
- package/dist/monokai.min-CH2iHqHz.js.map +1 -0
- package/dist/orangeheart-Da7uQj8U.js +185 -0
- package/dist/orangeheart-Da7uQj8U.js.map +1 -0
- package/dist/phycat-BGGT9oBk.js +336 -0
- package/dist/phycat-BGGT9oBk.js.map +1 -0
- package/dist/pie-DUYodGli.js +241 -0
- package/dist/pie-DUYodGli.js.map +1 -0
- package/dist/publish.js +360 -0
- package/dist/publish.js.map +1 -0
- package/dist/purple-Da1-Vfos.js +184 -0
- package/dist/purple-Da1-Vfos.js.map +1 -0
- package/dist/rainbow-BtrbZco6.js +168 -0
- package/dist/rainbow-BtrbZco6.js.map +1 -0
- package/dist/solarized-dark.min-BxbYljx4.js +12 -0
- package/dist/solarized-dark.min-BxbYljx4.js.map +1 -0
- package/dist/solarized-light.min-Bb25xgOC.js +12 -0
- package/dist/solarized-light.min-Bb25xgOC.js.map +1 -0
- package/dist/types/hltheme.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/publish.d.ts +1 -0
- package/dist/types/theme.d.ts +8 -0
- package/dist/xcode.min-CG-lWQgl.js +5 -0
- package/dist/xcode.min-CG-lWQgl.js.map +1 -0
- package/package.json +44 -0
package/dist/publish.js
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { JSDOM as W } from "jsdom";
|
|
2
|
+
import { FormData as L } from "formdata-node";
|
|
3
|
+
import { createReadStream as N } from "fs";
|
|
4
|
+
import { stat as x } from "fs/promises";
|
|
5
|
+
import b, { basename as j } from "path";
|
|
6
|
+
var I = (t, e, r) => {
|
|
7
|
+
if (!e.has(t))
|
|
8
|
+
throw TypeError("Cannot " + r);
|
|
9
|
+
}, c = (t, e, r) => (I(t, e, "read from private field"), r ? r.call(t) : e.get(t)), p = (t, e, r) => {
|
|
10
|
+
if (e.has(t))
|
|
11
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
12
|
+
e instanceof WeakSet ? e.add(t) : e.set(t, r);
|
|
13
|
+
}, w = (t, e, r, a) => (I(t, e, "write to private field"), e.set(t, r), r), z = (t) => typeof t == "object" && t != null && !Array.isArray(t), h = (t) => typeof t == "function", R = (t) => z(t) && h(t[Symbol.asyncIterator]), v = 65536;
|
|
14
|
+
async function* q(t) {
|
|
15
|
+
if (t.byteLength <= v) {
|
|
16
|
+
yield t;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let e = 0;
|
|
20
|
+
for (; e < t.byteLength; ) {
|
|
21
|
+
const r = Math.min(t.byteLength - e, v), a = t.buffer.slice(e, e + r);
|
|
22
|
+
e += a.byteLength, yield new Uint8Array(a);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function* C(t) {
|
|
26
|
+
const e = t.getReader();
|
|
27
|
+
for (; ; ) {
|
|
28
|
+
const { done: r, value: a } = await e.read();
|
|
29
|
+
if (r)
|
|
30
|
+
break;
|
|
31
|
+
yield a;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function* $(t) {
|
|
35
|
+
for await (const e of t)
|
|
36
|
+
yield* q(e);
|
|
37
|
+
}
|
|
38
|
+
var U = (t) => {
|
|
39
|
+
if (R(t))
|
|
40
|
+
return $(t);
|
|
41
|
+
if (h(t.getReader))
|
|
42
|
+
return $(C(t));
|
|
43
|
+
throw new TypeError(
|
|
44
|
+
"Unsupported data source: Expected either ReadableStream or async iterable."
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
async function* D(t) {
|
|
48
|
+
let e = 0;
|
|
49
|
+
for (; e !== t.size; ) {
|
|
50
|
+
const a = await t.slice(
|
|
51
|
+
e,
|
|
52
|
+
Math.min(t.size, e + v)
|
|
53
|
+
).arrayBuffer();
|
|
54
|
+
e += a.byteLength, yield new Uint8Array(a);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function* S(t, e = !1) {
|
|
58
|
+
for (const r of t)
|
|
59
|
+
ArrayBuffer.isView(r) ? e ? yield* q(r) : yield r : h(r.stream) ? yield* U(r.stream()) : yield* D(r);
|
|
60
|
+
}
|
|
61
|
+
function* H(t, e, r = 0, a) {
|
|
62
|
+
a ??= e;
|
|
63
|
+
let n = r < 0 ? Math.max(e + r, 0) : Math.min(r, e), i = a < 0 ? Math.max(e + a, 0) : Math.min(a, e);
|
|
64
|
+
const s = Math.max(i - n, 0);
|
|
65
|
+
let o = 0;
|
|
66
|
+
for (const d of t) {
|
|
67
|
+
if (o >= s)
|
|
68
|
+
break;
|
|
69
|
+
const l = ArrayBuffer.isView(d) ? d.byteLength : d.size;
|
|
70
|
+
if (n && l <= n)
|
|
71
|
+
n -= l, i -= l;
|
|
72
|
+
else {
|
|
73
|
+
let f;
|
|
74
|
+
ArrayBuffer.isView(d) ? (f = d.subarray(n, Math.min(l, i)), o += f.byteLength) : (f = d.slice(n, Math.min(l, i)), o += f.size), i -= l, n = 0, yield f;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
var u, _, g, O = class A {
|
|
79
|
+
/**
|
|
80
|
+
* Returns a new [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) object.
|
|
81
|
+
* The content of the blob consists of the concatenation of the values given in the parameter array.
|
|
82
|
+
*
|
|
83
|
+
* @param blobParts An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).
|
|
84
|
+
* @param options An optional object of type `BlobPropertyBag`.
|
|
85
|
+
*/
|
|
86
|
+
constructor(e = [], r = {}) {
|
|
87
|
+
if (p(this, u, []), p(this, _, ""), p(this, g, 0), r ??= {}, typeof e != "object" || e === null)
|
|
88
|
+
throw new TypeError(
|
|
89
|
+
"Failed to construct 'Blob': The provided value cannot be converted to a sequence."
|
|
90
|
+
);
|
|
91
|
+
if (!h(e[Symbol.iterator]))
|
|
92
|
+
throw new TypeError(
|
|
93
|
+
"Failed to construct 'Blob': The object must have a callable @@iterator property."
|
|
94
|
+
);
|
|
95
|
+
if (typeof r != "object" && !h(r))
|
|
96
|
+
throw new TypeError(
|
|
97
|
+
"Failed to construct 'Blob': parameter 2 cannot convert to dictionary."
|
|
98
|
+
);
|
|
99
|
+
const a = new TextEncoder();
|
|
100
|
+
for (const i of e) {
|
|
101
|
+
let s;
|
|
102
|
+
ArrayBuffer.isView(i) ? s = new Uint8Array(i.buffer.slice(
|
|
103
|
+
i.byteOffset,
|
|
104
|
+
i.byteOffset + i.byteLength
|
|
105
|
+
)) : i instanceof ArrayBuffer ? s = new Uint8Array(i.slice(0)) : i instanceof A ? s = i : s = a.encode(String(i)), w(this, g, c(this, g) + (ArrayBuffer.isView(s) ? s.byteLength : s.size)), c(this, u).push(s);
|
|
106
|
+
}
|
|
107
|
+
const n = r.type === void 0 ? "" : String(r.type);
|
|
108
|
+
w(this, _, /^[\x20-\x7E]*$/.test(n) ? n : "");
|
|
109
|
+
}
|
|
110
|
+
static [Symbol.hasInstance](e) {
|
|
111
|
+
return !!(e && typeof e == "object" && h(e.constructor) && (h(e.stream) || h(e.arrayBuffer)) && /^(Blob|File)$/.test(e[Symbol.toStringTag]));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns the [`MIME type`](https://developer.mozilla.org/en-US/docs/Glossary/MIME_type) of the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
|
|
115
|
+
*/
|
|
116
|
+
get type() {
|
|
117
|
+
return c(this, _);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Returns the size of the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) in bytes.
|
|
121
|
+
*/
|
|
122
|
+
get size() {
|
|
123
|
+
return c(this, g);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Creates and returns a new [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) object which contains data from a subset of the blob on which it's called.
|
|
127
|
+
*
|
|
128
|
+
* @param start An index into the Blob indicating the first byte to include in the new Blob. If you specify a negative value, it's treated as an offset from the end of the Blob toward the beginning. For example, -10 would be the 10th from last byte in the Blob. The default value is 0. If you specify a value for start that is larger than the size of the source Blob, the returned Blob has size 0 and contains no data.
|
|
129
|
+
* @param end An index into the Blob indicating the first byte that will *not* be included in the new Blob (i.e. the byte exactly at this index is not included). If you specify a negative value, it's treated as an offset from the end of the Blob toward the beginning. For example, -10 would be the 10th from last byte in the Blob. The default value is size.
|
|
130
|
+
* @param contentType The content type to assign to the new Blob; this will be the value of its type property. The default value is an empty string.
|
|
131
|
+
*/
|
|
132
|
+
slice(e, r, a) {
|
|
133
|
+
return new A(H(c(this, u), this.size, e, r), {
|
|
134
|
+
type: a
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves with a string containing the contents of the blob, interpreted as UTF-8.
|
|
139
|
+
*/
|
|
140
|
+
async text() {
|
|
141
|
+
const e = new TextDecoder();
|
|
142
|
+
let r = "";
|
|
143
|
+
for await (const a of S(c(this, u)))
|
|
144
|
+
r += e.decode(a, { stream: !0 });
|
|
145
|
+
return r += e.decode(), r;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves with the contents of the blob as binary data contained in an [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).
|
|
149
|
+
*/
|
|
150
|
+
async arrayBuffer() {
|
|
151
|
+
const e = new Uint8Array(this.size);
|
|
152
|
+
let r = 0;
|
|
153
|
+
for await (const a of S(c(this, u)))
|
|
154
|
+
e.set(a, r), r += a.length;
|
|
155
|
+
return e.buffer;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Returns a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) which upon reading returns the data contained within the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).
|
|
159
|
+
*/
|
|
160
|
+
stream() {
|
|
161
|
+
const e = S(c(this, u), !0);
|
|
162
|
+
return new ReadableStream({
|
|
163
|
+
async pull(r) {
|
|
164
|
+
const { value: a, done: n } = await e.next();
|
|
165
|
+
if (n)
|
|
166
|
+
return queueMicrotask(() => r.close());
|
|
167
|
+
r.enqueue(a);
|
|
168
|
+
},
|
|
169
|
+
async cancel() {
|
|
170
|
+
await e.return();
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
get [Symbol.toStringTag]() {
|
|
175
|
+
return "Blob";
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
u = /* @__PURE__ */ new WeakMap();
|
|
179
|
+
_ = /* @__PURE__ */ new WeakMap();
|
|
180
|
+
g = /* @__PURE__ */ new WeakMap();
|
|
181
|
+
var T = O;
|
|
182
|
+
Object.defineProperties(T.prototype, {
|
|
183
|
+
type: { enumerable: !0 },
|
|
184
|
+
size: { enumerable: !0 },
|
|
185
|
+
slice: { enumerable: !0 },
|
|
186
|
+
stream: { enumerable: !0 },
|
|
187
|
+
text: { enumerable: !0 },
|
|
188
|
+
arrayBuffer: { enumerable: !0 }
|
|
189
|
+
});
|
|
190
|
+
var M, k, V = class extends T {
|
|
191
|
+
/**
|
|
192
|
+
* Creates a new File instance.
|
|
193
|
+
*
|
|
194
|
+
* @param fileBits An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
|
|
195
|
+
* @param name The name of the file.
|
|
196
|
+
* @param options An options object containing optional attributes for the file.
|
|
197
|
+
*/
|
|
198
|
+
constructor(t, e, r = {}) {
|
|
199
|
+
if (super(t, r), p(this, M, void 0), p(this, k, 0), arguments.length < 2)
|
|
200
|
+
throw new TypeError(
|
|
201
|
+
`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`
|
|
202
|
+
);
|
|
203
|
+
w(this, M, String(e));
|
|
204
|
+
const a = r.lastModified === void 0 ? Date.now() : Number(r.lastModified);
|
|
205
|
+
Number.isNaN(a) || w(this, k, a);
|
|
206
|
+
}
|
|
207
|
+
static [Symbol.hasInstance](t) {
|
|
208
|
+
return t instanceof T && t[Symbol.toStringTag] === "File" && typeof t.name == "string";
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Name of the file referenced by the File object.
|
|
212
|
+
*/
|
|
213
|
+
get name() {
|
|
214
|
+
return c(this, M);
|
|
215
|
+
}
|
|
216
|
+
/* c8 ignore next 3 */
|
|
217
|
+
get webkitRelativePath() {
|
|
218
|
+
return "";
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
|
|
222
|
+
*/
|
|
223
|
+
get lastModified() {
|
|
224
|
+
return c(this, k);
|
|
225
|
+
}
|
|
226
|
+
get [Symbol.toStringTag]() {
|
|
227
|
+
return "File";
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
M = /* @__PURE__ */ new WeakMap();
|
|
231
|
+
k = /* @__PURE__ */ new WeakMap();
|
|
232
|
+
var m, y, J = class P {
|
|
233
|
+
constructor(e) {
|
|
234
|
+
p(this, m, void 0), p(this, y, void 0), w(this, m, e.path), w(this, y, e.start || 0), this.name = j(c(this, m)), this.size = e.size, this.lastModified = e.lastModified;
|
|
235
|
+
}
|
|
236
|
+
slice(e, r) {
|
|
237
|
+
return new P({
|
|
238
|
+
path: c(this, m),
|
|
239
|
+
lastModified: this.lastModified,
|
|
240
|
+
start: c(this, y) + e,
|
|
241
|
+
size: r - e
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
async *stream() {
|
|
245
|
+
const { mtimeMs: e } = await x(c(this, m));
|
|
246
|
+
if (e > this.lastModified)
|
|
247
|
+
throw new DOMException(
|
|
248
|
+
"The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.",
|
|
249
|
+
"NotReadableError"
|
|
250
|
+
);
|
|
251
|
+
this.size && (yield* N(c(this, m), {
|
|
252
|
+
start: c(this, y),
|
|
253
|
+
end: c(this, y) + this.size - 1
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
get [Symbol.toStringTag]() {
|
|
257
|
+
return "File";
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
m = /* @__PURE__ */ new WeakMap();
|
|
261
|
+
y = /* @__PURE__ */ new WeakMap();
|
|
262
|
+
var G = J;
|
|
263
|
+
function K(t, { mtimeMs: e, size: r }, a, n = {}) {
|
|
264
|
+
let i;
|
|
265
|
+
z(a) ? [n, i] = [a, void 0] : i = a;
|
|
266
|
+
const s = new G({ path: t, size: r, lastModified: e });
|
|
267
|
+
return i || (i = s.name), new V([s], i, {
|
|
268
|
+
...n,
|
|
269
|
+
lastModified: s.lastModified
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
async function X(t, e, r) {
|
|
273
|
+
const a = await x(t);
|
|
274
|
+
return K(t, a, e, r);
|
|
275
|
+
}
|
|
276
|
+
/*! Based on fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> & David Frank */
|
|
277
|
+
const Z = "https://api.weixin.qq.com/cgi-bin/token", Q = "https://api.weixin.qq.com/cgi-bin/draft/add", Y = "https://api.weixin.qq.com/cgi-bin/material/add_material", ee = process.env.WECHAT_APP_ID || "", te = process.env.WECHAT_APP_SECRET || "";
|
|
278
|
+
async function re() {
|
|
279
|
+
try {
|
|
280
|
+
const e = await (await fetch(`${Z}?grant_type=client_credential&appid=${ee}&secret=${te}`)).json();
|
|
281
|
+
if (e.access_token)
|
|
282
|
+
return e;
|
|
283
|
+
throw e.errcode ? new Error(`获取 Access Token 失败,错误码:${e.errcode},${e.errmsg}`) : new Error(`获取 Access Token 失败: ${e}`);
|
|
284
|
+
} catch (t) {
|
|
285
|
+
throw t;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
async function F(t, e, r, a) {
|
|
289
|
+
const n = new L();
|
|
290
|
+
n.append("media", e, r);
|
|
291
|
+
const i = await fetch(`${Y}?access_token=${a}&type=${t}`, {
|
|
292
|
+
method: "POST",
|
|
293
|
+
body: n
|
|
294
|
+
});
|
|
295
|
+
if (!i.ok) {
|
|
296
|
+
const d = await i.text();
|
|
297
|
+
throw new Error(`上传失败: ${i.status} ${d}`);
|
|
298
|
+
}
|
|
299
|
+
const s = await i.json();
|
|
300
|
+
if (s.errcode)
|
|
301
|
+
throw new Error(`上传失败,错误码:${s.errcode},错误信息:${s.errmsg}`);
|
|
302
|
+
const o = s.url.replace("http://", "https://");
|
|
303
|
+
return s.url = o, s;
|
|
304
|
+
}
|
|
305
|
+
async function E(t, e, r) {
|
|
306
|
+
if (t.startsWith("http")) {
|
|
307
|
+
const a = await fetch(t);
|
|
308
|
+
if (!a.ok || !a.body)
|
|
309
|
+
throw new Error(`Failed to download image from URL: ${t}`);
|
|
310
|
+
const n = b.basename(t.split("?")[0]), i = b.extname(n), s = r ?? (i === "" ? `${n}.jpg` : n), o = await a.arrayBuffer();
|
|
311
|
+
return await F("image", new Blob([o]), s, e);
|
|
312
|
+
} else {
|
|
313
|
+
const a = t, n = b.basename(a), i = b.extname(n), s = r ?? (i === "" ? `${n}.jpg` : n), o = await X(a);
|
|
314
|
+
return await F("image", o, s, e);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
async function ae(t, e) {
|
|
318
|
+
if (!t.includes("<img"))
|
|
319
|
+
return { html: t, firstImageId: "" };
|
|
320
|
+
const r = new W(t), a = r.window.document, i = Array.from(a.querySelectorAll("img")).map(async (l) => {
|
|
321
|
+
const f = l.getAttribute("src");
|
|
322
|
+
if (f) {
|
|
323
|
+
if (f.startsWith("https://mmbiz.qpic.cn"))
|
|
324
|
+
return f;
|
|
325
|
+
{
|
|
326
|
+
const B = await E(f, e);
|
|
327
|
+
return l.setAttribute("src", B.url), B.media_id;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return null;
|
|
331
|
+
}), o = (await Promise.all(i)).filter(Boolean)[0] || "";
|
|
332
|
+
return { html: r.serialize(), firstImageId: o };
|
|
333
|
+
}
|
|
334
|
+
async function le(t, e, r) {
|
|
335
|
+
try {
|
|
336
|
+
const a = await re(), n = e.replace(/\n<li/g, "<li").replace(/<\/li>\n/g, "</li>"), { html: i, firstImageId: s } = await ae(n, a.access_token);
|
|
337
|
+
let o = "";
|
|
338
|
+
if (r ? o = (await E(r, a.access_token, "cover.jpg")).media_id : s.startsWith("https://mmbiz.qpic.cn") ? o = (await E(s, a.access_token, "cover.jpg")).media_id : o = s, !o)
|
|
339
|
+
throw new Error("你必须指定一张封面图或者在正文中至少出现一张图片。");
|
|
340
|
+
const l = await (await fetch(`${Q}?access_token=${a.access_token}`, {
|
|
341
|
+
method: "POST",
|
|
342
|
+
body: JSON.stringify({
|
|
343
|
+
articles: [{
|
|
344
|
+
title: t,
|
|
345
|
+
content: i,
|
|
346
|
+
thumb_media_id: o
|
|
347
|
+
}]
|
|
348
|
+
})
|
|
349
|
+
})).json();
|
|
350
|
+
if (l.media_id)
|
|
351
|
+
return l;
|
|
352
|
+
throw l.errcode ? new Error(`上传到公众号草稿失败,错误码:${l.errcode},${l.errmsg}`) : new Error(`上传到公众号草稿失败: ${l}`);
|
|
353
|
+
} catch (a) {
|
|
354
|
+
throw a;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
export {
|
|
358
|
+
le as publishToDraft
|
|
359
|
+
};
|
|
360
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sources":["../node_modules/.pnpm/formdata-node@6.0.3/node_modules/formdata-node/lib/file-from-path.js","../src/publish.ts"],"sourcesContent":["var __accessCheck = (obj, member, msg) => {\n if (!member.has(obj))\n throw TypeError(\"Cannot \" + msg);\n};\nvar __privateGet = (obj, member, getter) => {\n __accessCheck(obj, member, \"read from private field\");\n return getter ? getter.call(obj) : member.get(obj);\n};\nvar __privateAdd = (obj, member, value) => {\n if (member.has(obj))\n throw TypeError(\"Cannot add the same private member more than once\");\n member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\n};\nvar __privateSet = (obj, member, value, setter) => {\n __accessCheck(obj, member, \"write to private field\");\n setter ? setter.call(obj, value) : member.set(obj, value);\n return value;\n};\n\n// src/fileFromPath.ts\nimport { statSync, createReadStream } from \"fs\";\nimport { stat } from \"fs/promises\";\nimport { basename } from \"path\";\n\n// src/isObject.ts\nvar isObject = (value) => typeof value === \"object\" && value != null && !Array.isArray(value);\n\n// src/isFunction.ts\nvar isFunction = (value) => typeof value === \"function\";\n\n// src/isAsyncIterable.ts\nvar isAsyncIterable = (value) => isObject(value) && isFunction(value[Symbol.asyncIterator]);\n\n// src/blobHelpers.ts\nvar MAX_CHUNK_SIZE = 65536;\nasync function* clonePart(value) {\n if (value.byteLength <= MAX_CHUNK_SIZE) {\n yield value;\n return;\n }\n let offset = 0;\n while (offset < value.byteLength) {\n const size = Math.min(value.byteLength - offset, MAX_CHUNK_SIZE);\n const buffer = value.buffer.slice(offset, offset + size);\n offset += buffer.byteLength;\n yield new Uint8Array(buffer);\n }\n}\nasync function* readStream(readable) {\n const reader = readable.getReader();\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n yield value;\n }\n}\nasync function* chunkStream(stream) {\n for await (const value of stream) {\n yield* clonePart(value);\n }\n}\nvar getStreamIterator = (source) => {\n if (isAsyncIterable(source)) {\n return chunkStream(source);\n }\n if (isFunction(source.getReader)) {\n return chunkStream(readStream(source));\n }\n throw new TypeError(\n \"Unsupported data source: Expected either ReadableStream or async iterable.\"\n );\n};\nasync function* consumeNodeBlob(blob) {\n let position = 0;\n while (position !== blob.size) {\n const chunk = blob.slice(\n position,\n Math.min(blob.size, position + MAX_CHUNK_SIZE)\n );\n const buffer = await chunk.arrayBuffer();\n position += buffer.byteLength;\n yield new Uint8Array(buffer);\n }\n}\nasync function* consumeBlobParts(parts, clone = false) {\n for (const part of parts) {\n if (ArrayBuffer.isView(part)) {\n if (clone) {\n yield* clonePart(part);\n } else {\n yield part;\n }\n } else if (isFunction(part.stream)) {\n yield* getStreamIterator(part.stream());\n } else {\n yield* consumeNodeBlob(part);\n }\n }\n}\nfunction* sliceBlob(blobParts, blobSize, start = 0, end) {\n end ??= blobSize;\n let relativeStart = start < 0 ? Math.max(blobSize + start, 0) : Math.min(start, blobSize);\n let relativeEnd = end < 0 ? Math.max(blobSize + end, 0) : Math.min(end, blobSize);\n const span = Math.max(relativeEnd - relativeStart, 0);\n let added = 0;\n for (const part of blobParts) {\n if (added >= span) {\n break;\n }\n const partSize = ArrayBuffer.isView(part) ? part.byteLength : part.size;\n if (relativeStart && partSize <= relativeStart) {\n relativeStart -= partSize;\n relativeEnd -= partSize;\n } else {\n let chunk;\n if (ArrayBuffer.isView(part)) {\n chunk = part.subarray(relativeStart, Math.min(partSize, relativeEnd));\n added += chunk.byteLength;\n } else {\n chunk = part.slice(relativeStart, Math.min(partSize, relativeEnd));\n added += chunk.size;\n }\n relativeEnd -= partSize;\n relativeStart = 0;\n yield chunk;\n }\n }\n}\n\n// src/Blob.ts\nvar _parts, _type, _size;\nvar _Blob = class _Blob {\n /**\n * Returns a new [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) object.\n * The content of the blob consists of the concatenation of the values given in the parameter array.\n *\n * @param blobParts An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).\n * @param options An optional object of type `BlobPropertyBag`.\n */\n constructor(blobParts = [], options = {}) {\n /**\n * An `Array` of [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) or [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).\n */\n __privateAdd(this, _parts, []);\n /**\n * Returns the [`MIME type`](https://developer.mozilla.org/en-US/docs/Glossary/MIME_type) of the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).\n */\n __privateAdd(this, _type, \"\");\n /**\n * Returns the size of the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) in bytes.\n */\n __privateAdd(this, _size, 0);\n options ??= {};\n if (typeof blobParts !== \"object\" || blobParts === null) {\n throw new TypeError(\n \"Failed to construct 'Blob': The provided value cannot be converted to a sequence.\"\n );\n }\n if (!isFunction(blobParts[Symbol.iterator])) {\n throw new TypeError(\n \"Failed to construct 'Blob': The object must have a callable @@iterator property.\"\n );\n }\n if (typeof options !== \"object\" && !isFunction(options)) {\n throw new TypeError(\n \"Failed to construct 'Blob': parameter 2 cannot convert to dictionary.\"\n );\n }\n const encoder = new TextEncoder();\n for (const raw of blobParts) {\n let part;\n if (ArrayBuffer.isView(raw)) {\n part = new Uint8Array(raw.buffer.slice(\n raw.byteOffset,\n raw.byteOffset + raw.byteLength\n ));\n } else if (raw instanceof ArrayBuffer) {\n part = new Uint8Array(raw.slice(0));\n } else if (raw instanceof _Blob) {\n part = raw;\n } else {\n part = encoder.encode(String(raw));\n }\n __privateSet(this, _size, __privateGet(this, _size) + (ArrayBuffer.isView(part) ? part.byteLength : part.size));\n __privateGet(this, _parts).push(part);\n }\n const type = options.type === void 0 ? \"\" : String(options.type);\n __privateSet(this, _type, /^[\\x20-\\x7E]*$/.test(type) ? type : \"\");\n }\n static [Symbol.hasInstance](value) {\n return Boolean(\n value && typeof value === \"object\" && isFunction(value.constructor) && (isFunction(value.stream) || isFunction(value.arrayBuffer)) && /^(Blob|File)$/.test(value[Symbol.toStringTag])\n );\n }\n /**\n * Returns the [`MIME type`](https://developer.mozilla.org/en-US/docs/Glossary/MIME_type) of the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).\n */\n get type() {\n return __privateGet(this, _type);\n }\n /**\n * Returns the size of the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) in bytes.\n */\n get size() {\n return __privateGet(this, _size);\n }\n /**\n * Creates and returns a new [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) object which contains data from a subset of the blob on which it's called.\n *\n * @param start An index into the Blob indicating the first byte to include in the new Blob. If you specify a negative value, it's treated as an offset from the end of the Blob toward the beginning. For example, -10 would be the 10th from last byte in the Blob. The default value is 0. If you specify a value for start that is larger than the size of the source Blob, the returned Blob has size 0 and contains no data.\n * @param end An index into the Blob indicating the first byte that will *not* be included in the new Blob (i.e. the byte exactly at this index is not included). If you specify a negative value, it's treated as an offset from the end of the Blob toward the beginning. For example, -10 would be the 10th from last byte in the Blob. The default value is size.\n * @param contentType The content type to assign to the new Blob; this will be the value of its type property. The default value is an empty string.\n */\n slice(start, end, contentType) {\n return new _Blob(sliceBlob(__privateGet(this, _parts), this.size, start, end), {\n type: contentType\n });\n }\n /**\n * Returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves with a string containing the contents of the blob, interpreted as UTF-8.\n */\n async text() {\n const decoder = new TextDecoder();\n let result = \"\";\n for await (const chunk of consumeBlobParts(__privateGet(this, _parts))) {\n result += decoder.decode(chunk, { stream: true });\n }\n result += decoder.decode();\n return result;\n }\n /**\n * Returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves with the contents of the blob as binary data contained in an [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).\n */\n async arrayBuffer() {\n const view = new Uint8Array(this.size);\n let offset = 0;\n for await (const chunk of consumeBlobParts(__privateGet(this, _parts))) {\n view.set(chunk, offset);\n offset += chunk.length;\n }\n return view.buffer;\n }\n /**\n * Returns a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) which upon reading returns the data contained within the [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob).\n */\n stream() {\n const iterator = consumeBlobParts(__privateGet(this, _parts), true);\n return new ReadableStream({\n async pull(controller) {\n const { value, done } = await iterator.next();\n if (done) {\n return queueMicrotask(() => controller.close());\n }\n controller.enqueue(value);\n },\n async cancel() {\n await iterator.return();\n }\n });\n }\n get [Symbol.toStringTag]() {\n return \"Blob\";\n }\n};\n_parts = new WeakMap();\n_type = new WeakMap();\n_size = new WeakMap();\nvar Blob = _Blob;\nObject.defineProperties(Blob.prototype, {\n type: { enumerable: true },\n size: { enumerable: true },\n slice: { enumerable: true },\n stream: { enumerable: true },\n text: { enumerable: true },\n arrayBuffer: { enumerable: true }\n});\n\n// src/File.ts\nvar _name, _lastModified;\nvar File = class extends Blob {\n /**\n * Creates a new File instance.\n *\n * @param fileBits An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).\n * @param name The name of the file.\n * @param options An options object containing optional attributes for the file.\n */\n constructor(fileBits, name, options = {}) {\n super(fileBits, options);\n /**\n * Returns the name of the file referenced by the File object.\n */\n __privateAdd(this, _name, void 0);\n /**\n * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.\n */\n __privateAdd(this, _lastModified, 0);\n if (arguments.length < 2) {\n throw new TypeError(\n `Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`\n );\n }\n __privateSet(this, _name, String(name));\n const lastModified = options.lastModified === void 0 ? Date.now() : Number(options.lastModified);\n if (!Number.isNaN(lastModified)) {\n __privateSet(this, _lastModified, lastModified);\n }\n }\n static [Symbol.hasInstance](value) {\n return value instanceof Blob && value[Symbol.toStringTag] === \"File\" && typeof value.name === \"string\";\n }\n /**\n * Name of the file referenced by the File object.\n */\n get name() {\n return __privateGet(this, _name);\n }\n /* c8 ignore next 3 */\n get webkitRelativePath() {\n return \"\";\n }\n /**\n * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.\n */\n get lastModified() {\n return __privateGet(this, _lastModified);\n }\n get [Symbol.toStringTag]() {\n return \"File\";\n }\n};\n_name = new WeakMap();\n_lastModified = new WeakMap();\n\n// src/isFile.ts\nvar isFile = (value) => value instanceof File;\n\n// src/fileFromPath.ts\nvar _path, _start;\nvar _FileFromPath = class _FileFromPath {\n constructor(input) {\n __privateAdd(this, _path, void 0);\n __privateAdd(this, _start, void 0);\n __privateSet(this, _path, input.path);\n __privateSet(this, _start, input.start || 0);\n this.name = basename(__privateGet(this, _path));\n this.size = input.size;\n this.lastModified = input.lastModified;\n }\n slice(start, end) {\n return new _FileFromPath({\n path: __privateGet(this, _path),\n lastModified: this.lastModified,\n start: __privateGet(this, _start) + start,\n size: end - start\n });\n }\n async *stream() {\n const { mtimeMs } = await stat(__privateGet(this, _path));\n if (mtimeMs > this.lastModified) {\n throw new DOMException(\n \"The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.\",\n \"NotReadableError\"\n );\n }\n if (this.size) {\n yield* createReadStream(__privateGet(this, _path), {\n start: __privateGet(this, _start),\n end: __privateGet(this, _start) + this.size - 1\n });\n }\n }\n get [Symbol.toStringTag]() {\n return \"File\";\n }\n};\n_path = new WeakMap();\n_start = new WeakMap();\nvar FileFromPath = _FileFromPath;\nfunction createFileFromPath(path, { mtimeMs, size }, filenameOrOptions, options = {}) {\n let filename;\n if (isObject(filenameOrOptions)) {\n [options, filename] = [filenameOrOptions, void 0];\n } else {\n filename = filenameOrOptions;\n }\n const file = new FileFromPath({ path, size, lastModified: mtimeMs });\n if (!filename) {\n filename = file.name;\n }\n return new File([file], filename, {\n ...options,\n lastModified: file.lastModified\n });\n}\nfunction fileFromPathSync(path, filenameOrOptions, options = {}) {\n const stats = statSync(path);\n return createFileFromPath(path, stats, filenameOrOptions, options);\n}\nasync function fileFromPath(path, filenameOrOptions, options) {\n const stats = await stat(path);\n return createFileFromPath(path, stats, filenameOrOptions, options);\n}\nexport {\n fileFromPath,\n fileFromPathSync,\n isFile\n};\n/*! Based on fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> & David Frank */\n","import { JSDOM } from \"jsdom\";\nimport { FormData, File } from 'formdata-node';\nimport { fileFromPath } from 'formdata-node/file-from-path';\nimport path from \"path\";\n\nconst tokenUrl = \"https://api.weixin.qq.com/cgi-bin/token\";\nconst publishUrl = \"https://api.weixin.qq.com/cgi-bin/draft/add\";\nconst uploadUrl = `https://api.weixin.qq.com/cgi-bin/material/add_material`;\nconst appId = process.env.WECHAT_APP_ID || \"\";\nconst appSecret = process.env.WECHAT_APP_SECRET || \"\";\n\ntype UploadResponse = {\n media_id: string;\n url: string\n};\n\nasync function fetchAccessToken() {\n try {\n const response = await fetch(`${tokenUrl}?grant_type=client_credential&appid=${appId}&secret=${appSecret}`);\n const data = await response.json();\n if (data.access_token) {\n return data;\n } else if (data.errcode) {\n throw new Error(`获取 Access Token 失败,错误码:${data.errcode},${data.errmsg}`);\n } else {\n throw new Error(`获取 Access Token 失败: ${data}`);\n }\n } catch (error) {\n throw error;\n }\n}\n\nasync function uploadMaterial(type: string, fileData: Blob | File, fileName: string, accessToken: string): Promise<UploadResponse> {\n const form = new FormData();\n form.append(\"media\", fileData, fileName);\n const response = await fetch(`${uploadUrl}?access_token=${accessToken}&type=${type}`, {\n method: 'POST',\n body: form as any,\n });\n if (!response.ok) {\n const errorText = await response.text();\n throw new Error(`上传失败: ${response.status} ${errorText}`);\n }\n const data = await response.json();\n if (data.errcode) {\n throw new Error(`上传失败,错误码:${data.errcode},错误信息:${data.errmsg}`);\n }\n const result = data.url.replace(\"http://\", \"https://\");\n data.url = result;\n return data;\n}\n\nasync function uploadImage(imageUrl: string, accessToken: string, fileName?: string): Promise<UploadResponse> {\n if (imageUrl.startsWith(\"http\")) {\n const response = await fetch(imageUrl);\n if (!response.ok || !response.body) {\n throw new Error(`Failed to download image from URL: ${imageUrl}`);\n }\n const fileNameFromUrl = path.basename(imageUrl.split(\"?\")[0]);\n const ext = path.extname(fileNameFromUrl);\n const imageName = fileName ?? (ext === \"\" ? `${fileNameFromUrl}.jpg` : fileNameFromUrl);\n const buffer = await response.arrayBuffer();\n return await uploadMaterial('image', new Blob([buffer]), imageName, accessToken);\n } else {\n const localImagePath = imageUrl;\n const fileNameFromLocal = path.basename(localImagePath);\n const ext = path.extname(fileNameFromLocal);\n const imageName = fileName ?? (ext === \"\" ? `${fileNameFromLocal}.jpg` : fileNameFromLocal);\n const file = await fileFromPath(localImagePath);\n return await uploadMaterial('image', file, imageName, accessToken);\n }\n}\n\nasync function uploadImages(content: string, accessToken: string): Promise<{ html: string, firstImageId: string }> {\n if (!content.includes('<img')) {\n return { html: content, firstImageId: \"\" };\n }\n\n const dom = new JSDOM(content);\n const document = dom.window.document;\n const images = Array.from(document.querySelectorAll('img'));\n\n const uploadPromises = images.map(async (element) => {\n const dataSrc = element.getAttribute('src');\n if (dataSrc) {\n if (!dataSrc.startsWith('https://mmbiz.qpic.cn')) {\n const resp = await uploadImage(dataSrc, accessToken);\n element.setAttribute('src', resp.url);\n return resp.media_id;\n } else {\n return dataSrc;\n }\n }\n return null;\n });\n\n const mediaIds = (await Promise.all(uploadPromises)).filter(Boolean);\n const firstImageId = mediaIds[0] || \"\";\n\n const updatedHtml = dom.serialize();\n return { html: updatedHtml, firstImageId };\n}\n\nexport async function publishToDraft(title: string, content: string, cover: string) {\n try {\n const accessToken = await fetchAccessToken();\n const handledContent = content.replace(/\\n<li/g, \"<li\").replace(/<\\/li>\\n/g, \"<\\/li>\");\n const { html, firstImageId } = await uploadImages(handledContent, accessToken.access_token);\n let thumbMediaId = \"\";\n if (cover) {\n const resp = await uploadImage(cover, accessToken.access_token, \"cover.jpg\");\n thumbMediaId = resp.media_id;\n } else {\n if (firstImageId.startsWith(\"https://mmbiz.qpic.cn\")) {\n const resp = await uploadImage(firstImageId, accessToken.access_token, \"cover.jpg\");\n thumbMediaId = resp.media_id;\n } else {\n thumbMediaId = firstImageId;\n }\n }\n if (!thumbMediaId) {\n throw new Error(\"你必须指定一张封面图或者在正文中至少出现一张图片。\");\n }\n const response = await fetch(`${publishUrl}?access_token=${accessToken.access_token}`, {\n method: 'POST',\n body: JSON.stringify({\n articles: [{\n title: title,\n content: html,\n thumb_media_id: thumbMediaId,\n }]\n })\n });\n const data = await response.json();\n if (data.media_id) {\n return data;\n } else if (data.errcode) {\n throw new Error(`上传到公众号草稿失败,错误码:${data.errcode},${data.errmsg}`);\n } else {\n throw new Error(`上传到公众号草稿失败: ${data}`);\n }\n } catch (error) {\n throw error;\n }\n}\n"],"names":["__accessCheck","obj","member","msg","__privateGet","getter","__privateAdd","value","__privateSet","setter","isObject","isFunction","isAsyncIterable","MAX_CHUNK_SIZE","clonePart","offset","size","buffer","readStream","readable","reader","done","chunkStream","stream","getStreamIterator","source","consumeNodeBlob","blob","position","consumeBlobParts","parts","clone","part","sliceBlob","blobParts","blobSize","start","end","relativeStart","relativeEnd","span","added","partSize","chunk","_parts","_type","_size","_Blob","options","encoder","raw","type","contentType","decoder","result","view","iterator","controller","Blob","_name","_lastModified","File","fileBits","name","lastModified","_path","_start","_FileFromPath","input","basename","mtimeMs","stat","createReadStream","FileFromPath","createFileFromPath","path","filenameOrOptions","filename","file","fileFromPath","stats","tokenUrl","publishUrl","uploadUrl","appId","appSecret","fetchAccessToken","data","error","uploadMaterial","fileData","fileName","accessToken","form","FormData","response","errorText","uploadImage","imageUrl","fileNameFromUrl","ext","imageName","localImagePath","fileNameFromLocal","uploadImages","content","dom","JSDOM","document","uploadPromises","element","dataSrc","resp","firstImageId","publishToDraft","title","cover","handledContent","html","thumbMediaId"],"mappings":";;;;;AAAA,IAAIA,IAAgB,CAACC,GAAKC,GAAQC,MAAQ;AACxC,MAAI,CAACD,EAAO,IAAID,CAAG;AACjB,UAAM,UAAU,YAAYE,CAAG;AACnC,GACIC,IAAe,CAACH,GAAKC,GAAQG,OAC/BL,EAAcC,GAAKC,GAAQ,yBAAyB,GAC7CG,IAASA,EAAO,KAAKJ,CAAG,IAAIC,EAAO,IAAID,CAAG,IAE/CK,IAAe,CAACL,GAAKC,GAAQK,MAAU;AACzC,MAAIL,EAAO,IAAID,CAAG;AAChB,UAAM,UAAU,mDAAmD;AACrE,EAAAC,aAAkB,UAAUA,EAAO,IAAID,CAAG,IAAIC,EAAO,IAAID,GAAKM,CAAK;AACrE,GACIC,IAAe,CAACP,GAAKC,GAAQK,GAAOE,OACtCT,EAAcC,GAAKC,GAAQ,wBAAwB,GAChBA,EAAO,IAAID,GAAKM,CAAK,GACjDA,IASLG,IAAW,CAACH,MAAU,OAAOA,KAAU,YAAYA,KAAS,QAAQ,CAAC,MAAM,QAAQA,CAAK,GAGxFI,IAAa,CAACJ,MAAU,OAAOA,KAAU,YAGzCK,IAAkB,CAACL,MAAUG,EAASH,CAAK,KAAKI,EAAWJ,EAAM,OAAO,aAAa,CAAC,GAGtFM,IAAiB;AACrB,gBAAgBC,EAAUP,GAAO;AAC/B,MAAIA,EAAM,cAAcM,GAAgB;AACtC,UAAMN;AACN;AAAA,EACF;AACA,MAAIQ,IAAS;AACb,SAAOA,IAASR,EAAM,cAAY;AAChC,UAAMS,IAAO,KAAK,IAAIT,EAAM,aAAaQ,GAAQF,CAAc,GACzDI,IAASV,EAAM,OAAO,MAAMQ,GAAQA,IAASC,CAAI;AACvD,IAAAD,KAAUE,EAAO,YACjB,MAAM,IAAI,WAAWA,CAAM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,EAAK;AACL,aAAOA;AACX,UAAWA,EAAK,UACN,IAAI,MAAM,kBAAkBA,EAAK,OAAO,IAAIA,EAAK,MAAM,EAAE,IAEzD,IAAI,MAAM,eAAeA,CAAI,EAAE;AAAA,EAE7C,SAASC,GAAO;AACZ,UAAMA;AAAA,EACV;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
const n = `/*
|
|
2
|
+
* Typora Theme - Purple / Author - hliu202
|
|
3
|
+
* https://github.com/hliu202/typora-purple-theme
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
--title-color: #8064a9;
|
|
8
|
+
--text-color: #444444;
|
|
9
|
+
--link-color: #2aa899;
|
|
10
|
+
--code-color: #745fb5;
|
|
11
|
+
--shadow-color: #eee;
|
|
12
|
+
--border-quote: rgba(116, 95, 181, 0.2);
|
|
13
|
+
--border: #e7e7e7;
|
|
14
|
+
--link-bottom: #bbb;
|
|
15
|
+
--shadow: 3px 3px 10px var(--shadow-color);
|
|
16
|
+
--inline-code-bg: #f4f2f9;
|
|
17
|
+
--header-weight: normal;
|
|
18
|
+
}
|
|
19
|
+
#wenyan {
|
|
20
|
+
font-family: var(--sans-serif-font);
|
|
21
|
+
color: var(--text-color);
|
|
22
|
+
line-height: 1.75;
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
}
|
|
25
|
+
#wenyan a {
|
|
26
|
+
word-wrap: break-word;
|
|
27
|
+
border-bottom: 1px solid var(--link-bottom);
|
|
28
|
+
color: var(--link-color);
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
}
|
|
31
|
+
#wenyan h1,
|
|
32
|
+
#wenyan h2,
|
|
33
|
+
#wenyan h3,
|
|
34
|
+
#wenyan h4,
|
|
35
|
+
#wenyan h5,
|
|
36
|
+
#wenyan h6 {
|
|
37
|
+
margin: 1.2em 0 1em;
|
|
38
|
+
padding: 0px;
|
|
39
|
+
font-weight: var(--header-weight);
|
|
40
|
+
color: var(--title-color);
|
|
41
|
+
font-family: var(--sans-serif-font);
|
|
42
|
+
}
|
|
43
|
+
#wenyan h1 {
|
|
44
|
+
text-align: center;
|
|
45
|
+
}
|
|
46
|
+
#wenyan h1::after {
|
|
47
|
+
content: "";
|
|
48
|
+
display: block;
|
|
49
|
+
margin: 0.2em auto 0;
|
|
50
|
+
width: 6em;
|
|
51
|
+
height: 2px;
|
|
52
|
+
border-bottom: 2px solid var(--title-color);
|
|
53
|
+
}
|
|
54
|
+
#wenyan h2 {
|
|
55
|
+
padding-left: 0.4em;
|
|
56
|
+
border-left: 0.4em solid var(--title-color);
|
|
57
|
+
border-bottom: 1px solid var(--title-color);
|
|
58
|
+
}
|
|
59
|
+
#wenyan h1 {
|
|
60
|
+
font-size: 1.5em;
|
|
61
|
+
}
|
|
62
|
+
#wenyan h2 {
|
|
63
|
+
font-size: 1.3em;
|
|
64
|
+
}
|
|
65
|
+
#wenyan h3 {
|
|
66
|
+
font-size: 1.2em;
|
|
67
|
+
}
|
|
68
|
+
#wenyan h4 {
|
|
69
|
+
font-size: 1.2em;
|
|
70
|
+
}
|
|
71
|
+
#wenyan h5 {
|
|
72
|
+
font-size: 1.2em;
|
|
73
|
+
}
|
|
74
|
+
#wenyan h6 {
|
|
75
|
+
font-size: 1.2em;
|
|
76
|
+
}
|
|
77
|
+
#wenyan p,
|
|
78
|
+
#wenyan ul,
|
|
79
|
+
#wenyan ol {
|
|
80
|
+
margin: 1em 0.8em;
|
|
81
|
+
}
|
|
82
|
+
#wenyan hr {
|
|
83
|
+
margin: 1.5em auto;
|
|
84
|
+
border-top: 1px solid var(--border);
|
|
85
|
+
}
|
|
86
|
+
#wenyan li > ol,
|
|
87
|
+
#wenyan li > ul {
|
|
88
|
+
margin: 0 0;
|
|
89
|
+
}
|
|
90
|
+
#wenyan ul,
|
|
91
|
+
#wenyan ol {
|
|
92
|
+
padding-left: 2em;
|
|
93
|
+
}
|
|
94
|
+
#wenyan ol li,
|
|
95
|
+
#wenyan ul li {
|
|
96
|
+
padding-left: 0.1em;
|
|
97
|
+
}
|
|
98
|
+
#wenyan blockquote {
|
|
99
|
+
margin: 0;
|
|
100
|
+
border-left: 0.3em solid var(--border-quote);
|
|
101
|
+
padding-left: 1em;
|
|
102
|
+
}
|
|
103
|
+
#wenyan table {
|
|
104
|
+
border-collapse: collapse;
|
|
105
|
+
margin: 1.4em auto;
|
|
106
|
+
max-width: 100%;
|
|
107
|
+
table-layout: fixed;
|
|
108
|
+
text-align: left;
|
|
109
|
+
overflow: auto;
|
|
110
|
+
display: table;
|
|
111
|
+
word-wrap: break-word;
|
|
112
|
+
word-break: break-all;
|
|
113
|
+
}
|
|
114
|
+
#wenyan table td,
|
|
115
|
+
#wenyan table th {
|
|
116
|
+
font-size: 0.75em;
|
|
117
|
+
padding: 9px 12px;
|
|
118
|
+
line-height: 22px;
|
|
119
|
+
color: #222;
|
|
120
|
+
border: 1px solid var(--border-quote);
|
|
121
|
+
vertical-align: top;
|
|
122
|
+
}
|
|
123
|
+
#wenyan table th {
|
|
124
|
+
font-weight: bold;
|
|
125
|
+
color: var(--title-color);
|
|
126
|
+
background-color: var(--inline-code-bg);
|
|
127
|
+
}
|
|
128
|
+
#wenyan strong {
|
|
129
|
+
padding: 0 2px;
|
|
130
|
+
font-weight: bold;
|
|
131
|
+
}
|
|
132
|
+
#wenyan p code {
|
|
133
|
+
padding: 2px 4px;
|
|
134
|
+
border-radius: 0.3em;
|
|
135
|
+
font-family: var(--monospace-font);
|
|
136
|
+
font-size: 0.9em;
|
|
137
|
+
color: var(--code-color);
|
|
138
|
+
background-color: var(--inline-code-bg);
|
|
139
|
+
margin: 0 2px;
|
|
140
|
+
}
|
|
141
|
+
#wenyan img {
|
|
142
|
+
max-width: 100%;
|
|
143
|
+
height: auto;
|
|
144
|
+
margin: 0 auto;
|
|
145
|
+
display: block;
|
|
146
|
+
}
|
|
147
|
+
#wenyan pre {
|
|
148
|
+
border-radius: 5px;
|
|
149
|
+
line-height: 2;
|
|
150
|
+
margin: 1em 0.5em;
|
|
151
|
+
padding: .5em;
|
|
152
|
+
box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px;
|
|
153
|
+
}
|
|
154
|
+
#wenyan pre code {
|
|
155
|
+
display: block;
|
|
156
|
+
overflow-x: auto;
|
|
157
|
+
margin: .5em;
|
|
158
|
+
padding: 0;
|
|
159
|
+
font-family: var(--monospace-font);
|
|
160
|
+
}
|
|
161
|
+
#wenyan .footnote {
|
|
162
|
+
color: var(--code-color);
|
|
163
|
+
background-color: var(--inline-code-bg);
|
|
164
|
+
}
|
|
165
|
+
#wenyan #footnotes p {
|
|
166
|
+
display: flex;
|
|
167
|
+
margin: 0;
|
|
168
|
+
font-size: 0.9em;
|
|
169
|
+
}
|
|
170
|
+
#wenyan .footnote-num {
|
|
171
|
+
display: inline;
|
|
172
|
+
width: 10%;
|
|
173
|
+
}
|
|
174
|
+
#wenyan .footnote-txt {
|
|
175
|
+
display: inline;
|
|
176
|
+
width: 90%;
|
|
177
|
+
word-wrap: break-word;
|
|
178
|
+
word-break: break-all;
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
181
|
+
export {
|
|
182
|
+
n as default
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=purple-Da1-Vfos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purple-Da1-Vfos.js","sources":["../src/themes/purple.css?raw"],"sourcesContent":["export default \"/*\\n * Typora Theme - Purple / Author - hliu202\\n * https://github.com/hliu202/typora-purple-theme\\n */\\n\\n:root {\\n --title-color: #8064a9;\\n --text-color: #444444;\\n --link-color: #2aa899;\\n --code-color: #745fb5;\\n --shadow-color: #eee;\\n --border-quote: rgba(116, 95, 181, 0.2);\\n --border: #e7e7e7;\\n --link-bottom: #bbb;\\n --shadow: 3px 3px 10px var(--shadow-color);\\n --inline-code-bg: #f4f2f9;\\n --header-weight: normal;\\n}\\n#wenyan {\\n font-family: var(--sans-serif-font);\\n color: var(--text-color);\\n line-height: 1.75;\\n font-size: 16px;\\n}\\n#wenyan a {\\n word-wrap: break-word;\\n border-bottom: 1px solid var(--link-bottom);\\n color: var(--link-color);\\n text-decoration: none;\\n}\\n#wenyan h1,\\n#wenyan h2,\\n#wenyan h3,\\n#wenyan h4,\\n#wenyan h5,\\n#wenyan h6 {\\n margin: 1.2em 0 1em;\\n padding: 0px;\\n font-weight: var(--header-weight);\\n color: var(--title-color);\\n font-family: var(--sans-serif-font);\\n}\\n#wenyan h1 {\\n text-align: center;\\n}\\n#wenyan h1::after {\\n content: \\\"\\\";\\n display: block;\\n margin: 0.2em auto 0;\\n width: 6em;\\n height: 2px;\\n border-bottom: 2px solid var(--title-color);\\n}\\n#wenyan h2 {\\n padding-left: 0.4em;\\n border-left: 0.4em solid var(--title-color);\\n border-bottom: 1px solid var(--title-color);\\n}\\n#wenyan h1 {\\n font-size: 1.5em;\\n}\\n#wenyan h2 {\\n font-size: 1.3em;\\n}\\n#wenyan h3 {\\n font-size: 1.2em;\\n}\\n#wenyan h4 {\\n font-size: 1.2em;\\n}\\n#wenyan h5 {\\n font-size: 1.2em;\\n}\\n#wenyan h6 {\\n font-size: 1.2em;\\n}\\n#wenyan p,\\n#wenyan ul,\\n#wenyan ol {\\n margin: 1em 0.8em;\\n}\\n#wenyan hr {\\n margin: 1.5em auto;\\n border-top: 1px solid var(--border);\\n}\\n#wenyan li > ol,\\n#wenyan li > ul {\\n margin: 0 0;\\n}\\n#wenyan ul,\\n#wenyan ol {\\n padding-left: 2em;\\n}\\n#wenyan ol li,\\n#wenyan ul li {\\n padding-left: 0.1em;\\n}\\n#wenyan blockquote {\\n margin: 0;\\n border-left: 0.3em solid var(--border-quote);\\n padding-left: 1em;\\n}\\n#wenyan table {\\n border-collapse: collapse;\\n margin: 1.4em auto;\\n max-width: 100%;\\n table-layout: fixed;\\n text-align: left;\\n overflow: auto;\\n display: table;\\n word-wrap: break-word;\\n word-break: break-all;\\n}\\n#wenyan table td,\\n#wenyan table th {\\n font-size: 0.75em;\\n padding: 9px 12px;\\n line-height: 22px;\\n color: #222;\\n border: 1px solid var(--border-quote);\\n vertical-align: top;\\n}\\n#wenyan table th {\\n font-weight: bold;\\n color: var(--title-color);\\n background-color: var(--inline-code-bg);\\n}\\n#wenyan strong {\\n padding: 0 2px;\\n font-weight: bold;\\n}\\n#wenyan p code {\\n padding: 2px 4px;\\n border-radius: 0.3em;\\n font-family: var(--monospace-font);\\n font-size: 0.9em;\\n color: var(--code-color);\\n background-color: var(--inline-code-bg);\\n margin: 0 2px;\\n}\\n#wenyan img {\\n max-width: 100%;\\n height: auto;\\n margin: 0 auto;\\n display: block;\\n}\\n#wenyan pre {\\n border-radius: 5px;\\n line-height: 2;\\n margin: 1em 0.5em;\\n padding: .5em;\\n box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px;\\n}\\n#wenyan pre code {\\n display: block;\\n overflow-x: auto;\\n margin: .5em;\\n padding: 0;\\n font-family: var(--monospace-font);\\n}\\n#wenyan .footnote {\\n color: var(--code-color);\\n background-color: var(--inline-code-bg);\\n}\\n#wenyan #footnotes p {\\n display: flex;\\n margin: 0;\\n font-size: 0.9em;\\n}\\n#wenyan .footnote-num {\\n display: inline;\\n width: 10%;\\n}\\n#wenyan .footnote-txt {\\n display: inline;\\n width: 90%;\\n word-wrap: break-word;\\n word-break: break-all;\\n}\\n\""],"names":["purple"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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