Socket
Socket
Sign inDemoInstall

@stackblitz/sdk

Package Overview
Dependencies
0
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.1 to 1.5.2

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+="embed=1"),e.clickToLoad&&(t+=(t.length?"&":"")+"ctl=1"),e.openFile&&(t+=(t.length?"&":"")+"file="+e.openFile),!e.view||"preview"!==e.view&&"editor"!==e.view||(t+=(t.length?"&":"")+"view="+e.view),e.theme&&(t+=(t.length?"&":"")+"theme="+e.theme),e.hideExplorer&&(t+=(t.length?"&":"")+"hideExplorer=1"),e.hideNavigation&&(t+=(t.length?"&":"")+"hideNavigation=1;"),e.hideDevTools&&(t+=(t.length?"&":"")+"hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>0&&e.devToolsHeight<100&&(t+=(t.length?"&":"")+"devtoolsheight="+e.devToolsHeight),t.length?"?"+t:t):t}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 l=[],s=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 l.forEach(function(e,n){e.id===t.id&&l.splice(n,1)});a++,o()}},500)}),l.push(this)},u=function(e){var t=e instanceof Element?"element":"id",n=l.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=u(e);return t?t.pending:new s(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+="embed=1"),e.clickToLoad&&(t+=(t.length?"&":"")+"ctl=1"),e.openFile&&(t+=(t.length?"&":"")+"file="+e.openFile),!e.view||"preview"!==e.view&&"editor"!==e.view||(t+=(t.length?"&":"")+"view="+e.view),e.theme&&(t+=(t.length?"&":"")+"theme="+e.theme),e.hideExplorer&&(t+=(t.length?"&":"")+"hideExplorer=1"),e.hideNavigation&&(t+=(t.length?"&":"")+"hideNavigation=1;"),e.hideDevTools&&(t+=(t.length?"&":"")+"hidedevtools=1"),e.initialPath&&(t+=(t.length?"&":"")+"initialpath="+encodeURIComponent(e.initialPath)),"number"==typeof e.devToolsHeight&&e.devToolsHeight>0&&e.devToolsHeight<100&&(t+=(t.length?"&":"")+"devtoolsheight="+e.devToolsHeight),t.length?"?"+t:t):t}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 l=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}})}}};l.prototype.applyFsDiff=function(e){return this.rdc.request({type:"SDK_APPLY_FS_DIFF",payload:e})},l.prototype.getFsSnapshot=function(){return this.rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})},l.prototype.getDependencies=function(){return this.rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})};var p=[],s=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 l(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)},u=function(e){var t=e instanceof Element?"element":"id",n=p.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=u(e);return t?t.pending:new s(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+="embed=1"),e.clickToLoad&&(t+=(t.length?"&":"")+"ctl=1"),e.openFile&&(t+=(t.length?"&":"")+"file="+e.openFile),!e.view||"preview"!==e.view&&"editor"!==e.view||(t+=(t.length?"&":"")+"view="+e.view),e.theme&&(t+=(t.length?"&":"")+"theme="+e.theme),e.hideExplorer&&(t+=(t.length?"&":"")+"hideExplorer=1"),e.hideNavigation&&(t+=(t.length?"&":"")+"hideNavigation=1;"),e.hideDevTools&&(t+=(t.length?"&":"")+"hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>0&&e.devToolsHeight<100&&(t+=(t.length?"&":"")+"devtoolsheight="+e.devToolsHeight),t.length?"?"+t:t):t}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 l=[],s=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 l.forEach(function(e,n){e.id===t.id&&l.splice(n,1)});a++,o()}},500)}),l.push(this)},u=function(e){var t=e instanceof Element?"element":"id",n=l.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=u(e);return t?t.pending:new s(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+="embed=1"),e.clickToLoad&&(t+=(t.length?"&":"")+"ctl=1"),e.openFile&&(t+=(t.length?"&":"")+"file="+e.openFile),!e.view||"preview"!==e.view&&"editor"!==e.view||(t+=(t.length?"&":"")+"view="+e.view),e.theme&&(t+=(t.length?"&":"")+"theme="+e.theme),e.hideExplorer&&(t+=(t.length?"&":"")+"hideExplorer=1"),e.hideNavigation&&(t+=(t.length?"&":"")+"hideNavigation=1;"),e.hideDevTools&&(t+=(t.length?"&":"")+"hidedevtools=1"),e.initialPath&&(t+=(t.length?"&":"")+"initialpath="+encodeURIComponent(e.initialPath)),"number"==typeof e.devToolsHeight&&e.devToolsHeight>0&&e.devToolsHeight<100&&(t+=(t.length?"&":"")+"devtoolsheight="+e.devToolsHeight),t.length?"?"+t:t):t}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 l=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}})}}};l.prototype.applyFsDiff=function(e){return this.rdc.request({type:"SDK_APPLY_FS_DIFF",payload:e})},l.prototype.getFsSnapshot=function(){return this.rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})},l.prototype.getDependencies=function(){return this.rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})};var p=[],s=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 l(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)},u=function(e){var t=e instanceof Element?"element":"id",n=p.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=u(e);return t?t.pending:new s(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+="embed=1"),e.clickToLoad&&(t+=(t.length?"&":"")+"ctl=1"),e.openFile&&(t+=(t.length?"&":"")+"file="+e.openFile),!e.view||"preview"!==e.view&&"editor"!==e.view||(t+=(t.length?"&":"")+"view="+e.view),e.theme&&(t+=(t.length?"&":"")+"theme="+e.theme),e.hideExplorer&&(t+=(t.length?"&":"")+"hideExplorer=1"),e.hideNavigation&&(t+=(t.length?"&":"")+"hideNavigation=1;"),e.hideDevTools&&(t+=(t.length?"&":"")+"hidedevtools=1"),"number"==typeof e.devToolsHeight&&e.devToolsHeight>0&&e.devToolsHeight<100&&(t+=(t.length?"&":"")+"devtoolsheight="+e.devToolsHeight),t.length?"?"+t:t):t}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=[],l=["typescript","create-react-app","angular-cli","javascript","polymer","vue"];function s(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function u(e){-1===l.indexOf(e.template)&&console.warn("Unsupported project template, must be one of: "+l.join(", "));var t=document.createElement("form");return t.method="POST",t.setAttribute("style","display:none;"),t.appendChild(s("project[title]",e.title)),t.appendChild(s("project[description]",e.description)),t.appendChild(s("project[template]",e.template)),e.tags&&e.tags.forEach(function(e){t.appendChild(s("project[tags][]",e))}),e.dependencies&&t.appendChild(s("project[dependencies]",JSON.stringify(e.dependencies))),e.settings&&t.appendChild(s("project[settings]",JSON.stringify(e.settings))),Object.keys(e.files).forEach(function(n){t.appendChild(s("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=u(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),l=(d=a,(c=u(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>"),s=document.createElement("iframe");return o(p,s,a),s.contentDocument&&s.contentDocument.write(l),h.connect(s)},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+="embed=1"),e.clickToLoad&&(t+=(t.length?"&":"")+"ctl=1"),e.openFile&&(t+=(t.length?"&":"")+"file="+e.openFile),!e.view||"preview"!==e.view&&"editor"!==e.view||(t+=(t.length?"&":"")+"view="+e.view),e.theme&&(t+=(t.length?"&":"")+"theme="+e.theme),e.hideExplorer&&(t+=(t.length?"&":"")+"hideExplorer=1"),e.hideNavigation&&(t+=(t.length?"&":"")+"hideNavigation=1;"),e.hideDevTools&&(t+=(t.length?"&":"")+"hidedevtools=1"),e.initialPath&&(t+=(t.length?"&":"")+"initialpath="+encodeURIComponent(e.initialPath)),"number"==typeof e.devToolsHeight&&e.devToolsHeight>0&&e.devToolsHeight<100&&(t+=(t.length?"&":"")+"devtoolsheight="+e.devToolsHeight),t.length?"?"+t:t):t}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=[],l=["typescript","create-react-app","angular-cli","javascript","polymer","vue"];function s(e,t){var n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function u(e){-1===l.indexOf(e.template)&&console.warn("Unsupported project template, must be one of: "+l.join(", "));var t=document.createElement("form");return t.method="POST",t.setAttribute("style","display:none;"),t.appendChild(s("project[title]",e.title)),t.appendChild(s("project[description]",e.description)),t.appendChild(s("project[template]",e.template)),e.tags&&e.tags.forEach(function(e){t.appendChild(s("project[tags][]",e))}),e.dependencies&&t.appendChild(s("project[dependencies]",JSON.stringify(e.dependencies))),e.settings&&t.appendChild(s("project[settings]",JSON.stringify(e.settings))),Object.keys(e.files).forEach(function(n){t.appendChild(s("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=u(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),l=(d=a,(c=u(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>"),s=document.createElement("iframe");return o(p,s,a),s.contentDocument&&s.contentDocument.write(l),h.connect(s)},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});
//# sourceMappingURL=sdk.umd.js.map
{
"name": "@stackblitz/sdk",
"version": "1.5.1",
"version": "1.5.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "./bundles/sdk.js",

@@ -31,2 +31,3 @@ export interface RequestData {

devToolsHeight?: number;
initialPath?: string;
origin?: string;

@@ -33,0 +34,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc