diff --git a/shared/api/export/shared_export_service.js b/shared/api/export/shared_export_service.js index a4388b6..8799ae6 100644 --- a/shared/api/export/shared_export_service.js +++ b/shared/api/export/shared_export_service.js @@ -661,7 +661,7 @@ export default class SharedExportService extends SharedUtil if (opDoc.coreLibs) coreLibs = coreLibs.concat(opDoc.coreLibs); } - if (subPatchOp.storage && subPatchOp.isSubPatchOp()) + if (this._opsUtil.isSubPatchOp(subPatchOp)) { const attBp = this._opsUtil.getSubPatchOpAttachment(opName); if (attBp && attBp.ops && attBp.ops.length > 0) @@ -939,6 +939,20 @@ export default class SharedExportService extends SharedUtil return coreLibScripts; } + _getDependencyUrls(dependencies) + { + const depLibScripts = []; + for (let l = 0; l < dependencies.length; l++) + { + const dep = dependencies[l]; + const file = this._opsUtil.getOpAbsolutePath(dep.op); + const depScript = { "name": dep.name, "src": path.join(this.finalJsPath, dep.src), "type": dep.type }; + if (dep.src.startsWith("http")) depScript.file = path.join(file, dep.src); + depLibScripts.push(depScript); + } + return depLibScripts; + } + _addAssets(proj, allFiles, options) { this._replaceAssetFilePathes(proj, options.handleAssets); diff --git a/shared/api/utils/shared_doc_util.js b/shared/api/utils/shared_doc_util.js index 6870a6c..418afa0 100644 --- a/shared/api/utils/shared_doc_util.js +++ b/shared/api/utils/shared_doc_util.js @@ -145,6 +145,44 @@ export default class SharedDocUtil extends SharedUtil return coreLibs; } + getProjectDependencies(project) + { + if (!project || !project.ops) return []; + + let projectDependencies = {}; + let usedOpsNames = {}; + project.ops.forEach((op) => + { + usedOpsNames[op.opId] = this._opsUtil.getOpNameById(op.opId); + }); + usedOpsNames = Object.values(usedOpsNames); + const opDocs = this.getOpDocsForCollections(usedOpsNames); + for (let i = 0; i < opDocs.length; i++) + { + const opDoc = opDocs[i]; + if (opDoc.dependencies) + { + const opDeps = opDoc.dependencies.filter((dep) => { return dep.type === "commonjs" || dep.type === "module"; }); + for (let j = 0; j < opDeps.length; j++) + { + const lib = opDeps[j]; + for (let k = 0; k < lib.src.length; k++) + { + const libName = k ? lib.name + "_" + (k + 1) : lib.name; + const src = lib.src[k]; + projectDependencies[libName] = { + "name": libName, + "type": lib.type, + "src": src, + "op": opDoc.name + }; + } + } + } + } + return Object.values(projectDependencies); + } + setOpLinks(str) { str = str || ""; @@ -509,6 +547,10 @@ export default class SharedDocUtil extends SharedUtil { docObj.coreLibs = js.coreLibs; } + if (js.dependencies) + { + docObj.dependencies = js.dependencies; + } if (js.issues) { docObj.issues = js.issues; diff --git a/shared/api/utils/shared_ops_util.js b/shared/api/utils/shared_ops_util.js index 2029ff0..33f99e0 100644 --- a/shared/api/utils/shared_ops_util.js +++ b/shared/api/utils/shared_ops_util.js @@ -138,6 +138,13 @@ export default class SharedOpsUtil extends SharedUtil return opname.startsWith("Ops.Ui.SubPatch"); } + isSubPatchOp(op) + { + if (!op || !op.storage) return false; + if (op.storage.subPatchVer) return true; + return op.storage.blueprintVer > 1; + } + getOpAbsoluteJsonFilename(opName) { const p = this.getOpAbsolutePath(opName);