@wp-playground/blueprints 0.9.2 → 0.9.10
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/index.cjs +1 -1
- package/index.js +1 -0
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bs=function(){var e;return typeof process<"u"&&((e=process.release)==null?void 0:e.name)==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(bs==="NODE"){let e=function(r){return new Promise(function(n,s){r.onload=r.onerror=function(i){r.onload=r.onerror=null,i.type==="load"?n(r.result):s(new Error("Failed to read the blob/file"))}})},t=function(){const r=new Uint8Array([1,2,3,4]),s=new File([r],"test").stream();try{return s.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class r extends Blob{constructor(s,i,c){super(s);let l;c!=null&&c.lastModified&&(l=new Date),(!l||isNaN(l.getFullYear()))&&(l=new Date),this.lastModifiedDate=l,this.lastModified=l.getMilliseconds(),this.name=i||""}}global.File=r}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const n=new FileReader;return n.readAsArrayBuffer(this),e(n)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const n=new FileReader;return n.readAsText(this),e(n)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let r=0;const n=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(s){const i=s.byobRequest.view,l=await n.slice(r,r+i.byteLength).arrayBuffer(),d=new Uint8Array(l);new Uint8Array(i.buffer).set(d);const f=d.byteLength;s.byobRequest.respond(f),r+=f,r>=n.size&&s.close()}})})}if(bs==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const Gr=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/0-playground.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"],Es=Symbol("SleepFinished");function Bi(e){return new Promise(t=>{setTimeout(()=>t(Es),e)})}class Hi extends Error{constructor(){super("Acquiring lock timed out")}}class Gi{constructor({concurrency:t,timeout:r}){this._running=0,this.concurrency=t,this.timeout=r,this.queue=[]}get remaining(){return this.concurrency-this.running}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency){const t=new Promise(r=>{this.queue.push(r)});this.timeout!==void 0?await Promise.race([t,Bi(this.timeout)]).then(r=>{if(r===Es)throw new Hi}):await t}else{this._running++;let t=!1;return()=>{t||(t=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}}async run(t){const r=await this.acquire();try{return await t()}finally{r()}}}function ue(...e){let t=e.join("/");const r=t[0]==="/",n=t.substring(t.length-1)==="/";return t=Ss(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function Ps(e){if(e==="/")return"/";e=Ss(e);const t=e.lastIndexOf("/");return t===-1?"":t===0?"/":e.substr(0,t)}function Ss(e){const t=e[0]==="/";return e=xi(e.split("/").filter(r=>!!r),!t).join("/"),(t?"/":"")+e.replace(/\/$/,"")}function xi(e,t){let r=0;for(let n=e.length-1;n>=0;n--){const s=e[n];s==="."?e.splice(n,1):s===".."?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e}function Ts(e=36,t="!@#$%^&*()_+=-[]/.,<>?"){const r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+t;let n="";for(let s=e;s>0;--s)n+=r[Math.floor(Math.random()*r.length)];return n}function Ki(){return Ts(36,"-_")}function pe(e){return`json_decode(base64_decode('${Ji(JSON.stringify(e))}'), true)`}function wr(e){const t={};for(const r in e)t[r]=pe(e[r]);return t}function Ji(e){return Qi(new TextEncoder().encode(e))}function Qi(e){const t=String.fromCodePoint(...e);return btoa(t)}const Zi="playground-log",Zn=(e,...t)=>{$e.dispatchEvent(new CustomEvent(Zi,{detail:{log:e,args:t}}))},Yi=(e,...t)=>{switch(typeof e.message=="string"?e.message=Lr(e.message):e.message.message&&typeof e.message.message=="string"&&(e.message.message=Lr(e.message.message)),e.severity){case"Debug":console.debug(e.message,...t);break;case"Info":console.info(e.message,...t);break;case"Warn":console.warn(e.message,...t);break;case"Error":console.error(e.message,...t);break;case"Fatal":console.error(e.message,...t);break;default:console.log(e.message,...t)}},Xi=e=>e instanceof Error?[e.message,e.stack].join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bs=function(){var e;return typeof process<"u"&&((e=process.release)==null?void 0:e.name)==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(bs==="NODE"){let e=function(r){return new Promise(function(n,s){r.onload=r.onerror=function(i){r.onload=r.onerror=null,i.type==="load"?n(r.result):s(new Error("Failed to read the blob/file"))}})},t=function(){const r=new Uint8Array([1,2,3,4]),s=new File([r],"test").stream();try{return s.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class r extends Blob{constructor(s,i,c){super(s);let l;c!=null&&c.lastModified&&(l=new Date),(!l||isNaN(l.getFullYear()))&&(l=new Date),this.lastModifiedDate=l,this.lastModified=l.getMilliseconds(),this.name=i||""}}global.File=r}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const n=new FileReader;return n.readAsArrayBuffer(this),e(n)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const n=new FileReader;return n.readAsText(this),e(n)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let r=0;const n=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(s){const i=s.byobRequest.view,l=await n.slice(r,r+i.byteLength).arrayBuffer(),d=new Uint8Array(l);new Uint8Array(i.buffer).set(d);const f=d.byteLength;s.byobRequest.respond(f),r+=f,r>=n.size&&s.close()}})})}if(bs==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const Gr=["db.php","plugins/akismet","plugins/hello.php","plugins/wordpress-importer","mu-plugins/sqlite-database-integration","mu-plugins/playground-includes","mu-plugins/0-playground.php","mu-plugins/0-sqlite.php","themes/twentytwenty","themes/twentytwentyone","themes/twentytwentytwo","themes/twentytwentythree","themes/twentytwentyfour","themes/twentytwentyfive","themes/twentytwentysix"],Es=Symbol("SleepFinished");function Bi(e){return new Promise(t=>{setTimeout(()=>t(Es),e)})}class Hi extends Error{constructor(){super("Acquiring lock timed out")}}class Gi{constructor({concurrency:t,timeout:r}){this._running=0,this.concurrency=t,this.timeout=r,this.queue=[]}get remaining(){return this.concurrency-this.running}get running(){return this._running}async acquire(){for(;;)if(this._running>=this.concurrency){const t=new Promise(r=>{this.queue.push(r)});this.timeout!==void 0?await Promise.race([t,Bi(this.timeout)]).then(r=>{if(r===Es)throw new Hi}):await t}else{this._running++;let t=!1;return()=>{t||(t=!0,this._running--,this.queue.length>0&&this.queue.shift()())}}}async run(t){const r=await this.acquire();try{return await t()}finally{r()}}}function ue(...e){let t=e.join("/");const r=t[0]==="/",n=t.substring(t.length-1)==="/";return t=Ss(t),!t&&!r&&(t="."),t&&n&&(t+="/"),t}function Ps(e){if(e==="/")return"/";e=Ss(e);const t=e.lastIndexOf("/");return t===-1?"":t===0?"/":e.substr(0,t)}function Ss(e){const t=e[0]==="/";return e=xi(e.split("/").filter(r=>!!r),!t).join("/"),(t?"/":"")+e.replace(/\/$/,"")}function xi(e,t){let r=0;for(let n=e.length-1;n>=0;n--){const s=e[n];s==="."?e.splice(n,1):s===".."?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e}function Ts(e=36,t="!@#$%^&*()_+=-[]/.,<>?"){const r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+t;let n="";for(let s=e;s>0;--s)n+=r[Math.floor(Math.random()*r.length)];return n}function Ki(){return Ts(36,"-_")}function pe(e){return`json_decode(base64_decode('${Ji(JSON.stringify(e))}'), true)`}function wr(e){const t={};for(const r in e)t[r]=pe(e[r]);return t}function Ji(e){return Qi(new TextEncoder().encode(e))}function Qi(e){const t=String.fromCodePoint(...e);return btoa(t)}const Zi="playground-log",Zn=(e,...t)=>{$e.dispatchEvent(new CustomEvent(Zi,{detail:{log:e,args:t}}))},Yi=(e,...t)=>{switch(typeof e.message=="string"?e.message=Lr(e.message):e.message.message&&typeof e.message.message=="string"&&(e.message.message=Lr(e.message.message)),e.severity){case"Debug":console.debug(e.message,...t);break;case"Info":console.info(e.message,...t);break;case"Warn":console.warn(e.message,...t);break;case"Error":console.error(e.message,...t);break;case"Fatal":console.error(e.message,...t);break;default:console.log(e.message,...t)}},Xi=e=>e instanceof Error?[e.message,e.stack].join(`
|
|
2
2
|
`):JSON.stringify(e,null,2),Rs=[],Yn=e=>{Rs.push(e)},Fr=e=>{if(e.raw===!0)Yn(e.message);else{const t=ro(typeof e.message=="object"?Xi(e.message):e.message,e.severity??"Info",e.prefix??"JavaScript");Yn(t)}};class eo extends EventTarget{constructor(t=[]){super(),this.handlers=t,this.fatalErrorEvent="playground-fatal-error"}getLogs(){return this.handlers.includes(Fr)?[...Rs]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
3
3
|
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
4
4
|
`),[])}logMessage(t,...r){for(const n of this.handlers)n(t,...r)}log(t,...r){this.logMessage({message:t,severity:void 0,prefix:"JavaScript",raw:!1},...r)}debug(t,...r){this.logMessage({message:t,severity:"Debug",prefix:"JavaScript",raw:!1},...r)}info(t,...r){this.logMessage({message:t,severity:"Info",prefix:"JavaScript",raw:!1},...r)}warn(t,...r){this.logMessage({message:t,severity:"Warn",prefix:"JavaScript",raw:!1},...r)}error(t,...r){this.logMessage({message:t,severity:"Error",prefix:"JavaScript",raw:!1},...r)}}const to=()=>{try{if(process.env.NODE_ENV==="test")return[Fr,Zn]}catch{}return[Fr,Yi,Zn]},$e=new eo(to()),Lr=e=>e.replace(/\t/g,""),ro=(e,t,r)=>{const n=new Date,s=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),c=s+" "+i;return e=Lr(e),`[${c}] ${r} ${t}: ${e}`},br=async(e,{pluginPath:t,pluginName:r},n)=>{n==null||n.tracker.setCaption(`Activating ${r||t}`);const s=await e.documentRoot,i=await e.run({code:`<?php
|
package/index.js
CHANGED
|
@@ -75,6 +75,7 @@ const gs = [
|
|
|
75
75
|
"mu-plugins/sqlite-database-integration",
|
|
76
76
|
"mu-plugins/playground-includes",
|
|
77
77
|
"mu-plugins/0-playground.php",
|
|
78
|
+
"mu-plugins/0-sqlite.php",
|
|
78
79
|
/*
|
|
79
80
|
* Listing core themes like that here isn't ideal, especially since
|
|
80
81
|
* developers may actually want to use one of them.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/blueprints",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"access": "public",
|
|
22
22
|
"directory": "../../../dist/packages/playground/blueprints"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "713ee9bb8310b399e232e66d65d11768c075cf93",
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=18.18.0",
|
|
27
27
|
"npm": ">=8.11.0"
|