@superdoc-dev/cli 0.3.0-next.17 → 0.3.0-next.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/index.js +76 -12
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -118581,7 +118581,7 @@ var init_remark_stringify_D8vxv_XI_es = __esm(() => {
|
|
|
118581
118581
|
eol = /\r?\n|\r/g;
|
|
118582
118582
|
});
|
|
118583
118583
|
|
|
118584
|
-
// ../../packages/superdoc/dist/chunks/DocxZipper-
|
|
118584
|
+
// ../../packages/superdoc/dist/chunks/DocxZipper-GK7co0eu.es.js
|
|
118585
118585
|
function getLens2(b64) {
|
|
118586
118586
|
var len$1 = b64.length;
|
|
118587
118587
|
if (len$1 % 4 > 0)
|
|
@@ -118712,13 +118712,13 @@ function partExistsInPackage(zipPath, baseFiles, updatedDocs) {
|
|
|
118712
118712
|
}
|
|
118713
118713
|
function parseXml(xmlString) {
|
|
118714
118714
|
try {
|
|
118715
|
-
return import_lib$
|
|
118715
|
+
return import_lib$2.xml2js(xmlString, { compact: false });
|
|
118716
118716
|
} catch {
|
|
118717
118717
|
return null;
|
|
118718
118718
|
}
|
|
118719
118719
|
}
|
|
118720
118720
|
function serializeXml(jsObject) {
|
|
118721
|
-
return import_lib$
|
|
118721
|
+
return import_lib$2.js2xml(jsObject, { spaces: 0 });
|
|
118722
118722
|
}
|
|
118723
118723
|
function findRootElement(parsed, tagName) {
|
|
118724
118724
|
return parsed?.elements?.find((el) => {
|
|
@@ -118742,7 +118742,7 @@ function createEmptyRels() {
|
|
|
118742
118742
|
}]
|
|
118743
118743
|
};
|
|
118744
118744
|
}
|
|
118745
|
-
function findMaxRId(relsRoot) {
|
|
118745
|
+
function findMaxRId$1(relsRoot) {
|
|
118746
118746
|
let max = 0;
|
|
118747
118747
|
for (const el of relsRoot.elements || []) {
|
|
118748
118748
|
const id = el.attributes?.Id;
|
|
@@ -118824,7 +118824,7 @@ function reconcileRootRels(relsRoot, presentParts) {
|
|
|
118824
118824
|
});
|
|
118825
118825
|
}
|
|
118826
118826
|
const indicesToRemove = /* @__PURE__ */ new Set;
|
|
118827
|
-
let maxRId = findMaxRId(relsRoot);
|
|
118827
|
+
let maxRId = findMaxRId$1(relsRoot);
|
|
118828
118828
|
for (const [relType, entry] of managedByType) {
|
|
118829
118829
|
const isPresent = presentParts.has(entry.zipPath);
|
|
118830
118830
|
const existing = existingRels.get(relType) || [];
|
|
@@ -118891,7 +118891,53 @@ function syncPackageMetadata({ baseFiles, updatedDocs }) {
|
|
|
118891
118891
|
relsXml: serializeXml(relsParsed)
|
|
118892
118892
|
};
|
|
118893
118893
|
}
|
|
118894
|
-
|
|
118894
|
+
function findMaxRId(elements) {
|
|
118895
|
+
let max = 0;
|
|
118896
|
+
for (const el of elements) {
|
|
118897
|
+
const match = el.attributes?.Id?.match(/^rId(\d+)$/);
|
|
118898
|
+
if (match)
|
|
118899
|
+
max = Math.max(max, Number(match[1]));
|
|
118900
|
+
}
|
|
118901
|
+
return max;
|
|
118902
|
+
}
|
|
118903
|
+
function reconcileDocumentRelationships(relsXml, fileExists) {
|
|
118904
|
+
if (!relsXml)
|
|
118905
|
+
return relsXml;
|
|
118906
|
+
let parsed;
|
|
118907
|
+
try {
|
|
118908
|
+
parsed = import_lib$12.xml2js(relsXml, { compact: false });
|
|
118909
|
+
} catch {
|
|
118910
|
+
return relsXml;
|
|
118911
|
+
}
|
|
118912
|
+
const relsTag = parsed?.elements?.find((el) => el.name === "Relationships");
|
|
118913
|
+
if (!relsTag)
|
|
118914
|
+
return relsXml;
|
|
118915
|
+
if (!relsTag.elements)
|
|
118916
|
+
relsTag.elements = [];
|
|
118917
|
+
let changed = false;
|
|
118918
|
+
let maxId = findMaxRId(relsTag.elements);
|
|
118919
|
+
for (const entry of MANAGED_DOCUMENT_PARTS) {
|
|
118920
|
+
if (!fileExists(entry.zipPath))
|
|
118921
|
+
continue;
|
|
118922
|
+
if (relsTag.elements.some((el) => el.attributes?.Type === entry.relationshipType))
|
|
118923
|
+
continue;
|
|
118924
|
+
maxId++;
|
|
118925
|
+
relsTag.elements.push({
|
|
118926
|
+
type: "element",
|
|
118927
|
+
name: "Relationship",
|
|
118928
|
+
attributes: {
|
|
118929
|
+
Id: `rId${maxId}`,
|
|
118930
|
+
Type: entry.relationshipType,
|
|
118931
|
+
Target: entry.relTarget
|
|
118932
|
+
}
|
|
118933
|
+
});
|
|
118934
|
+
changed = true;
|
|
118935
|
+
}
|
|
118936
|
+
if (!changed)
|
|
118937
|
+
return relsXml;
|
|
118938
|
+
return import_lib$12.js2xml(parsed, { spaces: 0 });
|
|
118939
|
+
}
|
|
118940
|
+
var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", buffer2, base64Js2, lookup2, revLookup2, Arr2, code5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i3, len2, ieee7542, Buffer3, isXmlLike = (name) => /\.xml$|\.rels$/i.test(name), MANAGED_PACKAGE_PARTS, import_lib$2, RELATIONSHIPS_NS = "http://schemas.openxmlformats.org/package/2006/relationships", import_lib$12, MANAGED_DOCUMENT_PARTS, import_lib3, import_jszip_min, IMAGE_EXTS, MIME_TYPE_FOR_EXT, CUSTOM_XML_ITEM_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.customXmlProperties+xml", FONT_CONTENT_TYPES, DocxZipper = class {
|
|
118895
118941
|
constructor(params = {}) {
|
|
118896
118942
|
this.debug = params.debug || false;
|
|
118897
118943
|
this.zip = new import_jszip_min.default;
|
|
@@ -119035,6 +119081,9 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
119035
119081
|
if (!hasFootnotes)
|
|
119036
119082
|
typesString += footnotesDef;
|
|
119037
119083
|
}
|
|
119084
|
+
for (const entry of MANAGED_DOCUMENT_PARTS)
|
|
119085
|
+
if (hasFile(entry.zipPath) && !hasPartOverride(`/${entry.zipPath}`))
|
|
119086
|
+
typesString += `<Override PartName="/${entry.zipPath}" ContentType="${entry.contentType}" />`;
|
|
119038
119087
|
const partNames = new Set(additionalPartNames);
|
|
119039
119088
|
if (docx?.files)
|
|
119040
119089
|
if (fromJson && Array.isArray(docx.files))
|
|
@@ -119112,6 +119161,14 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
119112
119161
|
const extendedDef = `<Override PartName="/${name}" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.${name.includes("header") ? "header" : "footer"}+xml"/>`;
|
|
119113
119162
|
updatedContentTypesXml = updatedContentTypesXml.replace("</Types>", `${extendedDef}</Types>`);
|
|
119114
119163
|
});
|
|
119164
|
+
if (relationshipsXml) {
|
|
119165
|
+
const reconciledRels = reconcileDocumentRelationships(relationshipsXml, hasFile);
|
|
119166
|
+
if (reconciledRels !== relationshipsXml)
|
|
119167
|
+
if (fromJson)
|
|
119168
|
+
updatedDocs["word/_rels/document.xml.rels"] = reconciledRels;
|
|
119169
|
+
else
|
|
119170
|
+
docx.file("word/_rels/document.xml.rels", reconciledRels);
|
|
119171
|
+
}
|
|
119115
119172
|
if (fromJson)
|
|
119116
119173
|
return updatedContentTypesXml;
|
|
119117
119174
|
docx.file(contentTypesPath, updatedContentTypesXml);
|
|
@@ -119219,7 +119276,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
|
|
|
119219
119276
|
return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
|
|
119220
119277
|
}
|
|
119221
119278
|
}, DocxZipper_default;
|
|
119222
|
-
var
|
|
119279
|
+
var init_DocxZipper_GK7co0eu_es = __esm(() => {
|
|
119223
119280
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
119224
119281
|
init_jszip_ChlR43oI_es();
|
|
119225
119282
|
init_xml_js_BtmJ6bNs_es();
|
|
@@ -120860,7 +120917,14 @@ var init_DocxZipper_DcuMk8AE_es = __esm(() => {
|
|
|
120860
120917
|
relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
|
|
120861
120918
|
}
|
|
120862
120919
|
];
|
|
120920
|
+
import_lib$2 = /* @__PURE__ */ __toESM2(require_lib(), 1);
|
|
120863
120921
|
import_lib$12 = /* @__PURE__ */ __toESM2(require_lib(), 1);
|
|
120922
|
+
MANAGED_DOCUMENT_PARTS = [{
|
|
120923
|
+
zipPath: "word/numbering.xml",
|
|
120924
|
+
contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
|
|
120925
|
+
relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",
|
|
120926
|
+
relTarget: "numbering.xml"
|
|
120927
|
+
}];
|
|
120864
120928
|
import_lib3 = /* @__PURE__ */ __toESM2(require_lib(), 1);
|
|
120865
120929
|
import_jszip_min = /* @__PURE__ */ __toESM2(require_jszip_min(), 1);
|
|
120866
120930
|
IMAGE_EXTS = new Set([
|
|
@@ -144322,7 +144386,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
144322
144386
|
init_remark_gfm_z_sDF4ss_es();
|
|
144323
144387
|
});
|
|
144324
144388
|
|
|
144325
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
144389
|
+
// ../../packages/superdoc/dist/chunks/src-B23kCZxx.es.js
|
|
144326
144390
|
function deleteProps(obj, propOrProps) {
|
|
144327
144391
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
144328
144392
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -224983,7 +225047,7 @@ var Node$13 = class Node$14 {
|
|
|
224983
225047
|
return false;
|
|
224984
225048
|
return Boolean(checker(attrs));
|
|
224985
225049
|
}, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
|
|
224986
|
-
var
|
|
225050
|
+
var init_src_B23kCZxx_es = __esm(() => {
|
|
224987
225051
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
224988
225052
|
init_SuperConverter_hvBoS9gB_es();
|
|
224989
225053
|
init_jszip_ChlR43oI_es();
|
|
@@ -224992,7 +225056,7 @@ var init_src_BAlN4OvK_es = __esm(() => {
|
|
|
224992
225056
|
init_unified_BRHLwnjP_es();
|
|
224993
225057
|
init_remark_gfm_z_sDF4ss_es();
|
|
224994
225058
|
init_remark_stringify_D8vxv_XI_es();
|
|
224995
|
-
|
|
225059
|
+
init_DocxZipper_GK7co0eu_es();
|
|
224996
225060
|
init_vue_DQHWm9lq_es();
|
|
224997
225061
|
init__plugin_vue_export_helper_HmhZBO0u_es();
|
|
224998
225062
|
init_eventemitter3_DGBTyUUP_es();
|
|
@@ -258071,13 +258135,13 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
258071
258135
|
|
|
258072
258136
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
258073
258137
|
var init_super_editor_es = __esm(() => {
|
|
258074
|
-
|
|
258138
|
+
init_src_B23kCZxx_es();
|
|
258075
258139
|
init_SuperConverter_hvBoS9gB_es();
|
|
258076
258140
|
init_jszip_ChlR43oI_es();
|
|
258077
258141
|
init_xml_js_BtmJ6bNs_es();
|
|
258078
258142
|
init_constants_ep1_Gwqi_es();
|
|
258079
258143
|
init_unified_BRHLwnjP_es();
|
|
258080
|
-
|
|
258144
|
+
init_DocxZipper_GK7co0eu_es();
|
|
258081
258145
|
init_vue_DQHWm9lq_es();
|
|
258082
258146
|
init_eventemitter3_DGBTyUUP_es();
|
|
258083
258147
|
init_zipper_DqXT7uTa_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"@types/bun": "^1.3.8",
|
|
21
21
|
"@types/node": "22.19.2",
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
|
+
"@superdoc/pm-adapter": "0.0.0",
|
|
23
24
|
"@superdoc/document-api": "0.0.1",
|
|
24
|
-
"superdoc": "1.19.0",
|
|
25
25
|
"@superdoc/super-editor": "0.0.1",
|
|
26
|
-
"
|
|
26
|
+
"superdoc": "1.19.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.3.0-next.
|
|
34
|
-
"@superdoc-dev/cli-darwin-x64": "0.3.0-next.
|
|
35
|
-
"@superdoc-dev/cli-linux-x64": "0.3.0-next.
|
|
36
|
-
"@superdoc-dev/cli-windows-x64": "0.3.0-next.
|
|
37
|
-
"@superdoc-dev/cli-linux-arm64": "0.3.0-next.
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.3.0-next.19",
|
|
34
|
+
"@superdoc-dev/cli-darwin-x64": "0.3.0-next.19",
|
|
35
|
+
"@superdoc-dev/cli-linux-x64": "0.3.0-next.19",
|
|
36
|
+
"@superdoc-dev/cli-windows-x64": "0.3.0-next.19",
|
|
37
|
+
"@superdoc-dev/cli-linux-arm64": "0.3.0-next.19"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "bun run src/index.ts",
|