@wp-playground/blueprints 1.0.11 → 1.0.13
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 +17 -17
- package/index.js +142 -141
- package/lib/steps/set-site-language.d.ts +7 -0
- package/package.json +11 -11
package/index.js
CHANGED
|
@@ -3,8 +3,9 @@ import { phpVar as fe, randomFilename as Lr, phpVars as ir, joinPaths as ie, dir
|
|
|
3
3
|
import { logger as me } from "@php-wasm/logger";
|
|
4
4
|
import { writeFiles as or, LatestSupportedPHPVersion as Nr, SupportedPHPVersions as Dr } from "@php-wasm/universal";
|
|
5
5
|
import { unzipFile as yr } from "@wp-playground/common";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { MinifiedWordPressVersions as xr, LatestMinifiedWordPressVersion as Cr } from "@wp-playground/wordpress-builds";
|
|
7
|
+
import { cloneResponseMonitorProgress as Ir, ProgressTracker as Wr } from "@php-wasm/progress";
|
|
8
|
+
import { listGitFiles as Ur, listDescendantFiles as Mr, sparseCheckout as zr } from "@wp-playground/storage";
|
|
8
9
|
const hr = [
|
|
9
10
|
"db.php",
|
|
10
11
|
"plugins/akismet",
|
|
@@ -102,9 +103,9 @@ const hr = [
|
|
|
102
103
|
throw me.debug(i), new Error(
|
|
103
104
|
`Theme ${t} could not be activated – WordPress exited with no error. Sometimes, when $_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details`
|
|
104
105
|
);
|
|
105
|
-
},
|
|
106
|
+
}, Vr = async (r, { code: t }) => await r.run({ code: t }), Br = async (r, { options: t }) => await r.run(t), wr = async (r, { path: t }) => {
|
|
106
107
|
await r.unlink(t);
|
|
107
|
-
},
|
|
108
|
+
}, Hr = async (r, { sql: t }, p) => {
|
|
108
109
|
p == null || p.tracker.setCaption("Executing SQL Queries");
|
|
109
110
|
const c = `/tmp/${Lr()}.sql`;
|
|
110
111
|
await r.writeFile(
|
|
@@ -130,7 +131,7 @@ const hr = [
|
|
|
130
131
|
`
|
|
131
132
|
});
|
|
132
133
|
return await wr(r, { path: c }), e;
|
|
133
|
-
},
|
|
134
|
+
}, Gr = async (r, { request: t }) => {
|
|
134
135
|
me.warn(
|
|
135
136
|
'Deprecated: The Blueprint step "request" is deprecated and will be removed in a future release.'
|
|
136
137
|
);
|
|
@@ -140,7 +141,7 @@ const hr = [
|
|
|
140
141
|
`Request failed with status ${p.httpStatusCode}`
|
|
141
142
|
);
|
|
142
143
|
return p;
|
|
143
|
-
},
|
|
144
|
+
}, Yr = `<?php
|
|
144
145
|
|
|
145
146
|
/**
|
|
146
147
|
* Rewrites the wp-config.php file to ensure specific constants are defined
|
|
@@ -474,10 +475,10 @@ function skip_whitespace($tokens) {
|
|
|
474
475
|
`, nr = async (r, { consts: t, method: p = "define-before-run" }) => {
|
|
475
476
|
switch (p) {
|
|
476
477
|
case "define-before-run":
|
|
477
|
-
await
|
|
478
|
+
await Zr(r, t);
|
|
478
479
|
break;
|
|
479
480
|
case "rewrite-wp-config": {
|
|
480
|
-
const c = await r.documentRoot, h = ie(c, "/wp-config.php"), i = await r.readFileAsText(h), e = await
|
|
481
|
+
const c = await r.documentRoot, h = ie(c, "/wp-config.php"), i = await r.readFileAsText(h), e = await Qr(
|
|
481
482
|
r,
|
|
482
483
|
i,
|
|
483
484
|
t
|
|
@@ -489,17 +490,17 @@ function skip_whitespace($tokens) {
|
|
|
489
490
|
throw new Error(`Invalid method: ${p}`);
|
|
490
491
|
}
|
|
491
492
|
};
|
|
492
|
-
async function
|
|
493
|
+
async function Zr(r, t) {
|
|
493
494
|
for (const p in t)
|
|
494
495
|
await r.defineConstant(p, t[p]);
|
|
495
496
|
}
|
|
496
|
-
async function
|
|
497
|
+
async function Qr(r, t, p) {
|
|
497
498
|
await r.writeFile("/tmp/code.php", t);
|
|
498
499
|
const c = ir({
|
|
499
500
|
consts: p
|
|
500
501
|
});
|
|
501
502
|
return await r.run({
|
|
502
|
-
code: `${
|
|
503
|
+
code: `${Yr}
|
|
503
504
|
$wp_config_path = '/tmp/code.php';
|
|
504
505
|
$wp_config = file_get_contents($wp_config_path);
|
|
505
506
|
$new_wp_config = rewrite_wp_config_to_define_constants($wp_config, ${c.consts});
|
|
@@ -519,7 +520,7 @@ const vr = async (r, { options: t }) => {
|
|
|
519
520
|
echo "Success";
|
|
520
521
|
`
|
|
521
522
|
});
|
|
522
|
-
},
|
|
523
|
+
}, Xr = async (r, { meta: t, userId: p }) => {
|
|
523
524
|
const c = await r.documentRoot;
|
|
524
525
|
await r.run({
|
|
525
526
|
code: `<?php
|
|
@@ -530,7 +531,7 @@ const vr = async (r, { options: t }) => {
|
|
|
530
531
|
}
|
|
531
532
|
`
|
|
532
533
|
});
|
|
533
|
-
}, ar = "/tmp/wp-cli.phar",
|
|
534
|
+
}, ar = "/tmp/wp-cli.phar", Jr = {
|
|
534
535
|
resource: "url",
|
|
535
536
|
/**
|
|
536
537
|
* Use compression for downloading the wp-cli.phar file.
|
|
@@ -555,7 +556,7 @@ const vr = async (r, { options: t }) => {
|
|
|
555
556
|
}, _r = async (r, { command: t, wpCliPath: p = ar }) => {
|
|
556
557
|
await Pr(r, p);
|
|
557
558
|
let c;
|
|
558
|
-
if (typeof t == "string" ? (t = t.trim(), c =
|
|
559
|
+
if (typeof t == "string" ? (t = t.trim(), c = Kr(t)) : c = t, c.shift() !== "wp")
|
|
559
560
|
throw new Error('The first argument must be "wp".');
|
|
560
561
|
const i = await r.documentRoot;
|
|
561
562
|
await r.writeFile("/tmp/stdout", ""), await r.writeFile("/tmp/stderr", ""), await r.writeFile(
|
|
@@ -591,7 +592,7 @@ const vr = async (r, { options: t }) => {
|
|
|
591
592
|
throw new Error(e.errors);
|
|
592
593
|
return e;
|
|
593
594
|
};
|
|
594
|
-
function
|
|
595
|
+
function Kr(r) {
|
|
595
596
|
let c = 0, h = "";
|
|
596
597
|
const i = [];
|
|
597
598
|
let e = "";
|
|
@@ -601,7 +602,7 @@ function Xr(r) {
|
|
|
601
602
|
}
|
|
602
603
|
return e && i.push(e), i;
|
|
603
604
|
}
|
|
604
|
-
const
|
|
605
|
+
const et = async (r, { wpCliPath: t }) => {
|
|
605
606
|
await Pr(r, t), await nr(r, {
|
|
606
607
|
consts: {
|
|
607
608
|
WP_ALLOW_MULTISITE: 1
|
|
@@ -621,20 +622,20 @@ const Jr = async (r, { wpCliPath: t }) => {
|
|
|
621
622
|
}), await _r(r, {
|
|
622
623
|
command: "wp core multisite-convert"
|
|
623
624
|
});
|
|
624
|
-
},
|
|
625
|
+
}, rt = async (r, { fromPath: t, toPath: p }) => {
|
|
625
626
|
await r.writeFile(
|
|
626
627
|
p,
|
|
627
628
|
await r.readFileAsBuffer(t)
|
|
628
629
|
);
|
|
629
|
-
},
|
|
630
|
+
}, tt = async (r, { fromPath: t, toPath: p }) => {
|
|
630
631
|
await r.mv(t, p);
|
|
631
|
-
},
|
|
632
|
+
}, st = async (r, { path: t }) => {
|
|
632
633
|
await r.mkdir(t);
|
|
633
|
-
},
|
|
634
|
+
}, it = async (r, { path: t }) => {
|
|
634
635
|
await r.rmdir(t);
|
|
635
636
|
}, kr = async (r, { path: t, data: p }) => {
|
|
636
637
|
p instanceof File && (p = new Uint8Array(await p.arrayBuffer())), t.startsWith("/wordpress/wp-content/mu-plugins") && !await r.fileExists("/wordpress/wp-content/mu-plugins") && await r.mkdir("/wordpress/wp-content/mu-plugins"), await r.writeFile(t, p);
|
|
637
|
-
},
|
|
638
|
+
}, ot = async (r, { writeToPath: t, filesTree: p }) => {
|
|
638
639
|
await or(r, t, p.files);
|
|
639
640
|
}, Or = async (r, { siteUrl: t }) => {
|
|
640
641
|
await nr(r, {
|
|
@@ -643,7 +644,7 @@ const Jr = async (r, { wpCliPath: t }) => {
|
|
|
643
644
|
WP_SITEURL: t
|
|
644
645
|
}
|
|
645
646
|
});
|
|
646
|
-
},
|
|
647
|
+
}, nt = async (r, { file: t }, p) => {
|
|
647
648
|
var h;
|
|
648
649
|
(h = p == null ? void 0 : p.tracker) == null || h.setCaption("Importing content"), await kr(r, {
|
|
649
650
|
path: "/tmp/import.wxr",
|
|
@@ -735,7 +736,7 @@ const Jr = async (r, { wpCliPath: t }) => {
|
|
|
735
736
|
else if (!t)
|
|
736
737
|
throw new Error("Either zipPath or zipFile must be provided");
|
|
737
738
|
await yr(r, t || p, c);
|
|
738
|
-
},
|
|
739
|
+
}, at = async (r, { wordPressFilesZip: t, pathInZip: p = "" }) => {
|
|
739
740
|
const c = await r.documentRoot;
|
|
740
741
|
let h = ie("/tmp", "import");
|
|
741
742
|
await r.mkdir(h), await pr(r, {
|
|
@@ -783,7 +784,7 @@ const Jr = async (r, { wpCliPath: t }) => {
|
|
|
783
784
|
async function dr(r, t) {
|
|
784
785
|
await r.fileExists(t) && (await r.isDir(t) ? await r.rmdir(t) : await r.unlink(t));
|
|
785
786
|
}
|
|
786
|
-
async function
|
|
787
|
+
async function pt(r) {
|
|
787
788
|
const t = await r.request({
|
|
788
789
|
url: "/wp-admin/export.php?download=true&content=all"
|
|
789
790
|
});
|
|
@@ -846,7 +847,7 @@ function Ke(r) {
|
|
|
846
847
|
const t = r.split(".").shift().replace(/-/g, " ");
|
|
847
848
|
return t.charAt(0).toUpperCase() + t.slice(1).toLowerCase();
|
|
848
849
|
}
|
|
849
|
-
const
|
|
850
|
+
const ft = async (r, { pluginData: t, pluginZipFile: p, ifAlreadyInstalled: c, options: h = {} }, i) => {
|
|
850
851
|
p && (t = p, me.warn(
|
|
851
852
|
'The "pluginZipFile" option is deprecated. Use "pluginData" instead.'
|
|
852
853
|
));
|
|
@@ -882,7 +883,7 @@ const at = async (r, { pluginData: t, pluginZipFile: p, ifAlreadyInstalled: c, o
|
|
|
882
883
|
},
|
|
883
884
|
i
|
|
884
885
|
);
|
|
885
|
-
},
|
|
886
|
+
}, lt = async (r, { themeData: t, themeZipFile: p, ifAlreadyInstalled: c, options: h = {} }, i) => {
|
|
886
887
|
p && (t = p, me.warn(
|
|
887
888
|
'The "themeZipFile" option is deprecated. Use "themeData" instead.'
|
|
888
889
|
));
|
|
@@ -921,9 +922,9 @@ const at = async (r, { pluginData: t, pluginZipFile: p, ifAlreadyInstalled: c, o
|
|
|
921
922
|
},
|
|
922
923
|
i
|
|
923
924
|
);
|
|
924
|
-
},
|
|
925
|
+
}, dt = async (r, { username: t = "admin" } = {}, p) => {
|
|
925
926
|
p == null || p.tracker.setCaption((p == null ? void 0 : p.initialCaption) || "Logging in"), r.defineConstant("PLAYGROUND_AUTO_LOGIN_AS_USER", t);
|
|
926
|
-
},
|
|
927
|
+
}, ut = async (r, t, p) => {
|
|
927
928
|
var h;
|
|
928
929
|
(h = p == null ? void 0 : p.tracker) == null || h.setCaption("Resetting WordPress data");
|
|
929
930
|
const c = await r.documentRoot;
|
|
@@ -947,7 +948,7 @@ const at = async (r, { pluginData: t, pluginZipFile: p, ifAlreadyInstalled: c, o
|
|
|
947
948
|
$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_commentmeta'");
|
|
948
949
|
`
|
|
949
950
|
});
|
|
950
|
-
},
|
|
951
|
+
}, ct = async (r, { options: t }) => {
|
|
951
952
|
await r.request({
|
|
952
953
|
url: "/wp-admin/install.php?step=2",
|
|
953
954
|
method: "POST",
|
|
@@ -964,7 +965,7 @@ const at = async (r, { pluginData: t, pluginZipFile: p, ifAlreadyInstalled: c, o
|
|
|
964
965
|
admin_email: "admin@localhost.com"
|
|
965
966
|
}
|
|
966
967
|
});
|
|
967
|
-
},
|
|
968
|
+
}, mt = async (r, { selfContained: t = !1 } = {}) => {
|
|
968
969
|
const p = "/tmp/wordpress-playground.zip", c = await r.documentRoot, h = ie(c, "wp-content");
|
|
969
970
|
let i = hr;
|
|
970
971
|
t && (i = i.filter((g) => !g.startsWith("themes/twenty")).filter(
|
|
@@ -981,7 +982,7 @@ const at = async (r, { pluginData: t, pluginZipFile: p, ifAlreadyInstalled: c, o
|
|
|
981
982
|
[ie(c, "wp-config.php")]: "wp-config.php"
|
|
982
983
|
} : {}
|
|
983
984
|
});
|
|
984
|
-
await
|
|
985
|
+
await ht(
|
|
985
986
|
r,
|
|
986
987
|
`zipDir(${e.wpContentPath}, ${e.zipPath}, array(
|
|
987
988
|
'exclude_paths' => ${e.exceptPaths},
|
|
@@ -991,7 +992,7 @@ const at = async (r, { pluginData: t, pluginZipFile: p, ifAlreadyInstalled: c, o
|
|
|
991
992
|
);
|
|
992
993
|
const d = await r.readFileAsBuffer(p);
|
|
993
994
|
return r.unlink(p), d;
|
|
994
|
-
},
|
|
995
|
+
}, yt = `<?php
|
|
995
996
|
|
|
996
997
|
function zipDir($root, $output, $options = array())
|
|
997
998
|
{
|
|
@@ -1051,21 +1052,21 @@ function join_paths()
|
|
|
1051
1052
|
return preg_replace('#/+#', '/', join('/', $paths));
|
|
1052
1053
|
}
|
|
1053
1054
|
`;
|
|
1054
|
-
async function
|
|
1055
|
+
async function ht(r, t) {
|
|
1055
1056
|
return await r.run({
|
|
1056
|
-
code:
|
|
1057
|
+
code: yt + t
|
|
1057
1058
|
});
|
|
1058
1059
|
}
|
|
1059
|
-
const
|
|
1060
|
+
const gt = (r, t, p = xr.beta, c = Cr) => (r.match(/^(\d.\d(.\d)?)-(alpha|beta|nightly|rc).*$/i) ? r = p.replace(/^(\d.\d)(.\d+)/i, "$1").replace(/(rc|beta).*$/i, "RC") : r.match(/^(\d+\.\d+)(?:\.\d+)?$/) || (r = c), `https://downloads.wordpress.org/translation/core/${r}/${t}.zip`), bt = async (r, { language: t }, p) => {
|
|
1060
1061
|
p == null || p.tracker.setCaption((p == null ? void 0 : p.initialCaption) || "Translating"), await r.defineConstant("WPLANG", t);
|
|
1061
|
-
const c = await r.documentRoot,
|
|
1062
|
-
|
|
1063
|
-
url: `https://downloads.wordpress.org/translation/core/${(await r.run({
|
|
1064
|
-
code: `<?php
|
|
1062
|
+
const c = await r.documentRoot, h = (await r.run({
|
|
1063
|
+
code: `<?php
|
|
1065
1064
|
require '${c}/wp-includes/version.php';
|
|
1066
1065
|
echo $wp_version;
|
|
1067
1066
|
`
|
|
1068
|
-
|
|
1067
|
+
})).text, i = [
|
|
1068
|
+
{
|
|
1069
|
+
url: gt(h, t),
|
|
1069
1070
|
type: "core"
|
|
1070
1071
|
}
|
|
1071
1072
|
], d = (await r.run({
|
|
@@ -1140,40 +1141,40 @@ const yt = async (r, { language: t }, p) => {
|
|
|
1140
1141
|
);
|
|
1141
1142
|
me.warn(`Error downloading translations for ${P}: ${$}`);
|
|
1142
1143
|
}
|
|
1143
|
-
},
|
|
1144
|
+
}, wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1144
1145
|
__proto__: null,
|
|
1145
1146
|
activatePlugin: gr,
|
|
1146
1147
|
activateTheme: br,
|
|
1147
|
-
cp:
|
|
1148
|
+
cp: rt,
|
|
1148
1149
|
defineSiteUrl: Or,
|
|
1149
1150
|
defineWpConfigConsts: nr,
|
|
1150
|
-
enableMultisite:
|
|
1151
|
-
exportWXR:
|
|
1151
|
+
enableMultisite: et,
|
|
1152
|
+
exportWXR: pt,
|
|
1152
1153
|
importThemeStarterContent: $r,
|
|
1153
|
-
importWordPressFiles:
|
|
1154
|
-
importWxr:
|
|
1155
|
-
installPlugin:
|
|
1156
|
-
installTheme:
|
|
1157
|
-
login:
|
|
1158
|
-
mkdir:
|
|
1159
|
-
mv:
|
|
1160
|
-
request:
|
|
1161
|
-
resetData:
|
|
1154
|
+
importWordPressFiles: at,
|
|
1155
|
+
importWxr: nt,
|
|
1156
|
+
installPlugin: ft,
|
|
1157
|
+
installTheme: lt,
|
|
1158
|
+
login: dt,
|
|
1159
|
+
mkdir: st,
|
|
1160
|
+
mv: tt,
|
|
1161
|
+
request: Gr,
|
|
1162
|
+
resetData: ut,
|
|
1162
1163
|
rm: wr,
|
|
1163
|
-
rmdir:
|
|
1164
|
-
runPHP:
|
|
1165
|
-
runPHPWithOptions:
|
|
1166
|
-
runSql:
|
|
1167
|
-
runWpInstallationWizard:
|
|
1168
|
-
setSiteLanguage:
|
|
1164
|
+
rmdir: it,
|
|
1165
|
+
runPHP: Vr,
|
|
1166
|
+
runPHPWithOptions: Br,
|
|
1167
|
+
runSql: Hr,
|
|
1168
|
+
runWpInstallationWizard: ct,
|
|
1169
|
+
setSiteLanguage: bt,
|
|
1169
1170
|
setSiteOptions: vr,
|
|
1170
1171
|
unzip: pr,
|
|
1171
|
-
updateUserMeta:
|
|
1172
|
+
updateUserMeta: Xr,
|
|
1172
1173
|
wpCLI: _r,
|
|
1173
1174
|
writeFile: kr,
|
|
1174
|
-
writeFiles:
|
|
1175
|
-
zipWpContent:
|
|
1176
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1175
|
+
writeFiles: ot,
|
|
1176
|
+
zipWpContent: mt
|
|
1177
|
+
}, Symbol.toStringTag, { value: "Module" })), vt = [
|
|
1177
1178
|
"vfs",
|
|
1178
1179
|
"literal",
|
|
1179
1180
|
"wordpress.org/themes",
|
|
@@ -1181,8 +1182,8 @@ const yt = async (r, { language: t }, p) => {
|
|
|
1181
1182
|
"url",
|
|
1182
1183
|
"git:directory"
|
|
1183
1184
|
];
|
|
1184
|
-
function
|
|
1185
|
-
return r && typeof r == "object" && typeof r.resource == "string" &&
|
|
1185
|
+
function Pt(r) {
|
|
1186
|
+
return r && typeof r == "object" && typeof r.resource == "string" && vt.includes(r.resource);
|
|
1186
1187
|
}
|
|
1187
1188
|
class Oe {
|
|
1188
1189
|
get progress() {
|
|
@@ -1213,32 +1214,32 @@ class Oe {
|
|
|
1213
1214
|
let i;
|
|
1214
1215
|
switch (t.resource) {
|
|
1215
1216
|
case "vfs":
|
|
1216
|
-
i = new
|
|
1217
|
+
i = new _t(t, c);
|
|
1217
1218
|
break;
|
|
1218
1219
|
case "literal":
|
|
1219
|
-
i = new
|
|
1220
|
+
i = new kt(t, c);
|
|
1220
1221
|
break;
|
|
1221
1222
|
case "wordpress.org/themes":
|
|
1222
|
-
i = new
|
|
1223
|
+
i = new jt(t, c);
|
|
1223
1224
|
break;
|
|
1224
1225
|
case "wordpress.org/plugins":
|
|
1225
|
-
i = new
|
|
1226
|
+
i = new qt(t, c);
|
|
1226
1227
|
break;
|
|
1227
1228
|
case "url":
|
|
1228
|
-
i = new
|
|
1229
|
+
i = new $t(t, c);
|
|
1229
1230
|
break;
|
|
1230
1231
|
case "git:directory":
|
|
1231
|
-
i = new
|
|
1232
|
+
i = new Et(t, c, {
|
|
1232
1233
|
corsProxy: h
|
|
1233
1234
|
});
|
|
1234
1235
|
break;
|
|
1235
1236
|
case "literal:directory":
|
|
1236
|
-
i = new
|
|
1237
|
+
i = new Tt(t, c);
|
|
1237
1238
|
break;
|
|
1238
1239
|
default:
|
|
1239
1240
|
throw new Error(`Invalid resource: ${t}`);
|
|
1240
1241
|
}
|
|
1241
|
-
return i = new
|
|
1242
|
+
return i = new At(i), p && (i = new Rt(i, p)), i;
|
|
1242
1243
|
}
|
|
1243
1244
|
}
|
|
1244
1245
|
class Tr extends Oe {
|
|
@@ -1266,7 +1267,7 @@ class Tr extends Oe {
|
|
|
1266
1267
|
this.resource.setPlayground(t);
|
|
1267
1268
|
}
|
|
1268
1269
|
}
|
|
1269
|
-
class
|
|
1270
|
+
class _t extends Oe {
|
|
1270
1271
|
/**
|
|
1271
1272
|
* Creates a new instance of `VFSResource`.
|
|
1272
1273
|
* @param playground The playground client.
|
|
@@ -1289,7 +1290,7 @@ class wt extends Oe {
|
|
|
1289
1290
|
return this.resource.path.split("/").pop() || "";
|
|
1290
1291
|
}
|
|
1291
1292
|
}
|
|
1292
|
-
class
|
|
1293
|
+
class kt extends Oe {
|
|
1293
1294
|
/**
|
|
1294
1295
|
* Creates a new instance of `LiteralResource`.
|
|
1295
1296
|
* @param resource The literal reference.
|
|
@@ -1325,9 +1326,9 @@ class fr extends Oe {
|
|
|
1325
1326
|
let h = await fetch(t);
|
|
1326
1327
|
if (!h.ok)
|
|
1327
1328
|
throw new Error(`Could not download "${t}"`);
|
|
1328
|
-
if (h = await
|
|
1329
|
+
if (h = await Ir(
|
|
1329
1330
|
h,
|
|
1330
|
-
((c = this.progress) == null ? void 0 : c.loadingListener) ??
|
|
1331
|
+
((c = this.progress) == null ? void 0 : c.loadingListener) ?? Ot
|
|
1331
1332
|
), h.status !== 200)
|
|
1332
1333
|
throw new Error(`Could not download "${t}"`);
|
|
1333
1334
|
return new File([await h.blob()], this.name);
|
|
@@ -1381,9 +1382,9 @@ class fr extends Oe {
|
|
|
1381
1382
|
return !0;
|
|
1382
1383
|
}
|
|
1383
1384
|
}
|
|
1384
|
-
const
|
|
1385
|
+
const Ot = () => {
|
|
1385
1386
|
};
|
|
1386
|
-
class
|
|
1387
|
+
class $t extends fr {
|
|
1387
1388
|
/**
|
|
1388
1389
|
* Creates a new instance of `UrlResource`.
|
|
1389
1390
|
* @param resource The URL reference.
|
|
@@ -1409,14 +1410,14 @@ class _t extends fr {
|
|
|
1409
1410
|
return this.resource.caption ?? super.caption;
|
|
1410
1411
|
}
|
|
1411
1412
|
}
|
|
1412
|
-
class
|
|
1413
|
+
class Et extends Oe {
|
|
1413
1414
|
constructor(t, p, c) {
|
|
1414
1415
|
super(), this.reference = t, this._progress = p, this.options = c;
|
|
1415
1416
|
}
|
|
1416
1417
|
async resolve() {
|
|
1417
1418
|
var d;
|
|
1418
|
-
const t = (d = this.options) != null && d.corsProxy ? `${this.options.corsProxy}?${this.reference.url}` : this.reference.url, p = ["", "HEAD"].includes(this.reference.ref) ? "HEAD" : `refs/heads/${this.reference.ref}`, c = await
|
|
1419
|
-
let e = await
|
|
1419
|
+
const t = (d = this.options) != null && d.corsProxy ? `${this.options.corsProxy}?${this.reference.url}` : this.reference.url, p = ["", "HEAD"].includes(this.reference.ref) ? "HEAD" : `refs/heads/${this.reference.ref}`, c = await Ur(t, p), h = this.reference.path.replace(/^\/+/, ""), i = Mr(c, h);
|
|
1420
|
+
let e = await zr(t, p, i);
|
|
1420
1421
|
return e = Object.fromEntries(
|
|
1421
1422
|
Object.entries(e).map(([g, x]) => (g = g.substring(this.reference.path.length), g = g.replace(/^\/+/, ""), [g, x]))
|
|
1422
1423
|
), {
|
|
@@ -1429,7 +1430,7 @@ class kt extends Oe {
|
|
|
1429
1430
|
return this.reference.path.split("/").pop();
|
|
1430
1431
|
}
|
|
1431
1432
|
}
|
|
1432
|
-
class
|
|
1433
|
+
class Tt extends Oe {
|
|
1433
1434
|
constructor(t, p) {
|
|
1434
1435
|
super(), this.reference = t, this._progress = p;
|
|
1435
1436
|
}
|
|
@@ -1441,7 +1442,7 @@ class Ot extends Oe {
|
|
|
1441
1442
|
return this.reference.name;
|
|
1442
1443
|
}
|
|
1443
1444
|
}
|
|
1444
|
-
class
|
|
1445
|
+
class jt extends fr {
|
|
1445
1446
|
constructor(t, p) {
|
|
1446
1447
|
super(p), this.resource = t;
|
|
1447
1448
|
}
|
|
@@ -1452,7 +1453,7 @@ class $t extends fr {
|
|
|
1452
1453
|
return `https://downloads.wordpress.org/theme/${jr(this.resource.slug)}`;
|
|
1453
1454
|
}
|
|
1454
1455
|
}
|
|
1455
|
-
class
|
|
1456
|
+
class qt extends fr {
|
|
1456
1457
|
constructor(t, p) {
|
|
1457
1458
|
super(p), this.resource = t;
|
|
1458
1459
|
}
|
|
@@ -1468,13 +1469,13 @@ class Et extends fr {
|
|
|
1468
1469
|
function jr(r) {
|
|
1469
1470
|
return !r || r.endsWith(".zip") ? r : r + ".latest-stable.zip";
|
|
1470
1471
|
}
|
|
1471
|
-
class
|
|
1472
|
+
class At extends Tr {
|
|
1472
1473
|
/** @inheritDoc */
|
|
1473
1474
|
async resolve() {
|
|
1474
1475
|
return this.promise || (this.promise = this.resource.resolve()), this.promise;
|
|
1475
1476
|
}
|
|
1476
1477
|
}
|
|
1477
|
-
class
|
|
1478
|
+
class Rt extends Tr {
|
|
1478
1479
|
constructor(t, p) {
|
|
1479
1480
|
super(t), this.semaphore = p;
|
|
1480
1481
|
}
|
|
@@ -1483,7 +1484,7 @@ class jt extends Tr {
|
|
|
1483
1484
|
return this.isAsync ? this.semaphore.run(() => this.resource.resolve()) : this.resource.resolve();
|
|
1484
1485
|
}
|
|
1485
1486
|
}
|
|
1486
|
-
const
|
|
1487
|
+
const Lt = {
|
|
1487
1488
|
type: "object",
|
|
1488
1489
|
properties: {
|
|
1489
1490
|
landingPage: {
|
|
@@ -1610,10 +1611,10 @@ const qt = {
|
|
|
1610
1611
|
$schema: { type: "string" }
|
|
1611
1612
|
},
|
|
1612
1613
|
additionalProperties: !1
|
|
1613
|
-
},
|
|
1614
|
+
}, Ft = {
|
|
1614
1615
|
type: "string",
|
|
1615
1616
|
enum: ["8.3", "8.2", "8.1", "8.0", "7.4", "7.3", "7.2", "7.1", "7.0"]
|
|
1616
|
-
},
|
|
1617
|
+
}, St = {
|
|
1617
1618
|
type: "object",
|
|
1618
1619
|
additionalProperties: { type: ["string", "boolean", "number"] }
|
|
1619
1620
|
}, qr = Object.prototype.hasOwnProperty;
|
|
@@ -3071,7 +3072,7 @@ Only the username field is required for user authentication.`
|
|
|
3071
3072
|
required: ["language", "step"]
|
|
3072
3073
|
}
|
|
3073
3074
|
]
|
|
3074
|
-
},
|
|
3075
|
+
}, Nt = {
|
|
3075
3076
|
type: "object",
|
|
3076
3077
|
additionalProperties: {
|
|
3077
3078
|
anyOf: [
|
|
@@ -3105,7 +3106,7 @@ function Le(r, { instancePath: t = "", parentData: p, parentDataProperty: c, roo
|
|
|
3105
3106
|
schemaPath: "#/additionalProperties/anyOf/1/type",
|
|
3106
3107
|
keyword: "type",
|
|
3107
3108
|
params: {
|
|
3108
|
-
type:
|
|
3109
|
+
type: Nt.additionalProperties.anyOf[1].type
|
|
3109
3110
|
},
|
|
3110
3111
|
message: "must be object,string"
|
|
3111
3112
|
};
|
|
@@ -4439,7 +4440,7 @@ function ce(r, { instancePath: t = "", parentData: p, parentDataProperty: c, roo
|
|
|
4439
4440
|
], !1;
|
|
4440
4441
|
return ce.errors = i, e === 0;
|
|
4441
4442
|
}
|
|
4442
|
-
const
|
|
4443
|
+
const Dt = {
|
|
4443
4444
|
type: "object",
|
|
4444
4445
|
properties: {
|
|
4445
4446
|
relativeUri: {
|
|
@@ -4511,7 +4512,7 @@ function ne(r, { instancePath: t = "", parentData: p, parentDataProperty: c, roo
|
|
|
4511
4512
|
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
4512
4513
|
const N = e;
|
|
4513
4514
|
for (const m in r)
|
|
4514
|
-
if (!qr.call(
|
|
4515
|
+
if (!qr.call(Dt.properties, m))
|
|
4515
4516
|
return ne.errors = [
|
|
4516
4517
|
{
|
|
4517
4518
|
instancePath: t,
|
|
@@ -10997,7 +10998,7 @@ function V(r, { instancePath: t = "", parentData: p, parentDataProperty: c, root
|
|
|
10997
10998
|
if (r && typeof r == "object" && !Array.isArray(r)) {
|
|
10998
10999
|
const E = e;
|
|
10999
11000
|
for (const u in r)
|
|
11000
|
-
if (!qr.call(
|
|
11001
|
+
if (!qr.call(Lt.properties, u))
|
|
11001
11002
|
return V.errors = [
|
|
11002
11003
|
{
|
|
11003
11004
|
instancePath: t,
|
|
@@ -11245,7 +11246,7 @@ function V(r, { instancePath: t = "", parentData: p, parentDataProperty: c, root
|
|
|
11245
11246
|
schemaPath: "#/definitions/SupportedPHPVersion/enum",
|
|
11246
11247
|
keyword: "enum",
|
|
11247
11248
|
params: {
|
|
11248
|
-
allowedValues:
|
|
11249
|
+
allowedValues: Ft.enum
|
|
11249
11250
|
},
|
|
11250
11251
|
message: "must be equal to one of the allowed values"
|
|
11251
11252
|
};
|
|
@@ -11458,7 +11459,7 @@ function V(r, { instancePath: t = "", parentData: p, parentDataProperty: c, root
|
|
|
11458
11459
|
schemaPath: "#/definitions/PHPConstants/additionalProperties/type",
|
|
11459
11460
|
keyword: "type",
|
|
11460
11461
|
params: {
|
|
11461
|
-
type:
|
|
11462
|
+
type: St.additionalProperties.type
|
|
11462
11463
|
},
|
|
11463
11464
|
message: "must be string,boolean,number"
|
|
11464
11465
|
}
|
|
@@ -11977,13 +11978,13 @@ function Je(r, { instancePath: t = "", parentData: p, parentDataProperty: c, roo
|
|
|
11977
11978
|
rootData: h
|
|
11978
11979
|
}) || (i = i === null ? V.errors : i.concat(V.errors), e = i.length), Je.errors = i, e === 0;
|
|
11979
11980
|
}
|
|
11980
|
-
const { wpCLI:
|
|
11981
|
+
const { wpCLI: xt, ...ur } = wt, Ct = {
|
|
11981
11982
|
...ur,
|
|
11982
|
-
"wp-cli":
|
|
11983
|
+
"wp-cli": xt,
|
|
11983
11984
|
importFile: ur.importWxr
|
|
11984
11985
|
};
|
|
11985
|
-
function
|
|
11986
|
-
progress: t = new
|
|
11986
|
+
function Kt(r, {
|
|
11987
|
+
progress: t = new Wr(),
|
|
11987
11988
|
semaphore: p = new Sr({ concurrency: 3 }),
|
|
11988
11989
|
onStepCompleted: c = () => {
|
|
11989
11990
|
},
|
|
@@ -11992,7 +11993,7 @@ function Zt(r, {
|
|
|
11992
11993
|
var $, L, N, m, I, U, Z, _, M;
|
|
11993
11994
|
r = structuredClone(r), r = {
|
|
11994
11995
|
...r,
|
|
11995
|
-
steps: (r.steps || []).filter(
|
|
11996
|
+
steps: (r.steps || []).filter(Ut).filter(Mt)
|
|
11996
11997
|
};
|
|
11997
11998
|
for (const E of r.steps)
|
|
11998
11999
|
!E || typeof E != "object" || (E.step === "importFile" ? (E.step = "importWxr", me.warn(
|
|
@@ -12031,7 +12032,7 @@ function Zt(r, {
|
|
|
12031
12032
|
if ((L = r == null ? void 0 : r.extraLibraries) != null && L.includes("wp-cli") || i !== -1) {
|
|
12032
12033
|
const E = {
|
|
12033
12034
|
step: "writeFile",
|
|
12034
|
-
data:
|
|
12035
|
+
data: Jr,
|
|
12035
12036
|
path: ar
|
|
12036
12037
|
};
|
|
12037
12038
|
i === -1 ? (N = r.steps) == null || N.push(E) : (m = r.steps) == null || m.splice(
|
|
@@ -12051,7 +12052,7 @@ function Zt(r, {
|
|
|
12051
12052
|
caption: "Downloading the WordPress Importer plugin"
|
|
12052
12053
|
}
|
|
12053
12054
|
}));
|
|
12054
|
-
const { valid: d, errors: g } =
|
|
12055
|
+
const { valid: d, errors: g } = It(r);
|
|
12055
12056
|
if (!d) {
|
|
12056
12057
|
const E = new Error(
|
|
12057
12058
|
`Invalid blueprint: ${g[0].message} at ${g[0].instancePath}`
|
|
@@ -12065,7 +12066,7 @@ function Zt(r, {
|
|
|
12065
12066
|
},
|
|
12066
12067
|
0
|
|
12067
12068
|
), P = x.map(
|
|
12068
|
-
(E) =>
|
|
12069
|
+
(E) => zt(E, {
|
|
12069
12070
|
semaphore: p,
|
|
12070
12071
|
rootProgressTracker: t,
|
|
12071
12072
|
totalProgressWeight: q,
|
|
@@ -12074,7 +12075,7 @@ function Zt(r, {
|
|
|
12074
12075
|
);
|
|
12075
12076
|
return {
|
|
12076
12077
|
versions: {
|
|
12077
|
-
php:
|
|
12078
|
+
php: Wt(
|
|
12078
12079
|
(Z = r.preferredVersions) == null ? void 0 : Z.php,
|
|
12079
12080
|
Dr,
|
|
12080
12081
|
Nr
|
|
@@ -12115,7 +12116,7 @@ function Zt(r, {
|
|
|
12115
12116
|
}
|
|
12116
12117
|
};
|
|
12117
12118
|
}
|
|
12118
|
-
function
|
|
12119
|
+
function It(r) {
|
|
12119
12120
|
var h;
|
|
12120
12121
|
const t = Je(r);
|
|
12121
12122
|
if (t)
|
|
@@ -12131,18 +12132,18 @@ function Dt(r) {
|
|
|
12131
12132
|
errors: c
|
|
12132
12133
|
};
|
|
12133
12134
|
}
|
|
12134
|
-
function
|
|
12135
|
+
function Wt(r, t, p) {
|
|
12135
12136
|
return r && t.includes(r) ? r : p;
|
|
12136
12137
|
}
|
|
12137
|
-
function
|
|
12138
|
+
function Ut(r) {
|
|
12138
12139
|
return !!(typeof r == "object" && r);
|
|
12139
12140
|
}
|
|
12140
|
-
function
|
|
12141
|
+
function Mt(r) {
|
|
12141
12142
|
return ["setPhpIniEntry", "request"].includes(r.step) ? (me.warn(
|
|
12142
12143
|
`The "${r.step}" Blueprint is no longer supported and you can remove it from your Blueprint.`
|
|
12143
12144
|
), !1) : !0;
|
|
12144
12145
|
}
|
|
12145
|
-
function
|
|
12146
|
+
function zt(r, {
|
|
12146
12147
|
semaphore: t,
|
|
12147
12148
|
rootProgressTracker: p,
|
|
12148
12149
|
totalProgressWeight: c,
|
|
@@ -12154,7 +12155,7 @@ function Wt(r, {
|
|
|
12154
12155
|
), e = {};
|
|
12155
12156
|
for (const $ of Object.keys(r)) {
|
|
12156
12157
|
let L = r[$];
|
|
12157
|
-
|
|
12158
|
+
Pt(L) && (L = Oe.create(L, {
|
|
12158
12159
|
semaphore: t,
|
|
12159
12160
|
corsProxy: h
|
|
12160
12161
|
})), e[$] = L;
|
|
@@ -12162,9 +12163,9 @@ function Wt(r, {
|
|
|
12162
12163
|
const d = async ($) => {
|
|
12163
12164
|
var L;
|
|
12164
12165
|
try {
|
|
12165
|
-
return i.fillSlowly(), await
|
|
12166
|
+
return i.fillSlowly(), await Ct[r.step](
|
|
12166
12167
|
$,
|
|
12167
|
-
await
|
|
12168
|
+
await Vt(e),
|
|
12168
12169
|
{
|
|
12169
12170
|
tracker: i,
|
|
12170
12171
|
initialCaption: (L = r.progress) == null ? void 0 : L.caption
|
|
@@ -12188,7 +12189,7 @@ function cr(r) {
|
|
|
12188
12189
|
}
|
|
12189
12190
|
return t;
|
|
12190
12191
|
}
|
|
12191
|
-
async function
|
|
12192
|
+
async function Vt(r) {
|
|
12192
12193
|
const t = {};
|
|
12193
12194
|
for (const p in r) {
|
|
12194
12195
|
const c = r[p];
|
|
@@ -12196,45 +12197,45 @@ async function Ut(r) {
|
|
|
12196
12197
|
}
|
|
12197
12198
|
return t;
|
|
12198
12199
|
}
|
|
12199
|
-
async function
|
|
12200
|
+
async function es(r, t) {
|
|
12200
12201
|
await r.run(t);
|
|
12201
12202
|
}
|
|
12202
|
-
function
|
|
12203
|
+
function rs() {
|
|
12203
12204
|
}
|
|
12204
12205
|
export {
|
|
12205
12206
|
gr as activatePlugin,
|
|
12206
12207
|
br as activateTheme,
|
|
12207
|
-
|
|
12208
|
-
|
|
12208
|
+
Kt as compileBlueprint,
|
|
12209
|
+
rt as cp,
|
|
12209
12210
|
Or as defineSiteUrl,
|
|
12210
12211
|
nr as defineWpConfigConsts,
|
|
12211
|
-
|
|
12212
|
-
|
|
12212
|
+
et as enableMultisite,
|
|
12213
|
+
pt as exportWXR,
|
|
12213
12214
|
$r as importThemeStarterContent,
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
|
|
12217
|
-
|
|
12218
|
-
|
|
12219
|
-
|
|
12220
|
-
|
|
12221
|
-
|
|
12222
|
-
|
|
12215
|
+
at as importWordPressFiles,
|
|
12216
|
+
nt as importWxr,
|
|
12217
|
+
ft as installPlugin,
|
|
12218
|
+
lt as installTheme,
|
|
12219
|
+
dt as login,
|
|
12220
|
+
st as mkdir,
|
|
12221
|
+
tt as mv,
|
|
12222
|
+
Gr as request,
|
|
12223
|
+
ut as resetData,
|
|
12223
12224
|
wr as rm,
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
|
|
12225
|
+
it as rmdir,
|
|
12226
|
+
es as runBlueprintSteps,
|
|
12227
|
+
Vr as runPHP,
|
|
12228
|
+
Br as runPHPWithOptions,
|
|
12229
|
+
Hr as runSql,
|
|
12230
|
+
ct as runWpInstallationWizard,
|
|
12231
|
+
rs as setPluginProxyURL,
|
|
12232
|
+
bt as setSiteLanguage,
|
|
12232
12233
|
vr as setSiteOptions,
|
|
12233
12234
|
pr as unzip,
|
|
12234
|
-
|
|
12235
|
+
Xr as updateUserMeta,
|
|
12235
12236
|
_r as wpCLI,
|
|
12236
12237
|
hr as wpContentFilesExcludedFromExport,
|
|
12237
12238
|
kr as writeFile,
|
|
12238
|
-
|
|
12239
|
-
|
|
12239
|
+
ot as writeFiles,
|
|
12240
|
+
mt as zipWpContent
|
|
12240
12241
|
};
|