code-playpad 0.15.0 → 0.16.0
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/README.md +23 -3
- package/dist/{boot-BVedZD8N.js → boot-BjUY1Ie7.js} +1 -1
- package/dist/cdn.js +2 -2
- package/dist/{compiler-D7kIFltD.js → compiler-UMrA2h8r.js} +1 -1
- package/dist/{cpp-CI2vFLOK.js → cpp-CDeK5gz8.js} +1 -1
- package/dist/{csharp-B4M3Us-m.js → csharp-D2mcw4Xx.js} +1 -1
- package/dist/{element-UgFuSGoC.js → element-Biju-4SA.js} +1 -1
- package/dist/element.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{java-BYlTOHGf.js → java-cevrzY6x.js} +1 -1
- package/dist/{javascript-CNLIMOk1.js → javascript-DZlNZDDe.js} +1 -1
- package/dist/{next-C9S3EZEz.js → next-CKL809hs.js} +1 -1
- package/dist/{next-xTgh8PXL.js → next-Cb5W_u4U.js} +1 -1
- package/dist/next-vendor.generated-CZBsaQeS.js +6 -0
- package/dist/{pyodide-Cr69zEd2.js → pyodide-DJAtHIb8.js} +1 -1
- package/dist/{react-DPG8BrcN.js → react-SfE82Kr_.js} +1 -1
- package/dist/react.js +1 -1
- package/dist/runtime/next-vendor.generated.d.ts +2 -2
- package/dist/standalone.js +1 -1
- package/dist/{worker-runtime-5Ujf07eB.js → worker-runtime-dxTpNm5e.js} +1 -1
- package/package.json +1 -1
- package/dist/next-vendor.generated-DcyCefTD.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as e}from"./config-3Z6xX6Jr.js";import{t}from"./worker-runtime-
|
|
1
|
+
import{d as e}from"./config-3Z6xX6Jr.js";import{t}from"./worker-runtime-dxTpNm5e.js";var n=`let currentId=null,stdinLines=[],stdinExhausted=!1,nextRequest=1,inputWaitMs=0;const pendingLines=new Map;let sucrasePromise=null,sucraseURL=null;const pendingModules=new Map;class TransformLoadError extends Error{}function requestModule(t){return new Promise((e,r)=>{pendingModules.set(t,{resolve:e,reject:r}),post({type:"module-request",id:currentId,name:t})})}function post(t){self.postMessage(t)}let functionLineOffset=0;try{new Function('throw new Error("probe")')()}catch(t){const e=/<anonymous>:(\\d+):/.exec(t.stack||"");e&&(functionLineOffset=Number(e[1])-1)}let currentFiles=[];const FLUSH_BYTES=8192,FLUSH_MS=16,EAGER_POSTS=32;let outputQueue=[],queuedChars=0,windowStart=-1/0,windowPosts=0;function writeOutput(t,e){const r=outputQueue[outputQueue.length-1];r&&r.type===t?r.text+=e:outputQueue.push({type:t,text:e}),queuedChars+=e.length;const i=performance.now();i-windowStart>=FLUSH_MS&&(windowStart=i,windowPosts=0),(windowPosts<EAGER_POSTS||queuedChars>=FLUSH_BYTES)&&flushOutput()}function flushOutput(){if(!outputQueue.length)return;windowPosts++;const t=outputQueue;outputQueue=[],queuedChars=0;for(const e of t)post({type:e.type,id:currentId,text:e.text})}function format(t,e,r){if(e=e||new Set,typeof t=="string")return r?t:JSON.stringify(t);if(typeof t=="bigint")return String(t)+"n";if(typeof t=="function")return"[Function"+(t.name?": "+t.name:"")+"]";if(typeof t=="symbol"||t==null||typeof t!="object")return String(t);if(e.has(t))return"[Circular]";e.add(t);try{if(t instanceof Error)return t.stack||t.name+": "+t.message;if(Array.isArray(t))return"[ "+t.map(n=>format(n,e)).join(", ")+" ]";if(t instanceof Map)return"Map("+t.size+") { "+[...t].map(([n,o])=>format(n,e)+" => "+format(o,e)).join(", ")+" }";if(t instanceof Set)return"Set("+t.size+") { "+[...t].map(n=>format(n,e)).join(", ")+" }";if(t instanceof Date)return t.toISOString();if(t instanceof Promise)return"Promise { \\u2026 }";const i=Object.entries(t).map(([n,o])=>n+": "+format(o,e)),a=t.constructor&&t.constructor.name;return(a&&a!=="Object"?a+" ":"")+"{ "+i.join(", ")+" }"}finally{e.delete(t)}}function formatArgs(t){return t.map(e=>format(e,null,!0)).join(" ")+\`
|
|
2
2
|
\`}const nativeConsole=self.console;self.console=Object.assign(Object.create(nativeConsole),{log:(...t)=>writeOutput("stdout",formatArgs(t)),info:(...t)=>writeOutput("stdout",formatArgs(t)),debug:(...t)=>writeOutput("stdout",formatArgs(t)),warn:(...t)=>writeOutput("stderr",formatArgs(t)),error:(...t)=>writeOutput("stderr",formatArgs(t))}),self._ppReadLine=async()=>{if(stdinLines.length){const i=stdinLines.shift();return writeOutput("echo",i+\`
|
|
3
3
|
\`),i}const t=nextRequest++;flushOutput();const e=performance.now(),r=await new Promise(i=>{pendingLines.set(t,i),post({type:"stdin-request",id:currentId,request:t})});return inputWaitMs+=performance.now()-e,typeof r!="string"&&(stdinExhausted=!0),typeof r=="string"?r:null};async function input(t){t!==void 0&&writeOutput("stdout",String(t));const e=await self._ppReadLine();if(e===null)throw new Error("EOF: no more input");return e}self.input=input;async function loadSucrase(){return sucrasePromise||(sucrasePromise=(async()=>{try{if(sucraseURL)return await import(sucraseURL);const t=await requestModule("sucrase"),e=URL.createObjectURL(new Blob([t],{type:"text/javascript"}));try{return await import(e)}finally{URL.revokeObjectURL(e)}}catch(t){const e=sucraseURL?" from "+sucraseURL:"";throw new TransformLoadError("Could not load the TypeScript transform (Sucrase)"+e+": "+(t&&t.message?t.message:String(t)))}})(),sucrasePromise.catch(()=>{sucrasePromise=null})),sucrasePromise}function isModule(t,e){return Object.keys(t).length>1?!0:/^\\s*(import|export)\\s/m.test(t[e]||"")}function needsTypeScript(t){return/\\.(ts|tsx|jsx|mts|cts)$/.test(t)}function transformsFor(t){const e=["imports"];return/\\.tsx?$|\\.mts$|\\.cts$/.test(t)&&e.push("typescript"),/\\.[jt]sx$/.test(t)&&e.push("jsx"),e}async function runAsModules(t,e){const{transform:r}=await loadSucrase(),i=new Map,a=(n,o)=>{if(!o.startsWith("."))return null;const u=((n.includes("/")?n.slice(0,n.lastIndexOf("/")+1):"")+o).split("/"),d=[];for(const p of u)p==="."||p===""||(p===".."?d.pop():d.push(p));const c=d.join("/");return[c,c+".js",c+".ts",c+".tsx",c+".jsx",c+".json",c+"/index.js",c+"/index.ts"].find(p=>p in t)||null};function s(n){if(i.has(n))return i.get(n).exports;const o={exports:{}};if(i.set(n,o),n.endsWith(".json")){try{o.exports=JSON.parse(t[n])}catch(c){throw new SyntaxError("Invalid JSON in "+n+": "+c.message)}return o.exports}const{code:f}=r(t[n],{transforms:transformsFor(n),filePath:n,preserveDynamicImport:!0}),u=c=>{const l=a(n,c);if(!l)throw new Error('Cannot find module "'+c+'" from "'+n+'"');return s(l)};return new Function("exports","require","module","__filename","input","console",f+\`
|
|
4
4
|
//# sourceURL=\`+n)(o.exports,u,o,n,input,self.console),o.exports}s(e)}async function run(t){currentId=t.id,stdinLines=t.stdin?String(t.stdin).replace(/\\n$/,"").split(\`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-version.generated-BNNJmf7J.js";import{u as t}from"./config-3Z6xX6Jr.js";import{n,t as r}from"./boot-
|
|
1
|
+
import{t as e}from"./react-version.generated-BNNJmf7J.js";import{u as t}from"./config-3Z6xX6Jr.js";import{n,t as r}from"./boot-BjUY1Ie7.js";var i=`default-src 'none'; script-src 'unsafe-inline' blob:; worker-src blob:; style-src 'unsafe-inline'; img-src data:; font-src data:; form-action 'none'; base-uri 'none'`,a=/@import\s+["']tailwindcss/,o=`self.__webpack_require__=function(){throw new Error('Client modules do not run on the server.')};self.__webpack_require__.u=function(){return ''};self.__webpack_chunk_load__=function(){return Promise.resolve()};`;function s(){let e=document.implementation.createHTMLDocument(``),n=e.createElement(`meta`);n.setAttribute(`charset`,`utf-8`);let a=e.createElement(`meta`);a.httpEquiv=`Content-Security-Policy`,a.content=i;let o=e.createElement(`script`),{nonce:s}=t();return s&&o.setAttribute(`nonce`,s),o.textContent=r,e.head.prepend(n,a,o),e.documentElement.lang=`en`,`<!doctype html>${e.documentElement.outerHTML}`}function c(e){let t={};for(let n of Object.keys(e))n.startsWith(`public/`)&&n.endsWith(`.svg`)&&(t[n.slice(6)]=`data:image/svg+xml,${encodeURIComponent(e[n])}`);return t}function l(e){let t=document.createElement(`form`);t.className=`cp-next-bar`;let n=(t,n,r)=>{let i=document.createElement(`button`);return i.type=`button`,i.setAttribute(`aria-label`,t),i.textContent=n,i.addEventListener(`click`,()=>e()?.send({__playpadNav:1,op:r})),i},r=n(`Back`,`←`,`back`),i=n(`Forward`,`→`,`forward`),a=n(`Reload`,`↻`,`refresh`);r.disabled=i.disabled=!0;let o=document.createElement(`input`);return o.setAttribute(`aria-label`,`Address`),o.spellcheck=!1,t.append(r,i,a,o),t.addEventListener(`submit`,t=>{t.preventDefault(),e()?.send({__playpadNav:1,op:`push`,url:o.value.startsWith(`/`)?o.value:`/${o.value}`})}),{element:t,update(e){o.value=e.url,r.disabled=!e.canBack,i.disabled=!e.canForward}}}var u=new class{id=`next`;label=`Next.js preview (React ${e})`;interactiveStdin=!1;statusDecidesFailure=!0;#e=null;#t=null;#n=null;#r=/* @__PURE__ */ new WeakMap;#i=/* @__PURE__ */ new WeakMap;get ready(){return this.#e!==null}async editorLanguage(){let{javascript:e}=await import(`@codemirror/lang-javascript`);return e({jsx:!0})}load(){return this.#n??=(async()=>{try{[this.#e,this.#t]=await Promise.all([import(`./compiler-UMrA2h8r.js`),import(`./next-vendor.generated-CZBsaQeS.js`)])}catch(e){throw this.#n=null,Error(`The Next.js runtime could not be loaded. Check your connection and reload the page. (${e.message})`)}})(),this.#n}run(e,t={}){let r=t.preview;if(!r)return Promise.reject(/* @__PURE__ */ Error(`Next.js needs a <code-playpad> widget to render in.`));this.dispose(r.host);let i,a=l(()=>i),o=new Promise((e,t)=>{i=new n(r,{},e,t,a.update)});return this.#r.set(r.host,i),this.#i.set(o,i),this.#a(i,t.files??{},t.entry??`app/page.jsx`,a.element),o}async#a(e,n,r,i){try{await this.load();let{compileProject:l,CompileError:u,startPath:d}=this.#e,f;try{f=l(n)}catch(t){if(t instanceof u){e.fail(t.reason,{file:t.file,...t.line?{line:t.line}:{},...t.column?{column:t.column}:{}},t.hint),e.showCompileBanner(t.hint);return}throw t}let p=f.css.some(e=>a.test(e.text))?(await import(`./next-tailwind.generated-BWL5i33i.js`)).NEXT_TAILWIND_SOURCE:null,m=this.#t;Object.assign(e.payload,{nextClient:m.NEXT_CLIENT_SOURCE,tailwind:p,nonce:t().nonce,modules:f.client,css:f.css,notices:f.notices,routeFiles:f.routeFiles,assets:c(n),start:d(r),serverSource:`${o}\n${m.NEXT_SERVER_SOURCE}`,serverModules:f.server.filter(e=>e.kind===`js`).map(({path:e,text:t})=>({path:e,text:t})),serverMeta:f.server.map(({path:e,kind:t,links:n,directive:r,text:i})=>({path:e,kind:t,links:n,directive:r,...t===`json`?{text:i}:{}}))}),e.open(s(),[i])}catch(t){e.fail(t.message)}}stop(e){e&&this.#i.get(e)?.dispose(!0)}hasLivePreview(e){return this.#r.get(e)?.live??!1}dispose(e){this.#r.get(e)?.dispose(!0),this.#r.delete(e)}};export{u as nextRuntime};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
|
|
4
4
|
* Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
|
|
5
5
|
*/
|
|
6
|
-
import{t as e}from"./react-version.generated-BNNJmf7J.js";import{u as t}from"./config-3Z6xX6Jr.js";import{n,t as r}from"./boot-nmFndPHW.js";var i=`default-src 'none'; script-src 'unsafe-inline' blob:; worker-src blob:; style-src 'unsafe-inline'; img-src data:; font-src data:; form-action 'none'; base-uri 'none'`,a=/@import\s+["']tailwindcss/,o=`self.__webpack_require__=function(){throw new Error('Client modules do not run on the server.')};self.__webpack_require__.u=function(){return ''};self.__webpack_chunk_load__=function(){return Promise.resolve()};`;function s(){let e=document.implementation.createHTMLDocument(``),n=e.createElement(`meta`);n.setAttribute(`charset`,`utf-8`);let a=e.createElement(`meta`);a.httpEquiv=`Content-Security-Policy`,a.content=i;let o=e.createElement(`script`),{nonce:s}=t();return s&&o.setAttribute(`nonce`,s),o.textContent=r,e.head.prepend(n,a,o),e.documentElement.lang=`en`,`<!doctype html>${e.documentElement.outerHTML}`}function c(e){let t={};for(let n of Object.keys(e))n.startsWith(`public/`)&&n.endsWith(`.svg`)&&(t[n.slice(6)]=`data:image/svg+xml,${encodeURIComponent(e[n])}`);return t}function l(e){let t=document.createElement(`form`);t.className=`cp-next-bar`;let n=(t,n,r)=>{let i=document.createElement(`button`);return i.type=`button`,i.setAttribute(`aria-label`,t),i.textContent=n,i.addEventListener(`click`,()=>e()?.send({__playpadNav:1,op:r})),i},r=n(`Back`,`←`,`back`),i=n(`Forward`,`→`,`forward`),a=n(`Reload`,`↻`,`refresh`);r.disabled=i.disabled=!0;let o=document.createElement(`input`);return o.setAttribute(`aria-label`,`Address`),o.spellcheck=!1,t.append(r,i,a,o),t.addEventListener(`submit`,t=>{t.preventDefault(),e()?.send({__playpadNav:1,op:`push`,url:o.value.startsWith(`/`)?o.value:`/${o.value}`})}),{element:t,update(e){o.value=e.url,r.disabled=!e.canBack,i.disabled=!e.canForward}}}var u=new class{id=`next`;label=`Next.js preview (React ${e})`;interactiveStdin=!1;statusDecidesFailure=!0;#e=null;#t=null;#n=null;#r=/* @__PURE__ */ new WeakMap;#i=/* @__PURE__ */ new WeakMap;get ready(){return this.#e!==null}async editorLanguage(){let{javascript:e}=await import(`./dist-BwlTZqCY.js`);return e({jsx:!0})}load(){return this.#n??=(async()=>{try{[this.#e,this.#t]=await Promise.all([import(`./compiler-
|
|
6
|
+
import{t as e}from"./react-version.generated-BNNJmf7J.js";import{u as t}from"./config-3Z6xX6Jr.js";import{n,t as r}from"./boot-nmFndPHW.js";var i=`default-src 'none'; script-src 'unsafe-inline' blob:; worker-src blob:; style-src 'unsafe-inline'; img-src data:; font-src data:; form-action 'none'; base-uri 'none'`,a=/@import\s+["']tailwindcss/,o=`self.__webpack_require__=function(){throw new Error('Client modules do not run on the server.')};self.__webpack_require__.u=function(){return ''};self.__webpack_chunk_load__=function(){return Promise.resolve()};`;function s(){let e=document.implementation.createHTMLDocument(``),n=e.createElement(`meta`);n.setAttribute(`charset`,`utf-8`);let a=e.createElement(`meta`);a.httpEquiv=`Content-Security-Policy`,a.content=i;let o=e.createElement(`script`),{nonce:s}=t();return s&&o.setAttribute(`nonce`,s),o.textContent=r,e.head.prepend(n,a,o),e.documentElement.lang=`en`,`<!doctype html>${e.documentElement.outerHTML}`}function c(e){let t={};for(let n of Object.keys(e))n.startsWith(`public/`)&&n.endsWith(`.svg`)&&(t[n.slice(6)]=`data:image/svg+xml,${encodeURIComponent(e[n])}`);return t}function l(e){let t=document.createElement(`form`);t.className=`cp-next-bar`;let n=(t,n,r)=>{let i=document.createElement(`button`);return i.type=`button`,i.setAttribute(`aria-label`,t),i.textContent=n,i.addEventListener(`click`,()=>e()?.send({__playpadNav:1,op:r})),i},r=n(`Back`,`←`,`back`),i=n(`Forward`,`→`,`forward`),a=n(`Reload`,`↻`,`refresh`);r.disabled=i.disabled=!0;let o=document.createElement(`input`);return o.setAttribute(`aria-label`,`Address`),o.spellcheck=!1,t.append(r,i,a,o),t.addEventListener(`submit`,t=>{t.preventDefault(),e()?.send({__playpadNav:1,op:`push`,url:o.value.startsWith(`/`)?o.value:`/${o.value}`})}),{element:t,update(e){o.value=e.url,r.disabled=!e.canBack,i.disabled=!e.canForward}}}var u=new class{id=`next`;label=`Next.js preview (React ${e})`;interactiveStdin=!1;statusDecidesFailure=!0;#e=null;#t=null;#n=null;#r=/* @__PURE__ */ new WeakMap;#i=/* @__PURE__ */ new WeakMap;get ready(){return this.#e!==null}async editorLanguage(){let{javascript:e}=await import(`./dist-BwlTZqCY.js`);return e({jsx:!0})}load(){return this.#n??=(async()=>{try{[this.#e,this.#t]=await Promise.all([import(`./compiler-UMrA2h8r.js`),import(`./next-vendor.generated-CZBsaQeS.js`)])}catch(e){throw this.#n=null,Error(`The Next.js runtime could not be loaded. Check your connection and reload the page. (${e.message})`)}})(),this.#n}run(e,t={}){let r=t.preview;if(!r)return Promise.reject(/* @__PURE__ */ Error(`Next.js needs a <code-playpad> widget to render in.`));this.dispose(r.host);let i,a=l(()=>i),o=new Promise((e,t)=>{i=new n(r,{},e,t,a.update)});return this.#r.set(r.host,i),this.#i.set(o,i),this.#a(i,t.files??{},t.entry??`app/page.jsx`,a.element),o}async#a(e,n,r,i){try{await this.load();let{compileProject:l,CompileError:u,startPath:d}=this.#e,f;try{f=l(n)}catch(t){if(t instanceof u){e.fail(t.reason,{file:t.file,...t.line?{line:t.line}:{},...t.column?{column:t.column}:{}},t.hint),e.showCompileBanner(t.hint);return}throw t}let p=f.css.some(e=>a.test(e.text))?(await import(`./next-tailwind.generated-BWL5i33i.js`)).NEXT_TAILWIND_SOURCE:null,m=this.#t;Object.assign(e.payload,{nextClient:m.NEXT_CLIENT_SOURCE,tailwind:p,nonce:t().nonce,modules:f.client,css:f.css,notices:f.notices,routeFiles:f.routeFiles,assets:c(n),start:d(r),serverSource:`${o}\n${m.NEXT_SERVER_SOURCE}`,serverModules:f.server.filter(e=>e.kind===`js`).map(({path:e,text:t})=>({path:e,text:t})),serverMeta:f.server.map(({path:e,kind:t,links:n,directive:r,text:i})=>({path:e,kind:t,links:n,directive:r,...t===`json`?{text:i}:{}}))}),e.open(s(),[i])}catch(t){e.fail(t.message)}}stop(e){e&&this.#i.get(e)?.dispose(!0)}hasLivePreview(e){return this.#r.get(e)?.live??!1}dispose(e){this.#r.get(e)?.dispose(!0),this.#r.delete(e)}};export{u as nextRuntime};
|