cep-webpack-plugin
Version:
Webpack plugin that emits a CSXS/manifest.xml file for Adobe CEP extensions.
6 lines • 3.88 kB
JavaScript
/*!
*** cep-webpack-plugin 2.0.0
*** Copyright © 2019, Jaid <jaid.jsx@gmail.com> (https://github.com/Jaid)
*** See https://github.com/Jaid/cep-webpack-plugin#readme
!*/
var e,t;e=global,t=function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t){e.exports=require("ow")},function(e,t){e.exports=require("xmlbuilder")},function(e,t){e.exports=require("ensure-object")},function(e,t){e.exports=require("resolve-any")},function(e,t){e.exports={photoshop:{host:"PHSP"},indesign:{host:"IDSN"},incopy:{host:"AICY"},illustrator:{host:"ILST"},premierePro:{host:"PPRO"},prelude:{host:"PRLD"},afterEffects:{host:"AEFT"},animate:{host:"FLPR"},audition:{host:"AUDT"},dreamweaver:{host:"DRWV"},muse:{host:"MUSE"},bridge:{host:"KBRG"},rush:{host:"RUSH"}}},function(e,t,n){n.r(t);var o=n(2),i=n.n(o),s=n(0),r=n.n(s),u=n(3),p=n.n(u),a=n(1),l=n.n(a),c=n(4),f=n.n(c);const d={encoding:"UTF-8"};t.default=class{constructor(e){const t=i()(e,"identifier");this.options={fileName:"CSXS/manifest.xml",version:"1.0.0",title:t.title||t.identifier,requiredCefVersion:"9.0",apps:{photoshop:"20"},mainPath:"./index.html",panel:!0,minify:!0,debug:null,debugPort:8400,debugFileName:".debug",...t},r()(this.options.identifier,r.a.string.nonEmpty)}apply(e){e.hooks.emit.tapPromise("CepWebpackPlugin",async e=>{const t=`${this.options.identifier}.extension`,n=[];for(const[e,t]of Object.entries(this.options.apps)){const o=f.a[e];n.push({"@Name":o.host,"@Version":t})}const o={ExtensionManifest:{"@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@Version":"8.0","@ExtensionBundleId":this.options.identifier,"@ExtensionBundleVersion":this.options.version,"@ExtensionBundleName":this.options.title,ExtensionList:{Extension:{"@Id":t,"@Version":this.options.version}},ExecutionEnvironment:{RequiredRuntimeList:{RequiredRuntime:{"@Name":"CSXS","@Version":this.options.requiredCefVersion}},HostList:{Host:n},LocaleList:{Locale:{"@Code":"All"}}},DispatchInfoList:{Extension:{"@Id":t,DispatchInfo:{Resources:{MainPath:this.options.mainPath},Lifecycle:{AutoVisible:!0}}}}}};if(this.options.panel){const e={title:this.options.title,height:600,width:200};o.ExtensionManifest.DispatchInfoList.Extension.DispatchInfo.UI={Type:"Panel",Menu:e.title,Geometry:{Size:{Height:e.height,Width:e.width}}}}const i=l.a.create(o,d).end({pretty:!this.options.minify}),s=await p()(this.options.fileName);e.assets[s]={source:()=>i,size:()=>i.length};const r="development"===e.compiler.options.mode;if(null===this.options.debug?r:this.options.debug){let o=this.options.debugPort;const i={ExtensionList:{Extension:{"@Id":t,HostList:{Host:n.map(e=>{const t=o;return o++,{"@Name":e["@Name"],"@Port":t}})}}}},s=l.a.create(i,d).end({pretty:!this.options.minify});e.assets[this.options.debugFileName]={source:()=>s,size:()=>s.length}}})}}}])},"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["cep-webpack-plugin"]=t():e.CepWebpackPlugin=t();