Socket
Socket
Sign inDemoInstall

@stackblitz/sdk

Package Overview
Dependencies
Maintainers
4
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stackblitz/sdk - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

2

bundles/sdk.js

@@ -1,2 +0,2 @@

function e(e){return e&&e.origin?e.origin:"https://stackblitz.com"}var t="300";function n(){return Math.random().toString(36).substring(7)}function i(e){var t=[];return e&&(e.forceEmbedLayout&&t.push("embed=1"),e.clickToLoad&&t.push("ctl=1"),"string"==typeof e.openFile&&t.push("file="+e.openFile),"preview"!==e.view&&"editor"!==e.view||t.push("view="+e.view),"light"!==e.theme&&"dark"!==e.theme||t.push("theme="+e.theme),e.hideExplorer&&t.push("hideExplorer=1"),e.hideNavigation&&t.push("hideNavigation=1"),e.hideDevTools&&t.push("hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>=0&&e.devToolsHeight<=100&&t.push("devtoolsheight="+Math.round(e.devToolsHeight))),t.length?"?"+t.join("&"):""}function o(e,t,n){if(null===e.parentNode)throw new Error("Invalid Element");t.id=e.id,d(t,n),e.parentNode.replaceChild(t,e)}function r(e){if("string"==typeof e){var t=document.getElementById(e);if(null!==t)return t}else if(e instanceof HTMLElement)return e;throw new Error("Invalid Element")}function a(e){return e&&!1===e.newWindow?"_self":"_blank"}function d(e,n){n&&(n.hasOwnProperty("height")&&(e.height=""+n.height),n.hasOwnProperty("width")&&(e.width=""+n.width)),e.height||(e.height=t),e.width||e.setAttribute("style","width:100%;")}var c=function(e){var t=this;this.pending={},this.port=e,this.port.onmessage=function(e){if(e.data.payload.__reqid){var n=e.data.payload.__reqid,i=e.data.payload.__success;if(t.pending[n]){if(delete e.data.payload.__reqid,delete e.data.payload.__success,i){var o=0===Object.keys(e.data.payload).length&&e.data.payload.constructor===Object?null:e.data.payload;t.pending[n].resolve(o)}else{var r=e.data.payload.error?e.data.type+": "+e.data.payload.error:e.data.type;t.pending[n].reject(r)}delete t.pending[n]}}}};c.prototype.request=function(e){var t=this,i=n();return new Promise(function(n,o){t.pending[i]={resolve:n,reject:o},e.payload.__reqid=i,t.port.postMessage(e)})};var p=function(e,t){var n=this;this.rdc=new c(e),this.preview={},Object.defineProperty(this.preview,"origin",{value:t.previewOrigin,writable:!1}),this.editor={openFile:function(e){return n.rdc.request({type:"SDK_OPEN_FILE",payload:{path:e}})}}};p.prototype.applyFsDiff=function(e){return this.rdc.request({type:"SDK_APPLY_FS_DIFF",payload:e})},p.prototype.getFsSnapshot=function(){return this.rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})},p.prototype.getDependencies=function(){return this.rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})};var s=[],u=function(e){var t=this;this.id=n(),this.element=e,this.pending=new Promise(function(e,n){var i=function(n){n.data.action&&"SDK_INIT_SUCCESS"===n.data.action&&n.data.id===t.id&&(t.vm=new p(n.ports[0],n.data.payload),e(t.vm),r())},o=function(){t.element.contentWindow&&t.element.contentWindow.postMessage({action:"SDK_INIT",id:t.id},"*")};function r(){window.clearInterval(d),window.removeEventListener("message",i)}window.addEventListener("message",i),o();var a=0,d=window.setInterval(function(){if(t.vm)r();else{if(a>=20)return r(),n("Timeout: Unable to establish a connection with the StackBlitz VM"),void s.forEach(function(e,n){e.id===t.id&&s.splice(n,1)});a++,o()}},500)}),s.push(this)},l=function(e){var t=e instanceof Element?"element":"id",n=s.find(function(n){return n[t]===e});return n||null},h=["typescript","create-react-app","angular-cli","javascript","polymer","vue"];function f(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function m(e){-1===h.indexOf(e.template)&&console.warn("Unsupported project template, must be one of: "+h.join(", "));var t=document.createElement("form");return t.method="POST",t.setAttribute("style","display:none;"),t.appendChild(f("project[title]",e.title)),t.appendChild(f("project[description]",e.description)),t.appendChild(f("project[template]",e.template)),e.tags&&e.tags.forEach(function(e){t.appendChild(f("project[tags][]",e))}),e.dependencies&&t.appendChild(f("project[dependencies]",JSON.stringify(e.dependencies))),e.settings&&t.appendChild(f("project[settings]",JSON.stringify(e.settings))),Object.keys(e.files).forEach(function(n){t.appendChild(f("project[files]["+n+"]",e.files[n]))}),t}function v(t,n){var o=m(t);return o.action=e(n)+"/run"+i(n),o.id="sb","<html><head><title></title></head><body>"+o.outerHTML+"<script>document.getElementById('sb').submit();<\/script></body></html>"}function g(t,n){var o=m(t);o.action=e(n)+"/run"+i(n),o.target=a(n),document.body.appendChild(o),o.submit(),document.body.removeChild(o)}var y={connect:function(e){if(!e||!e.contentWindow)return Promise.reject("Provided element is not an iframe.");var t=l(e);return t?t.pending:new u(e).pending},openGithubProject:function(t,n){window.open(e(n)+"/github/"+t+i(n),a(n))},openProject:function(e,t){g(e,t)},openProjectId:function(t,n){window.open(e(n)+"/edit/"+t+i(n),a(n))},embedGithubProject:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/github/"+n+i(a),o(d,c,a),y.connect(c)},embedProject:function(e,t,n){var i=r(e),a=v(t,n),d=document.createElement("iframe");return o(i,d,n),d.contentDocument&&d.contentDocument.write(a),y.connect(d)},embedProjectId:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/edit/"+n+i(a),o(d,c,a),y.connect(c)}};module.exports=y;
function e(e){return e&&e.origin?e.origin:"https://stackblitz.com"}var t="300";function n(){return Math.random().toString(36).substring(7)}function i(e){var t=[];return e&&(e.forceEmbedLayout&&t.push("embed=1"),e.clickToLoad&&t.push("ctl=1"),"string"==typeof e.openFile&&t.push("file="+e.openFile),"preview"!==e.view&&"editor"!==e.view||t.push("view="+e.view),"light"!==e.theme&&"dark"!==e.theme||t.push("theme="+e.theme),e.hideExplorer&&t.push("hideExplorer=1"),e.hideNavigation&&t.push("hideNavigation=1"),e.hideDevTools&&t.push("hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>=0&&e.devToolsHeight<=100&&t.push("devtoolsheight="+Math.round(e.devToolsHeight))),t.length?"?"+t.join("&"):""}function o(e,t,n){if(null===e.parentNode)throw new Error("Invalid Element");t.id=e.id,d(t,n),e.parentNode.replaceChild(t,e)}function r(e){if("string"==typeof e){var t=document.getElementById(e);if(null!==t)return t}else if(e instanceof HTMLElement)return e;throw new Error("Invalid Element")}function a(e){return e&&!1===e.newWindow?"_self":"_blank"}function d(e,n){n&&(n.hasOwnProperty("height")&&(e.height=""+n.height),n.hasOwnProperty("width")&&(e.width=""+n.width)),e.height||(e.height=t),e.width||e.setAttribute("style","width:100%;")}var c=function(e){var t=this;this.pending={},this.port=e,this.port.onmessage=function(e){if(e.data.payload.__reqid){var n=e.data.payload.__reqid,i=e.data.payload.__success;if(t.pending[n]){if(delete e.data.payload.__reqid,delete e.data.payload.__success,i){var o=0===Object.keys(e.data.payload).length&&e.data.payload.constructor===Object?null:e.data.payload;t.pending[n].resolve(o)}else{var r=e.data.payload.error?e.data.type+": "+e.data.payload.error:e.data.type;t.pending[n].reject(r)}delete t.pending[n]}}}};c.prototype.request=function(e){var t=this,i=n();return new Promise(function(n,o){t.pending[i]={resolve:n,reject:o},e.payload.__reqid=i,t.port.postMessage(e)})};var p=function(e,t){var n=this;this.rdc=new c(e),this.preview={},Object.defineProperty(this.preview,"origin",{value:t.previewOrigin,writable:!1}),this.editor={openFile:function(e){return n.rdc.request({type:"SDK_OPEN_FILE",payload:{path:e}})}}};p.prototype.applyFsDiff=function(e){return this.rdc.request({type:"SDK_APPLY_FS_DIFF",payload:e})},p.prototype.getFsSnapshot=function(){return this.rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})},p.prototype.getDependencies=function(){return this.rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})};var s=[],u=function(e){var t=this;this.id=n(),this.element=e,this.pending=new Promise(function(e,n){var i=function(n){n.data.action&&"SDK_INIT_SUCCESS"===n.data.action&&n.data.id===t.id&&(t.vm=new p(n.ports[0],n.data.payload),e(t.vm),r())},o=function(){t.element.contentWindow&&t.element.contentWindow.postMessage({action:"SDK_INIT",id:t.id},"*")};function r(){window.clearInterval(d),window.removeEventListener("message",i)}window.addEventListener("message",i),o();var a=0,d=window.setInterval(function(){if(t.vm)r();else{if(a>=20)return r(),n("Timeout: Unable to establish a connection with the StackBlitz VM"),void s.forEach(function(e,n){e.id===t.id&&s.splice(n,1)});a++,o()}},500)}),s.push(this)},l=function(e){var t=e instanceof Element?"element":"id",n=s.find(function(n){return n[t]===e});return n||null},h=["angular-cli","create-react-app","javascript","node","polymer","typescript","vue"];function f(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function m(e){-1===h.indexOf(e.template)&&console.warn("Unsupported project template, must be one of: "+h.join(", "));var t=document.createElement("form");return t.method="POST",t.setAttribute("style","display:none!important;"),t.appendChild(f("project[title]",e.title)),t.appendChild(f("project[description]",e.description)),t.appendChild(f("project[template]",e.template)),e.dependencies&&t.appendChild(f("project[dependencies]",JSON.stringify(e.dependencies))),e.settings&&t.appendChild(f("project[settings]",JSON.stringify(e.settings))),Object.keys(e.files).forEach(function(n){t.appendChild(f("project[files]["+n+"]",e.files[n]))}),t}function v(t,n){var o=m(t);return o.action=e(n)+"/run"+i(n),o.id="sb","<html><head><title></title></head><body>"+o.outerHTML+"<script>document.getElementById('sb').submit();<\/script></body></html>"}function g(t,n){var o=m(t);o.action=e(n)+"/run"+i(n),o.target=a(n),document.body.appendChild(o),o.submit(),document.body.removeChild(o)}var y={connect:function(e){if(!e||!e.contentWindow)return Promise.reject("Provided element is not an iframe.");var t=l(e);return t?t.pending:new u(e).pending},openGithubProject:function(t,n){window.open(e(n)+"/github/"+t+i(n),a(n))},openProject:function(e,t){g(e,t)},openProjectId:function(t,n){window.open(e(n)+"/edit/"+t+i(n),a(n))},embedGithubProject:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/github/"+n+i(a),o(d,c,a),y.connect(c)},embedProject:function(e,t,n){var i=r(e),a=v(t,n),d=document.createElement("iframe");return o(i,d,n),d.contentDocument&&d.contentDocument.write(a),y.connect(d)},embedProjectId:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/edit/"+n+i(a),o(d,c,a),y.connect(c)}};module.exports=y;
//# sourceMappingURL=sdk.js.map

@@ -1,2 +0,2 @@

function e(e){return e&&e.origin?e.origin:"https://stackblitz.com"}var t="300";function n(){return Math.random().toString(36).substring(7)}function i(e){var t=[];return e&&(e.forceEmbedLayout&&t.push("embed=1"),e.clickToLoad&&t.push("ctl=1"),"string"==typeof e.openFile&&t.push("file="+e.openFile),"preview"!==e.view&&"editor"!==e.view||t.push("view="+e.view),"light"!==e.theme&&"dark"!==e.theme||t.push("theme="+e.theme),e.hideExplorer&&t.push("hideExplorer=1"),e.hideNavigation&&t.push("hideNavigation=1"),e.hideDevTools&&t.push("hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>=0&&e.devToolsHeight<=100&&t.push("devtoolsheight="+Math.round(e.devToolsHeight))),t.length?"?"+t.join("&"):""}function o(e,t,n){if(null===e.parentNode)throw new Error("Invalid Element");t.id=e.id,d(t,n),e.parentNode.replaceChild(t,e)}function r(e){if("string"==typeof e){var t=document.getElementById(e);if(null!==t)return t}else if(e instanceof HTMLElement)return e;throw new Error("Invalid Element")}function a(e){return e&&!1===e.newWindow?"_self":"_blank"}function d(e,n){n&&(n.hasOwnProperty("height")&&(e.height=""+n.height),n.hasOwnProperty("width")&&(e.width=""+n.width)),e.height||(e.height=t),e.width||e.setAttribute("style","width:100%;")}var c=function(e){var t=this;this.pending={},this.port=e,this.port.onmessage=function(e){if(e.data.payload.__reqid){var n=e.data.payload.__reqid,i=e.data.payload.__success;if(t.pending[n]){if(delete e.data.payload.__reqid,delete e.data.payload.__success,i){var o=0===Object.keys(e.data.payload).length&&e.data.payload.constructor===Object?null:e.data.payload;t.pending[n].resolve(o)}else{var r=e.data.payload.error?e.data.type+": "+e.data.payload.error:e.data.type;t.pending[n].reject(r)}delete t.pending[n]}}}};c.prototype.request=function(e){var t=this,i=n();return new Promise(function(n,o){t.pending[i]={resolve:n,reject:o},e.payload.__reqid=i,t.port.postMessage(e)})};var p=function(e,t){var n=this;this.rdc=new c(e),this.preview={},Object.defineProperty(this.preview,"origin",{value:t.previewOrigin,writable:!1}),this.editor={openFile:function(e){return n.rdc.request({type:"SDK_OPEN_FILE",payload:{path:e}})}}};p.prototype.applyFsDiff=function(e){return this.rdc.request({type:"SDK_APPLY_FS_DIFF",payload:e})},p.prototype.getFsSnapshot=function(){return this.rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})},p.prototype.getDependencies=function(){return this.rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})};var s=[],u=function(e){var t=this;this.id=n(),this.element=e,this.pending=new Promise(function(e,n){var i=function(n){n.data.action&&"SDK_INIT_SUCCESS"===n.data.action&&n.data.id===t.id&&(t.vm=new p(n.ports[0],n.data.payload),e(t.vm),r())},o=function(){t.element.contentWindow&&t.element.contentWindow.postMessage({action:"SDK_INIT",id:t.id},"*")};function r(){window.clearInterval(d),window.removeEventListener("message",i)}window.addEventListener("message",i),o();var a=0,d=window.setInterval(function(){if(t.vm)r();else{if(a>=20)return r(),n("Timeout: Unable to establish a connection with the StackBlitz VM"),void s.forEach(function(e,n){e.id===t.id&&s.splice(n,1)});a++,o()}},500)}),s.push(this)},l=function(e){var t=e instanceof Element?"element":"id",n=s.find(function(n){return n[t]===e});return n||null},h=["typescript","create-react-app","angular-cli","javascript","polymer","vue"];function f(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function m(e){-1===h.indexOf(e.template)&&console.warn("Unsupported project template, must be one of: "+h.join(", "));var t=document.createElement("form");return t.method="POST",t.setAttribute("style","display:none;"),t.appendChild(f("project[title]",e.title)),t.appendChild(f("project[description]",e.description)),t.appendChild(f("project[template]",e.template)),e.tags&&e.tags.forEach(function(e){t.appendChild(f("project[tags][]",e))}),e.dependencies&&t.appendChild(f("project[dependencies]",JSON.stringify(e.dependencies))),e.settings&&t.appendChild(f("project[settings]",JSON.stringify(e.settings))),Object.keys(e.files).forEach(function(n){t.appendChild(f("project[files]["+n+"]",e.files[n]))}),t}function v(t,n){var o=m(t);return o.action=e(n)+"/run"+i(n),o.id="sb","<html><head><title></title></head><body>"+o.outerHTML+"<script>document.getElementById('sb').submit();<\/script></body></html>"}function g(t,n){var o=m(t);o.action=e(n)+"/run"+i(n),o.target=a(n),document.body.appendChild(o),o.submit(),document.body.removeChild(o)}var y={connect:function(e){if(!e||!e.contentWindow)return Promise.reject("Provided element is not an iframe.");var t=l(e);return t?t.pending:new u(e).pending},openGithubProject:function(t,n){window.open(e(n)+"/github/"+t+i(n),a(n))},openProject:function(e,t){g(e,t)},openProjectId:function(t,n){window.open(e(n)+"/edit/"+t+i(n),a(n))},embedGithubProject:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/github/"+n+i(a),o(d,c,a),y.connect(c)},embedProject:function(e,t,n){var i=r(e),a=v(t,n),d=document.createElement("iframe");return o(i,d,n),d.contentDocument&&d.contentDocument.write(a),y.connect(d)},embedProjectId:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/edit/"+n+i(a),o(d,c,a),y.connect(c)}};export default y;
function e(e){return e&&e.origin?e.origin:"https://stackblitz.com"}var t="300";function n(){return Math.random().toString(36).substring(7)}function i(e){var t=[];return e&&(e.forceEmbedLayout&&t.push("embed=1"),e.clickToLoad&&t.push("ctl=1"),"string"==typeof e.openFile&&t.push("file="+e.openFile),"preview"!==e.view&&"editor"!==e.view||t.push("view="+e.view),"light"!==e.theme&&"dark"!==e.theme||t.push("theme="+e.theme),e.hideExplorer&&t.push("hideExplorer=1"),e.hideNavigation&&t.push("hideNavigation=1"),e.hideDevTools&&t.push("hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>=0&&e.devToolsHeight<=100&&t.push("devtoolsheight="+Math.round(e.devToolsHeight))),t.length?"?"+t.join("&"):""}function o(e,t,n){if(null===e.parentNode)throw new Error("Invalid Element");t.id=e.id,d(t,n),e.parentNode.replaceChild(t,e)}function r(e){if("string"==typeof e){var t=document.getElementById(e);if(null!==t)return t}else if(e instanceof HTMLElement)return e;throw new Error("Invalid Element")}function a(e){return e&&!1===e.newWindow?"_self":"_blank"}function d(e,n){n&&(n.hasOwnProperty("height")&&(e.height=""+n.height),n.hasOwnProperty("width")&&(e.width=""+n.width)),e.height||(e.height=t),e.width||e.setAttribute("style","width:100%;")}var c=function(e){var t=this;this.pending={},this.port=e,this.port.onmessage=function(e){if(e.data.payload.__reqid){var n=e.data.payload.__reqid,i=e.data.payload.__success;if(t.pending[n]){if(delete e.data.payload.__reqid,delete e.data.payload.__success,i){var o=0===Object.keys(e.data.payload).length&&e.data.payload.constructor===Object?null:e.data.payload;t.pending[n].resolve(o)}else{var r=e.data.payload.error?e.data.type+": "+e.data.payload.error:e.data.type;t.pending[n].reject(r)}delete t.pending[n]}}}};c.prototype.request=function(e){var t=this,i=n();return new Promise(function(n,o){t.pending[i]={resolve:n,reject:o},e.payload.__reqid=i,t.port.postMessage(e)})};var p=function(e,t){var n=this;this.rdc=new c(e),this.preview={},Object.defineProperty(this.preview,"origin",{value:t.previewOrigin,writable:!1}),this.editor={openFile:function(e){return n.rdc.request({type:"SDK_OPEN_FILE",payload:{path:e}})}}};p.prototype.applyFsDiff=function(e){return this.rdc.request({type:"SDK_APPLY_FS_DIFF",payload:e})},p.prototype.getFsSnapshot=function(){return this.rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})},p.prototype.getDependencies=function(){return this.rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})};var s=[],u=function(e){var t=this;this.id=n(),this.element=e,this.pending=new Promise(function(e,n){var i=function(n){n.data.action&&"SDK_INIT_SUCCESS"===n.data.action&&n.data.id===t.id&&(t.vm=new p(n.ports[0],n.data.payload),e(t.vm),r())},o=function(){t.element.contentWindow&&t.element.contentWindow.postMessage({action:"SDK_INIT",id:t.id},"*")};function r(){window.clearInterval(d),window.removeEventListener("message",i)}window.addEventListener("message",i),o();var a=0,d=window.setInterval(function(){if(t.vm)r();else{if(a>=20)return r(),n("Timeout: Unable to establish a connection with the StackBlitz VM"),void s.forEach(function(e,n){e.id===t.id&&s.splice(n,1)});a++,o()}},500)}),s.push(this)},l=function(e){var t=e instanceof Element?"element":"id",n=s.find(function(n){return n[t]===e});return n||null},h=["angular-cli","create-react-app","javascript","node","polymer","typescript","vue"];function f(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function m(e){-1===h.indexOf(e.template)&&console.warn("Unsupported project template, must be one of: "+h.join(", "));var t=document.createElement("form");return t.method="POST",t.setAttribute("style","display:none!important;"),t.appendChild(f("project[title]",e.title)),t.appendChild(f("project[description]",e.description)),t.appendChild(f("project[template]",e.template)),e.dependencies&&t.appendChild(f("project[dependencies]",JSON.stringify(e.dependencies))),e.settings&&t.appendChild(f("project[settings]",JSON.stringify(e.settings))),Object.keys(e.files).forEach(function(n){t.appendChild(f("project[files]["+n+"]",e.files[n]))}),t}function v(t,n){var o=m(t);return o.action=e(n)+"/run"+i(n),o.id="sb","<html><head><title></title></head><body>"+o.outerHTML+"<script>document.getElementById('sb').submit();<\/script></body></html>"}function g(t,n){var o=m(t);o.action=e(n)+"/run"+i(n),o.target=a(n),document.body.appendChild(o),o.submit(),document.body.removeChild(o)}var y={connect:function(e){if(!e||!e.contentWindow)return Promise.reject("Provided element is not an iframe.");var t=l(e);return t?t.pending:new u(e).pending},openGithubProject:function(t,n){window.open(e(n)+"/github/"+t+i(n),a(n))},openProject:function(e,t){g(e,t)},openProjectId:function(t,n){window.open(e(n)+"/edit/"+t+i(n),a(n))},embedGithubProject:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/github/"+n+i(a),o(d,c,a),y.connect(c)},embedProject:function(e,t,n){var i=r(e),a=v(t,n),d=document.createElement("iframe");return o(i,d,n),d.contentDocument&&d.contentDocument.write(a),y.connect(d)},embedProjectId:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/edit/"+n+i(a),o(d,c,a),y.connect(c)}};export default y;
//# sourceMappingURL=sdk.m.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.StackBlitzSDK=t()}(this,function(){function e(e){return e&&e.origin?e.origin:"https://stackblitz.com"}var t="300";function n(){return Math.random().toString(36).substring(7)}function i(e){var t=[];return e&&(e.forceEmbedLayout&&t.push("embed=1"),e.clickToLoad&&t.push("ctl=1"),"string"==typeof e.openFile&&t.push("file="+e.openFile),"preview"!==e.view&&"editor"!==e.view||t.push("view="+e.view),"light"!==e.theme&&"dark"!==e.theme||t.push("theme="+e.theme),e.hideExplorer&&t.push("hideExplorer=1"),e.hideNavigation&&t.push("hideNavigation=1"),e.hideDevTools&&t.push("hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>=0&&e.devToolsHeight<=100&&t.push("devtoolsheight="+Math.round(e.devToolsHeight))),t.length?"?"+t.join("&"):""}function o(e,n,i){if(null===e.parentNode)throw new Error("Invalid Element");n.id=e.id,function(e,n){n&&(n.hasOwnProperty("height")&&(e.height=""+n.height),n.hasOwnProperty("width")&&(e.width=""+n.width));e.height||(e.height=t);e.width||e.setAttribute("style","width:100%;")}(n,i),e.parentNode.replaceChild(n,e)}function r(e){if("string"==typeof e){var t=document.getElementById(e);if(null!==t)return t}else if(e instanceof HTMLElement)return e;throw new Error("Invalid Element")}function a(e){return e&&!1===e.newWindow?"_self":"_blank"}var d=function(e){var t=this;this.pending={},this.port=e,this.port.onmessage=function(e){if(e.data.payload.__reqid){var n=e.data.payload.__reqid,i=e.data.payload.__success;if(t.pending[n]){if(delete e.data.payload.__reqid,delete e.data.payload.__success,i){var o=0===Object.keys(e.data.payload).length&&e.data.payload.constructor===Object?null:e.data.payload;t.pending[n].resolve(o)}else{var r=e.data.payload.error?e.data.type+": "+e.data.payload.error:e.data.type;t.pending[n].reject(r)}delete t.pending[n]}}}};d.prototype.request=function(e){var t=this,i=n();return new Promise(function(n,o){t.pending[i]={resolve:n,reject:o},e.payload.__reqid=i,t.port.postMessage(e)})};var c=function(e,t){var n=this;this.rdc=new d(e),this.preview={},Object.defineProperty(this.preview,"origin",{value:t.previewOrigin,writable:!1}),this.editor={openFile:function(e){return n.rdc.request({type:"SDK_OPEN_FILE",payload:{path:e}})}}};c.prototype.applyFsDiff=function(e){return this.rdc.request({type:"SDK_APPLY_FS_DIFF",payload:e})},c.prototype.getFsSnapshot=function(){return this.rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})},c.prototype.getDependencies=function(){return this.rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})};var p=[],s=["typescript","create-react-app","angular-cli","javascript","polymer","vue"];function u(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function l(e){-1===s.indexOf(e.template)&&console.warn("Unsupported project template, must be one of: "+s.join(", "));var t=document.createElement("form");return t.method="POST",t.setAttribute("style","display:none;"),t.appendChild(u("project[title]",e.title)),t.appendChild(u("project[description]",e.description)),t.appendChild(u("project[template]",e.template)),e.tags&&e.tags.forEach(function(e){t.appendChild(u("project[tags][]",e))}),e.dependencies&&t.appendChild(u("project[dependencies]",JSON.stringify(e.dependencies))),e.settings&&t.appendChild(u("project[settings]",JSON.stringify(e.settings))),Object.keys(e.files).forEach(function(n){t.appendChild(u("project[files]["+n+"]",e.files[n]))}),t}var h={connect:function(e){if(!e||!e.contentWindow)return Promise.reject("Provided element is not an iframe.");var t,i,o=(i=(t=e)instanceof Element?"element":"id",p.find(function(e){return e[i]===t})||null);return o?o.pending:new function(e){var t=this;this.id=n(),this.element=e,this.pending=new Promise(function(e,n){var i=function(n){n.data.action&&"SDK_INIT_SUCCESS"===n.data.action&&n.data.id===t.id&&(t.vm=new c(n.ports[0],n.data.payload),e(t.vm),r())},o=function(){t.element.contentWindow&&t.element.contentWindow.postMessage({action:"SDK_INIT",id:t.id},"*")};function r(){window.clearInterval(d),window.removeEventListener("message",i)}window.addEventListener("message",i),o();var a=0,d=window.setInterval(function(){if(t.vm)r();else{if(a>=20)return r(),n("Timeout: Unable to establish a connection with the StackBlitz VM"),void p.forEach(function(e,n){e.id===t.id&&p.splice(n,1)});a++,o()}},500)}),p.push(this)}(e).pending},openGithubProject:function(t,n){window.open(e(n)+"/github/"+t+i(n),a(n))},openProject:function(t,n){var o,r;o=n,(r=l(t)).action=e(o)+"/run"+i(o),r.target=a(o),document.body.appendChild(r),r.submit(),document.body.removeChild(r)},openProjectId:function(t,n){window.open(e(n)+"/edit/"+t+i(n),a(n))},embedGithubProject:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/github/"+n+i(a),o(d,c,a),h.connect(c)},embedProject:function(t,n,a){var d,c,p=r(t),s=(d=a,(c=l(n)).action=e(d)+"/run"+i(d),c.id="sb","<html><head><title></title></head><body>"+c.outerHTML+"<script>document.getElementById('sb').submit();<\/script></body></html>"),u=document.createElement("iframe");return o(p,u,a),u.contentDocument&&u.contentDocument.write(s),h.connect(u)},embedProjectId:function(t,n,a){var d=r(t),c=document.createElement("iframe");return c.src=e(a)+"/edit/"+n+i(a),o(d,c,a),h.connect(c)}};return h});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.StackBlitzSDK=t()}(this,function(){function e(e){return e&&e.origin?e.origin:"https://stackblitz.com"}var t="300";function n(){return Math.random().toString(36).substring(7)}function i(e){var t=[];return e&&(e.forceEmbedLayout&&t.push("embed=1"),e.clickToLoad&&t.push("ctl=1"),"string"==typeof e.openFile&&t.push("file="+e.openFile),"preview"!==e.view&&"editor"!==e.view||t.push("view="+e.view),"light"!==e.theme&&"dark"!==e.theme||t.push("theme="+e.theme),e.hideExplorer&&t.push("hideExplorer=1"),e.hideNavigation&&t.push("hideNavigation=1"),e.hideDevTools&&t.push("hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>=0&&e.devToolsHeight<=100&&t.push("devtoolsheight="+Math.round(e.devToolsHeight))),t.length?"?"+t.join("&"):""}function o(e,n,i){if(null===e.parentNode)throw new Error("Invalid Element");n.id=e.id,function(e,n){n&&(n.hasOwnProperty("height")&&(e.height=""+n.height),n.hasOwnProperty("width")&&(e.width=""+n.width));e.height||(e.height=t);e.width||e.setAttribute("style","width:100%;")}(n,i),e.parentNode.replaceChild(n,e)}function r(e){if("string"==typeof e){var t=document.getElementById(e);if(null!==t)return t}else if(e instanceof HTMLElement)return e;throw new Error("Invalid Element")}function d(e){return e&&!1===e.newWindow?"_self":"_blank"}var a=function(e){var t=this;this.pending={},this.port=e,this.port.onmessage=function(e){if(e.data.payload.__reqid){var n=e.data.payload.__reqid,i=e.data.payload.__success;if(t.pending[n]){if(delete e.data.payload.__reqid,delete e.data.payload.__success,i){var o=0===Object.keys(e.data.payload).length&&e.data.payload.constructor===Object?null:e.data.payload;t.pending[n].resolve(o)}else{var r=e.data.payload.error?e.data.type+": "+e.data.payload.error:e.data.type;t.pending[n].reject(r)}delete t.pending[n]}}}};a.prototype.request=function(e){var t=this,i=n();return new Promise(function(n,o){t.pending[i]={resolve:n,reject:o},e.payload.__reqid=i,t.port.postMessage(e)})};var c=function(e,t){var n=this;this.rdc=new a(e),this.preview={},Object.defineProperty(this.preview,"origin",{value:t.previewOrigin,writable:!1}),this.editor={openFile:function(e){return n.rdc.request({type:"SDK_OPEN_FILE",payload:{path:e}})}}};c.prototype.applyFsDiff=function(e){return this.rdc.request({type:"SDK_APPLY_FS_DIFF",payload:e})},c.prototype.getFsSnapshot=function(){return this.rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})},c.prototype.getDependencies=function(){return this.rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})};var p=[],s=["angular-cli","create-react-app","javascript","node","polymer","typescript","vue"];function u(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function l(e){-1===s.indexOf(e.template)&&console.warn("Unsupported project template, must be one of: "+s.join(", "));var t=document.createElement("form");return t.method="POST",t.setAttribute("style","display:none!important;"),t.appendChild(u("project[title]",e.title)),t.appendChild(u("project[description]",e.description)),t.appendChild(u("project[template]",e.template)),e.dependencies&&t.appendChild(u("project[dependencies]",JSON.stringify(e.dependencies))),e.settings&&t.appendChild(u("project[settings]",JSON.stringify(e.settings))),Object.keys(e.files).forEach(function(n){t.appendChild(u("project[files]["+n+"]",e.files[n]))}),t}var h={connect:function(e){if(!e||!e.contentWindow)return Promise.reject("Provided element is not an iframe.");var t,i,o=(i=(t=e)instanceof Element?"element":"id",p.find(function(e){return e[i]===t})||null);return o?o.pending:new function(e){var t=this;this.id=n(),this.element=e,this.pending=new Promise(function(e,n){var i=function(n){n.data.action&&"SDK_INIT_SUCCESS"===n.data.action&&n.data.id===t.id&&(t.vm=new c(n.ports[0],n.data.payload),e(t.vm),r())},o=function(){t.element.contentWindow&&t.element.contentWindow.postMessage({action:"SDK_INIT",id:t.id},"*")};function r(){window.clearInterval(a),window.removeEventListener("message",i)}window.addEventListener("message",i),o();var d=0,a=window.setInterval(function(){if(t.vm)r();else{if(d>=20)return r(),n("Timeout: Unable to establish a connection with the StackBlitz VM"),void p.forEach(function(e,n){e.id===t.id&&p.splice(n,1)});d++,o()}},500)}),p.push(this)}(e).pending},openGithubProject:function(t,n){window.open(e(n)+"/github/"+t+i(n),d(n))},openProject:function(t,n){var o,r;o=n,(r=l(t)).action=e(o)+"/run"+i(o),r.target=d(o),document.body.appendChild(r),r.submit(),document.body.removeChild(r)},openProjectId:function(t,n){window.open(e(n)+"/edit/"+t+i(n),d(n))},embedGithubProject:function(t,n,d){var a=r(t),c=document.createElement("iframe");return c.src=e(d)+"/github/"+n+i(d),o(a,c,d),h.connect(c)},embedProject:function(t,n,d){var a,c,p=r(t),s=(a=d,(c=l(n)).action=e(a)+"/run"+i(a),c.id="sb","<html><head><title></title></head><body>"+c.outerHTML+"<script>document.getElementById('sb').submit();<\/script></body></html>"),u=document.createElement("iframe");return o(p,u,d),u.contentDocument&&u.contentDocument.write(s),h.connect(u)},embedProjectId:function(t,n,d){var a=r(t),c=document.createElement("iframe");return c.src=e(d)+"/edit/"+n+i(d),o(a,c,d),h.connect(c)}};return h});
//# sourceMappingURL=sdk.umd.js.map
{
"name": "@stackblitz/sdk",
"version": "1.5.3",
"version": "1.5.4",
"description": "",

@@ -13,4 +13,3 @@ "main": "./bundles/sdk.js",

"compile": "tsc --p tsconfig.json",
"bundle": "npx microbundle --i dist/index.js --name StackBlitzSDK --target=browser",
"docs": "typedoc --out docs/ src/index.ts"
"bundle": "npx microbundle --i dist/index.js --name StackBlitzSDK --target=browser"
},

@@ -26,5 +25,4 @@ "files": [

"microbundle": "^0.3.1",
"typedoc": "^0.10.0",
"typescript": "^2.9.2"
}
}

@@ -1,12 +0,11 @@

import { VM } from './VM';
import { Project, OpenOptions, EmbedOptions } from './interfaces';
declare const StackBlitzSDK: {
connect: (frameEl: HTMLIFrameElement) => Promise<VM>;
connect: (frameEl: HTMLIFrameElement) => Promise<import("../../../../../../../Users/florens/Code/stackblitz/core/sdk/src/VM").VM>;
openGithubProject: (repoSlug: string, options?: OpenOptions | undefined) => void;
openProject: (project: Project, options?: OpenOptions | undefined) => void;
openProjectId: (projectId: string, options?: OpenOptions | undefined) => void;
embedGithubProject: (elementOrId: string | HTMLElement, repoSlug: string, options?: EmbedOptions | undefined) => Promise<VM>;
embedProject: (elementOrId: string | HTMLElement, project: Project, options?: EmbedOptions | undefined) => Promise<VM>;
embedProjectId: (elementOrId: string | HTMLElement, projectId: string, options?: EmbedOptions | undefined) => Promise<VM>;
embedGithubProject: (elementOrId: string | HTMLElement, repoSlug: string, options?: EmbedOptions | undefined) => Promise<import("../../../../../../../Users/florens/Code/stackblitz/core/sdk/src/VM").VM>;
embedProject: (elementOrId: string | HTMLElement, project: Project, options?: EmbedOptions | undefined) => Promise<import("../../../../../../../Users/florens/Code/stackblitz/core/sdk/src/VM").VM>;
embedProjectId: (elementOrId: string | HTMLElement, projectId: string, options?: EmbedOptions | undefined) => Promise<import("../../../../../../../Users/florens/Code/stackblitz/core/sdk/src/VM").VM>;
};
export default StackBlitzSDK;

@@ -9,9 +9,8 @@ export interface RequestData {

export interface Project {
title: string;
description: string;
template: string;
files: {
[path: string]: string;
};
title: string;
description: string;
template: string;
tags?: string[];
dependencies?: {

@@ -27,2 +26,3 @@ [name: string]: string;

};
tags?: string[];
}

@@ -29,0 +29,0 @@ export interface ProjectOptions {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc