@webskill/polyfill 0.0.3 → 0.0.7-next.20261124
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/polyfill.js +66 -4
- package/package.json +2 -2
package/dist/polyfill.js
CHANGED
|
@@ -300,6 +300,54 @@ var WebSkillPolyfill = (function(exports) {
|
|
|
300
300
|
return url;
|
|
301
301
|
}
|
|
302
302
|
//#endregion
|
|
303
|
+
//#region ../core/src/attachment/kind.ts
|
|
304
|
+
/** 可作为图片分片外发的 MIME 类型 @experimental */
|
|
305
|
+
const IMAGE_MIME_TYPES = [
|
|
306
|
+
"image/png",
|
|
307
|
+
"image/jpeg",
|
|
308
|
+
"image/webp",
|
|
309
|
+
"image/gif"
|
|
310
|
+
];
|
|
311
|
+
/**
|
|
312
|
+
* 可按文本读取的扩展名。accept 白名单与判定白名单共用这一份——
|
|
313
|
+
* 0.5.x 两处不一致,`log`/`yaml`/`yml` 能通过判定却在文件选择器里选不到。
|
|
314
|
+
*/
|
|
315
|
+
const TEXT_EXTENSIONS = [
|
|
316
|
+
"txt",
|
|
317
|
+
"md",
|
|
318
|
+
"csv",
|
|
319
|
+
"json",
|
|
320
|
+
"log",
|
|
321
|
+
"yaml",
|
|
322
|
+
"yml"
|
|
323
|
+
];
|
|
324
|
+
/** 非文本非图片但仍可整体外发的类型(provider 的 file 分片) @experimental */
|
|
325
|
+
const FILE_MIME_TYPES = ["application/pdf"];
|
|
326
|
+
const XLS_MIME = "application/vnd.ms-excel";
|
|
327
|
+
/**
|
|
328
|
+
* DWG 图纸的 MIME。没有官方注册值,各家各发一套,浏览器上传时更常见的是空串。
|
|
329
|
+
* @experimental
|
|
330
|
+
*/
|
|
331
|
+
const DWG_MIME_TYPES = [
|
|
332
|
+
"image/vnd.dwg",
|
|
333
|
+
"application/acad",
|
|
334
|
+
"application/x-acad",
|
|
335
|
+
"application/dwg",
|
|
336
|
+
"application/x-dwg",
|
|
337
|
+
"drawing/dwg"
|
|
338
|
+
];
|
|
339
|
+
/**
|
|
340
|
+
* 只存字节、不进上下文的扩展名。仍然是**白名单制**:
|
|
341
|
+
* 新增 `binary` 类别不等于任意二进制放行(AC-19.18)。
|
|
342
|
+
* @experimental
|
|
343
|
+
*/
|
|
344
|
+
const BINARY_EXTENSIONS = ["dwg"];
|
|
345
|
+
new Set(TEXT_EXTENSIONS);
|
|
346
|
+
new Set(IMAGE_MIME_TYPES);
|
|
347
|
+
new Set(FILE_MIME_TYPES);
|
|
348
|
+
new Set(DWG_MIME_TYPES);
|
|
349
|
+
new Set(BINARY_EXTENSIONS);
|
|
350
|
+
//#endregion
|
|
303
351
|
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js
|
|
304
352
|
const ALIAS = Symbol.for("yaml.alias");
|
|
305
353
|
const DOC = Symbol.for("yaml.document");
|
|
@@ -13670,7 +13718,8 @@ Never claim to have created, saved, or installed a skill unless a skill tool cal
|
|
|
13670
13718
|
pdf: "application/pdf",
|
|
13671
13719
|
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
13672
13720
|
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
13673
|
-
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
13721
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
13722
|
+
msg: "application/vnd.ms-outlook"
|
|
13674
13723
|
};
|
|
13675
13724
|
const BYTES_ONLY_MIME_SET = /* @__PURE__ */ new Set([
|
|
13676
13725
|
"image/vnd.dwg",
|
|
@@ -13687,7 +13736,7 @@ Never claim to have created, saved, or installed a skill unless a skill tool cal
|
|
|
13687
13736
|
return ((url.split(/[?#]/)[0] ?? "").split(".").pop() ?? "").toLowerCase() === "dwg";
|
|
13688
13737
|
}
|
|
13689
13738
|
/** 引擎侧固定流程(§2.3)用到的错误文案,集中一处便于判据引用 */
|
|
13690
|
-
const UNSUPPORTED_DOCUMENT_MESSAGE = `Only PDF (${SUPPORTED_DOCUMENT_MIME.pdf}), Word (${SUPPORTED_DOCUMENT_MIME.docx}), Excel (${SUPPORTED_DOCUMENT_MIME.xlsx}), PowerPoint (${SUPPORTED_DOCUMENT_MIME.pptx}) and plain text documents can be read.`;
|
|
13739
|
+
const UNSUPPORTED_DOCUMENT_MESSAGE = `Only PDF (${SUPPORTED_DOCUMENT_MIME.pdf}), Word (${SUPPORTED_DOCUMENT_MIME.docx}), Excel (${SUPPORTED_DOCUMENT_MIME.xlsx} or ${XLS_MIME}), PowerPoint (${SUPPORTED_DOCUMENT_MIME.pptx}), Outlook MSG (${SUPPORTED_DOCUMENT_MIME.msg}) and plain text documents can be read.`;
|
|
13691
13740
|
/**
|
|
13692
13741
|
* 内建工具:读页面链接指向的文档。
|
|
13693
13742
|
*
|
|
@@ -15541,7 +15590,7 @@ Never claim to have created, saved, or installed a skill unless a skill tool cal
|
|
|
15541
15590
|
}]
|
|
15542
15591
|
};
|
|
15543
15592
|
}
|
|
15544
|
-
const
|
|
15593
|
+
const extracted = {
|
|
15545
15594
|
[SUPPORTED_DOCUMENT_MIME.docx]: {
|
|
15546
15595
|
kind: "docx",
|
|
15547
15596
|
label: "Word documents",
|
|
@@ -15552,12 +15601,23 @@ Never claim to have created, saved, or installed a skill unless a skill tool cal
|
|
|
15552
15601
|
label: "Excel workbooks",
|
|
15553
15602
|
...this.#deps.xlsxExtractor ? { extractor: this.#deps.xlsxExtractor } : {}
|
|
15554
15603
|
},
|
|
15604
|
+
[XLS_MIME]: {
|
|
15605
|
+
kind: "xls",
|
|
15606
|
+
label: "Legacy Excel workbooks",
|
|
15607
|
+
...this.#deps.xlsxExtractor ? { extractor: this.#deps.xlsxExtractor } : {}
|
|
15608
|
+
},
|
|
15555
15609
|
[SUPPORTED_DOCUMENT_MIME.pptx]: {
|
|
15556
15610
|
kind: "pptx",
|
|
15557
15611
|
label: "PowerPoint presentations",
|
|
15558
15612
|
...this.#deps.pptxExtractor ? { extractor: this.#deps.pptxExtractor } : {}
|
|
15613
|
+
},
|
|
15614
|
+
[SUPPORTED_DOCUMENT_MIME.msg]: {
|
|
15615
|
+
kind: "msg",
|
|
15616
|
+
label: "Outlook messages",
|
|
15617
|
+
...this.#deps.msgExtractor ? { extractor: this.#deps.msgExtractor } : {}
|
|
15559
15618
|
}
|
|
15560
|
-
}
|
|
15619
|
+
};
|
|
15620
|
+
const route = extracted[mime] ?? ((mime === "" || mime === "application/octet-stream") && name.toLowerCase().endsWith(".msg") ? extracted[SUPPORTED_DOCUMENT_MIME.msg] : void 0);
|
|
15561
15621
|
if (route !== void 0) {
|
|
15562
15622
|
if (route.extractor === void 0) {
|
|
15563
15623
|
await audit({
|
|
@@ -17018,6 +17078,7 @@ Never claim to have created, saved, or installed a skill unless a skill tool cal
|
|
|
17018
17078
|
linkedDocuments: this.#deps.linkedDocuments,
|
|
17019
17079
|
docxExtractor: this.#deps.docxExtractor,
|
|
17020
17080
|
xlsxExtractor: this.#deps.xlsxExtractor,
|
|
17081
|
+
msgExtractor: this.#deps.msgExtractor,
|
|
17021
17082
|
pdfExtractor: this.#deps.pdfExtractor,
|
|
17022
17083
|
visionDelegate: this.#deps.visionDelegate,
|
|
17023
17084
|
documentAudit: this.#deps.documentAudit,
|
|
@@ -17153,6 +17214,7 @@ Never claim to have created, saved, or installed a skill unless a skill tool cal
|
|
|
17153
17214
|
linkedDocuments: this.#deps.linkedDocuments,
|
|
17154
17215
|
docxExtractor: this.#deps.docxExtractor,
|
|
17155
17216
|
xlsxExtractor: this.#deps.xlsxExtractor,
|
|
17217
|
+
msgExtractor: this.#deps.msgExtractor,
|
|
17156
17218
|
pdfExtractor: this.#deps.pdfExtractor,
|
|
17157
17219
|
visionDelegate: this.#deps.visionDelegate,
|
|
17158
17220
|
documentAudit: this.#deps.documentAudit,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webskill/polyfill",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7-next.20261124",
|
|
4
4
|
"description": "Browser polyfill for the WebSkill navigator API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@webskill/sdk": "^0.
|
|
34
|
+
"@webskill/sdk": "^0.32.0-next.20261124"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@webskill/sdk": "workspace:^",
|