@superdoc-dev/cli 0.2.0-next.93 → 0.2.0-next.94
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/index.js +93 -19
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -96229,7 +96229,7 @@ var init_remark_stringify_D8vxv_XI_es = __esm(() => {
|
|
|
96229
96229
|
eol = /\r?\n|\r/g;
|
|
96230
96230
|
});
|
|
96231
96231
|
|
|
96232
|
-
// ../../packages/superdoc/dist/chunks/DocxZipper-
|
|
96232
|
+
// ../../packages/superdoc/dist/chunks/DocxZipper-Dt7MDO2A.es.js
|
|
96233
96233
|
function getLens2(b64) {
|
|
96234
96234
|
var len$1 = b64.length;
|
|
96235
96235
|
if (len$1 % 4 > 0)
|
|
@@ -96401,6 +96401,10 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
96401
96401
|
async updateContentTypes(docx, media, fromJson, updatedDocs = {}) {
|
|
96402
96402
|
const additionalPartNames = Object.keys(updatedDocs || {});
|
|
96403
96403
|
const newMediaTypes = Object.keys(media).map((name) => this.getFileExtension(name)).filter((ext) => ext && IMAGE_EXTS.has(ext));
|
|
96404
|
+
const extensionlessMediaOverrides = Object.entries(media).filter(([name]) => !this.getFileExtension(name)).map(([name, value]) => ({
|
|
96405
|
+
name,
|
|
96406
|
+
contentType: this.#detectImageContentType(value)
|
|
96407
|
+
})).filter((entry) => entry.contentType);
|
|
96404
96408
|
const contentTypesPath = "[Content_Types].xml";
|
|
96405
96409
|
let contentTypesXml;
|
|
96406
96410
|
if (fromJson)
|
|
@@ -96423,6 +96427,13 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
96423
96427
|
seenTypes.add(type);
|
|
96424
96428
|
}
|
|
96425
96429
|
const types3 = JSON.parse(import_lib3.xml2json(contentTypesXml, null, 2)).elements?.find((el) => el.name === "Types") || {};
|
|
96430
|
+
const hasPartOverride = (partName) => types3.elements?.some((el) => el.name === "Override" && el.attributes.PartName === partName);
|
|
96431
|
+
for (const { name, contentType } of extensionlessMediaOverrides) {
|
|
96432
|
+
const partName = `/${name}`;
|
|
96433
|
+
if (hasPartOverride(partName))
|
|
96434
|
+
continue;
|
|
96435
|
+
typesString += `<Override PartName="${partName}" ContentType="${contentType}" />`;
|
|
96436
|
+
}
|
|
96426
96437
|
const hasComments = types3.elements?.some((el) => el.name === "Override" && el.attributes.PartName === "/word/comments.xml");
|
|
96427
96438
|
const hasCommentsExtended = types3.elements?.some((el) => el.name === "Override" && el.attributes.PartName === "/word/commentsExtended.xml");
|
|
96428
96439
|
const hasCommentsIds = types3.elements?.some((el) => el.name === "Override" && el.attributes.PartName === "/word/commentsIds.xml");
|
|
@@ -96596,8 +96607,24 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
96596
96607
|
await this.updateContentTypes(unzippedOriginalDocx, media, false, updatedDocs);
|
|
96597
96608
|
return unzippedOriginalDocx;
|
|
96598
96609
|
}
|
|
96610
|
+
#detectImageContentType(value) {
|
|
96611
|
+
if (value == null)
|
|
96612
|
+
return null;
|
|
96613
|
+
if (typeof value === "string" && value.startsWith("data:image/"))
|
|
96614
|
+
return value.match(/^data:(image\/[a-zA-Z0-9.+-]+);/i)?.[1]?.toLowerCase() || null;
|
|
96615
|
+
let detectedType = null;
|
|
96616
|
+
if (value instanceof ArrayBuffer)
|
|
96617
|
+
detectedType = detectImageType(new Uint8Array(value));
|
|
96618
|
+
else if (ArrayBuffer.isView(value))
|
|
96619
|
+
detectedType = detectImageType(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
|
|
96620
|
+
else if (typeof value === "string")
|
|
96621
|
+
detectedType = detectImageType(value.startsWith("data:") ? value.split(",", 2)[1] : value);
|
|
96622
|
+
if (!detectedType)
|
|
96623
|
+
return null;
|
|
96624
|
+
return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
|
|
96625
|
+
}
|
|
96599
96626
|
}, DocxZipper_default;
|
|
96600
|
-
var
|
|
96627
|
+
var init_DocxZipper_Dt7MDO2A_es = __esm(() => {
|
|
96601
96628
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
96602
96629
|
init_jszip_ChlR43oI_es();
|
|
96603
96630
|
init_xml_js_DLE8mr0n_es();
|
|
@@ -98231,7 +98258,10 @@ var init_DocxZipper_Dd7pl56D_es = __esm(() => {
|
|
|
98231
98258
|
"svg",
|
|
98232
98259
|
"webp"
|
|
98233
98260
|
]);
|
|
98234
|
-
MIME_TYPE_FOR_EXT = {
|
|
98261
|
+
MIME_TYPE_FOR_EXT = {
|
|
98262
|
+
tif: "tiff",
|
|
98263
|
+
jpg: "jpeg"
|
|
98264
|
+
};
|
|
98235
98265
|
DocxZipper_default = DocxZipper;
|
|
98236
98266
|
});
|
|
98237
98267
|
|
|
@@ -121884,9 +121914,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
121884
121914
|
init_remark_gfm_z_sDF4ss_es();
|
|
121885
121915
|
});
|
|
121886
121916
|
|
|
121887
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
121888
|
-
var
|
|
121889
|
-
__export(
|
|
121917
|
+
// ../../packages/superdoc/dist/chunks/src-CS_uXP_L.es.js
|
|
121918
|
+
var exports_src_CS_uXP_L_es = {};
|
|
121919
|
+
__export(exports_src_CS_uXP_L_es, {
|
|
121890
121920
|
zt: () => defineMark,
|
|
121891
121921
|
z: () => cM,
|
|
121892
121922
|
yt: () => removeAwarenessStates,
|
|
@@ -180667,11 +180697,53 @@ var Node$13 = class Node$14 {
|
|
|
180667
180697
|
});
|
|
180668
180698
|
}, derivePreferredFileName = (src) => {
|
|
180669
180699
|
if (typeof src !== "string" || src.length === 0)
|
|
180670
|
-
return "image.
|
|
180700
|
+
return "image.jpg";
|
|
180671
180701
|
if (src.startsWith("data:"))
|
|
180672
180702
|
return getBase64FileMeta(src).filename;
|
|
180673
|
-
|
|
180674
|
-
|
|
180703
|
+
const trimmed = (src.split("/").pop() ?? "").split(/[?#]/)[0];
|
|
180704
|
+
if (!trimmed)
|
|
180705
|
+
return "image.jpg";
|
|
180706
|
+
if (!trimmed.includes("."))
|
|
180707
|
+
return `${trimmed}.jpg`;
|
|
180708
|
+
return trimmed;
|
|
180709
|
+
}, parsePositiveInt = (value) => {
|
|
180710
|
+
const parsed = Number.parseInt(String(value), 10);
|
|
180711
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
180712
|
+
}, parseSizeFromImageUrl = (src) => {
|
|
180713
|
+
if (typeof src !== "string" || src.length === 0 || !src.startsWith("http"))
|
|
180714
|
+
return null;
|
|
180715
|
+
try {
|
|
180716
|
+
const url = new URL(src);
|
|
180717
|
+
const width = parsePositiveInt(url.searchParams.get("width")) ?? parsePositiveInt(url.searchParams.get("w")) ?? parsePositiveInt(url.searchParams.get("imgw"));
|
|
180718
|
+
const height = parsePositiveInt(url.searchParams.get("height")) ?? parsePositiveInt(url.searchParams.get("h")) ?? parsePositiveInt(url.searchParams.get("imgh"));
|
|
180719
|
+
if (width && height)
|
|
180720
|
+
return {
|
|
180721
|
+
width,
|
|
180722
|
+
height
|
|
180723
|
+
};
|
|
180724
|
+
const segments = url.pathname.split("/").filter(Boolean);
|
|
180725
|
+
const last2 = parsePositiveInt(segments.at(-1));
|
|
180726
|
+
const secondLast = parsePositiveInt(segments.at(-2));
|
|
180727
|
+
if (secondLast && last2)
|
|
180728
|
+
return {
|
|
180729
|
+
width: secondLast,
|
|
180730
|
+
height: last2
|
|
180731
|
+
};
|
|
180732
|
+
const compact = segments.at(-1)?.match(/^(\d{1,5})x(\d{1,5})$/i);
|
|
180733
|
+
if (compact) {
|
|
180734
|
+
const compactWidth = parsePositiveInt(compact[1]);
|
|
180735
|
+
const compactHeight = parsePositiveInt(compact[2]);
|
|
180736
|
+
if (compactWidth && compactHeight)
|
|
180737
|
+
return {
|
|
180738
|
+
width: compactWidth,
|
|
180739
|
+
height: compactHeight
|
|
180740
|
+
};
|
|
180741
|
+
}
|
|
180742
|
+
} catch {
|
|
180743
|
+
return null;
|
|
180744
|
+
}
|
|
180745
|
+
return null;
|
|
180746
|
+
}, hasFinitePositiveSize = (size$2) => Number.isFinite(size$2?.width) && size$2.width > 0 && Number.isFinite(size$2?.height) && size$2.height > 0, handleNodePath = (foundImages, editor, state) => {
|
|
180675
180747
|
const { tr } = state;
|
|
180676
180748
|
const mediaStore = editor.storage.image.media ?? {};
|
|
180677
180749
|
if (!editor.storage.image.media)
|
|
@@ -180687,8 +180759,10 @@ var Node$13 = class Node$14 {
|
|
|
180687
180759
|
editor,
|
|
180688
180760
|
path: mediaPath.startsWith("word/") ? mediaPath.slice(5) : mediaPath
|
|
180689
180761
|
});
|
|
180762
|
+
const inferredSize = hasFinitePositiveSize(node3.attrs?.size) ? null : parseSizeFromImageUrl(src);
|
|
180690
180763
|
tr.setNodeMarkup(pos, undefined, {
|
|
180691
180764
|
...node3.attrs,
|
|
180765
|
+
...inferredSize ? { size: inferredSize } : {},
|
|
180692
180766
|
src: mediaPath,
|
|
180693
180767
|
rId
|
|
180694
180768
|
});
|
|
@@ -199108,7 +199182,7 @@ var Node$13 = class Node$14 {
|
|
|
199108
199182
|
trackedChanges: context.trackedChanges ?? []
|
|
199109
199183
|
});
|
|
199110
199184
|
}, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
|
|
199111
|
-
var
|
|
199185
|
+
var init_src_CS_uXP_L_es = __esm(() => {
|
|
199112
199186
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
199113
199187
|
init_SuperConverter_6i_hCnOE_es();
|
|
199114
199188
|
init_jszip_ChlR43oI_es();
|
|
@@ -199117,7 +199191,7 @@ var init_src_DJwSvw2I_es = __esm(() => {
|
|
|
199117
199191
|
init_unified_BRHLwnjP_es();
|
|
199118
199192
|
init_remark_gfm_z_sDF4ss_es();
|
|
199119
199193
|
init_remark_stringify_D8vxv_XI_es();
|
|
199120
|
-
|
|
199194
|
+
init_DocxZipper_Dt7MDO2A_es();
|
|
199121
199195
|
init_vue_q66HzpoR_es();
|
|
199122
199196
|
init__plugin_vue_export_helper_HmhZBO0u_es();
|
|
199123
199197
|
init_eventemitter3_DGBTyUUP_es();
|
|
@@ -230845,8 +230919,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230845
230919
|
return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
230846
230920
|
};
|
|
230847
230921
|
stubFalse_default = stubFalse;
|
|
230848
|
-
freeExports$2 = typeof
|
|
230849
|
-
freeModule$2 = freeExports$2 && typeof
|
|
230922
|
+
freeExports$2 = typeof exports_src_CS_uXP_L_es == "object" && exports_src_CS_uXP_L_es && !exports_src_CS_uXP_L_es.nodeType && exports_src_CS_uXP_L_es;
|
|
230923
|
+
freeModule$2 = freeExports$2 && typeof module_src_CS_uXP_L_es == "object" && module_src_CS_uXP_L_es && !module_src_CS_uXP_L_es.nodeType && module_src_CS_uXP_L_es;
|
|
230850
230924
|
Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
|
|
230851
230925
|
isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
|
|
230852
230926
|
typedArrayTags = {};
|
|
@@ -230854,8 +230928,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230854
230928
|
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
230855
230929
|
_baseIsTypedArray_default = baseIsTypedArray;
|
|
230856
230930
|
_baseUnary_default = baseUnary;
|
|
230857
|
-
freeExports$1 = typeof
|
|
230858
|
-
freeModule$1 = freeExports$1 && typeof
|
|
230931
|
+
freeExports$1 = typeof exports_src_CS_uXP_L_es == "object" && exports_src_CS_uXP_L_es && !exports_src_CS_uXP_L_es.nodeType && exports_src_CS_uXP_L_es;
|
|
230932
|
+
freeModule$1 = freeExports$1 && typeof module_src_CS_uXP_L_es == "object" && module_src_CS_uXP_L_es && !module_src_CS_uXP_L_es.nodeType && module_src_CS_uXP_L_es;
|
|
230859
230933
|
freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
|
|
230860
230934
|
_nodeUtil_default = function() {
|
|
230861
230935
|
try {
|
|
@@ -230960,8 +231034,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230960
231034
|
Stack.prototype.has = _stackHas_default;
|
|
230961
231035
|
Stack.prototype.set = _stackSet_default;
|
|
230962
231036
|
_Stack_default = Stack;
|
|
230963
|
-
freeExports = typeof
|
|
230964
|
-
freeModule = freeExports && typeof
|
|
231037
|
+
freeExports = typeof exports_src_CS_uXP_L_es == "object" && exports_src_CS_uXP_L_es && !exports_src_CS_uXP_L_es.nodeType && exports_src_CS_uXP_L_es;
|
|
231038
|
+
freeModule = freeExports && typeof module_src_CS_uXP_L_es == "object" && module_src_CS_uXP_L_es && !module_src_CS_uXP_L_es.nodeType && module_src_CS_uXP_L_es;
|
|
230965
231039
|
Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
|
|
230966
231040
|
allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
|
|
230967
231041
|
_cloneBuffer_default = cloneBuffer;
|
|
@@ -239041,13 +239115,13 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
239041
239115
|
|
|
239042
239116
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
239043
239117
|
var init_super_editor_es = __esm(() => {
|
|
239044
|
-
|
|
239118
|
+
init_src_CS_uXP_L_es();
|
|
239045
239119
|
init_SuperConverter_6i_hCnOE_es();
|
|
239046
239120
|
init_jszip_ChlR43oI_es();
|
|
239047
239121
|
init_xml_js_DLE8mr0n_es();
|
|
239048
239122
|
init_constants_CMPtQbp7_es();
|
|
239049
239123
|
init_unified_BRHLwnjP_es();
|
|
239050
|
-
|
|
239124
|
+
init_DocxZipper_Dt7MDO2A_es();
|
|
239051
239125
|
init_vue_q66HzpoR_es();
|
|
239052
239126
|
init_eventemitter3_DGBTyUUP_es();
|
|
239053
239127
|
init_zipper_DqXT7uTa_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.94",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
23
|
"@superdoc/document-api": "0.0.1",
|
|
24
24
|
"@superdoc/super-editor": "0.0.1",
|
|
25
|
-
"
|
|
26
|
-
"superdoc": "
|
|
25
|
+
"superdoc": "1.17.0",
|
|
26
|
+
"@superdoc/pm-adapter": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"module": "src/index.ts",
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.
|
|
34
|
-
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.
|
|
35
|
-
"@superdoc-dev/cli-linux-x64": "0.2.0-next.
|
|
36
|
-
"@superdoc-dev/cli-
|
|
37
|
-
"@superdoc-dev/cli-
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.94",
|
|
34
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.94",
|
|
35
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.94",
|
|
36
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.94",
|
|
37
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.94"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "bun run src/index.ts",
|