@wp-playground/blueprints 0.7.18 → 0.7.20
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/blueprint-schema.json +2 -2
- package/index.cjs +123 -102
- package/index.d.ts +19 -30
- package/index.js +1118 -1067
- package/lib/steps/define-site-url.d.ts +3 -3
- package/lib/steps/define-wp-config-consts.d.ts +3 -2
- package/lib/steps/enable-multisite.d.ts +1 -1
- package/lib/steps/import-wordpress-files.d.ts +2 -2
- package/lib/steps/login.d.ts +2 -2
- package/lib/steps/request.d.ts +1 -1
- package/lib/steps/run-php-with-options.d.ts +1 -1
- package/lib/steps/run-php.d.ts +1 -0
- package/lib/steps/site-data.d.ts +3 -3
- package/lib/steps/wp-cli.d.ts +1 -1
- package/package.json +2 -2
- package/lib/utils/run-php-with-zip-functions.d.ts +0 -2
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var gt = (e, t, r) => {
|
|
2
2
|
if (!t.has(e))
|
|
3
3
|
throw TypeError("Cannot " + r);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
5
|
+
var ce = (e, t, r) => (gt(e, t, "read from private field"), r ? r.call(e) : t.get(e)), ie = (e, t, r) => {
|
|
6
6
|
if (t.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(e) : t.set(e, r);
|
|
9
|
-
},
|
|
10
|
-
var
|
|
9
|
+
}, ye = (e, t, r, n) => (gt(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r);
|
|
10
|
+
var oe = (e, t, r) => (gt(e, t, "access private method"), r);
|
|
11
11
|
const currentJsRuntime = function() {
|
|
12
12
|
var e;
|
|
13
13
|
return typeof process < "u" && ((e = process.release) == null ? void 0 : e.name) === "node" ? "NODE" : typeof window < "u" ? "WEB" : (
|
|
@@ -290,85 +290,8 @@ function bytesToBase64(e) {
|
|
|
290
290
|
const t = String.fromCodePoint(...e);
|
|
291
291
|
return btoa(t);
|
|
292
292
|
}
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
const s = await e.documentRoot;
|
|
296
|
-
await e.run({
|
|
297
|
-
code: `<?php
|
|
298
|
-
define( 'WP_ADMIN', true );
|
|
299
|
-
require_once( ${phpVar(s)}. "/wp-load.php" );
|
|
300
|
-
require_once( ${phpVar(s)}. "/wp-admin/includes/plugin.php" );
|
|
301
|
-
|
|
302
|
-
// Set current user to admin
|
|
303
|
-
wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
|
|
304
|
-
|
|
305
|
-
$plugin_path = ${phpVar(t)};
|
|
306
|
-
|
|
307
|
-
if (!is_dir($plugin_path)) {
|
|
308
|
-
activate_plugin($plugin_path);
|
|
309
|
-
die();
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
foreach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {
|
|
313
|
-
$info = get_plugin_data( $file, false, false );
|
|
314
|
-
if ( ! empty( $info['Name'] ) ) {
|
|
315
|
-
activate_plugin( $file );
|
|
316
|
-
die();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// If we got here, the plugin was not found.
|
|
321
|
-
exit(1);
|
|
322
|
-
`
|
|
323
|
-
});
|
|
324
|
-
}, activateTheme = async (e, { themeFolderName: t }, r) => {
|
|
325
|
-
r == null || r.tracker.setCaption(`Activating ${t}`);
|
|
326
|
-
const n = await e.documentRoot;
|
|
327
|
-
await e.run({
|
|
328
|
-
code: `<?php
|
|
329
|
-
define( 'WP_ADMIN', true );
|
|
330
|
-
require_once( ${phpVar(n)}. "/wp-load.php" );
|
|
331
|
-
|
|
332
|
-
// Set current user to admin
|
|
333
|
-
wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
|
|
334
|
-
|
|
335
|
-
switch_theme( ${phpVar(t)} );
|
|
336
|
-
`
|
|
337
|
-
});
|
|
338
|
-
}, runPHP = async (e, { code: t }) => await e.run({ code: t }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
339
|
-
await e.unlink(t);
|
|
340
|
-
}, runSql = async (e, { sql: t }, r) => {
|
|
341
|
-
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
342
|
-
const n = `/tmp/${randomFilename()}.sql`;
|
|
343
|
-
await e.writeFile(
|
|
344
|
-
n,
|
|
345
|
-
new Uint8Array(await t.arrayBuffer())
|
|
346
|
-
);
|
|
347
|
-
const s = await e.documentRoot, i = phpVars({ docroot: s, sqlFilename: n }), o = await e.run({
|
|
348
|
-
code: `<?php
|
|
349
|
-
require_once ${i.docroot} . '/wp-load.php';
|
|
350
|
-
|
|
351
|
-
$handle = fopen(${i.sqlFilename}, 'r');
|
|
352
|
-
$buffer = '';
|
|
353
|
-
|
|
354
|
-
global $wpdb;
|
|
355
|
-
|
|
356
|
-
while ($bytes = fgets($handle)) {
|
|
357
|
-
$buffer .= $bytes;
|
|
358
|
-
|
|
359
|
-
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
360
|
-
") {
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
$wpdb->query($buffer);
|
|
365
|
-
$buffer = '';
|
|
366
|
-
}
|
|
367
|
-
`
|
|
368
|
-
});
|
|
369
|
-
return await rm(e, { path: n }), o;
|
|
370
|
-
}, logToConsole = (e, ...t) => {
|
|
371
|
-
switch (e.severity) {
|
|
293
|
+
const logToConsole = (e, ...t) => {
|
|
294
|
+
switch (typeof e.message == "string" ? e.message = prepareLogMessage(e.message) : e.message.message && typeof e.message.message == "string" && (e.message.message = prepareLogMessage(e.message.message)), e.severity) {
|
|
372
295
|
case "Debug":
|
|
373
296
|
console.debug(e.message, ...t);
|
|
374
297
|
break;
|
|
@@ -387,17 +310,15 @@ switch_theme( ${phpVar(t)} );
|
|
|
387
310
|
default:
|
|
388
311
|
console.log(e.message, ...t);
|
|
389
312
|
}
|
|
390
|
-
}, prepareLogMessage = (e
|
|
391
|
-
|
|
392
|
-
...t.map((r) => JSON.stringify(r))
|
|
393
|
-
].join(" "), logs = [], addToLogArray = (e) => {
|
|
313
|
+
}, prepareLogMessage$1 = (e) => e instanceof Error ? [e.message, e.stack].join(`
|
|
314
|
+
`) : JSON.stringify(e, null, 2), logs = [], addToLogArray = (e) => {
|
|
394
315
|
logs.push(e);
|
|
395
316
|
}, logToMemory = (e) => {
|
|
396
317
|
if (e.raw === !0)
|
|
397
318
|
addToLogArray(e.message);
|
|
398
319
|
else {
|
|
399
320
|
const t = formatLogEntry(
|
|
400
|
-
typeof e.message == "object" ? prepareLogMessage(e.message) : e.message,
|
|
321
|
+
typeof e.message == "object" ? prepareLogMessage$1(e.message) : e.message,
|
|
401
322
|
e.severity ?? "Info",
|
|
402
323
|
e.prefix ?? "JavaScript"
|
|
403
324
|
);
|
|
@@ -516,7 +437,14 @@ class Logger extends EventTarget {
|
|
|
516
437
|
);
|
|
517
438
|
}
|
|
518
439
|
}
|
|
519
|
-
const
|
|
440
|
+
const getDefaultHandlers = () => {
|
|
441
|
+
try {
|
|
442
|
+
if (process.env.NODE_ENV === "test")
|
|
443
|
+
return [logToMemory];
|
|
444
|
+
} catch {
|
|
445
|
+
}
|
|
446
|
+
return [logToMemory, logToConsole];
|
|
447
|
+
}, logger = new Logger(getDefaultHandlers()), prepareLogMessage = (e) => e.replace(/\t/g, ""), formatLogEntry = (e, t, r) => {
|
|
520
448
|
const n = /* @__PURE__ */ new Date(), s = new Intl.DateTimeFormat("en-GB", {
|
|
521
449
|
year: "numeric",
|
|
522
450
|
month: "short",
|
|
@@ -529,8 +457,116 @@ const logger = new Logger([logToMemory, logToConsole]), formatLogEntry = (e, t,
|
|
|
529
457
|
hour12: !1,
|
|
530
458
|
timeZone: "UTC",
|
|
531
459
|
timeZoneName: "short"
|
|
532
|
-
}).format(n);
|
|
533
|
-
return `[${
|
|
460
|
+
}).format(n), o = s + " " + i;
|
|
461
|
+
return e = prepareLogMessage(e), `[${o}] ${r} ${t}: ${e}`;
|
|
462
|
+
}, activatePlugin = async (e, { pluginPath: t, pluginName: r }, n) => {
|
|
463
|
+
n == null || n.tracker.setCaption(`Activating ${r || t}`);
|
|
464
|
+
const s = await e.documentRoot, i = await e.run({
|
|
465
|
+
code: `<?php
|
|
466
|
+
define( 'WP_ADMIN', true );
|
|
467
|
+
require_once( ${phpVar(s)}. "/wp-load.php" );
|
|
468
|
+
require_once( ${phpVar(s)}. "/wp-admin/includes/plugin.php" );
|
|
469
|
+
|
|
470
|
+
// Set current user to admin
|
|
471
|
+
wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
|
|
472
|
+
|
|
473
|
+
$plugin_path = ${phpVar(t)};
|
|
474
|
+
$response = false;
|
|
475
|
+
if (!is_dir($plugin_path)) {
|
|
476
|
+
$response = activate_plugin($plugin_path);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// Activate plugin by name if activation by path wasn't successful
|
|
480
|
+
if ( null !== $response ) {
|
|
481
|
+
foreach ( ( glob( $plugin_path . '/*.php' ) ?: array() ) as $file ) {
|
|
482
|
+
$info = get_plugin_data( $file, false, false );
|
|
483
|
+
if ( ! empty( $info['Name'] ) ) {
|
|
484
|
+
$response = activate_plugin( $file );
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if ( null === $response ) {
|
|
491
|
+
die('Plugin activated successfully');
|
|
492
|
+
} else if ( is_wp_error( $response ) ) {
|
|
493
|
+
throw new Exception( $response->get_error_message() );
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
throw new Exception( 'Unable to activate plugin' );
|
|
497
|
+
`
|
|
498
|
+
});
|
|
499
|
+
if (i.text !== "Plugin activated successfully")
|
|
500
|
+
throw logger.debug(i), new Error(
|
|
501
|
+
`Plugin ${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`
|
|
502
|
+
);
|
|
503
|
+
}, activateTheme = async (e, { themeFolderName: t }, r) => {
|
|
504
|
+
r == null || r.tracker.setCaption(`Activating ${t}`);
|
|
505
|
+
const n = await e.documentRoot, s = `${n}/wp-content/themes/${t}`;
|
|
506
|
+
if (!await e.fileExists(s))
|
|
507
|
+
throw new Error(`
|
|
508
|
+
Couldn't activate theme ${t}.
|
|
509
|
+
Theme not found at the provided theme path: ${s}.
|
|
510
|
+
Check the theme path to ensure it's correct.
|
|
511
|
+
If the theme is not installed, you can install it using the installTheme step.
|
|
512
|
+
More info can be found in the Blueprint documentation: https://wordpress.github.io/wordpress-playground/blueprints-api/steps/#ActivateThemeStep
|
|
513
|
+
`);
|
|
514
|
+
const i = await e.run({
|
|
515
|
+
code: `<?php
|
|
516
|
+
define( 'WP_ADMIN', true );
|
|
517
|
+
require_once( getenv('docroot') . "/wp-load.php" );
|
|
518
|
+
|
|
519
|
+
// Set current user to admin
|
|
520
|
+
wp_set_current_user( get_users(array('role' => 'Administrator') )[0]->ID );
|
|
521
|
+
|
|
522
|
+
switch_theme( getenv('themeFolderName') );
|
|
523
|
+
|
|
524
|
+
if( wp_get_theme()->get_stylesheet() !== getenv('themeFolderName') ) {
|
|
525
|
+
throw new Exception( 'Theme ' . getenv('themeFolderName') . ' could not be activated.' );
|
|
526
|
+
}
|
|
527
|
+
die('Theme activated successfully');
|
|
528
|
+
`,
|
|
529
|
+
env: {
|
|
530
|
+
docroot: n,
|
|
531
|
+
themeFolderName: t
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
if (i.text !== "Theme activated successfully")
|
|
535
|
+
throw logger.debug(i), new Error(
|
|
536
|
+
`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`
|
|
537
|
+
);
|
|
538
|
+
}, runPHP = async (e, { code: t }) => await e.run({ code: t }), runPHPWithOptions = async (e, { options: t }) => await e.run(t), rm = async (e, { path: t }) => {
|
|
539
|
+
await e.unlink(t);
|
|
540
|
+
}, runSql = async (e, { sql: t }, r) => {
|
|
541
|
+
r == null || r.tracker.setCaption("Executing SQL Queries");
|
|
542
|
+
const n = `/tmp/${randomFilename()}.sql`;
|
|
543
|
+
await e.writeFile(
|
|
544
|
+
n,
|
|
545
|
+
new Uint8Array(await t.arrayBuffer())
|
|
546
|
+
);
|
|
547
|
+
const s = await e.documentRoot, i = phpVars({ docroot: s, sqlFilename: n }), o = await e.run({
|
|
548
|
+
code: `<?php
|
|
549
|
+
require_once ${i.docroot} . '/wp-load.php';
|
|
550
|
+
|
|
551
|
+
$handle = fopen(${i.sqlFilename}, 'r');
|
|
552
|
+
$buffer = '';
|
|
553
|
+
|
|
554
|
+
global $wpdb;
|
|
555
|
+
|
|
556
|
+
while ($bytes = fgets($handle)) {
|
|
557
|
+
$buffer .= $bytes;
|
|
558
|
+
|
|
559
|
+
if (!feof($handle) && substr($buffer, -1, 1) !== "
|
|
560
|
+
") {
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
$wpdb->query($buffer);
|
|
565
|
+
$buffer = '';
|
|
566
|
+
}
|
|
567
|
+
`
|
|
568
|
+
});
|
|
569
|
+
return await rm(e, { path: n }), o;
|
|
534
570
|
}, request = async (e, { request: t }) => {
|
|
535
571
|
logger.warn(
|
|
536
572
|
'Deprecated: The Blueprint step "request" is deprecated and will be removed in a future release.'
|
|
@@ -872,7 +908,7 @@ function skip_whitespace($tokens) {
|
|
|
872
908
|
}
|
|
873
909
|
return $output;
|
|
874
910
|
}
|
|
875
|
-
`, defineWpConfigConsts = async (e, { consts: t, method: r = "
|
|
911
|
+
`, defineWpConfigConsts = async (e, { consts: t, method: r = "define-before-run" }) => {
|
|
876
912
|
switch (r) {
|
|
877
913
|
case "define-before-run":
|
|
878
914
|
await defineBeforeRun(e, t);
|
|
@@ -960,7 +996,7 @@ function getURLScope(e) {
|
|
|
960
996
|
return isURLScoped(e) ? e.pathname.split("/")[1].split(":")[1] : null;
|
|
961
997
|
}
|
|
962
998
|
const enableMultisite = async (e) => {
|
|
963
|
-
var
|
|
999
|
+
var N;
|
|
964
1000
|
await defineWpConfigConsts(e, {
|
|
965
1001
|
consts: {
|
|
966
1002
|
WP_ALLOW_MULTISITE: 1
|
|
@@ -992,7 +1028,11 @@ $plugins = glob($plugins_root . "/*");
|
|
|
992
1028
|
|
|
993
1029
|
$deactivated_plugins = [];
|
|
994
1030
|
foreach($plugins as $plugin_path) {
|
|
1031
|
+
if (str_ends_with($plugin_path, '/index.php')) {
|
|
1032
|
+
continue;
|
|
1033
|
+
}
|
|
995
1034
|
if (!is_dir($plugin_path)) {
|
|
1035
|
+
$deactivated_plugins[] = substr($plugin_path, strlen($plugins_root) + 1);
|
|
996
1036
|
deactivate_plugins($plugin_path);
|
|
997
1037
|
continue;
|
|
998
1038
|
}
|
|
@@ -1008,13 +1048,13 @@ foreach($plugins as $plugin_path) {
|
|
|
1008
1048
|
}
|
|
1009
1049
|
echo json_encode($deactivated_plugins);
|
|
1010
1050
|
`
|
|
1011
|
-
})).json, d = (
|
|
1051
|
+
})).json, d = (N = (await request(e, {
|
|
1012
1052
|
request: {
|
|
1013
1053
|
url: "/wp-admin/network.php"
|
|
1014
1054
|
}
|
|
1015
1055
|
})).text.match(
|
|
1016
1056
|
/name="_wpnonce"\s+value="([^"]+)"/
|
|
1017
|
-
)) == null ? void 0 :
|
|
1057
|
+
)) == null ? void 0 : N[1], u = await request(e, {
|
|
1018
1058
|
request: {
|
|
1019
1059
|
url: "/wp-admin/network.php",
|
|
1020
1060
|
method: "POST",
|
|
@@ -1040,7 +1080,6 @@ echo json_encode($deactivated_plugins);
|
|
|
1040
1080
|
);
|
|
1041
1081
|
await defineWpConfigConsts(e, {
|
|
1042
1082
|
consts: {
|
|
1043
|
-
SUNRISE: "on",
|
|
1044
1083
|
MULTISITE: !0,
|
|
1045
1084
|
SUBDOMAIN_INSTALL: !1,
|
|
1046
1085
|
SITE_ID_CURRENT_SITE: 1,
|
|
@@ -1051,16 +1090,20 @@ echo json_encode($deactivated_plugins);
|
|
|
1051
1090
|
});
|
|
1052
1091
|
const f = new URL(await e.absoluteUrl), g = isURLScoped(f) ? "scope:" + getURLScope(f) : null;
|
|
1053
1092
|
await e.writeFile(
|
|
1054
|
-
|
|
1093
|
+
"/internal/shared/preload/sunrise.php",
|
|
1055
1094
|
`<?php
|
|
1056
|
-
|
|
1057
|
-
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
1058
|
-
}
|
|
1095
|
+
$_SERVER['HTTP_HOST'] = ${phpVar(f.hostname)};
|
|
1059
1096
|
$folder = ${phpVar(g)};
|
|
1060
1097
|
if ($folder && strpos($_SERVER['REQUEST_URI'],"/$folder") === false) {
|
|
1061
|
-
$_SERVER['HTTP_HOST'] = ${phpVar(f.hostname)};
|
|
1062
1098
|
$_SERVER['REQUEST_URI'] = "/$folder/" . ltrim($_SERVER['REQUEST_URI'], '/');
|
|
1063
1099
|
}
|
|
1100
|
+
`
|
|
1101
|
+
), await e.writeFile(
|
|
1102
|
+
"/internal/shared/mu-plugins/sunrise.php",
|
|
1103
|
+
`<?php
|
|
1104
|
+
if ( !defined( 'BLOG_ID_CURRENT_SITE' ) ) {
|
|
1105
|
+
define( 'BLOG_ID_CURRENT_SITE', 1 );
|
|
1106
|
+
}
|
|
1064
1107
|
`
|
|
1065
1108
|
), await login(e, {});
|
|
1066
1109
|
for (const C of o)
|
|
@@ -1103,6 +1146,9 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
1103
1146
|
await e.run({
|
|
1104
1147
|
code: `<?php
|
|
1105
1148
|
require ${phpVar(n)} . '/wp-load.php';
|
|
1149
|
+
if ( ! function_exists( 'wp_crop_image' ) ) {
|
|
1150
|
+
require ${phpVar(n)} . '/wp-admin/includes/image.php';
|
|
1151
|
+
}
|
|
1106
1152
|
kses_remove_filters();
|
|
1107
1153
|
$admin_id = get_users(array('role' => 'Administrator') )[0];
|
|
1108
1154
|
$importer = new WXR_Importer( array(
|
|
@@ -1120,118 +1166,46 @@ const cp = async (e, { fromPath: t, toPath: r }) => {
|
|
|
1120
1166
|
$result = $importer->import( '/tmp/import.wxr' );
|
|
1121
1167
|
`
|
|
1122
1168
|
});
|
|
1123
|
-
},
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
)
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
if (is_dir($entry)) {
|
|
1153
|
-
$directory_path = $entry . '/';
|
|
1154
|
-
array_push($directories, $directory_path);
|
|
1155
|
-
} else if (is_file($entry)) {
|
|
1156
|
-
$zip->addFile($entry, substr($entry, strlen($zip_root)));
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
closedir($handle);
|
|
1169
|
+
}, tmpPath = "/tmp/file.zip", unzipFile = async (e, t, r) => {
|
|
1170
|
+
if (t instanceof File) {
|
|
1171
|
+
const s = t;
|
|
1172
|
+
t = tmpPath, await e.writeFile(
|
|
1173
|
+
t,
|
|
1174
|
+
new Uint8Array(await s.arrayBuffer())
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
const n = phpVars({
|
|
1178
|
+
zipPath: t,
|
|
1179
|
+
extractToPath: r
|
|
1180
|
+
});
|
|
1181
|
+
await e.run({
|
|
1182
|
+
code: `<?php
|
|
1183
|
+
function unzip($zipPath, $extractTo, $overwrite = true)
|
|
1184
|
+
{
|
|
1185
|
+
if (!is_dir($extractTo)) {
|
|
1186
|
+
mkdir($extractTo, 0777, true);
|
|
1187
|
+
}
|
|
1188
|
+
$zip = new ZipArchive;
|
|
1189
|
+
$res = $zip->open($zipPath);
|
|
1190
|
+
if ($res === TRUE) {
|
|
1191
|
+
$zip->extractTo($extractTo);
|
|
1192
|
+
$zip->close();
|
|
1193
|
+
chmod($extractTo, 0777);
|
|
1194
|
+
} else {
|
|
1195
|
+
throw new Exception("Could not unzip file");
|
|
1160
1196
|
}
|
|
1161
1197
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
chmod($output, 0777);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
function join_paths()
|
|
1171
|
-
{
|
|
1172
|
-
$paths = array();
|
|
1173
|
-
|
|
1174
|
-
foreach (func_get_args() as $arg) {
|
|
1175
|
-
if ($arg !== '') {
|
|
1176
|
-
$paths[] = $arg;
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
return preg_replace('#/+#', '/', join('/', $paths));
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
function unzip($zipPath, $extractTo, $overwrite = true)
|
|
1184
|
-
{
|
|
1185
|
-
if (!is_dir($extractTo)) {
|
|
1186
|
-
mkdir($extractTo, 0777, true);
|
|
1187
|
-
}
|
|
1188
|
-
$zip = new ZipArchive;
|
|
1189
|
-
$res = $zip->open($zipPath);
|
|
1190
|
-
if ($res === TRUE) {
|
|
1191
|
-
$zip->extractTo($extractTo);
|
|
1192
|
-
$zip->close();
|
|
1193
|
-
chmod($extractTo, 0777);
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
function delTree($dir)
|
|
1199
|
-
{
|
|
1200
|
-
$files = array_diff(scandir($dir), array('.', '..'));
|
|
1201
|
-
foreach ($files as $file) {
|
|
1202
|
-
(is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
|
|
1203
|
-
}
|
|
1204
|
-
return rmdir($dir);
|
|
1205
|
-
}
|
|
1206
|
-
`;
|
|
1207
|
-
async function runPhpWithZipFunctions(e, t) {
|
|
1208
|
-
return await e.run({
|
|
1209
|
-
code: zipFunctions + t
|
|
1210
|
-
});
|
|
1211
|
-
}
|
|
1212
|
-
const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, extractToPath: n }) => {
|
|
1198
|
+
unzip(${n.zipPath}, ${n.extractToPath});
|
|
1199
|
+
`
|
|
1200
|
+
}), await e.fileExists(tmpPath) && await e.unlink(tmpPath);
|
|
1201
|
+
}, unzip = async (e, { zipFile: t, zipPath: r, extractToPath: n }) => {
|
|
1213
1202
|
if (r)
|
|
1214
|
-
|
|
1215
|
-
tmpPath,
|
|
1216
|
-
await e.readFileAsBuffer(r)
|
|
1217
|
-
), logger.warn(
|
|
1203
|
+
logger.warn(
|
|
1218
1204
|
'The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.'
|
|
1219
1205
|
);
|
|
1220
|
-
else if (t)
|
|
1221
|
-
await e.writeFile(
|
|
1222
|
-
tmpPath,
|
|
1223
|
-
new Uint8Array(await t.arrayBuffer())
|
|
1224
|
-
);
|
|
1225
|
-
else
|
|
1206
|
+
else if (!t)
|
|
1226
1207
|
throw new Error("Either zipPath or zipFile must be provided");
|
|
1227
|
-
|
|
1228
|
-
zipPath: tmpPath,
|
|
1229
|
-
extractToPath: n
|
|
1230
|
-
});
|
|
1231
|
-
await runPhpWithZipFunctions(
|
|
1232
|
-
e,
|
|
1233
|
-
`unzip(${s.zipPath}, ${s.extractToPath});`
|
|
1234
|
-
), e.fileExists(tmpPath) && await e.unlink(tmpPath);
|
|
1208
|
+
await unzipFile(e, t || r, n);
|
|
1235
1209
|
}, importWordPressFiles = async (e, { wordPressFilesZip: t, pathInZip: r = "" }) => {
|
|
1236
1210
|
const n = await e.documentRoot;
|
|
1237
1211
|
let s = joinPaths("/tmp", "import");
|
|
@@ -1246,8 +1220,8 @@ const tmpPath = "/tmp/file.zip", unzip = async (e, { zipFile: t, zipPath: r, ext
|
|
|
1246
1220
|
f
|
|
1247
1221
|
);
|
|
1248
1222
|
await removePath(e, g);
|
|
1249
|
-
const
|
|
1250
|
-
await e.fileExists(
|
|
1223
|
+
const N = joinPaths(o, f);
|
|
1224
|
+
await e.fileExists(N) && (await e.mkdir(dirname(g)), await e.mv(N, g));
|
|
1251
1225
|
}
|
|
1252
1226
|
const l = joinPaths(
|
|
1253
1227
|
s,
|
|
@@ -1305,8 +1279,8 @@ async function installAsset(e, {
|
|
|
1305
1279
|
});
|
|
1306
1280
|
u = u.filter((S) => !S.endsWith("/__MACOSX"));
|
|
1307
1281
|
const f = u.length === 1 && await e.isDir(u[0]);
|
|
1308
|
-
let g,
|
|
1309
|
-
f ? (
|
|
1282
|
+
let g, N = "";
|
|
1283
|
+
f ? (N = u[0], g = u[0].split("/").pop()) : (N = d, g = i);
|
|
1310
1284
|
const C = `${t}/${g}`;
|
|
1311
1285
|
if (await e.fileExists(C)) {
|
|
1312
1286
|
if (!await e.isDir(C))
|
|
@@ -1328,7 +1302,7 @@ async function installAsset(e, {
|
|
|
1328
1302
|
);
|
|
1329
1303
|
}
|
|
1330
1304
|
}
|
|
1331
|
-
return await e.mv(
|
|
1305
|
+
return await e.mv(N, C), {
|
|
1332
1306
|
assetFolderPath: C,
|
|
1333
1307
|
assetFolderName: g
|
|
1334
1308
|
};
|
|
@@ -1417,7 +1391,72 @@ const installPlugin = async (e, { pluginZipFile: t, ifAlreadyInstalled: r, optio
|
|
|
1417
1391
|
);
|
|
1418
1392
|
const l = await e.readFileAsBuffer(r);
|
|
1419
1393
|
return e.unlink(r), l;
|
|
1420
|
-
},
|
|
1394
|
+
}, zipFunctions = `<?php
|
|
1395
|
+
|
|
1396
|
+
function zipDir($root, $output, $options = array())
|
|
1397
|
+
{
|
|
1398
|
+
$root = rtrim($root, '/');
|
|
1399
|
+
$additionalPaths = array_key_exists('additional_paths', $options) ? $options['additional_paths'] : array();
|
|
1400
|
+
$excludePaths = array_key_exists('exclude_paths', $options) ? $options['exclude_paths'] : array();
|
|
1401
|
+
$zip_root = array_key_exists('zip_root', $options) ? $options['zip_root'] : $root;
|
|
1402
|
+
|
|
1403
|
+
$zip = new ZipArchive;
|
|
1404
|
+
$res = $zip->open($output, ZipArchive::CREATE);
|
|
1405
|
+
if ($res === TRUE) {
|
|
1406
|
+
$directories = array(
|
|
1407
|
+
$root . '/'
|
|
1408
|
+
);
|
|
1409
|
+
while (sizeof($directories)) {
|
|
1410
|
+
$current_dir = array_pop($directories);
|
|
1411
|
+
|
|
1412
|
+
if ($handle = opendir($current_dir)) {
|
|
1413
|
+
while (false !== ($entry = readdir($handle))) {
|
|
1414
|
+
if ($entry == '.' || $entry == '..') {
|
|
1415
|
+
continue;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
$entry = join_paths($current_dir, $entry);
|
|
1419
|
+
if (in_array($entry, $excludePaths)) {
|
|
1420
|
+
continue;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
if (is_dir($entry)) {
|
|
1424
|
+
$directory_path = $entry . '/';
|
|
1425
|
+
array_push($directories, $directory_path);
|
|
1426
|
+
} else if (is_file($entry)) {
|
|
1427
|
+
$zip->addFile($entry, substr($entry, strlen($zip_root)));
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
closedir($handle);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
foreach ($additionalPaths as $disk_path => $zip_path) {
|
|
1434
|
+
$zip->addFile($disk_path, $zip_path);
|
|
1435
|
+
}
|
|
1436
|
+
$zip->close();
|
|
1437
|
+
chmod($output, 0777);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
function join_paths()
|
|
1442
|
+
{
|
|
1443
|
+
$paths = array();
|
|
1444
|
+
|
|
1445
|
+
foreach (func_get_args() as $arg) {
|
|
1446
|
+
if ($arg !== '') {
|
|
1447
|
+
$paths[] = $arg;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
return preg_replace('#/+#', '/', join('/', $paths));
|
|
1452
|
+
}
|
|
1453
|
+
`;
|
|
1454
|
+
async function runPhpWithZipFunctions(e, t) {
|
|
1455
|
+
return await e.run({
|
|
1456
|
+
code: zipFunctions + t
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
const wpCLI$1 = async (e, { command: t, wpCliPath: r = "/tmp/wp-cli.phar" }) => {
|
|
1421
1460
|
if (!await e.fileExists(r))
|
|
1422
1461
|
throw new Error(`wp-cli.phar not found at ${r}`);
|
|
1423
1462
|
let n;
|
|
@@ -1705,169 +1744,6 @@ class ProgressTracker extends EventTarget {
|
|
|
1705
1744
|
this.dispatchEvent(new CustomEvent("done"));
|
|
1706
1745
|
}
|
|
1707
1746
|
}
|
|
1708
|
-
const kError = Symbol("error"), kMessage = Symbol("message");
|
|
1709
|
-
class ErrorEvent2 extends Event {
|
|
1710
|
-
/**
|
|
1711
|
-
* Create a new `ErrorEvent`.
|
|
1712
|
-
*
|
|
1713
|
-
* @param type The name of the event
|
|
1714
|
-
* @param options A dictionary object that allows for setting
|
|
1715
|
-
* attributes via object members of the same name.
|
|
1716
|
-
*/
|
|
1717
|
-
constructor(t, r = {}) {
|
|
1718
|
-
super(t), this[kError] = r.error === void 0 ? null : r.error, this[kMessage] = r.message === void 0 ? "" : r.message;
|
|
1719
|
-
}
|
|
1720
|
-
get error() {
|
|
1721
|
-
return this[kError];
|
|
1722
|
-
}
|
|
1723
|
-
get message() {
|
|
1724
|
-
return this[kMessage];
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
Object.defineProperty(ErrorEvent2.prototype, "error", { enumerable: !0 });
|
|
1728
|
-
Object.defineProperty(ErrorEvent2.prototype, "message", { enumerable: !0 });
|
|
1729
|
-
const ErrorEvent = typeof globalThis.ErrorEvent == "function" ? globalThis.ErrorEvent : ErrorEvent2;
|
|
1730
|
-
function isExitCodeZero(e) {
|
|
1731
|
-
return e instanceof Error ? "exitCode" in e && (e == null ? void 0 : e.exitCode) === 0 || (e == null ? void 0 : e.name) === "ExitStatus" && "status" in e && e.status === 0 : !1;
|
|
1732
|
-
}
|
|
1733
|
-
class UnhandledRejectionsTarget extends EventTarget {
|
|
1734
|
-
constructor() {
|
|
1735
|
-
super(...arguments), this.listenersCount = 0;
|
|
1736
|
-
}
|
|
1737
|
-
addEventListener(t, r) {
|
|
1738
|
-
++this.listenersCount, super.addEventListener(t, r);
|
|
1739
|
-
}
|
|
1740
|
-
removeEventListener(t, r) {
|
|
1741
|
-
--this.listenersCount, super.removeEventListener(t, r);
|
|
1742
|
-
}
|
|
1743
|
-
hasListeners() {
|
|
1744
|
-
return this.listenersCount > 0;
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
function improveWASMErrorReporting(e) {
|
|
1748
|
-
e.asm = {
|
|
1749
|
-
...e.asm
|
|
1750
|
-
};
|
|
1751
|
-
const t = new UnhandledRejectionsTarget();
|
|
1752
|
-
for (const r in e.asm)
|
|
1753
|
-
if (typeof e.asm[r] == "function") {
|
|
1754
|
-
const n = e.asm[r];
|
|
1755
|
-
e.asm[r] = function(...s) {
|
|
1756
|
-
var i;
|
|
1757
|
-
try {
|
|
1758
|
-
return n(...s);
|
|
1759
|
-
} catch (o) {
|
|
1760
|
-
if (!(o instanceof Error))
|
|
1761
|
-
throw o;
|
|
1762
|
-
const l = clarifyErrorMessage(
|
|
1763
|
-
o,
|
|
1764
|
-
(i = e.lastAsyncifyStackSource) == null ? void 0 : i.stack
|
|
1765
|
-
);
|
|
1766
|
-
if (e.lastAsyncifyStackSource && (o.cause = e.lastAsyncifyStackSource), t.hasListeners()) {
|
|
1767
|
-
t.dispatchEvent(
|
|
1768
|
-
new ErrorEvent("error", {
|
|
1769
|
-
error: o,
|
|
1770
|
-
message: l
|
|
1771
|
-
})
|
|
1772
|
-
);
|
|
1773
|
-
return;
|
|
1774
|
-
}
|
|
1775
|
-
throw isExitCodeZero(o) || showCriticalErrorBox(l), o;
|
|
1776
|
-
}
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
|
-
return t;
|
|
1780
|
-
}
|
|
1781
|
-
let functionsMaybeMissingFromAsyncify = [];
|
|
1782
|
-
function getFunctionsMaybeMissingFromAsyncify() {
|
|
1783
|
-
return functionsMaybeMissingFromAsyncify;
|
|
1784
|
-
}
|
|
1785
|
-
function clarifyErrorMessage(e, t) {
|
|
1786
|
-
if (e.message === "unreachable") {
|
|
1787
|
-
let r = UNREACHABLE_ERROR;
|
|
1788
|
-
t || (r += `
|
|
1789
|
-
|
|
1790
|
-
This stack trace is lacking. For a better one initialize
|
|
1791
|
-
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
1792
|
-
|
|
1793
|
-
`), functionsMaybeMissingFromAsyncify = extractPHPFunctionsFromStack(
|
|
1794
|
-
t || e.stack || ""
|
|
1795
|
-
);
|
|
1796
|
-
for (const n of functionsMaybeMissingFromAsyncify)
|
|
1797
|
-
r += ` * ${n}
|
|
1798
|
-
`;
|
|
1799
|
-
return r;
|
|
1800
|
-
}
|
|
1801
|
-
return e.message;
|
|
1802
|
-
}
|
|
1803
|
-
const UNREACHABLE_ERROR = `
|
|
1804
|
-
"unreachable" WASM instruction executed.
|
|
1805
|
-
|
|
1806
|
-
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
1807
|
-
list when building PHP.wasm.
|
|
1808
|
-
|
|
1809
|
-
You will need to file a new issue in the WordPress Playground repository
|
|
1810
|
-
and paste this error message there:
|
|
1811
|
-
|
|
1812
|
-
https://github.com/WordPress/wordpress-playground/issues/new
|
|
1813
|
-
|
|
1814
|
-
If you're a core developer, the typical fix is to:
|
|
1815
|
-
|
|
1816
|
-
* Isolate a minimal reproduction of the error
|
|
1817
|
-
* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
|
|
1818
|
-
* Run 'npm run fix-asyncify'
|
|
1819
|
-
* Commit the changes, push to the repo, release updated NPM packages
|
|
1820
|
-
|
|
1821
|
-
Below is a list of all the PHP functions found in the stack trace to
|
|
1822
|
-
help with the minimal reproduction. If they're all already listed in
|
|
1823
|
-
the Dockerfile, you'll need to trigger this error again with long stack
|
|
1824
|
-
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
1825
|
-
CLI option:
|
|
1826
|
-
|
|
1827
|
-
`, redBg = "\x1B[41m", bold = "\x1B[1m", reset = "\x1B[0m", eol = "\x1B[K";
|
|
1828
|
-
let logged = !1;
|
|
1829
|
-
function showCriticalErrorBox(e) {
|
|
1830
|
-
if (!logged && (logged = !0, !(e != null && e.trim().startsWith("Program terminated with exit")))) {
|
|
1831
|
-
logger.log(`${redBg}
|
|
1832
|
-
${eol}
|
|
1833
|
-
${bold} WASM ERROR${reset}${redBg}`);
|
|
1834
|
-
for (const t of e.split(`
|
|
1835
|
-
`))
|
|
1836
|
-
logger.log(`${eol} ${t} `);
|
|
1837
|
-
logger.log(`${reset}`);
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
function extractPHPFunctionsFromStack(e) {
|
|
1841
|
-
try {
|
|
1842
|
-
const t = e.split(`
|
|
1843
|
-
`).slice(1).map((r) => {
|
|
1844
|
-
const n = r.trim().substring(3).split(" ");
|
|
1845
|
-
return {
|
|
1846
|
-
fn: n.length >= 2 ? n[0] : "<unknown>",
|
|
1847
|
-
isWasm: r.includes("wasm://")
|
|
1848
|
-
};
|
|
1849
|
-
}).filter(
|
|
1850
|
-
({ fn: r, isWasm: n }) => n && !r.startsWith("dynCall_") && !r.startsWith("invoke_")
|
|
1851
|
-
).map(({ fn: r }) => r);
|
|
1852
|
-
return Array.from(new Set(t));
|
|
1853
|
-
} catch {
|
|
1854
|
-
return [];
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
ReadableStream.prototype[Symbol.asyncIterator] || (ReadableStream.prototype[Symbol.asyncIterator] = async function* () {
|
|
1858
|
-
const e = this.getReader();
|
|
1859
|
-
try {
|
|
1860
|
-
for (; ; ) {
|
|
1861
|
-
const { done: t, value: r } = await e.read();
|
|
1862
|
-
if (t)
|
|
1863
|
-
return;
|
|
1864
|
-
yield r;
|
|
1865
|
-
}
|
|
1866
|
-
} finally {
|
|
1867
|
-
e.releaseLock();
|
|
1868
|
-
}
|
|
1869
|
-
}, ReadableStream.prototype.iterate = // @ts-ignore
|
|
1870
|
-
ReadableStream.prototype[Symbol.asyncIterator]);
|
|
1871
1747
|
const responseTexts = {
|
|
1872
1748
|
500: "Internal Server Error",
|
|
1873
1749
|
502: "Bad Gateway",
|
|
@@ -1912,40 +1788,22 @@ class PHPResponse {
|
|
|
1912
1788
|
errors: this.errors,
|
|
1913
1789
|
exitCode: this.exitCode,
|
|
1914
1790
|
httpStatusCode: this.httpStatusCode
|
|
1915
|
-
};
|
|
1916
|
-
}
|
|
1917
|
-
/**
|
|
1918
|
-
* Response body as JSON.
|
|
1919
|
-
*/
|
|
1920
|
-
get json() {
|
|
1921
|
-
return JSON.parse(this.text);
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* Response body as text.
|
|
1925
|
-
*/
|
|
1926
|
-
get text() {
|
|
1927
|
-
return new TextDecoder().decode(this.bytes);
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
const
|
|
1931
|
-
"8.3",
|
|
1932
|
-
"8.2",
|
|
1933
|
-
"8.1",
|
|
1934
|
-
"8.0",
|
|
1935
|
-
"7.4",
|
|
1936
|
-
"7.3",
|
|
1937
|
-
"7.2",
|
|
1938
|
-
"7.1",
|
|
1939
|
-
"7.0"
|
|
1940
|
-
], LatestSupportedPHPVersion = SupportedPHPVersions[0], SupportedPHPExtensionsList = [
|
|
1941
|
-
"iconv",
|
|
1942
|
-
"mbstring",
|
|
1943
|
-
"xml-bundle",
|
|
1944
|
-
"gd"
|
|
1945
|
-
], SupportedPHPExtensionBundles = {
|
|
1946
|
-
"kitchen-sink": SupportedPHPExtensionsList,
|
|
1947
|
-
light: []
|
|
1948
|
-
}, FileErrorCodes = {
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Response body as JSON.
|
|
1795
|
+
*/
|
|
1796
|
+
get json() {
|
|
1797
|
+
return JSON.parse(this.text);
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Response body as text.
|
|
1801
|
+
*/
|
|
1802
|
+
get text() {
|
|
1803
|
+
return new TextDecoder().decode(this.bytes);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
const FileErrorCodes = {
|
|
1949
1807
|
0: "No error occurred. System call completed successfully.",
|
|
1950
1808
|
1: "Argument list too long.",
|
|
1951
1809
|
2: "Permission denied.",
|
|
@@ -2056,6 +1914,155 @@ function getLoadedRuntime(e) {
|
|
|
2056
1914
|
var e;
|
|
2057
1915
|
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";
|
|
2058
1916
|
})();
|
|
1917
|
+
const kError = Symbol("error"), kMessage = Symbol("message");
|
|
1918
|
+
class ErrorEvent2 extends Event {
|
|
1919
|
+
/**
|
|
1920
|
+
* Create a new `ErrorEvent`.
|
|
1921
|
+
*
|
|
1922
|
+
* @param type The name of the event
|
|
1923
|
+
* @param options A dictionary object that allows for setting
|
|
1924
|
+
* attributes via object members of the same name.
|
|
1925
|
+
*/
|
|
1926
|
+
constructor(t, r = {}) {
|
|
1927
|
+
super(t), this[kError] = r.error === void 0 ? null : r.error, this[kMessage] = r.message === void 0 ? "" : r.message;
|
|
1928
|
+
}
|
|
1929
|
+
get error() {
|
|
1930
|
+
return this[kError];
|
|
1931
|
+
}
|
|
1932
|
+
get message() {
|
|
1933
|
+
return this[kMessage];
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
Object.defineProperty(ErrorEvent2.prototype, "error", { enumerable: !0 });
|
|
1937
|
+
Object.defineProperty(ErrorEvent2.prototype, "message", { enumerable: !0 });
|
|
1938
|
+
const ErrorEvent = typeof globalThis.ErrorEvent == "function" ? globalThis.ErrorEvent : ErrorEvent2;
|
|
1939
|
+
function isExitCodeZero(e) {
|
|
1940
|
+
return e instanceof Error ? "exitCode" in e && (e == null ? void 0 : e.exitCode) === 0 || (e == null ? void 0 : e.name) === "ExitStatus" && "status" in e && e.status === 0 : !1;
|
|
1941
|
+
}
|
|
1942
|
+
class UnhandledRejectionsTarget extends EventTarget {
|
|
1943
|
+
constructor() {
|
|
1944
|
+
super(...arguments), this.listenersCount = 0;
|
|
1945
|
+
}
|
|
1946
|
+
addEventListener(t, r) {
|
|
1947
|
+
++this.listenersCount, super.addEventListener(t, r);
|
|
1948
|
+
}
|
|
1949
|
+
removeEventListener(t, r) {
|
|
1950
|
+
--this.listenersCount, super.removeEventListener(t, r);
|
|
1951
|
+
}
|
|
1952
|
+
hasListeners() {
|
|
1953
|
+
return this.listenersCount > 0;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
function improveWASMErrorReporting(e) {
|
|
1957
|
+
e.asm = {
|
|
1958
|
+
...e.asm
|
|
1959
|
+
};
|
|
1960
|
+
const t = new UnhandledRejectionsTarget();
|
|
1961
|
+
for (const r in e.asm)
|
|
1962
|
+
if (typeof e.asm[r] == "function") {
|
|
1963
|
+
const n = e.asm[r];
|
|
1964
|
+
e.asm[r] = function(...s) {
|
|
1965
|
+
var i;
|
|
1966
|
+
try {
|
|
1967
|
+
return n(...s);
|
|
1968
|
+
} catch (o) {
|
|
1969
|
+
if (!(o instanceof Error))
|
|
1970
|
+
throw o;
|
|
1971
|
+
const l = clarifyErrorMessage(
|
|
1972
|
+
o,
|
|
1973
|
+
(i = e.lastAsyncifyStackSource) == null ? void 0 : i.stack
|
|
1974
|
+
);
|
|
1975
|
+
if (e.lastAsyncifyStackSource && (o.cause = e.lastAsyncifyStackSource), t.hasListeners()) {
|
|
1976
|
+
t.dispatchEvent(
|
|
1977
|
+
new ErrorEvent("error", {
|
|
1978
|
+
error: o,
|
|
1979
|
+
message: l
|
|
1980
|
+
})
|
|
1981
|
+
);
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
throw isExitCodeZero(o) || showCriticalErrorBox(l), o;
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1988
|
+
return t;
|
|
1989
|
+
}
|
|
1990
|
+
let functionsMaybeMissingFromAsyncify = [];
|
|
1991
|
+
function getFunctionsMaybeMissingFromAsyncify() {
|
|
1992
|
+
return functionsMaybeMissingFromAsyncify;
|
|
1993
|
+
}
|
|
1994
|
+
function clarifyErrorMessage(e, t) {
|
|
1995
|
+
if (e.message === "unreachable") {
|
|
1996
|
+
let r = UNREACHABLE_ERROR;
|
|
1997
|
+
t || (r += `
|
|
1998
|
+
|
|
1999
|
+
This stack trace is lacking. For a better one initialize
|
|
2000
|
+
the PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).
|
|
2001
|
+
|
|
2002
|
+
`), functionsMaybeMissingFromAsyncify = extractPHPFunctionsFromStack(
|
|
2003
|
+
t || e.stack || ""
|
|
2004
|
+
);
|
|
2005
|
+
for (const n of functionsMaybeMissingFromAsyncify)
|
|
2006
|
+
r += ` * ${n}
|
|
2007
|
+
`;
|
|
2008
|
+
return r;
|
|
2009
|
+
}
|
|
2010
|
+
return e.message;
|
|
2011
|
+
}
|
|
2012
|
+
const UNREACHABLE_ERROR = `
|
|
2013
|
+
"unreachable" WASM instruction executed.
|
|
2014
|
+
|
|
2015
|
+
The typical reason is a PHP function missing from the ASYNCIFY_ONLY
|
|
2016
|
+
list when building PHP.wasm.
|
|
2017
|
+
|
|
2018
|
+
You will need to file a new issue in the WordPress Playground repository
|
|
2019
|
+
and paste this error message there:
|
|
2020
|
+
|
|
2021
|
+
https://github.com/WordPress/wordpress-playground/issues/new
|
|
2022
|
+
|
|
2023
|
+
If you're a core developer, the typical fix is to:
|
|
2024
|
+
|
|
2025
|
+
* Isolate a minimal reproduction of the error
|
|
2026
|
+
* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
|
|
2027
|
+
* Run 'npm run fix-asyncify'
|
|
2028
|
+
* Commit the changes, push to the repo, release updated NPM packages
|
|
2029
|
+
|
|
2030
|
+
Below is a list of all the PHP functions found in the stack trace to
|
|
2031
|
+
help with the minimal reproduction. If they're all already listed in
|
|
2032
|
+
the Dockerfile, you'll need to trigger this error again with long stack
|
|
2033
|
+
traces enabled. In node.js, you can do it using the --stack-trace-limit=100
|
|
2034
|
+
CLI option:
|
|
2035
|
+
|
|
2036
|
+
`, redBg = "\x1B[41m", bold = "\x1B[1m", reset = "\x1B[0m", eol = "\x1B[K";
|
|
2037
|
+
let logged = !1;
|
|
2038
|
+
function showCriticalErrorBox(e) {
|
|
2039
|
+
if (!logged && (logged = !0, !(e != null && e.trim().startsWith("Program terminated with exit")))) {
|
|
2040
|
+
logger.log(`${redBg}
|
|
2041
|
+
${eol}
|
|
2042
|
+
${bold} WASM ERROR${reset}${redBg}`);
|
|
2043
|
+
for (const t of e.split(`
|
|
2044
|
+
`))
|
|
2045
|
+
logger.log(`${eol} ${t} `);
|
|
2046
|
+
logger.log(`${reset}`);
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
function extractPHPFunctionsFromStack(e) {
|
|
2050
|
+
try {
|
|
2051
|
+
const t = e.split(`
|
|
2052
|
+
`).slice(1).map((r) => {
|
|
2053
|
+
const n = r.trim().substring(3).split(" ");
|
|
2054
|
+
return {
|
|
2055
|
+
fn: n.length >= 2 ? n[0] : "<unknown>",
|
|
2056
|
+
isWasm: r.includes("wasm://")
|
|
2057
|
+
};
|
|
2058
|
+
}).filter(
|
|
2059
|
+
({ fn: r, isWasm: n }) => n && !r.startsWith("dynCall_") && !r.startsWith("invoke_")
|
|
2060
|
+
).map(({ fn: r }) => r);
|
|
2061
|
+
return Array.from(new Set(t));
|
|
2062
|
+
} catch {
|
|
2063
|
+
return [];
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2059
2066
|
var __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = (e, t, r, n) => {
|
|
2060
2067
|
for (var s = n > 1 ? void 0 : n ? __getOwnPropDesc(t, r) : t, i = e.length - 1, o; i >= 0; i--)
|
|
2061
2068
|
(o = e[i]) && (s = (n ? o(t, r, s) : o(s)) || s);
|
|
@@ -2067,7 +2074,8 @@ class PHPExecutionFailureError extends Error {
|
|
|
2067
2074
|
super(t), this.response = r, this.source = n;
|
|
2068
2075
|
}
|
|
2069
2076
|
}
|
|
2070
|
-
|
|
2077
|
+
const PHP_INI_PATH = "/internal/shared/php.ini", AUTO_PREPEND_SCRIPT = "/internal/shared/auto_prepend_file.php";
|
|
2078
|
+
var Ue, Ee, Pe, we, Ve, nt, Ot, st, It, it, jt, ot, Dt, at, At, ct, Ft, lt, Mt, dt, qt, ut, Lt, pt, Ut, Ye, $t, ft, Vt, ht, Ht, mt, zt;
|
|
2071
2079
|
class BasePHP {
|
|
2072
2080
|
/**
|
|
2073
2081
|
* Initializes a PHP runtime.
|
|
@@ -2086,46 +2094,43 @@ class BasePHP {
|
|
|
2086
2094
|
* was provided.
|
|
2087
2095
|
* @returns Computed $_SERVER entries.
|
|
2088
2096
|
*/
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
ee(this, be, void 0);
|
|
2110
|
-
ee(this, He, void 0);
|
|
2111
|
-
fe(this, Ne, []), fe(this, ve, !1), fe(this, Ee, null), fe(this, be, /* @__PURE__ */ new Map()), fe(this, He, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e);
|
|
2097
|
+
ie(this, nt);
|
|
2098
|
+
ie(this, st);
|
|
2099
|
+
ie(this, it);
|
|
2100
|
+
ie(this, ot);
|
|
2101
|
+
ie(this, at);
|
|
2102
|
+
ie(this, ct);
|
|
2103
|
+
ie(this, lt);
|
|
2104
|
+
ie(this, dt);
|
|
2105
|
+
ie(this, ut);
|
|
2106
|
+
ie(this, pt);
|
|
2107
|
+
ie(this, Ye);
|
|
2108
|
+
ie(this, ft);
|
|
2109
|
+
ie(this, ht);
|
|
2110
|
+
ie(this, mt);
|
|
2111
|
+
ie(this, Ue, void 0);
|
|
2112
|
+
ie(this, Ee, void 0);
|
|
2113
|
+
ie(this, Pe, void 0);
|
|
2114
|
+
ie(this, we, void 0);
|
|
2115
|
+
ie(this, Ve, void 0);
|
|
2116
|
+
ye(this, Ee, !1), ye(this, Pe, null), ye(this, we, /* @__PURE__ */ new Map()), ye(this, Ve, []), this.semaphore = new Semaphore({ concurrency: 1 }), e !== void 0 && this.initializeRuntime(e);
|
|
2112
2117
|
}
|
|
2113
2118
|
addEventListener(e, t) {
|
|
2114
|
-
|
|
2119
|
+
ce(this, we).has(e) || ce(this, we).set(e, /* @__PURE__ */ new Set()), ce(this, we).get(e).add(t);
|
|
2115
2120
|
}
|
|
2116
2121
|
removeEventListener(e, t) {
|
|
2117
2122
|
var r;
|
|
2118
|
-
(r =
|
|
2123
|
+
(r = ce(this, we).get(e)) == null || r.delete(t);
|
|
2119
2124
|
}
|
|
2120
2125
|
dispatchEvent(e) {
|
|
2121
|
-
const t =
|
|
2126
|
+
const t = ce(this, we).get(e.type);
|
|
2122
2127
|
if (t)
|
|
2123
2128
|
for (const r of t)
|
|
2124
2129
|
r(e);
|
|
2125
2130
|
}
|
|
2126
2131
|
/** @inheritDoc */
|
|
2127
2132
|
async onMessage(e) {
|
|
2128
|
-
|
|
2133
|
+
ce(this, Ve).push(e);
|
|
2129
2134
|
}
|
|
2130
2135
|
/** @inheritDoc */
|
|
2131
2136
|
async setSpawnHandler(handler) {
|
|
@@ -2153,14 +2158,60 @@ class BasePHP {
|
|
|
2153
2158
|
const t = getLoadedRuntime(e);
|
|
2154
2159
|
if (!t)
|
|
2155
2160
|
throw new Error("Invalid PHP runtime id.");
|
|
2156
|
-
this[__private__dont__use] = t,
|
|
2157
|
-
|
|
2161
|
+
this[__private__dont__use] = t, this[__private__dont__use].ccall(
|
|
2162
|
+
"wasm_set_phpini_path",
|
|
2163
|
+
null,
|
|
2164
|
+
["string"],
|
|
2165
|
+
[PHP_INI_PATH]
|
|
2166
|
+
), this.fileExists(PHP_INI_PATH) || this.writeFile(
|
|
2167
|
+
PHP_INI_PATH,
|
|
2168
|
+
[
|
|
2169
|
+
"auto_prepend_file=" + AUTO_PREPEND_SCRIPT,
|
|
2170
|
+
"memory_limit=256M",
|
|
2171
|
+
"ignore_repeated_errors = 1",
|
|
2172
|
+
"error_reporting = E_ALL",
|
|
2173
|
+
"display_errors = 1",
|
|
2174
|
+
"html_errors = 1",
|
|
2175
|
+
"display_startup_errors = On",
|
|
2176
|
+
"log_errors = 1",
|
|
2177
|
+
"always_populate_raw_post_data = -1",
|
|
2178
|
+
"upload_max_filesize = 2000M",
|
|
2179
|
+
"post_max_size = 2000M",
|
|
2180
|
+
"disable_functions = curl_exec,curl_multi_exec",
|
|
2181
|
+
"allow_url_fopen = Off",
|
|
2182
|
+
"allow_url_include = Off",
|
|
2183
|
+
"session.save_path = /home/web_user",
|
|
2184
|
+
"implicit_flush = 1",
|
|
2185
|
+
"output_buffering = 0",
|
|
2186
|
+
"max_execution_time = 0",
|
|
2187
|
+
"max_input_time = -1"
|
|
2188
|
+
].join(`
|
|
2189
|
+
`)
|
|
2190
|
+
), this.fileExists(AUTO_PREPEND_SCRIPT) || this.writeFile(
|
|
2191
|
+
AUTO_PREPEND_SCRIPT,
|
|
2192
|
+
`<?php
|
|
2193
|
+
// Define constants set via defineConstant() calls
|
|
2194
|
+
if(file_exists('/internal/shared/consts.json')) {
|
|
2195
|
+
$consts = json_decode(file_get_contents('/internal/shared/consts.json'), true);
|
|
2196
|
+
foreach ($consts as $const => $value) {
|
|
2197
|
+
if (!defined($const) && is_scalar($value)) {
|
|
2198
|
+
define($const, $value);
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
// Preload all the files from /internal/shared/preload
|
|
2203
|
+
foreach (glob('/internal/shared/preload/*.php') as $file) {
|
|
2204
|
+
require_once $file;
|
|
2205
|
+
}
|
|
2206
|
+
`
|
|
2207
|
+
), t.onMessage = async (r) => {
|
|
2208
|
+
for (const n of ce(this, Ve)) {
|
|
2158
2209
|
const s = await n(r);
|
|
2159
2210
|
if (s)
|
|
2160
2211
|
return s;
|
|
2161
2212
|
}
|
|
2162
2213
|
return "";
|
|
2163
|
-
},
|
|
2214
|
+
}, ye(this, Pe, improveWASMErrorReporting(t)), this.dispatchEvent({
|
|
2164
2215
|
type: "runtime.initialized"
|
|
2165
2216
|
});
|
|
2166
2217
|
}
|
|
@@ -2175,24 +2226,7 @@ class BasePHP {
|
|
|
2175
2226
|
throw new Error(
|
|
2176
2227
|
"Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?"
|
|
2177
2228
|
);
|
|
2178
|
-
|
|
2179
|
-
}
|
|
2180
|
-
/** @inheritDoc */
|
|
2181
|
-
setPhpIniPath(e) {
|
|
2182
|
-
if (se(this, ve))
|
|
2183
|
-
throw new Error("Cannot set PHP ini path after calling run().");
|
|
2184
|
-
fe(this, Ve, e), this[__private__dont__use].ccall(
|
|
2185
|
-
"wasm_set_phpini_path",
|
|
2186
|
-
null,
|
|
2187
|
-
["string"],
|
|
2188
|
-
[e]
|
|
2189
|
-
);
|
|
2190
|
-
}
|
|
2191
|
-
/** @inheritDoc */
|
|
2192
|
-
setPhpIniEntry(e, t) {
|
|
2193
|
-
if (se(this, ve))
|
|
2194
|
-
throw new Error("Cannot set PHP ini entries after calling run().");
|
|
2195
|
-
se(this, Ne).push([e, t]);
|
|
2229
|
+
ye(this, Ue, e);
|
|
2196
2230
|
}
|
|
2197
2231
|
/** @inheritDoc */
|
|
2198
2232
|
chdir(e) {
|
|
@@ -2214,20 +2248,20 @@ class BasePHP {
|
|
|
2214
2248
|
const t = await this.semaphore.acquire();
|
|
2215
2249
|
let r;
|
|
2216
2250
|
try {
|
|
2217
|
-
if (
|
|
2251
|
+
if (ce(this, Ee) || (oe(this, st, It).call(this), ye(this, Ee, !0)), e.scriptPath && !this.fileExists(e.scriptPath))
|
|
2218
2252
|
throw new Error(
|
|
2219
2253
|
`The script path "${e.scriptPath}" does not exist.`
|
|
2220
2254
|
);
|
|
2221
|
-
|
|
2222
|
-
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443", i =
|
|
2223
|
-
|
|
2224
|
-
const o =
|
|
2255
|
+
oe(this, ot, Dt).call(this, e.relativeUri || ""), oe(this, dt, qt).call(this, e.method || "GET");
|
|
2256
|
+
const n = normalizeHeaders(e.headers || {}), s = n.host || "example.com:443", i = oe(this, lt, Mt).call(this, s, e.protocol || "http");
|
|
2257
|
+
oe(this, at, At).call(this, s), oe(this, ct, Ft).call(this, i), oe(this, ut, Lt).call(this, n), e.body && (r = oe(this, pt, Ut).call(this, e.body)), typeof e.code == "string" ? (this.writeFile("/internal/eval.php", e.code), oe(this, Ye, $t).call(this, "/internal/eval.php")) : oe(this, Ye, $t).call(this, e.scriptPath || "");
|
|
2258
|
+
const o = oe(this, nt, Ot).call(this, e.$_SERVER, n, i);
|
|
2225
2259
|
for (const u in o)
|
|
2226
|
-
|
|
2260
|
+
oe(this, ft, Vt).call(this, u, o[u]);
|
|
2227
2261
|
const l = e.env || {};
|
|
2228
2262
|
for (const u in l)
|
|
2229
|
-
|
|
2230
|
-
const d = await
|
|
2263
|
+
oe(this, ht, Ht).call(this, u, l[u]);
|
|
2264
|
+
const d = await oe(this, mt, zt).call(this);
|
|
2231
2265
|
if (d.exitCode !== 0) {
|
|
2232
2266
|
logger.warn("PHP.run() output was:", d.text);
|
|
2233
2267
|
const u = new PHPExecutionFailureError(
|
|
@@ -2259,12 +2293,12 @@ class BasePHP {
|
|
|
2259
2293
|
let r = {};
|
|
2260
2294
|
try {
|
|
2261
2295
|
r = JSON.parse(
|
|
2262
|
-
this.fileExists("/internal/consts.json") && this.readFileAsText("/internal/consts.json") || "{}"
|
|
2296
|
+
this.fileExists("/internal/shared/consts.json") && this.readFileAsText("/internal/shared/consts.json") || "{}"
|
|
2263
2297
|
);
|
|
2264
2298
|
} catch {
|
|
2265
2299
|
}
|
|
2266
2300
|
this.writeFile(
|
|
2267
|
-
"/internal/consts.json",
|
|
2301
|
+
"/internal/shared/consts.json",
|
|
2268
2302
|
JSON.stringify({
|
|
2269
2303
|
...r,
|
|
2270
2304
|
[e]: t
|
|
@@ -2291,16 +2325,18 @@ class BasePHP {
|
|
|
2291
2325
|
}
|
|
2292
2326
|
/** @inheritDoc */
|
|
2293
2327
|
mv(e, t) {
|
|
2328
|
+
const r = this[__private__dont__use].FS;
|
|
2294
2329
|
try {
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2330
|
+
const n = r.lookupPath(e).node.mount, s = this.fileExists(t) ? r.lookupPath(t).node.mount : r.lookupPath(dirname(t)).node.mount;
|
|
2331
|
+
n.mountpoint !== s.mountpoint ? (copyRecursive(r, e, t), this.rmdir(e, { recursive: !0 })) : r.rename(e, t);
|
|
2332
|
+
} catch (n) {
|
|
2333
|
+
const s = getEmscriptenFsError(n);
|
|
2334
|
+
throw s ? new Error(
|
|
2335
|
+
`Could not move ${e} to ${t}: ${s}`,
|
|
2300
2336
|
{
|
|
2301
|
-
cause:
|
|
2337
|
+
cause: n
|
|
2302
2338
|
}
|
|
2303
|
-
) :
|
|
2339
|
+
) : n;
|
|
2304
2340
|
}
|
|
2305
2341
|
}
|
|
2306
2342
|
rmdir(e, t = { recursive: !0 }) {
|
|
@@ -2353,7 +2389,7 @@ class BasePHP {
|
|
|
2353
2389
|
this.exit();
|
|
2354
2390
|
} catch {
|
|
2355
2391
|
}
|
|
2356
|
-
this.initializeRuntime(e),
|
|
2392
|
+
this.initializeRuntime(e), ce(this, Ue) && this.setSapiName(ce(this, Ue)), t && copyFS(r, this[__private__dont__use].FS, t);
|
|
2357
2393
|
}
|
|
2358
2394
|
exit(e = 0) {
|
|
2359
2395
|
this.dispatchEvent({
|
|
@@ -2363,13 +2399,13 @@ class BasePHP {
|
|
|
2363
2399
|
this[__private__dont__use]._exit(e);
|
|
2364
2400
|
} catch {
|
|
2365
2401
|
}
|
|
2366
|
-
|
|
2402
|
+
ye(this, Ee, !1), ye(this, Pe, null), delete this[__private__dont__use].onMessage, delete this[__private__dont__use];
|
|
2367
2403
|
}
|
|
2368
2404
|
[Symbol.dispose]() {
|
|
2369
|
-
|
|
2405
|
+
ce(this, Ee) && this.exit(0);
|
|
2370
2406
|
}
|
|
2371
2407
|
}
|
|
2372
|
-
|
|
2408
|
+
Ue = new WeakMap(), Ee = new WeakMap(), Pe = new WeakMap(), we = new WeakMap(), Ve = new WeakMap(), nt = new WeakSet(), Ot = function(e, t, r) {
|
|
2373
2409
|
const n = {
|
|
2374
2410
|
...e || {}
|
|
2375
2411
|
};
|
|
@@ -2379,32 +2415,9 @@ Ne = new WeakMap(), Ve = new WeakMap(), ze = new WeakMap(), ve = new WeakMap(),
|
|
|
2379
2415
|
["content-type", "content-length"].includes(s.toLowerCase()) && (i = ""), n[`${i}${s.toUpperCase().replace(/-/g, "_")}`] = t[s];
|
|
2380
2416
|
}
|
|
2381
2417
|
return n;
|
|
2382
|
-
},
|
|
2383
|
-
if (this.setPhpIniEntry("auto_prepend_file", "/internal/consts.php"), this.fileExists("/internal/consts.php") || this.writeFile(
|
|
2384
|
-
"/internal/consts.php",
|
|
2385
|
-
`<?php
|
|
2386
|
-
if(file_exists('/internal/consts.json')) {
|
|
2387
|
-
$consts = json_decode(file_get_contents('/internal/consts.json'), true);
|
|
2388
|
-
foreach ($consts as $const => $value) {
|
|
2389
|
-
if (!defined($const) && is_scalar($value)) {
|
|
2390
|
-
define($const, $value);
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
}`
|
|
2394
|
-
), se(this, Ne).length > 0) {
|
|
2395
|
-
const e = se(this, Ne).map(([t, r]) => `${t}=${r}`).join(`
|
|
2396
|
-
`) + `
|
|
2397
|
-
|
|
2398
|
-
`;
|
|
2399
|
-
this[__private__dont__use].ccall(
|
|
2400
|
-
"wasm_set_phpini_entries",
|
|
2401
|
-
null,
|
|
2402
|
-
[STRING],
|
|
2403
|
-
[e]
|
|
2404
|
-
);
|
|
2405
|
-
}
|
|
2418
|
+
}, st = new WeakSet(), It = function() {
|
|
2406
2419
|
this[__private__dont__use].ccall("php_wasm_init", null, [], []);
|
|
2407
|
-
},
|
|
2420
|
+
}, it = new WeakSet(), jt = function() {
|
|
2408
2421
|
const e = "/internal/headers.json";
|
|
2409
2422
|
if (!this.fileExists(e))
|
|
2410
2423
|
throw new Error(
|
|
@@ -2421,7 +2434,7 @@ Ne = new WeakMap(), Ve = new WeakMap(), ze = new WeakMap(), ve = new WeakMap(),
|
|
|
2421
2434
|
headers: r,
|
|
2422
2435
|
httpStatusCode: t.status
|
|
2423
2436
|
};
|
|
2424
|
-
},
|
|
2437
|
+
}, ot = new WeakSet(), Dt = function(e) {
|
|
2425
2438
|
if (this[__private__dont__use].ccall(
|
|
2426
2439
|
"wasm_set_request_uri",
|
|
2427
2440
|
null,
|
|
@@ -2436,35 +2449,35 @@ Ne = new WeakMap(), Ve = new WeakMap(), ze = new WeakMap(), ve = new WeakMap(),
|
|
|
2436
2449
|
[t]
|
|
2437
2450
|
);
|
|
2438
2451
|
}
|
|
2439
|
-
},
|
|
2452
|
+
}, at = new WeakSet(), At = function(e) {
|
|
2440
2453
|
this[__private__dont__use].ccall(
|
|
2441
2454
|
"wasm_set_request_host",
|
|
2442
2455
|
null,
|
|
2443
2456
|
[STRING],
|
|
2444
2457
|
[e]
|
|
2445
2458
|
);
|
|
2446
|
-
},
|
|
2459
|
+
}, ct = new WeakSet(), Ft = function(e) {
|
|
2447
2460
|
this[__private__dont__use].ccall(
|
|
2448
2461
|
"wasm_set_request_port",
|
|
2449
2462
|
null,
|
|
2450
2463
|
[NUMBER],
|
|
2451
2464
|
[e]
|
|
2452
2465
|
);
|
|
2453
|
-
},
|
|
2466
|
+
}, lt = new WeakSet(), Mt = function(e, t) {
|
|
2454
2467
|
let r;
|
|
2455
2468
|
try {
|
|
2456
2469
|
r = parseInt(new URL(e).port, 10);
|
|
2457
2470
|
} catch {
|
|
2458
2471
|
}
|
|
2459
2472
|
return (!r || isNaN(r) || r === 80) && (r = t === "https" ? 443 : 80), r;
|
|
2460
|
-
},
|
|
2473
|
+
}, dt = new WeakSet(), qt = function(e) {
|
|
2461
2474
|
this[__private__dont__use].ccall(
|
|
2462
2475
|
"wasm_set_request_method",
|
|
2463
2476
|
null,
|
|
2464
2477
|
[STRING],
|
|
2465
2478
|
[e]
|
|
2466
2479
|
);
|
|
2467
|
-
},
|
|
2480
|
+
}, ut = new WeakSet(), Lt = function(e) {
|
|
2468
2481
|
e.cookie && this[__private__dont__use].ccall(
|
|
2469
2482
|
"wasm_set_cookies",
|
|
2470
2483
|
null,
|
|
@@ -2481,7 +2494,7 @@ Ne = new WeakMap(), Ve = new WeakMap(), ze = new WeakMap(), ve = new WeakMap(),
|
|
|
2481
2494
|
[NUMBER],
|
|
2482
2495
|
[parseInt(e["content-length"], 10)]
|
|
2483
2496
|
);
|
|
2484
|
-
},
|
|
2497
|
+
}, pt = new WeakSet(), Ut = function(e) {
|
|
2485
2498
|
let t, r;
|
|
2486
2499
|
typeof e == "string" ? (logger.warn(
|
|
2487
2500
|
"Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details"
|
|
@@ -2504,35 +2517,28 @@ Ne = new WeakMap(), Ve = new WeakMap(), ze = new WeakMap(), ve = new WeakMap(),
|
|
|
2504
2517
|
[NUMBER],
|
|
2505
2518
|
[r]
|
|
2506
2519
|
), n;
|
|
2507
|
-
},
|
|
2520
|
+
}, Ye = new WeakSet(), $t = function(e) {
|
|
2508
2521
|
this[__private__dont__use].ccall(
|
|
2509
2522
|
"wasm_set_path_translated",
|
|
2510
2523
|
null,
|
|
2511
2524
|
[STRING],
|
|
2512
2525
|
[e]
|
|
2513
2526
|
);
|
|
2514
|
-
},
|
|
2527
|
+
}, ft = new WeakSet(), Vt = function(e, t) {
|
|
2515
2528
|
this[__private__dont__use].ccall(
|
|
2516
2529
|
"wasm_add_SERVER_entry",
|
|
2517
2530
|
null,
|
|
2518
2531
|
[STRING, STRING],
|
|
2519
2532
|
[e, t]
|
|
2520
2533
|
);
|
|
2521
|
-
},
|
|
2534
|
+
}, ht = new WeakSet(), Ht = function(e, t) {
|
|
2522
2535
|
this[__private__dont__use].ccall(
|
|
2523
2536
|
"wasm_add_ENV_entry",
|
|
2524
2537
|
null,
|
|
2525
2538
|
[STRING, STRING],
|
|
2526
2539
|
[e, t]
|
|
2527
2540
|
);
|
|
2528
|
-
},
|
|
2529
|
-
this[__private__dont__use].ccall(
|
|
2530
|
-
"wasm_set_php_code",
|
|
2531
|
-
null,
|
|
2532
|
-
[STRING],
|
|
2533
|
-
[e]
|
|
2534
|
-
);
|
|
2535
|
-
}, $t = new WeakSet(), Gt = async function() {
|
|
2541
|
+
}, mt = new WeakSet(), zt = async function() {
|
|
2536
2542
|
var s;
|
|
2537
2543
|
let e, t;
|
|
2538
2544
|
try {
|
|
@@ -2542,7 +2548,7 @@ Ne = new WeakMap(), Ve = new WeakMap(), ze = new WeakMap(), ve = new WeakMap(),
|
|
|
2542
2548
|
logger.error(u), logger.error(u.error);
|
|
2543
2549
|
const f = new Error("Rethrown");
|
|
2544
2550
|
f.cause = u.error, f.betterMessage = u.message, o(f);
|
|
2545
|
-
}, (d =
|
|
2551
|
+
}, (d = ce(this, Pe)) == null || d.addEventListener(
|
|
2546
2552
|
"error",
|
|
2547
2553
|
t
|
|
2548
2554
|
);
|
|
@@ -2566,9 +2572,9 @@ Ne = new WeakMap(), Ve = new WeakMap(), ze = new WeakMap(), ve = new WeakMap(),
|
|
|
2566
2572
|
const o = i, l = "betterMessage" in o ? o.betterMessage : o.message, d = new Error(l);
|
|
2567
2573
|
throw d.cause = o, logger.error(d), d;
|
|
2568
2574
|
} finally {
|
|
2569
|
-
(s =
|
|
2575
|
+
(s = ce(this, Pe)) == null || s.removeEventListener("error", t);
|
|
2570
2576
|
}
|
|
2571
|
-
const { headers: r, httpStatusCode: n } =
|
|
2577
|
+
const { headers: r, httpStatusCode: n } = oe(this, it, jt).call(this);
|
|
2572
2578
|
return new PHPResponse(
|
|
2573
2579
|
e === 0 ? n : 500,
|
|
2574
2580
|
r,
|
|
@@ -2631,7 +2637,59 @@ function copyFS(e, t, r) {
|
|
|
2631
2637
|
for (const i of s)
|
|
2632
2638
|
copyFS(e, t, joinPaths(r, i));
|
|
2633
2639
|
}
|
|
2634
|
-
|
|
2640
|
+
function copyRecursive(e, t, r) {
|
|
2641
|
+
const n = e.lookupPath(t).node;
|
|
2642
|
+
if (e.isDir(n.mode)) {
|
|
2643
|
+
e.mkdirTree(r);
|
|
2644
|
+
const s = e.readdir(t).filter(
|
|
2645
|
+
(i) => i !== "." && i !== ".."
|
|
2646
|
+
);
|
|
2647
|
+
for (const i of s)
|
|
2648
|
+
copyRecursive(
|
|
2649
|
+
e,
|
|
2650
|
+
joinPaths(t, i),
|
|
2651
|
+
joinPaths(r, i)
|
|
2652
|
+
);
|
|
2653
|
+
} else
|
|
2654
|
+
e.writeFile(r, e.readFile(t));
|
|
2655
|
+
}
|
|
2656
|
+
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2657
|
+
function getDefaultExportFromCjs(e) {
|
|
2658
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2659
|
+
}
|
|
2660
|
+
ReadableStream.prototype[Symbol.asyncIterator] || (ReadableStream.prototype[Symbol.asyncIterator] = async function* () {
|
|
2661
|
+
const e = this.getReader();
|
|
2662
|
+
try {
|
|
2663
|
+
for (; ; ) {
|
|
2664
|
+
const { done: t, value: r } = await e.read();
|
|
2665
|
+
if (t)
|
|
2666
|
+
return;
|
|
2667
|
+
yield r;
|
|
2668
|
+
}
|
|
2669
|
+
} finally {
|
|
2670
|
+
e.releaseLock();
|
|
2671
|
+
}
|
|
2672
|
+
}, ReadableStream.prototype.iterate = // @ts-ignore
|
|
2673
|
+
ReadableStream.prototype[Symbol.asyncIterator]);
|
|
2674
|
+
const SupportedPHPVersions = [
|
|
2675
|
+
"8.3",
|
|
2676
|
+
"8.2",
|
|
2677
|
+
"8.1",
|
|
2678
|
+
"8.0",
|
|
2679
|
+
"7.4",
|
|
2680
|
+
"7.3",
|
|
2681
|
+
"7.2",
|
|
2682
|
+
"7.1",
|
|
2683
|
+
"7.0"
|
|
2684
|
+
], LatestSupportedPHPVersion = SupportedPHPVersions[0], SupportedPHPExtensionsList = [
|
|
2685
|
+
"iconv",
|
|
2686
|
+
"mbstring",
|
|
2687
|
+
"xml-bundle",
|
|
2688
|
+
"gd"
|
|
2689
|
+
], SupportedPHPExtensionBundles = {
|
|
2690
|
+
"kitchen-sink": SupportedPHPExtensionsList,
|
|
2691
|
+
light: []
|
|
2692
|
+
}, ResourceTypes = [
|
|
2635
2693
|
"vfs",
|
|
2636
2694
|
"literal",
|
|
2637
2695
|
"wordpress.org/themes",
|
|
@@ -2749,30 +2807,26 @@ class FetchResource extends Resource {
|
|
|
2749
2807
|
throw new Error(
|
|
2750
2808
|
`Could not download "${t}".
|
|
2751
2809
|
Check if the URL is correct and the server is reachable.
|
|
2752
|
-
If
|
|
2753
|
-
Check the console and network for more information.
|
|
2810
|
+
If it is reachable, the server might be blocking the request.
|
|
2811
|
+
Check the browser console and network tabs for more information.
|
|
2754
2812
|
|
|
2755
|
-
## Does the console
|
|
2813
|
+
## Does the console show the error "No 'Access-Control-Allow-Origin' header"?
|
|
2756
2814
|
|
|
2757
|
-
This means the server
|
|
2758
|
-
(cross-origin requests, or CORS). You
|
|
2759
|
-
cross-origin file downloads.
|
|
2815
|
+
This means the server that hosts your file does not allow requests from other sites
|
|
2816
|
+
(cross-origin requests, or CORS). You need to move the asset to a server that allows
|
|
2817
|
+
cross-origin file downloads. Learn more about CORS at
|
|
2760
2818
|
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS.
|
|
2761
2819
|
|
|
2762
|
-
If
|
|
2763
|
-
|
|
2820
|
+
If your file is on GitHub, load it from "raw.githubusercontent.com".
|
|
2821
|
+
Here's how to do that:
|
|
2764
2822
|
|
|
2765
|
-
1. Start with the original GitHub URL
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
2. Replace 'github.com' with 'raw.githubusercontent.com'.
|
|
2770
|
-
3. Remove the '/blob/' part of the URL.
|
|
2823
|
+
1. Start with the original GitHub URL of the file. For example:
|
|
2824
|
+
https://github.com/username/repository/blob/branch/filename.
|
|
2825
|
+
2. Replace "github.com" with "raw.githubusercontent.com".
|
|
2826
|
+
3. Remove the "/blob/" part of the URL.
|
|
2771
2827
|
|
|
2772
2828
|
The resulting URL should look like this:
|
|
2773
|
-
'''
|
|
2774
2829
|
https://raw.githubusercontent.com/username/repository/branch/filename
|
|
2775
|
-
'''
|
|
2776
2830
|
|
|
2777
2831
|
Error:
|
|
2778
2832
|
${s}`
|
|
@@ -2890,10 +2944,6 @@ class SemaphoreResource extends DecoratedResource {
|
|
|
2890
2944
|
return this.isAsync ? this.semaphore.run(() => super.resolve()) : super.resolve();
|
|
2891
2945
|
}
|
|
2892
2946
|
}
|
|
2893
|
-
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2894
|
-
function getDefaultExportFromCjs(e) {
|
|
2895
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2896
|
-
}
|
|
2897
2947
|
var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors = {}, codegen = {}, code$1 = {};
|
|
2898
2948
|
(function(e) {
|
|
2899
2949
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.regexpCode = e.getEsmExportName = e.getProperty = e.safeStringify = e.stringify = e.strConcat = e.addCodeArg = e.str = e._ = e.nil = e._Code = e.Name = e.IDENTIFIER = e._CodeOrName = void 0;
|
|
@@ -2992,10 +3042,10 @@ var ajv$1 = { exports: {} }, core$2 = {}, validate = {}, boolSchema = {}, errors
|
|
|
2992
3042
|
function g(_) {
|
|
2993
3043
|
return typeof _ == "number" || typeof _ == "boolean" || _ === null ? _ : C(Array.isArray(_) ? _.join(",") : _);
|
|
2994
3044
|
}
|
|
2995
|
-
function
|
|
3045
|
+
function N(_) {
|
|
2996
3046
|
return new n(C(_));
|
|
2997
3047
|
}
|
|
2998
|
-
e.stringify =
|
|
3048
|
+
e.stringify = N;
|
|
2999
3049
|
function C(_) {
|
|
3000
3050
|
return JSON.stringify(_).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
3001
3051
|
}
|
|
@@ -3078,7 +3128,7 @@ var scope = {};
|
|
|
3078
3128
|
var g;
|
|
3079
3129
|
if (f.ref === void 0)
|
|
3080
3130
|
throw new Error("CodeGen: ref must be passed in value");
|
|
3081
|
-
const
|
|
3131
|
+
const N = this.toName(u), { prefix: C } = N, S = (g = f.key) !== null && g !== void 0 ? g : f.ref;
|
|
3082
3132
|
let R = this._values[C];
|
|
3083
3133
|
if (R) {
|
|
3084
3134
|
const $ = R.get(S);
|
|
@@ -3086,9 +3136,9 @@ var scope = {};
|
|
|
3086
3136
|
return $;
|
|
3087
3137
|
} else
|
|
3088
3138
|
R = this._values[C] = /* @__PURE__ */ new Map();
|
|
3089
|
-
R.set(S,
|
|
3139
|
+
R.set(S, N);
|
|
3090
3140
|
const y = this._scope[C] || (this._scope[C] = []), _ = y.length;
|
|
3091
|
-
return y[_] = f.ref,
|
|
3141
|
+
return y[_] = f.ref, N.setValue(f, { property: C, itemIndex: _ }), N;
|
|
3092
3142
|
}
|
|
3093
3143
|
getValue(u, f) {
|
|
3094
3144
|
const g = this._values[u];
|
|
@@ -3103,13 +3153,13 @@ var scope = {};
|
|
|
3103
3153
|
});
|
|
3104
3154
|
}
|
|
3105
3155
|
scopeCode(u = this._values, f, g) {
|
|
3106
|
-
return this._reduceValues(u, (
|
|
3107
|
-
if (
|
|
3108
|
-
throw new Error(`CodeGen: name "${
|
|
3109
|
-
return
|
|
3156
|
+
return this._reduceValues(u, (N) => {
|
|
3157
|
+
if (N.value === void 0)
|
|
3158
|
+
throw new Error(`CodeGen: name "${N}" has no value`);
|
|
3159
|
+
return N.value.code;
|
|
3110
3160
|
}, f, g);
|
|
3111
3161
|
}
|
|
3112
|
-
_reduceValues(u, f, g = {},
|
|
3162
|
+
_reduceValues(u, f, g = {}, N) {
|
|
3113
3163
|
let C = t.nil;
|
|
3114
3164
|
for (const S in u) {
|
|
3115
3165
|
const R = u[S];
|
|
@@ -3124,7 +3174,7 @@ var scope = {};
|
|
|
3124
3174
|
if ($) {
|
|
3125
3175
|
const b = this.opts.es5 ? e.varKinds.var : e.varKinds.const;
|
|
3126
3176
|
C = (0, t._)`${C}${b} ${_} = ${$};${this.opts._n}`;
|
|
3127
|
-
} else if ($ =
|
|
3177
|
+
} else if ($ = N == null ? void 0 : N(_))
|
|
3128
3178
|
C = (0, t._)`${C}${$}${this.opts._n}`;
|
|
3129
3179
|
else
|
|
3130
3180
|
throw new r(_);
|
|
@@ -3187,31 +3237,31 @@ var scope = {};
|
|
|
3187
3237
|
}
|
|
3188
3238
|
}
|
|
3189
3239
|
class o extends i {
|
|
3190
|
-
constructor(a, h,
|
|
3191
|
-
super(), this.varKind = a, this.name = h, this.rhs =
|
|
3240
|
+
constructor(a, h, O) {
|
|
3241
|
+
super(), this.varKind = a, this.name = h, this.rhs = O;
|
|
3192
3242
|
}
|
|
3193
3243
|
render({ es5: a, _n: h }) {
|
|
3194
|
-
const
|
|
3195
|
-
return `${
|
|
3244
|
+
const O = a ? r.varKinds.var : this.varKind, M = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
3245
|
+
return `${O} ${this.name}${M};` + h;
|
|
3196
3246
|
}
|
|
3197
3247
|
optimizeNames(a, h) {
|
|
3198
3248
|
if (a[this.name.str])
|
|
3199
|
-
return this.rhs && (this.rhs =
|
|
3249
|
+
return this.rhs && (this.rhs = ne(this.rhs, a, h)), this;
|
|
3200
3250
|
}
|
|
3201
3251
|
get names() {
|
|
3202
3252
|
return this.rhs instanceof t._CodeOrName ? this.rhs.names : {};
|
|
3203
3253
|
}
|
|
3204
3254
|
}
|
|
3205
3255
|
class l extends i {
|
|
3206
|
-
constructor(a, h,
|
|
3207
|
-
super(), this.lhs = a, this.rhs = h, this.sideEffects =
|
|
3256
|
+
constructor(a, h, O) {
|
|
3257
|
+
super(), this.lhs = a, this.rhs = h, this.sideEffects = O;
|
|
3208
3258
|
}
|
|
3209
3259
|
render({ _n: a }) {
|
|
3210
3260
|
return `${this.lhs} = ${this.rhs};` + a;
|
|
3211
3261
|
}
|
|
3212
3262
|
optimizeNames(a, h) {
|
|
3213
3263
|
if (!(this.lhs instanceof t.Name && !a[this.lhs.str] && !this.sideEffects))
|
|
3214
|
-
return this.rhs =
|
|
3264
|
+
return this.rhs = ne(this.rhs, a, h), this;
|
|
3215
3265
|
}
|
|
3216
3266
|
get names() {
|
|
3217
3267
|
const a = this.lhs instanceof t.Name ? {} : { ...this.lhs.names };
|
|
@@ -3219,8 +3269,8 @@ var scope = {};
|
|
|
3219
3269
|
}
|
|
3220
3270
|
}
|
|
3221
3271
|
class d extends l {
|
|
3222
|
-
constructor(a, h,
|
|
3223
|
-
super(a,
|
|
3272
|
+
constructor(a, h, O, M) {
|
|
3273
|
+
super(a, O, M), this.op = h;
|
|
3224
3274
|
}
|
|
3225
3275
|
render({ _n: a }) {
|
|
3226
3276
|
return `${this.lhs} ${this.op}= ${this.rhs};` + a;
|
|
@@ -3253,7 +3303,7 @@ var scope = {};
|
|
|
3253
3303
|
return this.error.names;
|
|
3254
3304
|
}
|
|
3255
3305
|
}
|
|
3256
|
-
class
|
|
3306
|
+
class N extends i {
|
|
3257
3307
|
constructor(a) {
|
|
3258
3308
|
super(), this.code = a;
|
|
3259
3309
|
}
|
|
@@ -3264,7 +3314,7 @@ var scope = {};
|
|
|
3264
3314
|
return `${this.code}` ? this : void 0;
|
|
3265
3315
|
}
|
|
3266
3316
|
optimizeNames(a, h) {
|
|
3267
|
-
return this.code =
|
|
3317
|
+
return this.code = ne(this.code, a, h), this;
|
|
3268
3318
|
}
|
|
3269
3319
|
get names() {
|
|
3270
3320
|
return this.code instanceof t._CodeOrName ? this.code.names : {};
|
|
@@ -3275,25 +3325,25 @@ var scope = {};
|
|
|
3275
3325
|
super(), this.nodes = a;
|
|
3276
3326
|
}
|
|
3277
3327
|
render(a) {
|
|
3278
|
-
return this.nodes.reduce((h,
|
|
3328
|
+
return this.nodes.reduce((h, O) => h + O.render(a), "");
|
|
3279
3329
|
}
|
|
3280
3330
|
optimizeNodes() {
|
|
3281
3331
|
const { nodes: a } = this;
|
|
3282
3332
|
let h = a.length;
|
|
3283
3333
|
for (; h--; ) {
|
|
3284
|
-
const
|
|
3285
|
-
Array.isArray(
|
|
3334
|
+
const O = a[h].optimizeNodes();
|
|
3335
|
+
Array.isArray(O) ? a.splice(h, 1, ...O) : O ? a[h] = O : a.splice(h, 1);
|
|
3286
3336
|
}
|
|
3287
3337
|
return a.length > 0 ? this : void 0;
|
|
3288
3338
|
}
|
|
3289
3339
|
optimizeNames(a, h) {
|
|
3290
|
-
const { nodes:
|
|
3291
|
-
let M =
|
|
3340
|
+
const { nodes: O } = this;
|
|
3341
|
+
let M = O.length;
|
|
3292
3342
|
for (; M--; ) {
|
|
3293
|
-
const q =
|
|
3294
|
-
q.optimizeNames(a, h) || (Se(a, q.names),
|
|
3343
|
+
const q = O[M];
|
|
3344
|
+
q.optimizeNames(a, h) || (Se(a, q.names), O.splice(M, 1));
|
|
3295
3345
|
}
|
|
3296
|
-
return
|
|
3346
|
+
return O.length > 0 ? this : void 0;
|
|
3297
3347
|
}
|
|
3298
3348
|
get names() {
|
|
3299
3349
|
return this.nodes.reduce((a, h) => G(a, h.names), {});
|
|
@@ -3324,8 +3374,8 @@ var scope = {};
|
|
|
3324
3374
|
return this.nodes;
|
|
3325
3375
|
let h = this.else;
|
|
3326
3376
|
if (h) {
|
|
3327
|
-
const
|
|
3328
|
-
h = this.else = Array.isArray(
|
|
3377
|
+
const O = h.optimizeNodes();
|
|
3378
|
+
h = this.else = Array.isArray(O) ? new y(O) : O;
|
|
3329
3379
|
}
|
|
3330
3380
|
if (h)
|
|
3331
3381
|
return a === !1 ? h instanceof _ ? h : h.nodes : this.nodes.length ? this : new _(Te(a), h instanceof _ ? [h] : h.nodes);
|
|
@@ -3333,9 +3383,9 @@ var scope = {};
|
|
|
3333
3383
|
return this;
|
|
3334
3384
|
}
|
|
3335
3385
|
optimizeNames(a, h) {
|
|
3336
|
-
var
|
|
3337
|
-
if (this.else = (
|
|
3338
|
-
return this.condition =
|
|
3386
|
+
var O;
|
|
3387
|
+
if (this.else = (O = this.else) === null || O === void 0 ? void 0 : O.optimizeNames(a, h), !!(super.optimizeNames(a, h) || this.else))
|
|
3388
|
+
return this.condition = ne(this.condition, a, h), this;
|
|
3339
3389
|
}
|
|
3340
3390
|
get names() {
|
|
3341
3391
|
const a = super.names;
|
|
@@ -3355,19 +3405,19 @@ var scope = {};
|
|
|
3355
3405
|
}
|
|
3356
3406
|
optimizeNames(a, h) {
|
|
3357
3407
|
if (super.optimizeNames(a, h))
|
|
3358
|
-
return this.iteration =
|
|
3408
|
+
return this.iteration = ne(this.iteration, a, h), this;
|
|
3359
3409
|
}
|
|
3360
3410
|
get names() {
|
|
3361
3411
|
return G(super.names, this.iteration.names);
|
|
3362
3412
|
}
|
|
3363
3413
|
}
|
|
3364
3414
|
class I extends $ {
|
|
3365
|
-
constructor(a, h,
|
|
3366
|
-
super(), this.varKind = a, this.name = h, this.from =
|
|
3415
|
+
constructor(a, h, O, M) {
|
|
3416
|
+
super(), this.varKind = a, this.name = h, this.from = O, this.to = M;
|
|
3367
3417
|
}
|
|
3368
3418
|
render(a) {
|
|
3369
|
-
const h = a.es5 ? r.varKinds.var : this.varKind, { name:
|
|
3370
|
-
return `for(${h} ${
|
|
3419
|
+
const h = a.es5 ? r.varKinds.var : this.varKind, { name: O, from: M, to: q } = this;
|
|
3420
|
+
return `for(${h} ${O}=${M}; ${O}<${q}; ${O}++)` + super.render(a);
|
|
3371
3421
|
}
|
|
3372
3422
|
get names() {
|
|
3373
3423
|
const a = de(super.names, this.from);
|
|
@@ -3375,23 +3425,23 @@ var scope = {};
|
|
|
3375
3425
|
}
|
|
3376
3426
|
}
|
|
3377
3427
|
class A extends $ {
|
|
3378
|
-
constructor(a, h,
|
|
3379
|
-
super(), this.loop = a, this.varKind = h, this.name =
|
|
3428
|
+
constructor(a, h, O, M) {
|
|
3429
|
+
super(), this.loop = a, this.varKind = h, this.name = O, this.iterable = M;
|
|
3380
3430
|
}
|
|
3381
3431
|
render(a) {
|
|
3382
3432
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(a);
|
|
3383
3433
|
}
|
|
3384
3434
|
optimizeNames(a, h) {
|
|
3385
3435
|
if (super.optimizeNames(a, h))
|
|
3386
|
-
return this.iterable =
|
|
3436
|
+
return this.iterable = ne(this.iterable, a, h), this;
|
|
3387
3437
|
}
|
|
3388
3438
|
get names() {
|
|
3389
3439
|
return G(super.names, this.iterable.names);
|
|
3390
3440
|
}
|
|
3391
3441
|
}
|
|
3392
3442
|
class w extends S {
|
|
3393
|
-
constructor(a, h,
|
|
3394
|
-
super(), this.name = a, this.args = h, this.async =
|
|
3443
|
+
constructor(a, h, O) {
|
|
3444
|
+
super(), this.name = a, this.args = h, this.async = O;
|
|
3395
3445
|
}
|
|
3396
3446
|
render(a) {
|
|
3397
3447
|
return `${this.async ? "async " : ""}function ${this.name}(${this.args})` + super.render(a);
|
|
@@ -3414,8 +3464,8 @@ var scope = {};
|
|
|
3414
3464
|
return super.optimizeNodes(), (a = this.catch) === null || a === void 0 || a.optimizeNodes(), (h = this.finally) === null || h === void 0 || h.optimizeNodes(), this;
|
|
3415
3465
|
}
|
|
3416
3466
|
optimizeNames(a, h) {
|
|
3417
|
-
var
|
|
3418
|
-
return super.optimizeNames(a, h), (
|
|
3467
|
+
var O, M;
|
|
3468
|
+
return super.optimizeNames(a, h), (O = this.catch) === null || O === void 0 || O.optimizeNames(a, h), (M = this.finally) === null || M === void 0 || M.optimizeNames(a, h), this;
|
|
3419
3469
|
}
|
|
3420
3470
|
get names() {
|
|
3421
3471
|
const a = super.names;
|
|
@@ -3431,12 +3481,12 @@ var scope = {};
|
|
|
3431
3481
|
}
|
|
3432
3482
|
}
|
|
3433
3483
|
V.kind = "catch";
|
|
3434
|
-
class
|
|
3484
|
+
class z extends S {
|
|
3435
3485
|
render(a) {
|
|
3436
3486
|
return "finally" + super.render(a);
|
|
3437
3487
|
}
|
|
3438
3488
|
}
|
|
3439
|
-
|
|
3489
|
+
z.kind = "finally";
|
|
3440
3490
|
class X {
|
|
3441
3491
|
constructor(a, h = {}) {
|
|
3442
3492
|
this._values = {}, this._blockStarts = [], this._constants = {}, this.opts = { ...h, _n: h.lines ? `
|
|
@@ -3455,8 +3505,8 @@ var scope = {};
|
|
|
3455
3505
|
}
|
|
3456
3506
|
// reserves unique name in the external scope and assigns value to it
|
|
3457
3507
|
scopeValue(a, h) {
|
|
3458
|
-
const
|
|
3459
|
-
return (this._values[
|
|
3508
|
+
const O = this._extScope.value(a, h);
|
|
3509
|
+
return (this._values[O.prefix] || (this._values[O.prefix] = /* @__PURE__ */ new Set())).add(O), O;
|
|
3460
3510
|
}
|
|
3461
3511
|
getScopeValue(a, h) {
|
|
3462
3512
|
return this._extScope.getValue(a, h);
|
|
@@ -3469,25 +3519,25 @@ var scope = {};
|
|
|
3469
3519
|
scopeCode() {
|
|
3470
3520
|
return this._extScope.scopeCode(this._values);
|
|
3471
3521
|
}
|
|
3472
|
-
_def(a, h,
|
|
3522
|
+
_def(a, h, O, M) {
|
|
3473
3523
|
const q = this._scope.toName(h);
|
|
3474
|
-
return
|
|
3524
|
+
return O !== void 0 && M && (this._constants[q.str] = O), this._leafNode(new o(a, q, O)), q;
|
|
3475
3525
|
}
|
|
3476
3526
|
// `const` declaration (`var` in es5 mode)
|
|
3477
|
-
const(a, h,
|
|
3478
|
-
return this._def(r.varKinds.const, a, h,
|
|
3527
|
+
const(a, h, O) {
|
|
3528
|
+
return this._def(r.varKinds.const, a, h, O);
|
|
3479
3529
|
}
|
|
3480
3530
|
// `let` declaration with optional assignment (`var` in es5 mode)
|
|
3481
|
-
let(a, h,
|
|
3482
|
-
return this._def(r.varKinds.let, a, h,
|
|
3531
|
+
let(a, h, O) {
|
|
3532
|
+
return this._def(r.varKinds.let, a, h, O);
|
|
3483
3533
|
}
|
|
3484
3534
|
// `var` declaration with optional assignment
|
|
3485
|
-
var(a, h,
|
|
3486
|
-
return this._def(r.varKinds.var, a, h,
|
|
3535
|
+
var(a, h, O) {
|
|
3536
|
+
return this._def(r.varKinds.var, a, h, O);
|
|
3487
3537
|
}
|
|
3488
3538
|
// assignment code
|
|
3489
|
-
assign(a, h,
|
|
3490
|
-
return this._leafNode(new l(a, h,
|
|
3539
|
+
assign(a, h, O) {
|
|
3540
|
+
return this._leafNode(new l(a, h, O));
|
|
3491
3541
|
}
|
|
3492
3542
|
// `+=` code
|
|
3493
3543
|
add(a, h) {
|
|
@@ -3495,22 +3545,22 @@ var scope = {};
|
|
|
3495
3545
|
}
|
|
3496
3546
|
// appends passed SafeExpr to code or executes Block
|
|
3497
3547
|
code(a) {
|
|
3498
|
-
return typeof a == "function" ? a() : a !== t.nil && this._leafNode(new
|
|
3548
|
+
return typeof a == "function" ? a() : a !== t.nil && this._leafNode(new N(a)), this;
|
|
3499
3549
|
}
|
|
3500
3550
|
// returns code for object literal for the passed argument list of key-value pairs
|
|
3501
3551
|
object(...a) {
|
|
3502
3552
|
const h = ["{"];
|
|
3503
|
-
for (const [
|
|
3504
|
-
h.length > 1 && h.push(","), h.push(
|
|
3553
|
+
for (const [O, M] of a)
|
|
3554
|
+
h.length > 1 && h.push(","), h.push(O), (O !== M || this.opts.es5) && (h.push(":"), (0, t.addCodeArg)(h, M));
|
|
3505
3555
|
return h.push("}"), new t._Code(h);
|
|
3506
3556
|
}
|
|
3507
3557
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
3508
|
-
if(a, h,
|
|
3509
|
-
if (this._blockNode(new _(a)), h &&
|
|
3510
|
-
this.code(h).else().code(
|
|
3558
|
+
if(a, h, O) {
|
|
3559
|
+
if (this._blockNode(new _(a)), h && O)
|
|
3560
|
+
this.code(h).else().code(O).endIf();
|
|
3511
3561
|
else if (h)
|
|
3512
3562
|
this.code(h).endIf();
|
|
3513
|
-
else if (
|
|
3563
|
+
else if (O)
|
|
3514
3564
|
throw new Error('CodeGen: "else" body without "then" body');
|
|
3515
3565
|
return this;
|
|
3516
3566
|
}
|
|
@@ -3534,28 +3584,28 @@ var scope = {};
|
|
|
3534
3584
|
return this._for(new b(a), h);
|
|
3535
3585
|
}
|
|
3536
3586
|
// `for` statement for a range of values
|
|
3537
|
-
forRange(a, h,
|
|
3587
|
+
forRange(a, h, O, M, q = this.opts.es5 ? r.varKinds.var : r.varKinds.let) {
|
|
3538
3588
|
const x = this._scope.toName(a);
|
|
3539
|
-
return this._for(new I(q, x, h,
|
|
3589
|
+
return this._for(new I(q, x, h, O), () => M(x));
|
|
3540
3590
|
}
|
|
3541
3591
|
// `for-of` statement (in es5 mode replace with a normal for loop)
|
|
3542
|
-
forOf(a, h,
|
|
3592
|
+
forOf(a, h, O, M = r.varKinds.const) {
|
|
3543
3593
|
const q = this._scope.toName(a);
|
|
3544
3594
|
if (this.opts.es5) {
|
|
3545
3595
|
const x = h instanceof t.Name ? h : this.var("_arr", h);
|
|
3546
3596
|
return this.forRange("_i", 0, (0, t._)`${x}.length`, (W) => {
|
|
3547
|
-
this.var(q, (0, t._)`${x}[${W}]`),
|
|
3597
|
+
this.var(q, (0, t._)`${x}[${W}]`), O(q);
|
|
3548
3598
|
});
|
|
3549
3599
|
}
|
|
3550
|
-
return this._for(new A("of", M, q, h), () =>
|
|
3600
|
+
return this._for(new A("of", M, q, h), () => O(q));
|
|
3551
3601
|
}
|
|
3552
3602
|
// `for-in` statement.
|
|
3553
3603
|
// With option `ownProperties` replaced with a `for-of` loop for object keys
|
|
3554
|
-
forIn(a, h,
|
|
3604
|
+
forIn(a, h, O, M = this.opts.es5 ? r.varKinds.var : r.varKinds.const) {
|
|
3555
3605
|
if (this.opts.ownProperties)
|
|
3556
|
-
return this.forOf(a, (0, t._)`Object.keys(${h})`,
|
|
3606
|
+
return this.forOf(a, (0, t._)`Object.keys(${h})`, O);
|
|
3557
3607
|
const q = this._scope.toName(a);
|
|
3558
|
-
return this._for(new A("in", M, q, h), () =>
|
|
3608
|
+
return this._for(new A("in", M, q, h), () => O(q));
|
|
3559
3609
|
}
|
|
3560
3610
|
// end `for` loop
|
|
3561
3611
|
endFor() {
|
|
@@ -3577,15 +3627,15 @@ var scope = {};
|
|
|
3577
3627
|
return this._endBlockNode(k);
|
|
3578
3628
|
}
|
|
3579
3629
|
// `try` statement
|
|
3580
|
-
try(a, h,
|
|
3581
|
-
if (!h && !
|
|
3630
|
+
try(a, h, O) {
|
|
3631
|
+
if (!h && !O)
|
|
3582
3632
|
throw new Error('CodeGen: "try" without "catch" and "finally"');
|
|
3583
3633
|
const M = new D();
|
|
3584
3634
|
if (this._blockNode(M), this.code(a), h) {
|
|
3585
3635
|
const q = this.name("e");
|
|
3586
3636
|
this._currNode = M.catch = new V(q), h(q);
|
|
3587
3637
|
}
|
|
3588
|
-
return
|
|
3638
|
+
return O && (this._currNode = M.finally = new z(), this.code(O)), this._endBlockNode(V, z);
|
|
3589
3639
|
}
|
|
3590
3640
|
// `throw` statement
|
|
3591
3641
|
throw(a) {
|
|
@@ -3600,14 +3650,14 @@ var scope = {};
|
|
|
3600
3650
|
const h = this._blockStarts.pop();
|
|
3601
3651
|
if (h === void 0)
|
|
3602
3652
|
throw new Error("CodeGen: not in self-balancing block");
|
|
3603
|
-
const
|
|
3604
|
-
if (
|
|
3605
|
-
throw new Error(`CodeGen: wrong number of nodes: ${
|
|
3653
|
+
const O = this._nodes.length - h;
|
|
3654
|
+
if (O < 0 || a !== void 0 && O !== a)
|
|
3655
|
+
throw new Error(`CodeGen: wrong number of nodes: ${O} vs ${a} expected`);
|
|
3606
3656
|
return this._nodes.length = h, this;
|
|
3607
3657
|
}
|
|
3608
3658
|
// `function` heading (or definition if funcBody is passed)
|
|
3609
|
-
func(a, h = t.nil,
|
|
3610
|
-
return this._blockNode(new w(a, h,
|
|
3659
|
+
func(a, h = t.nil, O, M) {
|
|
3660
|
+
return this._blockNode(new w(a, h, O)), M && this.code(M).endFunc(), this;
|
|
3611
3661
|
}
|
|
3612
3662
|
// end function definition
|
|
3613
3663
|
endFunc() {
|
|
@@ -3624,8 +3674,8 @@ var scope = {};
|
|
|
3624
3674
|
this._currNode.nodes.push(a), this._nodes.push(a);
|
|
3625
3675
|
}
|
|
3626
3676
|
_endBlockNode(a, h) {
|
|
3627
|
-
const
|
|
3628
|
-
if (
|
|
3677
|
+
const O = this._currNode;
|
|
3678
|
+
if (O instanceof a || h && O instanceof h)
|
|
3629
3679
|
return this._nodes.pop(), this;
|
|
3630
3680
|
throw new Error(`CodeGen: not in block "${h ? `${a.kind}/${h.kind}` : a.kind}"`);
|
|
3631
3681
|
}
|
|
@@ -3648,21 +3698,21 @@ var scope = {};
|
|
|
3648
3698
|
}
|
|
3649
3699
|
}
|
|
3650
3700
|
e.CodeGen = X;
|
|
3651
|
-
function G(
|
|
3701
|
+
function G(E, a) {
|
|
3652
3702
|
for (const h in a)
|
|
3653
|
-
|
|
3654
|
-
return
|
|
3655
|
-
}
|
|
3656
|
-
function de(
|
|
3657
|
-
return a instanceof t._CodeOrName ? G(
|
|
3658
|
-
}
|
|
3659
|
-
function
|
|
3660
|
-
if (
|
|
3661
|
-
return
|
|
3662
|
-
if (!M(
|
|
3663
|
-
return
|
|
3664
|
-
return new t._Code(
|
|
3665
|
-
function
|
|
3703
|
+
E[h] = (E[h] || 0) + (a[h] || 0);
|
|
3704
|
+
return E;
|
|
3705
|
+
}
|
|
3706
|
+
function de(E, a) {
|
|
3707
|
+
return a instanceof t._CodeOrName ? G(E, a.names) : E;
|
|
3708
|
+
}
|
|
3709
|
+
function ne(E, a, h) {
|
|
3710
|
+
if (E instanceof t.Name)
|
|
3711
|
+
return O(E);
|
|
3712
|
+
if (!M(E))
|
|
3713
|
+
return E;
|
|
3714
|
+
return new t._Code(E._items.reduce((q, x) => (x instanceof t.Name && (x = O(x)), x instanceof t._Code ? q.push(...x._items) : q.push(x), q), []));
|
|
3715
|
+
function O(q) {
|
|
3666
3716
|
const x = h[q.str];
|
|
3667
3717
|
return x === void 0 || a[q.str] !== 1 ? q : (delete a[q.str], x);
|
|
3668
3718
|
}
|
|
@@ -3670,29 +3720,29 @@ var scope = {};
|
|
|
3670
3720
|
return q instanceof t._Code && q._items.some((x) => x instanceof t.Name && a[x.str] === 1 && h[x.str] !== void 0);
|
|
3671
3721
|
}
|
|
3672
3722
|
}
|
|
3673
|
-
function Se(
|
|
3723
|
+
function Se(E, a) {
|
|
3674
3724
|
for (const h in a)
|
|
3675
|
-
|
|
3725
|
+
E[h] = (E[h] || 0) - (a[h] || 0);
|
|
3676
3726
|
}
|
|
3677
|
-
function Te(
|
|
3678
|
-
return typeof
|
|
3727
|
+
function Te(E) {
|
|
3728
|
+
return typeof E == "boolean" || typeof E == "number" || E === null ? !E : (0, t._)`!${j(E)}`;
|
|
3679
3729
|
}
|
|
3680
3730
|
e.not = Te;
|
|
3681
|
-
const
|
|
3682
|
-
function
|
|
3683
|
-
return
|
|
3731
|
+
const Oe = v(e.operators.AND);
|
|
3732
|
+
function He(...E) {
|
|
3733
|
+
return E.reduce(Oe);
|
|
3684
3734
|
}
|
|
3685
|
-
e.and =
|
|
3686
|
-
const
|
|
3687
|
-
function F(...
|
|
3688
|
-
return
|
|
3735
|
+
e.and = He;
|
|
3736
|
+
const Ie = v(e.operators.OR);
|
|
3737
|
+
function F(...E) {
|
|
3738
|
+
return E.reduce(Ie);
|
|
3689
3739
|
}
|
|
3690
3740
|
e.or = F;
|
|
3691
|
-
function v(
|
|
3692
|
-
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${
|
|
3741
|
+
function v(E) {
|
|
3742
|
+
return (a, h) => a === t.nil ? h : h === t.nil ? a : (0, t._)`${j(a)} ${E} ${j(h)}`;
|
|
3693
3743
|
}
|
|
3694
|
-
function j(
|
|
3695
|
-
return
|
|
3744
|
+
function j(E) {
|
|
3745
|
+
return E instanceof t.Name ? E : (0, t._)`(${E})`;
|
|
3696
3746
|
}
|
|
3697
3747
|
})(codegen);
|
|
3698
3748
|
var util = {};
|
|
@@ -3714,9 +3764,9 @@ var util = {};
|
|
|
3714
3764
|
const { opts: D, self: V } = w;
|
|
3715
3765
|
if (!D.strictSchema || typeof k == "boolean")
|
|
3716
3766
|
return;
|
|
3717
|
-
const
|
|
3767
|
+
const z = V.RULES.keywords;
|
|
3718
3768
|
for (const X in k)
|
|
3719
|
-
|
|
3769
|
+
z[X] || A(w, `unknown keyword: "${X}"`);
|
|
3720
3770
|
}
|
|
3721
3771
|
e.checkUnknownRules = i;
|
|
3722
3772
|
function o(w, k) {
|
|
@@ -3737,8 +3787,8 @@ var util = {};
|
|
|
3737
3787
|
return !1;
|
|
3738
3788
|
}
|
|
3739
3789
|
e.schemaHasRulesButRef = l;
|
|
3740
|
-
function d({ topSchemaRef: w, schemaPath: k }, D, V,
|
|
3741
|
-
if (!
|
|
3790
|
+
function d({ topSchemaRef: w, schemaPath: k }, D, V, z) {
|
|
3791
|
+
if (!z) {
|
|
3742
3792
|
if (typeof D == "number" || typeof D == "boolean")
|
|
3743
3793
|
return D;
|
|
3744
3794
|
if (typeof D == "string")
|
|
@@ -3748,7 +3798,7 @@ var util = {};
|
|
|
3748
3798
|
}
|
|
3749
3799
|
e.schemaRefOrVal = d;
|
|
3750
3800
|
function u(w) {
|
|
3751
|
-
return
|
|
3801
|
+
return N(decodeURIComponent(w));
|
|
3752
3802
|
}
|
|
3753
3803
|
e.unescapeFragment = u;
|
|
3754
3804
|
function f(w) {
|
|
@@ -3759,10 +3809,10 @@ var util = {};
|
|
|
3759
3809
|
return typeof w == "number" ? `${w}` : w.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3760
3810
|
}
|
|
3761
3811
|
e.escapeJsonPointer = g;
|
|
3762
|
-
function
|
|
3812
|
+
function N(w) {
|
|
3763
3813
|
return w.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
3764
3814
|
}
|
|
3765
|
-
e.unescapeJsonPointer =
|
|
3815
|
+
e.unescapeJsonPointer = N;
|
|
3766
3816
|
function C(w, k) {
|
|
3767
3817
|
if (Array.isArray(w))
|
|
3768
3818
|
for (const D of w)
|
|
@@ -3772,9 +3822,9 @@ var util = {};
|
|
|
3772
3822
|
}
|
|
3773
3823
|
e.eachItem = C;
|
|
3774
3824
|
function S({ mergeNames: w, mergeToName: k, mergeValues: D, resultToName: V }) {
|
|
3775
|
-
return (
|
|
3776
|
-
const
|
|
3777
|
-
return de === t.Name && !(
|
|
3825
|
+
return (z, X, G, de) => {
|
|
3826
|
+
const ne = G === void 0 ? X : G instanceof t.Name ? (X instanceof t.Name ? w(z, X, G) : k(z, X, G), G) : X instanceof t.Name ? (k(z, G, X), X) : D(X, G);
|
|
3827
|
+
return de === t.Name && !(ne instanceof t.Name) ? V(z, ne) : ne;
|
|
3778
3828
|
};
|
|
3779
3829
|
}
|
|
3780
3830
|
e.mergeEvaluated = {
|
|
@@ -3911,9 +3961,9 @@ names$1.default = names;
|
|
|
3911
3961
|
};
|
|
3912
3962
|
function g(y, _, $) {
|
|
3913
3963
|
const { createErrors: b } = y.it;
|
|
3914
|
-
return b === !1 ? (0, t._)`{}` :
|
|
3964
|
+
return b === !1 ? (0, t._)`{}` : N(y, _, $);
|
|
3915
3965
|
}
|
|
3916
|
-
function
|
|
3966
|
+
function N(y, _, $ = {}) {
|
|
3917
3967
|
const { gen: b, it: I } = y, A = [
|
|
3918
3968
|
C(I, $),
|
|
3919
3969
|
S(y, $)
|
|
@@ -3929,8 +3979,8 @@ names$1.default = names;
|
|
|
3929
3979
|
return $ && (I = (0, t.str)`${I}${(0, r.getErrorPath)($, r.Type.Str)}`), [f.schemaPath, I];
|
|
3930
3980
|
}
|
|
3931
3981
|
function R(y, { params: _, message: $ }, b) {
|
|
3932
|
-
const { keyword: I, data: A, schemaValue: w, it: k } = y, { opts: D, propertyName: V, topSchemaRef:
|
|
3933
|
-
b.push([f.keyword, I], [f.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), D.messages && b.push([f.message, typeof $ == "function" ? $(y) : $]), D.verbose && b.push([f.schema, w], [f.parentSchema, (0, t._)`${
|
|
3982
|
+
const { keyword: I, data: A, schemaValue: w, it: k } = y, { opts: D, propertyName: V, topSchemaRef: z, schemaPath: X } = k;
|
|
3983
|
+
b.push([f.keyword, I], [f.params, typeof _ == "function" ? _(y) : _ || (0, t._)`{}`]), D.messages && b.push([f.message, typeof $ == "function" ? $(y) : $]), D.verbose && b.push([f.schema, w], [f.parentSchema, (0, t._)`${z}${X}`], [n.default.data, A]), V && b.push([f.propertyName, V]);
|
|
3934
3984
|
}
|
|
3935
3985
|
})(errors);
|
|
3936
3986
|
Object.defineProperty(boolSchema, "__esModule", { value: !0 });
|
|
@@ -4032,9 +4082,9 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4032
4082
|
function u(b, I) {
|
|
4033
4083
|
const { gen: A, data: w, opts: k } = b, D = g(I, k.coerceTypes), V = I.length > 0 && !(D.length === 0 && I.length === 1 && (0, r.schemaHasRulesForType)(b, I[0]));
|
|
4034
4084
|
if (V) {
|
|
4035
|
-
const
|
|
4036
|
-
A.if(
|
|
4037
|
-
D.length ?
|
|
4085
|
+
const z = R(I, w, k.strictNumbers, o.Wrong);
|
|
4086
|
+
A.if(z, () => {
|
|
4087
|
+
D.length ? N(b, I, D) : _(b);
|
|
4038
4088
|
});
|
|
4039
4089
|
}
|
|
4040
4090
|
return V;
|
|
@@ -4044,36 +4094,36 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4044
4094
|
function g(b, I) {
|
|
4045
4095
|
return I ? b.filter((A) => f.has(A) || I === "array" && A === "array") : [];
|
|
4046
4096
|
}
|
|
4047
|
-
function
|
|
4048
|
-
const { gen: w, data: k, opts: D } = b, V = w.let("dataType", (0, s._)`typeof ${k}`),
|
|
4049
|
-
D.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${k}) && ${k}.length == 1`, () => w.assign(k, (0, s._)`${k}[0]`).assign(V, (0, s._)`typeof ${k}`).if(R(I, k, D.strictNumbers), () => w.assign(
|
|
4097
|
+
function N(b, I, A) {
|
|
4098
|
+
const { gen: w, data: k, opts: D } = b, V = w.let("dataType", (0, s._)`typeof ${k}`), z = w.let("coerced", (0, s._)`undefined`);
|
|
4099
|
+
D.coerceTypes === "array" && w.if((0, s._)`${V} == 'object' && Array.isArray(${k}) && ${k}.length == 1`, () => w.assign(k, (0, s._)`${k}[0]`).assign(V, (0, s._)`typeof ${k}`).if(R(I, k, D.strictNumbers), () => w.assign(z, k))), w.if((0, s._)`${z} !== undefined`);
|
|
4050
4100
|
for (const G of A)
|
|
4051
4101
|
(f.has(G) || G === "array" && D.coerceTypes === "array") && X(G);
|
|
4052
|
-
w.else(), _(b), w.endIf(), w.if((0, s._)`${
|
|
4053
|
-
w.assign(k,
|
|
4102
|
+
w.else(), _(b), w.endIf(), w.if((0, s._)`${z} !== undefined`, () => {
|
|
4103
|
+
w.assign(k, z), C(b, z);
|
|
4054
4104
|
});
|
|
4055
4105
|
function X(G) {
|
|
4056
4106
|
switch (G) {
|
|
4057
4107
|
case "string":
|
|
4058
|
-
w.elseIf((0, s._)`${V} == "number" || ${V} == "boolean"`).assign(
|
|
4108
|
+
w.elseIf((0, s._)`${V} == "number" || ${V} == "boolean"`).assign(z, (0, s._)`"" + ${k}`).elseIf((0, s._)`${k} === null`).assign(z, (0, s._)`""`);
|
|
4059
4109
|
return;
|
|
4060
4110
|
case "number":
|
|
4061
4111
|
w.elseIf((0, s._)`${V} == "boolean" || ${k} === null
|
|
4062
|
-
|| (${V} == "string" && ${k} && ${k} == +${k})`).assign(
|
|
4112
|
+
|| (${V} == "string" && ${k} && ${k} == +${k})`).assign(z, (0, s._)`+${k}`);
|
|
4063
4113
|
return;
|
|
4064
4114
|
case "integer":
|
|
4065
4115
|
w.elseIf((0, s._)`${V} === "boolean" || ${k} === null
|
|
4066
|
-
|| (${V} === "string" && ${k} && ${k} == +${k} && !(${k} % 1))`).assign(
|
|
4116
|
+
|| (${V} === "string" && ${k} && ${k} == +${k} && !(${k} % 1))`).assign(z, (0, s._)`+${k}`);
|
|
4067
4117
|
return;
|
|
4068
4118
|
case "boolean":
|
|
4069
|
-
w.elseIf((0, s._)`${k} === "false" || ${k} === 0 || ${k} === null`).assign(
|
|
4119
|
+
w.elseIf((0, s._)`${k} === "false" || ${k} === 0 || ${k} === null`).assign(z, !1).elseIf((0, s._)`${k} === "true" || ${k} === 1`).assign(z, !0);
|
|
4070
4120
|
return;
|
|
4071
4121
|
case "null":
|
|
4072
|
-
w.elseIf((0, s._)`${k} === "" || ${k} === 0 || ${k} === false`), w.assign(
|
|
4122
|
+
w.elseIf((0, s._)`${k} === "" || ${k} === 0 || ${k} === false`), w.assign(z, null);
|
|
4073
4123
|
return;
|
|
4074
4124
|
case "array":
|
|
4075
4125
|
w.elseIf((0, s._)`${V} === "string" || ${V} === "number"
|
|
4076
|
-
|| ${V} === "boolean" || ${k} === null`).assign(
|
|
4126
|
+
|| ${V} === "boolean" || ${k} === null`).assign(z, (0, s._)`[${k}]`);
|
|
4077
4127
|
}
|
|
4078
4128
|
}
|
|
4079
4129
|
}
|
|
@@ -4102,8 +4152,8 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
4102
4152
|
return (0, s._)`typeof ${I} ${k} ${b}`;
|
|
4103
4153
|
}
|
|
4104
4154
|
return w === o.Correct ? D : (0, s.not)(D);
|
|
4105
|
-
function V(
|
|
4106
|
-
return (0, s.and)((0, s._)`typeof ${I} == "number"`,
|
|
4155
|
+
function V(z = s.nil) {
|
|
4156
|
+
return (0, s.and)((0, s._)`typeof ${I} == "number"`, z, A ? (0, s._)`isFinite(${I})` : s.nil);
|
|
4107
4157
|
}
|
|
4108
4158
|
}
|
|
4109
4159
|
e.checkDataType = S;
|
|
@@ -4229,8 +4279,8 @@ function callValidateCode({ schemaCode: e, data: t, it: { gen: r, topSchemaRef:
|
|
|
4229
4279
|
[names_1$5.default.rootData, names_1$5.default.rootData]
|
|
4230
4280
|
];
|
|
4231
4281
|
o.opts.dynamicRef && g.push([names_1$5.default.dynamicAnchors, names_1$5.default.dynamicAnchors]);
|
|
4232
|
-
const
|
|
4233
|
-
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${d}, ${
|
|
4282
|
+
const N = (0, codegen_1$q._)`${f}, ${r.object(...g)}`;
|
|
4283
|
+
return d !== codegen_1$q.nil ? (0, codegen_1$q._)`${l}.call(${d}, ${N})` : (0, codegen_1$q._)`${l}(${N})`;
|
|
4234
4284
|
}
|
|
4235
4285
|
code.callValidateCode = callValidateCode;
|
|
4236
4286
|
const newRegExp = (0, codegen_1$q._)`new RegExp`;
|
|
@@ -4300,8 +4350,8 @@ function funcKeywordCode(e, t) {
|
|
|
4300
4350
|
const { gen: n, keyword: s, schema: i, parentSchema: o, $data: l, it: d } = e;
|
|
4301
4351
|
checkAsyncKeyword(d, t);
|
|
4302
4352
|
const u = !l && t.compile ? t.compile.call(d.self, i, o, d) : t.validate, f = useKeyword(n, s, u), g = n.let("valid");
|
|
4303
|
-
e.block$data(g,
|
|
4304
|
-
function
|
|
4353
|
+
e.block$data(g, N), e.ok((r = t.valid) !== null && r !== void 0 ? r : g);
|
|
4354
|
+
function N() {
|
|
4305
4355
|
if (t.errors === !1)
|
|
4306
4356
|
R(), t.modifying && modifyData(e), y(() => e.error());
|
|
4307
4357
|
else {
|
|
@@ -4402,8 +4452,8 @@ function extendSubschemaData(e, t, { dataProp: r, dataPropType: n, data: s, data
|
|
|
4402
4452
|
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
4403
4453
|
const { gen: l } = t;
|
|
4404
4454
|
if (r !== void 0) {
|
|
4405
|
-
const { errorPath: u, dataPathArr: f, opts: g } = t,
|
|
4406
|
-
d(
|
|
4455
|
+
const { errorPath: u, dataPathArr: f, opts: g } = t, N = l.let("data", (0, codegen_1$o._)`${t.data}${(0, codegen_1$o.getProperty)(r)}`, !0);
|
|
4456
|
+
d(N), e.errorPath = (0, codegen_1$o.str)`${u}${(0, util_1$n.getErrorPath)(r, n, g.jsPropertySyntax)}`, e.parentDataProperty = (0, codegen_1$o._)`${r}`, e.dataPathArr = [...f, e.parentDataProperty];
|
|
4407
4457
|
}
|
|
4408
4458
|
if (s !== void 0) {
|
|
4409
4459
|
const u = s instanceof codegen_1$o.Name ? s : l.let("data", s, !0);
|
|
@@ -4511,8 +4561,8 @@ function _traverse(e, t, r, n, s, i, o, l, d, u) {
|
|
|
4511
4561
|
var g = n[f];
|
|
4512
4562
|
if (Array.isArray(g)) {
|
|
4513
4563
|
if (f in traverse$1.arrayKeywords)
|
|
4514
|
-
for (var
|
|
4515
|
-
_traverse(e, t, r, g[
|
|
4564
|
+
for (var N = 0; N < g.length; N++)
|
|
4565
|
+
_traverse(e, t, r, g[N], s + "/" + f + "/" + N, i, s, f, n, N);
|
|
4516
4566
|
} else if (f in traverse$1.propsKeywords) {
|
|
4517
4567
|
if (g && typeof g == "object")
|
|
4518
4568
|
for (var C in g)
|
|
@@ -4602,12 +4652,12 @@ function getSchemaRefs(e, t) {
|
|
|
4602
4652
|
if (typeof e == "boolean")
|
|
4603
4653
|
return {};
|
|
4604
4654
|
const { schemaId: r, uriResolver: n } = this.opts, s = normalizeId(e[r] || t), i = { "": s }, o = getFullPath(n, s, !1), l = {}, d = /* @__PURE__ */ new Set();
|
|
4605
|
-
return traverse(e, { allKeys: !0 }, (g,
|
|
4655
|
+
return traverse(e, { allKeys: !0 }, (g, N, C, S) => {
|
|
4606
4656
|
if (S === void 0)
|
|
4607
4657
|
return;
|
|
4608
|
-
const R = o +
|
|
4658
|
+
const R = o + N;
|
|
4609
4659
|
let y = i[S];
|
|
4610
|
-
typeof g[r] == "string" && (y = _.call(this, g[r])), $.call(this, g.$anchor), $.call(this, g.$dynamicAnchor), i[
|
|
4660
|
+
typeof g[r] == "string" && (y = _.call(this, g[r])), $.call(this, g.$anchor), $.call(this, g.$dynamicAnchor), i[N] = y;
|
|
4611
4661
|
function _(b) {
|
|
4612
4662
|
const I = this.opts.uriResolver.resolve;
|
|
4613
4663
|
if (b = normalizeId(y ? I(y, b) : b), d.has(b))
|
|
@@ -4624,8 +4674,8 @@ function getSchemaRefs(e, t) {
|
|
|
4624
4674
|
}
|
|
4625
4675
|
}
|
|
4626
4676
|
}), l;
|
|
4627
|
-
function u(g,
|
|
4628
|
-
if (
|
|
4677
|
+
function u(g, N, C) {
|
|
4678
|
+
if (N !== void 0 && !equal$2(g, N))
|
|
4629
4679
|
throw f(C);
|
|
4630
4680
|
}
|
|
4631
4681
|
function f(g) {
|
|
@@ -4745,12 +4795,12 @@ function schemaKeywords(e, t, r, n) {
|
|
|
4745
4795
|
return;
|
|
4746
4796
|
}
|
|
4747
4797
|
d.jtd || checkStrictTypes(e, t), s.block(() => {
|
|
4748
|
-
for (const
|
|
4749
|
-
g(
|
|
4798
|
+
for (const N of f.rules)
|
|
4799
|
+
g(N);
|
|
4750
4800
|
g(f.post);
|
|
4751
4801
|
});
|
|
4752
|
-
function g(
|
|
4753
|
-
(0, applicability_1.shouldUseGroup)(i,
|
|
4802
|
+
function g(N) {
|
|
4803
|
+
(0, applicability_1.shouldUseGroup)(i, N) && (N.type ? (s.if((0, dataType_2.checkDataType)(N.type, o, d.strictNumbers)), iterateKeywords(e, N), t.length === 1 && t[0] === N.type && r && (s.else(), (0, dataType_2.reportTypeError)(e)), s.endIf()) : iterateKeywords(e, N), l || s.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${n || 0}`));
|
|
4754
4804
|
}
|
|
4755
4805
|
}
|
|
4756
4806
|
function iterateKeywords(e, t) {
|
|
@@ -5147,8 +5197,8 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5147
5197
|
c[m] = arguments[m];
|
|
5148
5198
|
if (c.length > 1) {
|
|
5149
5199
|
c[0] = c[0].slice(0, -1);
|
|
5150
|
-
for (var T = c.length - 1,
|
|
5151
|
-
c[
|
|
5200
|
+
for (var T = c.length - 1, P = 1; P < T; ++P)
|
|
5201
|
+
c[P] = c[P].slice(1, -1);
|
|
5152
5202
|
return c[T] = c[T].slice(1), c.join("");
|
|
5153
5203
|
} else
|
|
5154
5204
|
return c[0];
|
|
@@ -5173,39 +5223,39 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5173
5223
|
return m;
|
|
5174
5224
|
}
|
|
5175
5225
|
function u(p) {
|
|
5176
|
-
var c = "[A-Za-z]", m = "[0-9]", T = n(m, "[A-Fa-f]"),
|
|
5177
|
-
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(
|
|
5178
|
-
var J = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m),
|
|
5179
|
-
s("[vV]" + T + "+\\." + n(B, U, "[\\:]") + "+"), s(s(
|
|
5180
|
-
var
|
|
5181
|
-
return s(s(
|
|
5226
|
+
var c = "[A-Za-z]", m = "[0-9]", T = n(m, "[A-Fa-f]"), P = s(s("%[EFef]" + T + "%" + T + T + "%" + T + T) + "|" + s("%[89A-Fa-f]" + T + "%" + T + T) + "|" + s("%" + T + T)), L = "[\\:\\/\\?\\#\\[\\]\\@]", U = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", K = n(L, U), Q = p ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]", te = p ? "[\\uE000-\\uF8FF]" : "[]", B = n(c, m, "[\\-\\.\\_\\~]", Q);
|
|
5227
|
+
s(c + n(c, m, "[\\+\\-\\.]") + "*"), s(s(P + "|" + n(B, U, "[\\:]")) + "*");
|
|
5228
|
+
var J = s(s("25[0-5]") + "|" + s("2[0-4]" + m) + "|" + s("1" + m + m) + "|" + s("0?[1-9]" + m) + "|0?0?" + m), re = s(J + "\\." + J + "\\." + J + "\\." + J), H = s(T + "{1,4}"), Z = s(s(H + "\\:" + H) + "|" + re), se = s(s(H + "\\:") + "{6}" + Z), Y = s("\\:\\:" + s(H + "\\:") + "{5}" + Z), be = s(s(H) + "?\\:\\:" + s(H + "\\:") + "{4}" + Z), _e = s(s(s(H + "\\:") + "{0,1}" + H) + "?\\:\\:" + s(H + "\\:") + "{3}" + Z), ge = s(s(s(H + "\\:") + "{0,2}" + H) + "?\\:\\:" + s(H + "\\:") + "{2}" + Z), Le = s(s(s(H + "\\:") + "{0,3}" + H) + "?\\:\\:" + H + "\\:" + Z), Ce = s(s(s(H + "\\:") + "{0,4}" + H) + "?\\:\\:" + Z), pe = s(s(s(H + "\\:") + "{0,5}" + H) + "?\\:\\:" + H), $e = s(s(s(H + "\\:") + "{0,6}" + H) + "?\\:\\:"), Ne = s([se, Y, be, _e, ge, Le, Ce, pe, $e].join("|")), ve = s(s(B + "|" + P) + "+");
|
|
5229
|
+
s("[vV]" + T + "+\\." + n(B, U, "[\\:]") + "+"), s(s(P + "|" + n(B, U)) + "*");
|
|
5230
|
+
var Qe = s(P + "|" + n(B, U, "[\\:\\@]"));
|
|
5231
|
+
return s(s(P + "|" + n(B, U, "[\\@]")) + "+"), s(s(Qe + "|" + n("[\\/\\?]", te)) + "*"), {
|
|
5182
5232
|
NOT_SCHEME: new RegExp(n("[^]", c, m, "[\\+\\-\\.]"), "g"),
|
|
5183
5233
|
NOT_USERINFO: new RegExp(n("[^\\%\\:]", B, U), "g"),
|
|
5184
5234
|
NOT_HOST: new RegExp(n("[^\\%\\[\\]\\:]", B, U), "g"),
|
|
5185
5235
|
NOT_PATH: new RegExp(n("[^\\%\\/\\:\\@]", B, U), "g"),
|
|
5186
5236
|
NOT_PATH_NOSCHEME: new RegExp(n("[^\\%\\/\\@]", B, U), "g"),
|
|
5187
|
-
NOT_QUERY: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]",
|
|
5237
|
+
NOT_QUERY: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]", te), "g"),
|
|
5188
5238
|
NOT_FRAGMENT: new RegExp(n("[^\\%]", B, U, "[\\:\\@\\/\\?]"), "g"),
|
|
5189
5239
|
ESCAPE: new RegExp(n("[^]", B, U), "g"),
|
|
5190
5240
|
UNRESERVED: new RegExp(B, "g"),
|
|
5191
5241
|
OTHER_CHARS: new RegExp(n("[^\\%]", B, K), "g"),
|
|
5192
|
-
PCT_ENCODED: new RegExp(
|
|
5193
|
-
IPV4ADDRESS: new RegExp("^(" +
|
|
5194
|
-
IPV6ADDRESS: new RegExp("^\\[?(" +
|
|
5242
|
+
PCT_ENCODED: new RegExp(P, "g"),
|
|
5243
|
+
IPV4ADDRESS: new RegExp("^(" + re + ")$"),
|
|
5244
|
+
IPV6ADDRESS: new RegExp("^\\[?(" + Ne + ")" + s(s("\\%25|\\%(?!" + T + "{2})") + "(" + ve + ")") + "?\\]?$")
|
|
5195
5245
|
//RFC 6874, with relaxed parsing rules
|
|
5196
5246
|
};
|
|
5197
5247
|
}
|
|
5198
|
-
var f = u(!1), g = u(!0),
|
|
5248
|
+
var f = u(!1), g = u(!0), N = function() {
|
|
5199
5249
|
function p(c, m) {
|
|
5200
|
-
var T = [],
|
|
5250
|
+
var T = [], P = !0, L = !1, U = void 0;
|
|
5201
5251
|
try {
|
|
5202
|
-
for (var K = c[Symbol.iterator](), Q; !(
|
|
5252
|
+
for (var K = c[Symbol.iterator](), Q; !(P = (Q = K.next()).done) && (T.push(Q.value), !(m && T.length === m)); P = !0)
|
|
5203
5253
|
;
|
|
5204
|
-
} catch (
|
|
5205
|
-
L = !0, U =
|
|
5254
|
+
} catch (te) {
|
|
5255
|
+
L = !0, U = te;
|
|
5206
5256
|
} finally {
|
|
5207
5257
|
try {
|
|
5208
|
-
!
|
|
5258
|
+
!P && K.return && K.return();
|
|
5209
5259
|
} finally {
|
|
5210
5260
|
if (L)
|
|
5211
5261
|
throw U;
|
|
@@ -5227,13 +5277,13 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5227
5277
|
return m;
|
|
5228
5278
|
} else
|
|
5229
5279
|
return Array.from(p);
|
|
5230
|
-
}, S = 2147483647, R = 36, y = 1, _ = 26, $ = 38, b = 700, I = 72, A = 128, w = "-", k = /^xn--/, D = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g,
|
|
5280
|
+
}, S = 2147483647, R = 36, y = 1, _ = 26, $ = 38, b = 700, I = 72, A = 128, w = "-", k = /^xn--/, D = /[^\0-\x7E]/, V = /[\x2E\u3002\uFF0E\uFF61]/g, z = {
|
|
5231
5281
|
overflow: "Overflow: input needs wider integers to process",
|
|
5232
5282
|
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
5233
5283
|
"invalid-input": "Invalid input"
|
|
5234
5284
|
}, X = R - y, G = Math.floor, de = String.fromCharCode;
|
|
5235
|
-
function
|
|
5236
|
-
throw new RangeError(
|
|
5285
|
+
function ne(p) {
|
|
5286
|
+
throw new RangeError(z[p]);
|
|
5237
5287
|
}
|
|
5238
5288
|
function Se(p, c) {
|
|
5239
5289
|
for (var m = [], T = p.length; T--; )
|
|
@@ -5243,131 +5293,131 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5243
5293
|
function Te(p, c) {
|
|
5244
5294
|
var m = p.split("@"), T = "";
|
|
5245
5295
|
m.length > 1 && (T = m[0] + "@", p = m[1]), p = p.replace(V, ".");
|
|
5246
|
-
var
|
|
5296
|
+
var P = p.split("."), L = Se(P, c).join(".");
|
|
5247
5297
|
return T + L;
|
|
5248
5298
|
}
|
|
5249
|
-
function
|
|
5299
|
+
function Oe(p) {
|
|
5250
5300
|
for (var c = [], m = 0, T = p.length; m < T; ) {
|
|
5251
|
-
var
|
|
5252
|
-
if (
|
|
5301
|
+
var P = p.charCodeAt(m++);
|
|
5302
|
+
if (P >= 55296 && P <= 56319 && m < T) {
|
|
5253
5303
|
var L = p.charCodeAt(m++);
|
|
5254
|
-
(L & 64512) == 56320 ? c.push(((
|
|
5304
|
+
(L & 64512) == 56320 ? c.push(((P & 1023) << 10) + (L & 1023) + 65536) : (c.push(P), m--);
|
|
5255
5305
|
} else
|
|
5256
|
-
c.push(
|
|
5306
|
+
c.push(P);
|
|
5257
5307
|
}
|
|
5258
5308
|
return c;
|
|
5259
5309
|
}
|
|
5260
|
-
var
|
|
5310
|
+
var He = function(c) {
|
|
5261
5311
|
return String.fromCodePoint.apply(String, C(c));
|
|
5262
|
-
},
|
|
5312
|
+
}, Ie = function(c) {
|
|
5263
5313
|
return c - 48 < 10 ? c - 22 : c - 65 < 26 ? c - 65 : c - 97 < 26 ? c - 97 : R;
|
|
5264
5314
|
}, F = function(c, m) {
|
|
5265
5315
|
return c + 22 + 75 * (c < 26) - ((m != 0) << 5);
|
|
5266
5316
|
}, v = function(c, m, T) {
|
|
5267
|
-
var
|
|
5317
|
+
var P = 0;
|
|
5268
5318
|
for (
|
|
5269
5319
|
c = T ? G(c / b) : c >> 1, c += G(c / m);
|
|
5270
5320
|
/* no initialization */
|
|
5271
5321
|
c > X * _ >> 1;
|
|
5272
|
-
|
|
5322
|
+
P += R
|
|
5273
5323
|
)
|
|
5274
5324
|
c = G(c / X);
|
|
5275
|
-
return G(
|
|
5325
|
+
return G(P + (X + 1) * c / (c + $));
|
|
5276
5326
|
}, j = function(c) {
|
|
5277
|
-
var m = [], T = c.length,
|
|
5327
|
+
var m = [], T = c.length, P = 0, L = A, U = I, K = c.lastIndexOf(w);
|
|
5278
5328
|
K < 0 && (K = 0);
|
|
5279
5329
|
for (var Q = 0; Q < K; ++Q)
|
|
5280
|
-
c.charCodeAt(Q) >= 128 &&
|
|
5281
|
-
for (var
|
|
5330
|
+
c.charCodeAt(Q) >= 128 && ne("not-basic"), m.push(c.charCodeAt(Q));
|
|
5331
|
+
for (var te = K > 0 ? K + 1 : 0; te < T; ) {
|
|
5282
5332
|
for (
|
|
5283
|
-
var B =
|
|
5333
|
+
var B = P, J = 1, re = R;
|
|
5284
5334
|
;
|
|
5285
5335
|
/* no condition */
|
|
5286
|
-
|
|
5336
|
+
re += R
|
|
5287
5337
|
) {
|
|
5288
|
-
|
|
5289
|
-
var
|
|
5290
|
-
(
|
|
5291
|
-
var Z =
|
|
5292
|
-
if (
|
|
5338
|
+
te >= T && ne("invalid-input");
|
|
5339
|
+
var H = Ie(c.charCodeAt(te++));
|
|
5340
|
+
(H >= R || H > G((S - P) / J)) && ne("overflow"), P += H * J;
|
|
5341
|
+
var Z = re <= U ? y : re >= U + _ ? _ : re - U;
|
|
5342
|
+
if (H < Z)
|
|
5293
5343
|
break;
|
|
5294
|
-
var
|
|
5295
|
-
J > G(S /
|
|
5344
|
+
var se = R - Z;
|
|
5345
|
+
J > G(S / se) && ne("overflow"), J *= se;
|
|
5296
5346
|
}
|
|
5297
5347
|
var Y = m.length + 1;
|
|
5298
|
-
U = v(
|
|
5348
|
+
U = v(P - B, Y, B == 0), G(P / Y) > S - L && ne("overflow"), L += G(P / Y), P %= Y, m.splice(P++, 0, L);
|
|
5299
5349
|
}
|
|
5300
5350
|
return String.fromCodePoint.apply(String, m);
|
|
5301
|
-
},
|
|
5351
|
+
}, E = function(c) {
|
|
5302
5352
|
var m = [];
|
|
5303
|
-
c =
|
|
5304
|
-
var T = c.length,
|
|
5353
|
+
c = Oe(c);
|
|
5354
|
+
var T = c.length, P = A, L = 0, U = I, K = !0, Q = !1, te = void 0;
|
|
5305
5355
|
try {
|
|
5306
5356
|
for (var B = c[Symbol.iterator](), J; !(K = (J = B.next()).done); K = !0) {
|
|
5307
|
-
var
|
|
5308
|
-
|
|
5357
|
+
var re = J.value;
|
|
5358
|
+
re < 128 && m.push(de(re));
|
|
5309
5359
|
}
|
|
5310
|
-
} catch (
|
|
5311
|
-
Q = !0,
|
|
5360
|
+
} catch (Ze) {
|
|
5361
|
+
Q = !0, te = Ze;
|
|
5312
5362
|
} finally {
|
|
5313
5363
|
try {
|
|
5314
5364
|
!K && B.return && B.return();
|
|
5315
5365
|
} finally {
|
|
5316
5366
|
if (Q)
|
|
5317
|
-
throw
|
|
5367
|
+
throw te;
|
|
5318
5368
|
}
|
|
5319
5369
|
}
|
|
5320
|
-
var
|
|
5321
|
-
for (
|
|
5322
|
-
var
|
|
5370
|
+
var H = m.length, Z = H;
|
|
5371
|
+
for (H && m.push(w); Z < T; ) {
|
|
5372
|
+
var se = S, Y = !0, be = !1, _e = void 0;
|
|
5323
5373
|
try {
|
|
5324
|
-
for (var
|
|
5325
|
-
var Ce =
|
|
5326
|
-
Ce >=
|
|
5374
|
+
for (var ge = c[Symbol.iterator](), Le; !(Y = (Le = ge.next()).done); Y = !0) {
|
|
5375
|
+
var Ce = Le.value;
|
|
5376
|
+
Ce >= P && Ce < se && (se = Ce);
|
|
5327
5377
|
}
|
|
5328
|
-
} catch (
|
|
5329
|
-
|
|
5378
|
+
} catch (Ze) {
|
|
5379
|
+
be = !0, _e = Ze;
|
|
5330
5380
|
} finally {
|
|
5331
5381
|
try {
|
|
5332
|
-
!Y &&
|
|
5382
|
+
!Y && ge.return && ge.return();
|
|
5333
5383
|
} finally {
|
|
5334
|
-
if (
|
|
5335
|
-
throw
|
|
5384
|
+
if (be)
|
|
5385
|
+
throw _e;
|
|
5336
5386
|
}
|
|
5337
5387
|
}
|
|
5338
5388
|
var pe = Z + 1;
|
|
5339
|
-
|
|
5340
|
-
var
|
|
5389
|
+
se - P > G((S - L) / pe) && ne("overflow"), L += (se - P) * pe, P = se;
|
|
5390
|
+
var $e = !0, Ne = !1, ve = void 0;
|
|
5341
5391
|
try {
|
|
5342
|
-
for (var
|
|
5343
|
-
var
|
|
5344
|
-
if (
|
|
5392
|
+
for (var Qe = c[Symbol.iterator](), Rt; !($e = (Rt = Qe.next()).done); $e = !0) {
|
|
5393
|
+
var kt = Rt.value;
|
|
5394
|
+
if (kt < P && ++L > S && ne("overflow"), kt == P) {
|
|
5345
5395
|
for (
|
|
5346
|
-
var
|
|
5396
|
+
var et = L, tt = R;
|
|
5347
5397
|
;
|
|
5348
5398
|
/* no condition */
|
|
5349
|
-
|
|
5399
|
+
tt += R
|
|
5350
5400
|
) {
|
|
5351
|
-
var
|
|
5352
|
-
if (
|
|
5401
|
+
var rt = tt <= U ? y : tt >= U + _ ? _ : tt - U;
|
|
5402
|
+
if (et < rt)
|
|
5353
5403
|
break;
|
|
5354
|
-
var
|
|
5355
|
-
m.push(de(F(
|
|
5404
|
+
var Ct = et - rt, Nt = R - rt;
|
|
5405
|
+
m.push(de(F(rt + Ct % Nt, 0))), et = G(Ct / Nt);
|
|
5356
5406
|
}
|
|
5357
|
-
m.push(de(F(
|
|
5407
|
+
m.push(de(F(et, 0))), U = v(L, pe, Z == H), L = 0, ++Z;
|
|
5358
5408
|
}
|
|
5359
5409
|
}
|
|
5360
|
-
} catch (
|
|
5361
|
-
|
|
5410
|
+
} catch (Ze) {
|
|
5411
|
+
Ne = !0, ve = Ze;
|
|
5362
5412
|
} finally {
|
|
5363
5413
|
try {
|
|
5364
|
-
|
|
5414
|
+
!$e && Qe.return && Qe.return();
|
|
5365
5415
|
} finally {
|
|
5366
|
-
if (
|
|
5367
|
-
throw
|
|
5416
|
+
if (Ne)
|
|
5417
|
+
throw ve;
|
|
5368
5418
|
}
|
|
5369
5419
|
}
|
|
5370
|
-
++L, ++
|
|
5420
|
+
++L, ++P;
|
|
5371
5421
|
}
|
|
5372
5422
|
return m.join("");
|
|
5373
5423
|
}, a = function(c) {
|
|
@@ -5376,9 +5426,9 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5376
5426
|
});
|
|
5377
5427
|
}, h = function(c) {
|
|
5378
5428
|
return Te(c, function(m) {
|
|
5379
|
-
return D.test(m) ? "xn--" +
|
|
5429
|
+
return D.test(m) ? "xn--" + E(m) : m;
|
|
5380
5430
|
});
|
|
5381
|
-
},
|
|
5431
|
+
}, O = {
|
|
5382
5432
|
/**
|
|
5383
5433
|
* A string representing the current Punycode.js version number.
|
|
5384
5434
|
* @memberOf punycode
|
|
@@ -5393,11 +5443,11 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5393
5443
|
* @type Object
|
|
5394
5444
|
*/
|
|
5395
5445
|
ucs2: {
|
|
5396
|
-
decode:
|
|
5397
|
-
encode:
|
|
5446
|
+
decode: Oe,
|
|
5447
|
+
encode: He
|
|
5398
5448
|
},
|
|
5399
5449
|
decode: j,
|
|
5400
|
-
encode:
|
|
5450
|
+
encode: E,
|
|
5401
5451
|
toASCII: h,
|
|
5402
5452
|
toUnicode: a
|
|
5403
5453
|
}, M = {};
|
|
@@ -5407,20 +5457,20 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5407
5457
|
}
|
|
5408
5458
|
function x(p) {
|
|
5409
5459
|
for (var c = "", m = 0, T = p.length; m < T; ) {
|
|
5410
|
-
var
|
|
5411
|
-
if (
|
|
5412
|
-
c += String.fromCharCode(
|
|
5413
|
-
else if (
|
|
5460
|
+
var P = parseInt(p.substr(m + 1, 2), 16);
|
|
5461
|
+
if (P < 128)
|
|
5462
|
+
c += String.fromCharCode(P), m += 3;
|
|
5463
|
+
else if (P >= 194 && P < 224) {
|
|
5414
5464
|
if (T - m >= 6) {
|
|
5415
5465
|
var L = parseInt(p.substr(m + 4, 2), 16);
|
|
5416
|
-
c += String.fromCharCode((
|
|
5466
|
+
c += String.fromCharCode((P & 31) << 6 | L & 63);
|
|
5417
5467
|
} else
|
|
5418
5468
|
c += p.substr(m, 6);
|
|
5419
5469
|
m += 6;
|
|
5420
|
-
} else if (
|
|
5470
|
+
} else if (P >= 224) {
|
|
5421
5471
|
if (T - m >= 9) {
|
|
5422
5472
|
var U = parseInt(p.substr(m + 4, 2), 16), K = parseInt(p.substr(m + 7, 2), 16);
|
|
5423
|
-
c += String.fromCharCode((
|
|
5473
|
+
c += String.fromCharCode((P & 15) << 12 | (U & 63) << 6 | K & 63);
|
|
5424
5474
|
} else
|
|
5425
5475
|
c += p.substr(m, 9);
|
|
5426
5476
|
m += 9;
|
|
@@ -5431,54 +5481,54 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5431
5481
|
}
|
|
5432
5482
|
function W(p, c) {
|
|
5433
5483
|
function m(T) {
|
|
5434
|
-
var
|
|
5435
|
-
return
|
|
5484
|
+
var P = x(T);
|
|
5485
|
+
return P.match(c.UNRESERVED) ? P : T;
|
|
5436
5486
|
}
|
|
5437
5487
|
return p.scheme && (p.scheme = String(p.scheme).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_SCHEME, "")), p.userinfo !== void 0 && (p.userinfo = String(p.userinfo).replace(c.PCT_ENCODED, m).replace(c.NOT_USERINFO, q).replace(c.PCT_ENCODED, o)), p.host !== void 0 && (p.host = String(p.host).replace(c.PCT_ENCODED, m).toLowerCase().replace(c.NOT_HOST, q).replace(c.PCT_ENCODED, o)), p.path !== void 0 && (p.path = String(p.path).replace(c.PCT_ENCODED, m).replace(p.scheme ? c.NOT_PATH : c.NOT_PATH_NOSCHEME, q).replace(c.PCT_ENCODED, o)), p.query !== void 0 && (p.query = String(p.query).replace(c.PCT_ENCODED, m).replace(c.NOT_QUERY, q).replace(c.PCT_ENCODED, o)), p.fragment !== void 0 && (p.fragment = String(p.fragment).replace(c.PCT_ENCODED, m).replace(c.NOT_FRAGMENT, q).replace(c.PCT_ENCODED, o)), p;
|
|
5438
5488
|
}
|
|
5439
|
-
function
|
|
5489
|
+
function ee(p) {
|
|
5440
5490
|
return p.replace(/^0*(.*)/, "$1") || "0";
|
|
5441
5491
|
}
|
|
5442
|
-
function
|
|
5443
|
-
var m = p.match(c.IPV4ADDRESS) || [], T =
|
|
5444
|
-
return
|
|
5445
|
-
}
|
|
5446
|
-
function
|
|
5447
|
-
var m = p.match(c.IPV6ADDRESS) || [], T =
|
|
5448
|
-
if (
|
|
5449
|
-
for (var U =
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
var
|
|
5453
|
-
if (
|
|
5454
|
-
var
|
|
5455
|
-
|
|
5492
|
+
function fe(p, c) {
|
|
5493
|
+
var m = p.match(c.IPV4ADDRESS) || [], T = N(m, 2), P = T[1];
|
|
5494
|
+
return P ? P.split(".").map(ee).join(".") : p;
|
|
5495
|
+
}
|
|
5496
|
+
function je(p, c) {
|
|
5497
|
+
var m = p.match(c.IPV6ADDRESS) || [], T = N(m, 3), P = T[1], L = T[2];
|
|
5498
|
+
if (P) {
|
|
5499
|
+
for (var U = P.toLowerCase().split("::").reverse(), K = N(U, 2), Q = K[0], te = K[1], B = te ? te.split(":").map(ee) : [], J = Q.split(":").map(ee), re = c.IPV4ADDRESS.test(J[J.length - 1]), H = re ? 7 : 8, Z = J.length - H, se = Array(H), Y = 0; Y < H; ++Y)
|
|
5500
|
+
se[Y] = B[Y] || J[Z + Y] || "";
|
|
5501
|
+
re && (se[H - 1] = fe(se[H - 1], c));
|
|
5502
|
+
var be = se.reduce(function(pe, $e, Ne) {
|
|
5503
|
+
if (!$e || $e === "0") {
|
|
5504
|
+
var ve = pe[pe.length - 1];
|
|
5505
|
+
ve && ve.index + ve.length === Ne ? ve.length++ : pe.push({ index: Ne, length: 1 });
|
|
5456
5506
|
}
|
|
5457
5507
|
return pe;
|
|
5458
|
-
}, []),
|
|
5459
|
-
return
|
|
5460
|
-
})[0],
|
|
5461
|
-
if (
|
|
5462
|
-
var
|
|
5463
|
-
|
|
5508
|
+
}, []), _e = be.sort(function(pe, $e) {
|
|
5509
|
+
return $e.length - pe.length;
|
|
5510
|
+
})[0], ge = void 0;
|
|
5511
|
+
if (_e && _e.length > 1) {
|
|
5512
|
+
var Le = se.slice(0, _e.index), Ce = se.slice(_e.index + _e.length);
|
|
5513
|
+
ge = Le.join(":") + "::" + Ce.join(":");
|
|
5464
5514
|
} else
|
|
5465
|
-
|
|
5466
|
-
return L && (
|
|
5515
|
+
ge = se.join(":");
|
|
5516
|
+
return L && (ge += "%" + L), ge;
|
|
5467
5517
|
} else
|
|
5468
5518
|
return p;
|
|
5469
5519
|
}
|
|
5470
|
-
var
|
|
5520
|
+
var ze = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i, xe = "".match(/(){0}/)[1] === void 0;
|
|
5471
5521
|
function le(p) {
|
|
5472
5522
|
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = {}, T = c.iri !== !1 ? g : f;
|
|
5473
5523
|
c.reference === "suffix" && (p = (c.scheme ? c.scheme + ":" : "") + "//" + p);
|
|
5474
|
-
var
|
|
5475
|
-
if (
|
|
5476
|
-
|
|
5524
|
+
var P = p.match(ze);
|
|
5525
|
+
if (P) {
|
|
5526
|
+
xe ? (m.scheme = P[1], m.userinfo = P[3], m.host = P[4], m.port = parseInt(P[5], 10), m.path = P[6] || "", m.query = P[7], m.fragment = P[8], isNaN(m.port) && (m.port = P[5])) : (m.scheme = P[1] || void 0, m.userinfo = p.indexOf("@") !== -1 ? P[3] : void 0, m.host = p.indexOf("//") !== -1 ? P[4] : void 0, m.port = parseInt(P[5], 10), m.path = P[6] || "", m.query = p.indexOf("?") !== -1 ? P[7] : void 0, m.fragment = p.indexOf("#") !== -1 ? P[8] : void 0, isNaN(m.port) && (m.port = p.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? P[4] : void 0)), m.host && (m.host = je(fe(m.host, T), T)), m.scheme === void 0 && m.userinfo === void 0 && m.host === void 0 && m.port === void 0 && !m.path && m.query === void 0 ? m.reference = "same-document" : m.scheme === void 0 ? m.reference = "relative" : m.fragment === void 0 ? m.reference = "absolute" : m.reference = "uri", c.reference && c.reference !== "suffix" && c.reference !== m.reference && (m.error = m.error || "URI is not a " + c.reference + " reference.");
|
|
5477
5527
|
var L = M[(c.scheme || m.scheme || "").toLowerCase()];
|
|
5478
5528
|
if (!c.unicodeSupport && (!L || !L.unicodeSupport)) {
|
|
5479
5529
|
if (m.host && (c.domainHost || L && L.domainHost))
|
|
5480
5530
|
try {
|
|
5481
|
-
m.host =
|
|
5531
|
+
m.host = O.toASCII(m.host.replace(T.PCT_ENCODED, x).toLowerCase());
|
|
5482
5532
|
} catch (U) {
|
|
5483
5533
|
m.error = m.error || "Host's domain name can not be converted to ASCII via punycode: " + U;
|
|
5484
5534
|
}
|
|
@@ -5490,25 +5540,25 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5490
5540
|
m.error = m.error || "URI can not be parsed.";
|
|
5491
5541
|
return m;
|
|
5492
5542
|
}
|
|
5493
|
-
function
|
|
5543
|
+
function Be(p, c) {
|
|
5494
5544
|
var m = c.iri !== !1 ? g : f, T = [];
|
|
5495
|
-
return p.userinfo !== void 0 && (T.push(p.userinfo), T.push("@")), p.host !== void 0 && T.push(
|
|
5545
|
+
return p.userinfo !== void 0 && (T.push(p.userinfo), T.push("@")), p.host !== void 0 && T.push(je(fe(String(p.host), m), m).replace(m.IPV6ADDRESS, function(P, L, U) {
|
|
5496
5546
|
return "[" + L + (U ? "%25" + U : "") + "]";
|
|
5497
5547
|
})), (typeof p.port == "number" || typeof p.port == "string") && (T.push(":"), T.push(String(p.port))), T.length ? T.join("") : void 0;
|
|
5498
5548
|
}
|
|
5499
|
-
var
|
|
5500
|
-
function
|
|
5549
|
+
var De = /^\.\.?\//, Ae = /^\/\.(\/|$)/, Fe = /^\/\.\.(\/|$)/, We = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5550
|
+
function he(p) {
|
|
5501
5551
|
for (var c = []; p.length; )
|
|
5502
|
-
if (p.match(
|
|
5503
|
-
p = p.replace(
|
|
5552
|
+
if (p.match(De))
|
|
5553
|
+
p = p.replace(De, "");
|
|
5554
|
+
else if (p.match(Ae))
|
|
5555
|
+
p = p.replace(Ae, "/");
|
|
5504
5556
|
else if (p.match(Fe))
|
|
5505
|
-
p = p.replace(Fe, "/");
|
|
5506
|
-
else if (p.match(Me))
|
|
5507
|
-
p = p.replace(Me, "/"), c.pop();
|
|
5557
|
+
p = p.replace(Fe, "/"), c.pop();
|
|
5508
5558
|
else if (p === "." || p === "..")
|
|
5509
5559
|
p = "";
|
|
5510
5560
|
else {
|
|
5511
|
-
var m = p.match(
|
|
5561
|
+
var m = p.match(We);
|
|
5512
5562
|
if (m) {
|
|
5513
5563
|
var T = m[0];
|
|
5514
5564
|
p = p.slice(T.length), c.push(T);
|
|
@@ -5517,39 +5567,39 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5517
5567
|
}
|
|
5518
5568
|
return c.join("");
|
|
5519
5569
|
}
|
|
5520
|
-
function
|
|
5521
|
-
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? g : f, T = [],
|
|
5522
|
-
if (
|
|
5523
|
-
if (c.domainHost ||
|
|
5570
|
+
function ae(p) {
|
|
5571
|
+
var c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, m = c.iri ? g : f, T = [], P = M[(c.scheme || p.scheme || "").toLowerCase()];
|
|
5572
|
+
if (P && P.serialize && P.serialize(p, c), p.host && !m.IPV6ADDRESS.test(p.host)) {
|
|
5573
|
+
if (c.domainHost || P && P.domainHost)
|
|
5524
5574
|
try {
|
|
5525
|
-
p.host = c.iri ?
|
|
5575
|
+
p.host = c.iri ? O.toUnicode(p.host) : O.toASCII(p.host.replace(m.PCT_ENCODED, x).toLowerCase());
|
|
5526
5576
|
} catch (K) {
|
|
5527
5577
|
p.error = p.error || "Host's domain name can not be converted to " + (c.iri ? "Unicode" : "ASCII") + " via punycode: " + K;
|
|
5528
5578
|
}
|
|
5529
5579
|
}
|
|
5530
5580
|
W(p, m), c.reference !== "suffix" && p.scheme && (T.push(p.scheme), T.push(":"));
|
|
5531
|
-
var L =
|
|
5581
|
+
var L = Be(p, c);
|
|
5532
5582
|
if (L !== void 0 && (c.reference !== "suffix" && T.push("//"), T.push(L), p.path && p.path.charAt(0) !== "/" && T.push("/")), p.path !== void 0) {
|
|
5533
5583
|
var U = p.path;
|
|
5534
|
-
!c.absolutePath && (!
|
|
5584
|
+
!c.absolutePath && (!P || !P.absolutePath) && (U = he(U)), L === void 0 && (U = U.replace(/^\/\//, "/%2F")), T.push(U);
|
|
5535
5585
|
}
|
|
5536
5586
|
return p.query !== void 0 && (T.push("?"), T.push(p.query)), p.fragment !== void 0 && (T.push("#"), T.push(p.fragment)), T.join("");
|
|
5537
5587
|
}
|
|
5538
|
-
function
|
|
5539
|
-
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, T = arguments[3],
|
|
5540
|
-
return T || (p = le(
|
|
5588
|
+
function Me(p, c) {
|
|
5589
|
+
var m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, T = arguments[3], P = {};
|
|
5590
|
+
return T || (p = le(ae(p, m), m), c = le(ae(c, m), m)), m = m || {}, !m.tolerant && c.scheme ? (P.scheme = c.scheme, P.userinfo = c.userinfo, P.host = c.host, P.port = c.port, P.path = he(c.path || ""), P.query = c.query) : (c.userinfo !== void 0 || c.host !== void 0 || c.port !== void 0 ? (P.userinfo = c.userinfo, P.host = c.host, P.port = c.port, P.path = he(c.path || ""), P.query = c.query) : (c.path ? (c.path.charAt(0) === "/" ? P.path = he(c.path) : ((p.userinfo !== void 0 || p.host !== void 0 || p.port !== void 0) && !p.path ? P.path = "/" + c.path : p.path ? P.path = p.path.slice(0, p.path.lastIndexOf("/") + 1) + c.path : P.path = c.path, P.path = he(P.path)), P.query = c.query) : (P.path = p.path, c.query !== void 0 ? P.query = c.query : P.query = p.query), P.userinfo = p.userinfo, P.host = p.host, P.port = p.port), P.scheme = p.scheme), P.fragment = c.fragment, P;
|
|
5541
5591
|
}
|
|
5542
|
-
function
|
|
5592
|
+
function Ge(p, c, m) {
|
|
5543
5593
|
var T = d({ scheme: "null" }, m);
|
|
5544
|
-
return
|
|
5594
|
+
return ae(Me(le(p, T), le(c, T), T, !0), T);
|
|
5545
5595
|
}
|
|
5546
5596
|
function Re(p, c) {
|
|
5547
|
-
return typeof p == "string" ? p =
|
|
5597
|
+
return typeof p == "string" ? p = ae(le(p, c), c) : i(p) === "object" && (p = le(ae(p, c), c)), p;
|
|
5548
5598
|
}
|
|
5549
|
-
function
|
|
5550
|
-
return typeof p == "string" ? p =
|
|
5599
|
+
function Ke(p, c, m) {
|
|
5600
|
+
return typeof p == "string" ? p = ae(le(p, m), m) : i(p) === "object" && (p = ae(p, m)), typeof c == "string" ? c = ae(le(c, m), m) : i(c) === "object" && (c = ae(c, m)), p === c;
|
|
5551
5601
|
}
|
|
5552
|
-
function
|
|
5602
|
+
function Xe(p, c) {
|
|
5553
5603
|
return p && p.toString().replace(!c || !c.iri ? f.ESCAPE : g.ESCAPE, q);
|
|
5554
5604
|
}
|
|
5555
5605
|
function ue(p, c) {
|
|
@@ -5565,50 +5615,50 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5565
5615
|
var T = String(c.scheme).toLowerCase() === "https";
|
|
5566
5616
|
return (c.port === (T ? 443 : 80) || c.port === "") && (c.port = void 0), c.path || (c.path = "/"), c;
|
|
5567
5617
|
}
|
|
5568
|
-
},
|
|
5618
|
+
}, yt = {
|
|
5569
5619
|
scheme: "https",
|
|
5570
5620
|
domainHost: ke.domainHost,
|
|
5571
5621
|
parse: ke.parse,
|
|
5572
5622
|
serialize: ke.serialize
|
|
5573
5623
|
};
|
|
5574
|
-
function
|
|
5624
|
+
function vt(p) {
|
|
5575
5625
|
return typeof p.secure == "boolean" ? p.secure : String(p.scheme).toLowerCase() === "wss";
|
|
5576
5626
|
}
|
|
5577
|
-
var
|
|
5627
|
+
var Je = {
|
|
5578
5628
|
scheme: "ws",
|
|
5579
5629
|
domainHost: !0,
|
|
5580
5630
|
parse: function(c, m) {
|
|
5581
5631
|
var T = c;
|
|
5582
|
-
return T.secure =
|
|
5632
|
+
return T.secure = vt(T), T.resourceName = (T.path || "/") + (T.query ? "?" + T.query : ""), T.path = void 0, T.query = void 0, T;
|
|
5583
5633
|
},
|
|
5584
5634
|
serialize: function(c, m) {
|
|
5585
|
-
if ((c.port === (
|
|
5586
|
-
var T = c.resourceName.split("?"),
|
|
5635
|
+
if ((c.port === (vt(c) ? 443 : 80) || c.port === "") && (c.port = void 0), typeof c.secure == "boolean" && (c.scheme = c.secure ? "wss" : "ws", c.secure = void 0), c.resourceName) {
|
|
5636
|
+
var T = c.resourceName.split("?"), P = N(T, 2), L = P[0], U = P[1];
|
|
5587
5637
|
c.path = L && L !== "/" ? L : void 0, c.query = U, c.resourceName = void 0;
|
|
5588
5638
|
}
|
|
5589
5639
|
return c.fragment = void 0, c;
|
|
5590
5640
|
}
|
|
5591
|
-
},
|
|
5641
|
+
}, wt = {
|
|
5592
5642
|
scheme: "wss",
|
|
5593
|
-
domainHost:
|
|
5594
|
-
parse:
|
|
5595
|
-
serialize:
|
|
5596
|
-
},
|
|
5597
|
-
function
|
|
5643
|
+
domainHost: Je.domainHost,
|
|
5644
|
+
parse: Je.parse,
|
|
5645
|
+
serialize: Je.serialize
|
|
5646
|
+
}, xt = {}, bt = "[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]", me = "[0-9A-Fa-f]", Bt = s(s("%[EFef]" + me + "%" + me + me + "%" + me + me) + "|" + s("%[89A-Fa-f]" + me + "%" + me + me) + "|" + s("%" + me + me)), Wt = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]", Gt = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]", Kt = n(Gt, '[\\"\\\\]'), Jt = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]", Qt = new RegExp(bt, "g"), qe = new RegExp(Bt, "g"), Zt = new RegExp(n("[^]", Wt, "[\\.]", '[\\"]', Kt), "g"), Et = new RegExp(n("[^]", bt, Jt), "g"), Yt = Et;
|
|
5647
|
+
function _t(p) {
|
|
5598
5648
|
var c = x(p);
|
|
5599
|
-
return c.match(
|
|
5649
|
+
return c.match(Qt) ? c : p;
|
|
5600
5650
|
}
|
|
5601
|
-
var
|
|
5651
|
+
var Pt = {
|
|
5602
5652
|
scheme: "mailto",
|
|
5603
5653
|
parse: function(c, m) {
|
|
5604
|
-
var T = c,
|
|
5654
|
+
var T = c, P = T.to = T.path ? T.path.split(",") : [];
|
|
5605
5655
|
if (T.path = void 0, T.query) {
|
|
5606
|
-
for (var L = !1, U = {}, K = T.query.split("&"), Q = 0,
|
|
5656
|
+
for (var L = !1, U = {}, K = T.query.split("&"), Q = 0, te = K.length; Q < te; ++Q) {
|
|
5607
5657
|
var B = K[Q].split("=");
|
|
5608
5658
|
switch (B[0]) {
|
|
5609
5659
|
case "to":
|
|
5610
|
-
for (var J = B[1].split(","),
|
|
5611
|
-
|
|
5660
|
+
for (var J = B[1].split(","), re = 0, H = J.length; re < H; ++re)
|
|
5661
|
+
P.push(J[re]);
|
|
5612
5662
|
break;
|
|
5613
5663
|
case "subject":
|
|
5614
5664
|
T.subject = ue(B[1], m);
|
|
@@ -5624,70 +5674,70 @@ var uri$1 = {}, uri_all = { exports: {} };
|
|
|
5624
5674
|
L && (T.headers = U);
|
|
5625
5675
|
}
|
|
5626
5676
|
T.query = void 0;
|
|
5627
|
-
for (var Z = 0,
|
|
5628
|
-
var Y =
|
|
5677
|
+
for (var Z = 0, se = P.length; Z < se; ++Z) {
|
|
5678
|
+
var Y = P[Z].split("@");
|
|
5629
5679
|
if (Y[0] = ue(Y[0]), m.unicodeSupport)
|
|
5630
5680
|
Y[1] = ue(Y[1], m).toLowerCase();
|
|
5631
5681
|
else
|
|
5632
5682
|
try {
|
|
5633
|
-
Y[1] =
|
|
5634
|
-
} catch (
|
|
5635
|
-
T.error = T.error || "Email address's domain name can not be converted to ASCII via punycode: " +
|
|
5683
|
+
Y[1] = O.toASCII(ue(Y[1], m).toLowerCase());
|
|
5684
|
+
} catch (be) {
|
|
5685
|
+
T.error = T.error || "Email address's domain name can not be converted to ASCII via punycode: " + be;
|
|
5636
5686
|
}
|
|
5637
|
-
|
|
5687
|
+
P[Z] = Y.join("@");
|
|
5638
5688
|
}
|
|
5639
5689
|
return T;
|
|
5640
5690
|
},
|
|
5641
5691
|
serialize: function(c, m) {
|
|
5642
|
-
var T = c,
|
|
5643
|
-
if (
|
|
5644
|
-
for (var L = 0, U =
|
|
5645
|
-
var K = String(
|
|
5692
|
+
var T = c, P = l(c.to);
|
|
5693
|
+
if (P) {
|
|
5694
|
+
for (var L = 0, U = P.length; L < U; ++L) {
|
|
5695
|
+
var K = String(P[L]), Q = K.lastIndexOf("@"), te = K.slice(0, Q).replace(qe, _t).replace(qe, o).replace(Zt, q), B = K.slice(Q + 1);
|
|
5646
5696
|
try {
|
|
5647
|
-
B = m.iri ?
|
|
5697
|
+
B = m.iri ? O.toUnicode(B) : O.toASCII(ue(B, m).toLowerCase());
|
|
5648
5698
|
} catch (Z) {
|
|
5649
5699
|
T.error = T.error || "Email address's domain name can not be converted to " + (m.iri ? "Unicode" : "ASCII") + " via punycode: " + Z;
|
|
5650
5700
|
}
|
|
5651
|
-
|
|
5701
|
+
P[L] = te + "@" + B;
|
|
5652
5702
|
}
|
|
5653
|
-
T.path =
|
|
5703
|
+
T.path = P.join(",");
|
|
5654
5704
|
}
|
|
5655
5705
|
var J = c.headers = c.headers || {};
|
|
5656
5706
|
c.subject && (J.subject = c.subject), c.body && (J.body = c.body);
|
|
5657
|
-
var
|
|
5658
|
-
for (var
|
|
5659
|
-
J[
|
|
5660
|
-
return
|
|
5707
|
+
var re = [];
|
|
5708
|
+
for (var H in J)
|
|
5709
|
+
J[H] !== xt[H] && re.push(H.replace(qe, _t).replace(qe, o).replace(Et, q) + "=" + J[H].replace(qe, _t).replace(qe, o).replace(Yt, q));
|
|
5710
|
+
return re.length && (T.query = re.join("&")), T;
|
|
5661
5711
|
}
|
|
5662
|
-
},
|
|
5712
|
+
}, Xt = /^([^\:]+)\:(.*)/, St = {
|
|
5663
5713
|
scheme: "urn",
|
|
5664
5714
|
parse: function(c, m) {
|
|
5665
|
-
var T = c.path && c.path.match(
|
|
5715
|
+
var T = c.path && c.path.match(Xt), P = c;
|
|
5666
5716
|
if (T) {
|
|
5667
|
-
var L = m.scheme ||
|
|
5668
|
-
|
|
5717
|
+
var L = m.scheme || P.scheme || "urn", U = T[1].toLowerCase(), K = T[2], Q = L + ":" + (m.nid || U), te = M[Q];
|
|
5718
|
+
P.nid = U, P.nss = K, P.path = void 0, te && (P = te.parse(P, m));
|
|
5669
5719
|
} else
|
|
5670
|
-
|
|
5671
|
-
return
|
|
5720
|
+
P.error = P.error || "URN can not be parsed.";
|
|
5721
|
+
return P;
|
|
5672
5722
|
},
|
|
5673
5723
|
serialize: function(c, m) {
|
|
5674
|
-
var T = m.scheme || c.scheme || "urn",
|
|
5724
|
+
var T = m.scheme || c.scheme || "urn", P = c.nid, L = T + ":" + (m.nid || P), U = M[L];
|
|
5675
5725
|
U && (c = U.serialize(c, m));
|
|
5676
5726
|
var K = c, Q = c.nss;
|
|
5677
|
-
return K.path = (
|
|
5727
|
+
return K.path = (P || m.nid) + ":" + Q, K;
|
|
5678
5728
|
}
|
|
5679
|
-
},
|
|
5729
|
+
}, er = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/, Tt = {
|
|
5680
5730
|
scheme: "urn:uuid",
|
|
5681
5731
|
parse: function(c, m) {
|
|
5682
5732
|
var T = c;
|
|
5683
|
-
return T.uuid = T.nss, T.nss = void 0, !m.tolerant && (!T.uuid || !T.uuid.match(
|
|
5733
|
+
return T.uuid = T.nss, T.nss = void 0, !m.tolerant && (!T.uuid || !T.uuid.match(er)) && (T.error = T.error || "UUID is not valid."), T;
|
|
5684
5734
|
},
|
|
5685
5735
|
serialize: function(c, m) {
|
|
5686
5736
|
var T = c;
|
|
5687
5737
|
return T.nss = (c.uuid || "").toLowerCase(), T;
|
|
5688
5738
|
}
|
|
5689
5739
|
};
|
|
5690
|
-
M[ke.scheme] = ke, M[
|
|
5740
|
+
M[ke.scheme] = ke, M[yt.scheme] = yt, M[Je.scheme] = Je, M[wt.scheme] = wt, M[Pt.scheme] = Pt, M[St.scheme] = St, M[Tt.scheme] = Tt, r.SCHEMES = M, r.pctEncChar = q, r.pctDecChars = x, r.parse = le, r.removeDotSegments = he, r.serialize = ae, r.resolveComponents = Me, r.resolve = Ge, r.normalize = Re, r.equal = Ke, r.escapeComponent = Xe, r.unescapeComponent = ue, Object.defineProperty(r, "__esModule", { value: !0 });
|
|
5691
5741
|
});
|
|
5692
5742
|
})(uri_all, uri_all.exports);
|
|
5693
5743
|
var uri_allExports = uri_all.exports;
|
|
@@ -5715,7 +5765,7 @@ uri$1.default = uri;
|
|
|
5715
5765
|
} }), Object.defineProperty(e, "CodeGen", { enumerable: !0, get: function() {
|
|
5716
5766
|
return r.CodeGen;
|
|
5717
5767
|
} });
|
|
5718
|
-
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, f = util, g = require$$9,
|
|
5768
|
+
const n = validation_error, s = ref_error, i = rules, o = compile, l = codegen, d = resolve$1, u = dataType, f = util, g = require$$9, N = uri$1, C = (F, v) => new RegExp(F, v);
|
|
5719
5769
|
C.code = "new RegExp";
|
|
5720
5770
|
const S = ["removeAdditional", "useDefaults", "coerceTypes"], R = /* @__PURE__ */ new Set([
|
|
5721
5771
|
"validate",
|
|
@@ -5753,134 +5803,134 @@ uri$1.default = uri;
|
|
|
5753
5803
|
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
5754
5804
|
}, $ = 200;
|
|
5755
5805
|
function b(F) {
|
|
5756
|
-
var v, j,
|
|
5757
|
-
const Re = F.strict,
|
|
5806
|
+
var v, j, E, a, h, O, M, q, x, W, ee, fe, je, ze, xe, le, Be, De, Ae, Fe, We, he, ae, Me, Ge;
|
|
5807
|
+
const Re = F.strict, Ke = (v = F.code) === null || v === void 0 ? void 0 : v.optimize, Xe = Ke === !0 || Ke === void 0 ? 1 : Ke || 0, ue = (E = (j = F.code) === null || j === void 0 ? void 0 : j.regExp) !== null && E !== void 0 ? E : C, ke = (a = F.uriResolver) !== null && a !== void 0 ? a : N.default;
|
|
5758
5808
|
return {
|
|
5759
|
-
strictSchema: (
|
|
5809
|
+
strictSchema: (O = (h = F.strictSchema) !== null && h !== void 0 ? h : Re) !== null && O !== void 0 ? O : !0,
|
|
5760
5810
|
strictNumbers: (q = (M = F.strictNumbers) !== null && M !== void 0 ? M : Re) !== null && q !== void 0 ? q : !0,
|
|
5761
5811
|
strictTypes: (W = (x = F.strictTypes) !== null && x !== void 0 ? x : Re) !== null && W !== void 0 ? W : "log",
|
|
5762
|
-
strictTuples: (
|
|
5763
|
-
strictRequired: (
|
|
5764
|
-
code: F.code ? { ...F.code, optimize:
|
|
5765
|
-
loopRequired: (
|
|
5812
|
+
strictTuples: (fe = (ee = F.strictTuples) !== null && ee !== void 0 ? ee : Re) !== null && fe !== void 0 ? fe : "log",
|
|
5813
|
+
strictRequired: (ze = (je = F.strictRequired) !== null && je !== void 0 ? je : Re) !== null && ze !== void 0 ? ze : !1,
|
|
5814
|
+
code: F.code ? { ...F.code, optimize: Xe, regExp: ue } : { optimize: Xe, regExp: ue },
|
|
5815
|
+
loopRequired: (xe = F.loopRequired) !== null && xe !== void 0 ? xe : $,
|
|
5766
5816
|
loopEnum: (le = F.loopEnum) !== null && le !== void 0 ? le : $,
|
|
5767
|
-
meta: (
|
|
5768
|
-
messages: (
|
|
5769
|
-
inlineRefs: (
|
|
5770
|
-
schemaId: (
|
|
5771
|
-
addUsedSchema: (
|
|
5772
|
-
validateSchema: (
|
|
5773
|
-
validateFormats: (
|
|
5774
|
-
unicodeRegExp: (
|
|
5775
|
-
int32range: (
|
|
5817
|
+
meta: (Be = F.meta) !== null && Be !== void 0 ? Be : !0,
|
|
5818
|
+
messages: (De = F.messages) !== null && De !== void 0 ? De : !0,
|
|
5819
|
+
inlineRefs: (Ae = F.inlineRefs) !== null && Ae !== void 0 ? Ae : !0,
|
|
5820
|
+
schemaId: (Fe = F.schemaId) !== null && Fe !== void 0 ? Fe : "$id",
|
|
5821
|
+
addUsedSchema: (We = F.addUsedSchema) !== null && We !== void 0 ? We : !0,
|
|
5822
|
+
validateSchema: (he = F.validateSchema) !== null && he !== void 0 ? he : !0,
|
|
5823
|
+
validateFormats: (ae = F.validateFormats) !== null && ae !== void 0 ? ae : !0,
|
|
5824
|
+
unicodeRegExp: (Me = F.unicodeRegExp) !== null && Me !== void 0 ? Me : !0,
|
|
5825
|
+
int32range: (Ge = F.int32range) !== null && Ge !== void 0 ? Ge : !0,
|
|
5776
5826
|
uriResolver: ke
|
|
5777
5827
|
};
|
|
5778
5828
|
}
|
|
5779
5829
|
class I {
|
|
5780
5830
|
constructor(v = {}) {
|
|
5781
5831
|
this.schemas = {}, this.refs = {}, this.formats = {}, this._compilations = /* @__PURE__ */ new Set(), this._loading = {}, this._cache = /* @__PURE__ */ new Map(), v = this.opts = { ...v, ...b(v) };
|
|
5782
|
-
const { es5: j, lines:
|
|
5783
|
-
this.scope = new l.ValueScope({ scope: {}, prefixes: R, es5: j, lines:
|
|
5832
|
+
const { es5: j, lines: E } = this.opts.code;
|
|
5833
|
+
this.scope = new l.ValueScope({ scope: {}, prefixes: R, es5: j, lines: E }), this.logger = G(v.logger);
|
|
5784
5834
|
const a = v.validateFormats;
|
|
5785
|
-
v.validateFormats = !1, this.RULES = (0, i.getRules)(), A.call(this, y, v, "NOT SUPPORTED"), A.call(this, _, v, "DEPRECATED", "warn"), this._metaOpts =
|
|
5835
|
+
v.validateFormats = !1, this.RULES = (0, i.getRules)(), A.call(this, y, v, "NOT SUPPORTED"), A.call(this, _, v, "DEPRECATED", "warn"), this._metaOpts = z.call(this), v.formats && D.call(this), this._addVocabularies(), this._addDefaultMetaSchema(), v.keywords && V.call(this, v.keywords), typeof v.meta == "object" && this.addMetaSchema(v.meta), k.call(this), v.validateFormats = a;
|
|
5786
5836
|
}
|
|
5787
5837
|
_addVocabularies() {
|
|
5788
5838
|
this.addKeyword("$async");
|
|
5789
5839
|
}
|
|
5790
5840
|
_addDefaultMetaSchema() {
|
|
5791
|
-
const { $data: v, meta: j, schemaId:
|
|
5841
|
+
const { $data: v, meta: j, schemaId: E } = this.opts;
|
|
5792
5842
|
let a = g;
|
|
5793
|
-
|
|
5843
|
+
E === "id" && (a = { ...g }, a.id = a.$id, delete a.$id), j && v && this.addMetaSchema(a, a[E], !1);
|
|
5794
5844
|
}
|
|
5795
5845
|
defaultMeta() {
|
|
5796
5846
|
const { meta: v, schemaId: j } = this.opts;
|
|
5797
5847
|
return this.opts.defaultMeta = typeof v == "object" ? v[j] || v : void 0;
|
|
5798
5848
|
}
|
|
5799
5849
|
validate(v, j) {
|
|
5800
|
-
let
|
|
5850
|
+
let E;
|
|
5801
5851
|
if (typeof v == "string") {
|
|
5802
|
-
if (
|
|
5852
|
+
if (E = this.getSchema(v), !E)
|
|
5803
5853
|
throw new Error(`no schema with key or ref "${v}"`);
|
|
5804
5854
|
} else
|
|
5805
|
-
|
|
5806
|
-
const a =
|
|
5807
|
-
return "$async" in
|
|
5855
|
+
E = this.compile(v);
|
|
5856
|
+
const a = E(j);
|
|
5857
|
+
return "$async" in E || (this.errors = E.errors), a;
|
|
5808
5858
|
}
|
|
5809
5859
|
compile(v, j) {
|
|
5810
|
-
const
|
|
5811
|
-
return
|
|
5860
|
+
const E = this._addSchema(v, j);
|
|
5861
|
+
return E.validate || this._compileSchemaEnv(E);
|
|
5812
5862
|
}
|
|
5813
5863
|
compileAsync(v, j) {
|
|
5814
5864
|
if (typeof this.opts.loadSchema != "function")
|
|
5815
5865
|
throw new Error("options.loadSchema should be a function");
|
|
5816
|
-
const { loadSchema:
|
|
5866
|
+
const { loadSchema: E } = this.opts;
|
|
5817
5867
|
return a.call(this, v, j);
|
|
5818
|
-
async function a(W,
|
|
5868
|
+
async function a(W, ee) {
|
|
5819
5869
|
await h.call(this, W.$schema);
|
|
5820
|
-
const
|
|
5821
|
-
return
|
|
5870
|
+
const fe = this._addSchema(W, ee);
|
|
5871
|
+
return fe.validate || O.call(this, fe);
|
|
5822
5872
|
}
|
|
5823
5873
|
async function h(W) {
|
|
5824
5874
|
W && !this.getSchema(W) && await a.call(this, { $ref: W }, !0);
|
|
5825
5875
|
}
|
|
5826
|
-
async function
|
|
5876
|
+
async function O(W) {
|
|
5827
5877
|
try {
|
|
5828
5878
|
return this._compileSchemaEnv(W);
|
|
5829
|
-
} catch (
|
|
5830
|
-
if (!(
|
|
5831
|
-
throw
|
|
5832
|
-
return M.call(this,
|
|
5879
|
+
} catch (ee) {
|
|
5880
|
+
if (!(ee instanceof s.default))
|
|
5881
|
+
throw ee;
|
|
5882
|
+
return M.call(this, ee), await q.call(this, ee.missingSchema), O.call(this, W);
|
|
5833
5883
|
}
|
|
5834
5884
|
}
|
|
5835
|
-
function M({ missingSchema: W, missingRef:
|
|
5885
|
+
function M({ missingSchema: W, missingRef: ee }) {
|
|
5836
5886
|
if (this.refs[W])
|
|
5837
|
-
throw new Error(`AnySchema ${W} is loaded but ${
|
|
5887
|
+
throw new Error(`AnySchema ${W} is loaded but ${ee} cannot be resolved`);
|
|
5838
5888
|
}
|
|
5839
5889
|
async function q(W) {
|
|
5840
|
-
const
|
|
5841
|
-
this.refs[W] || await h.call(this,
|
|
5890
|
+
const ee = await x.call(this, W);
|
|
5891
|
+
this.refs[W] || await h.call(this, ee.$schema), this.refs[W] || this.addSchema(ee, W, j);
|
|
5842
5892
|
}
|
|
5843
5893
|
async function x(W) {
|
|
5844
|
-
const
|
|
5845
|
-
if (
|
|
5846
|
-
return
|
|
5894
|
+
const ee = this._loading[W];
|
|
5895
|
+
if (ee)
|
|
5896
|
+
return ee;
|
|
5847
5897
|
try {
|
|
5848
|
-
return await (this._loading[W] =
|
|
5898
|
+
return await (this._loading[W] = E(W));
|
|
5849
5899
|
} finally {
|
|
5850
5900
|
delete this._loading[W];
|
|
5851
5901
|
}
|
|
5852
5902
|
}
|
|
5853
5903
|
}
|
|
5854
5904
|
// Adds schema to the instance
|
|
5855
|
-
addSchema(v, j,
|
|
5905
|
+
addSchema(v, j, E, a = this.opts.validateSchema) {
|
|
5856
5906
|
if (Array.isArray(v)) {
|
|
5857
|
-
for (const
|
|
5858
|
-
this.addSchema(
|
|
5907
|
+
for (const O of v)
|
|
5908
|
+
this.addSchema(O, void 0, E, a);
|
|
5859
5909
|
return this;
|
|
5860
5910
|
}
|
|
5861
5911
|
let h;
|
|
5862
5912
|
if (typeof v == "object") {
|
|
5863
|
-
const { schemaId:
|
|
5864
|
-
if (h = v[
|
|
5865
|
-
throw new Error(`schema ${
|
|
5913
|
+
const { schemaId: O } = this.opts;
|
|
5914
|
+
if (h = v[O], h !== void 0 && typeof h != "string")
|
|
5915
|
+
throw new Error(`schema ${O} must be string`);
|
|
5866
5916
|
}
|
|
5867
|
-
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v,
|
|
5917
|
+
return j = (0, d.normalizeId)(j || h), this._checkUnique(j), this.schemas[j] = this._addSchema(v, E, j, a, !0), this;
|
|
5868
5918
|
}
|
|
5869
5919
|
// Add schema that will be used to validate other schemas
|
|
5870
5920
|
// options in META_IGNORE_OPTIONS are alway set to false
|
|
5871
|
-
addMetaSchema(v, j,
|
|
5872
|
-
return this.addSchema(v, j, !0,
|
|
5921
|
+
addMetaSchema(v, j, E = this.opts.validateSchema) {
|
|
5922
|
+
return this.addSchema(v, j, !0, E), this;
|
|
5873
5923
|
}
|
|
5874
5924
|
// Validate schema against its meta-schema
|
|
5875
5925
|
validateSchema(v, j) {
|
|
5876
5926
|
if (typeof v == "boolean")
|
|
5877
5927
|
return !0;
|
|
5878
|
-
let
|
|
5879
|
-
if (
|
|
5928
|
+
let E;
|
|
5929
|
+
if (E = v.$schema, E !== void 0 && typeof E != "string")
|
|
5880
5930
|
throw new Error("$schema must be a string");
|
|
5881
|
-
if (
|
|
5931
|
+
if (E = E || this.opts.defaultMeta || this.defaultMeta(), !E)
|
|
5882
5932
|
return this.logger.warn("meta-schema not available"), this.errors = null, !0;
|
|
5883
|
-
const a = this.validate(
|
|
5933
|
+
const a = this.validate(E, v);
|
|
5884
5934
|
if (!a && j) {
|
|
5885
5935
|
const h = "schema is invalid: " + this.errorsText();
|
|
5886
5936
|
if (this.opts.validateSchema === "log")
|
|
@@ -5897,7 +5947,7 @@ uri$1.default = uri;
|
|
|
5897
5947
|
for (; typeof (j = w.call(this, v)) == "string"; )
|
|
5898
5948
|
v = j;
|
|
5899
5949
|
if (j === void 0) {
|
|
5900
|
-
const { schemaId:
|
|
5950
|
+
const { schemaId: E } = this.opts, a = new o.SchemaEnv({ schema: {}, schemaId: E });
|
|
5901
5951
|
if (j = o.resolveSchema.call(this, a, v), !j)
|
|
5902
5952
|
return;
|
|
5903
5953
|
this.refs[v] = j;
|
|
@@ -5921,8 +5971,8 @@ uri$1.default = uri;
|
|
|
5921
5971
|
case "object": {
|
|
5922
5972
|
const j = v;
|
|
5923
5973
|
this._cache.delete(j);
|
|
5924
|
-
let
|
|
5925
|
-
return
|
|
5974
|
+
let E = v[this.opts.schemaId];
|
|
5975
|
+
return E && (E = (0, d.normalizeId)(E), delete this.schemas[E], delete this.refs[E]), this;
|
|
5926
5976
|
}
|
|
5927
5977
|
default:
|
|
5928
5978
|
throw new Error("ajv.removeSchema: invalid parameter");
|
|
@@ -5935,23 +5985,23 @@ uri$1.default = uri;
|
|
|
5935
5985
|
return this;
|
|
5936
5986
|
}
|
|
5937
5987
|
addKeyword(v, j) {
|
|
5938
|
-
let
|
|
5988
|
+
let E;
|
|
5939
5989
|
if (typeof v == "string")
|
|
5940
|
-
|
|
5990
|
+
E = v, typeof j == "object" && (this.logger.warn("these parameters are deprecated, see docs for addKeyword"), j.keyword = E);
|
|
5941
5991
|
else if (typeof v == "object" && j === void 0) {
|
|
5942
|
-
if (j = v,
|
|
5992
|
+
if (j = v, E = j.keyword, Array.isArray(E) && !E.length)
|
|
5943
5993
|
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
5944
5994
|
} else
|
|
5945
5995
|
throw new Error("invalid addKeywords parameters");
|
|
5946
|
-
if (
|
|
5947
|
-
return (0, f.eachItem)(
|
|
5948
|
-
|
|
5996
|
+
if (ne.call(this, E, j), !j)
|
|
5997
|
+
return (0, f.eachItem)(E, (h) => Se.call(this, h)), this;
|
|
5998
|
+
Oe.call(this, j);
|
|
5949
5999
|
const a = {
|
|
5950
6000
|
...j,
|
|
5951
6001
|
type: (0, u.getJSONTypes)(j.type),
|
|
5952
6002
|
schemaType: (0, u.getJSONTypes)(j.schemaType)
|
|
5953
6003
|
};
|
|
5954
|
-
return (0, f.eachItem)(
|
|
6004
|
+
return (0, f.eachItem)(E, a.type.length === 0 ? (h) => Se.call(this, h, a) : (h) => a.type.forEach((O) => Se.call(this, h, a, O))), this;
|
|
5955
6005
|
}
|
|
5956
6006
|
getKeyword(v) {
|
|
5957
6007
|
const j = this.RULES.all[v];
|
|
@@ -5961,9 +6011,9 @@ uri$1.default = uri;
|
|
|
5961
6011
|
removeKeyword(v) {
|
|
5962
6012
|
const { RULES: j } = this;
|
|
5963
6013
|
delete j.keywords[v], delete j.all[v];
|
|
5964
|
-
for (const
|
|
5965
|
-
const a =
|
|
5966
|
-
a >= 0 &&
|
|
6014
|
+
for (const E of j.rules) {
|
|
6015
|
+
const a = E.rules.findIndex((h) => h.keyword === v);
|
|
6016
|
+
a >= 0 && E.rules.splice(a, 1);
|
|
5967
6017
|
}
|
|
5968
6018
|
return this;
|
|
5969
6019
|
}
|
|
@@ -5971,38 +6021,38 @@ uri$1.default = uri;
|
|
|
5971
6021
|
addFormat(v, j) {
|
|
5972
6022
|
return typeof j == "string" && (j = new RegExp(j)), this.formats[v] = j, this;
|
|
5973
6023
|
}
|
|
5974
|
-
errorsText(v = this.errors, { separator: j = ", ", dataVar:
|
|
5975
|
-
return !v || v.length === 0 ? "No errors" : v.map((a) => `${
|
|
6024
|
+
errorsText(v = this.errors, { separator: j = ", ", dataVar: E = "data" } = {}) {
|
|
6025
|
+
return !v || v.length === 0 ? "No errors" : v.map((a) => `${E}${a.instancePath} ${a.message}`).reduce((a, h) => a + j + h);
|
|
5976
6026
|
}
|
|
5977
6027
|
$dataMetaSchema(v, j) {
|
|
5978
|
-
const
|
|
6028
|
+
const E = this.RULES.all;
|
|
5979
6029
|
v = JSON.parse(JSON.stringify(v));
|
|
5980
6030
|
for (const a of j) {
|
|
5981
6031
|
const h = a.split("/").slice(1);
|
|
5982
|
-
let
|
|
6032
|
+
let O = v;
|
|
5983
6033
|
for (const M of h)
|
|
5984
|
-
|
|
5985
|
-
for (const M in
|
|
5986
|
-
const q =
|
|
6034
|
+
O = O[M];
|
|
6035
|
+
for (const M in E) {
|
|
6036
|
+
const q = E[M];
|
|
5987
6037
|
if (typeof q != "object")
|
|
5988
6038
|
continue;
|
|
5989
|
-
const { $data: x } = q.definition, W =
|
|
5990
|
-
x && W && (
|
|
6039
|
+
const { $data: x } = q.definition, W = O[M];
|
|
6040
|
+
x && W && (O[M] = Ie(W));
|
|
5991
6041
|
}
|
|
5992
6042
|
}
|
|
5993
6043
|
return v;
|
|
5994
6044
|
}
|
|
5995
6045
|
_removeAllSchemas(v, j) {
|
|
5996
|
-
for (const
|
|
5997
|
-
const a = v[
|
|
5998
|
-
(!j || j.test(
|
|
6046
|
+
for (const E in v) {
|
|
6047
|
+
const a = v[E];
|
|
6048
|
+
(!j || j.test(E)) && (typeof a == "string" ? delete v[E] : a && !a.meta && (this._cache.delete(a.schema), delete v[E]));
|
|
5999
6049
|
}
|
|
6000
6050
|
}
|
|
6001
|
-
_addSchema(v, j,
|
|
6002
|
-
let
|
|
6051
|
+
_addSchema(v, j, E, a = this.opts.validateSchema, h = this.opts.addUsedSchema) {
|
|
6052
|
+
let O;
|
|
6003
6053
|
const { schemaId: M } = this.opts;
|
|
6004
6054
|
if (typeof v == "object")
|
|
6005
|
-
|
|
6055
|
+
O = v[M];
|
|
6006
6056
|
else {
|
|
6007
6057
|
if (this.opts.jtd)
|
|
6008
6058
|
throw new Error("schema must be object");
|
|
@@ -6012,9 +6062,9 @@ uri$1.default = uri;
|
|
|
6012
6062
|
let q = this._cache.get(v);
|
|
6013
6063
|
if (q !== void 0)
|
|
6014
6064
|
return q;
|
|
6015
|
-
|
|
6016
|
-
const x = d.getSchemaRefs.call(this, v,
|
|
6017
|
-
return q = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId:
|
|
6065
|
+
E = (0, d.normalizeId)(O || E);
|
|
6066
|
+
const x = d.getSchemaRefs.call(this, v, E);
|
|
6067
|
+
return q = new o.SchemaEnv({ schema: v, schemaId: M, meta: j, baseId: E, localRefs: x }), this._cache.set(q.schema, q), h && !E.startsWith("#") && (E && this._checkUnique(E), this.refs[E] = q), a && this.validateSchema(v, !0), q;
|
|
6018
6068
|
}
|
|
6019
6069
|
_checkUnique(v) {
|
|
6020
6070
|
if (this.schemas[v] || this.refs[v])
|
|
@@ -6036,10 +6086,10 @@ uri$1.default = uri;
|
|
|
6036
6086
|
}
|
|
6037
6087
|
}
|
|
6038
6088
|
e.default = I, I.ValidationError = n.default, I.MissingRefError = s.default;
|
|
6039
|
-
function A(F, v, j,
|
|
6089
|
+
function A(F, v, j, E = "error") {
|
|
6040
6090
|
for (const a in F) {
|
|
6041
6091
|
const h = a;
|
|
6042
|
-
h in v && this.logger[
|
|
6092
|
+
h in v && this.logger[E](`${j}: option ${a}. ${F[h]}`);
|
|
6043
6093
|
}
|
|
6044
6094
|
}
|
|
6045
6095
|
function w(F) {
|
|
@@ -6071,7 +6121,7 @@ uri$1.default = uri;
|
|
|
6071
6121
|
j.keyword || (j.keyword = v), this.addKeyword(j);
|
|
6072
6122
|
}
|
|
6073
6123
|
}
|
|
6074
|
-
function
|
|
6124
|
+
function z() {
|
|
6075
6125
|
const F = { ...this.opts };
|
|
6076
6126
|
for (const v of S)
|
|
6077
6127
|
delete F[v];
|
|
@@ -6091,24 +6141,24 @@ uri$1.default = uri;
|
|
|
6091
6141
|
throw new Error("logger must implement log, warn and error methods");
|
|
6092
6142
|
}
|
|
6093
6143
|
const de = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
6094
|
-
function
|
|
6144
|
+
function ne(F, v) {
|
|
6095
6145
|
const { RULES: j } = this;
|
|
6096
|
-
if ((0, f.eachItem)(F, (
|
|
6097
|
-
if (j.keywords[
|
|
6098
|
-
throw new Error(`Keyword ${
|
|
6099
|
-
if (!de.test(
|
|
6100
|
-
throw new Error(`Keyword ${
|
|
6146
|
+
if ((0, f.eachItem)(F, (E) => {
|
|
6147
|
+
if (j.keywords[E])
|
|
6148
|
+
throw new Error(`Keyword ${E} is already defined`);
|
|
6149
|
+
if (!de.test(E))
|
|
6150
|
+
throw new Error(`Keyword ${E} has invalid name`);
|
|
6101
6151
|
}), !!v && v.$data && !("code" in v || "validate" in v))
|
|
6102
6152
|
throw new Error('$data keyword must have "code" or "validate" function');
|
|
6103
6153
|
}
|
|
6104
6154
|
function Se(F, v, j) {
|
|
6105
|
-
var
|
|
6155
|
+
var E;
|
|
6106
6156
|
const a = v == null ? void 0 : v.post;
|
|
6107
6157
|
if (j && a)
|
|
6108
6158
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
6109
6159
|
const { RULES: h } = this;
|
|
6110
|
-
let
|
|
6111
|
-
if (
|
|
6160
|
+
let O = a ? h.post : h.rules.find(({ type: q }) => q === j);
|
|
6161
|
+
if (O || (O = { type: j, rules: [] }, h.rules.push(O)), h.keywords[F] = !0, !v)
|
|
6112
6162
|
return;
|
|
6113
6163
|
const M = {
|
|
6114
6164
|
keyword: F,
|
|
@@ -6118,21 +6168,21 @@ uri$1.default = uri;
|
|
|
6118
6168
|
schemaType: (0, u.getJSONTypes)(v.schemaType)
|
|
6119
6169
|
}
|
|
6120
6170
|
};
|
|
6121
|
-
v.before ? Te.call(this,
|
|
6171
|
+
v.before ? Te.call(this, O, M, v.before) : O.rules.push(M), h.all[F] = M, (E = v.implements) === null || E === void 0 || E.forEach((q) => this.addKeyword(q));
|
|
6122
6172
|
}
|
|
6123
6173
|
function Te(F, v, j) {
|
|
6124
|
-
const
|
|
6125
|
-
|
|
6174
|
+
const E = F.rules.findIndex((a) => a.keyword === j);
|
|
6175
|
+
E >= 0 ? F.rules.splice(E, 0, v) : (F.rules.push(v), this.logger.warn(`rule ${j} is not defined`));
|
|
6126
6176
|
}
|
|
6127
|
-
function
|
|
6177
|
+
function Oe(F) {
|
|
6128
6178
|
let { metaSchema: v } = F;
|
|
6129
|
-
v !== void 0 && (F.$data && this.opts.$data && (v =
|
|
6179
|
+
v !== void 0 && (F.$data && this.opts.$data && (v = Ie(v)), F.validateSchema = this.compile(v, !0));
|
|
6130
6180
|
}
|
|
6131
|
-
const
|
|
6181
|
+
const He = {
|
|
6132
6182
|
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
6133
6183
|
};
|
|
6134
|
-
function
|
|
6135
|
-
return { anyOf: [F,
|
|
6184
|
+
function Ie(F) {
|
|
6185
|
+
return { anyOf: [F, He] };
|
|
6136
6186
|
}
|
|
6137
6187
|
})(core$2);
|
|
6138
6188
|
var draft7 = {}, core$1 = {}, id = {};
|
|
@@ -6158,7 +6208,7 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6158
6208
|
if (f === void 0)
|
|
6159
6209
|
throw new ref_error_1.default(n.opts.uriResolver, s, r);
|
|
6160
6210
|
if (f instanceof compile_1$1.SchemaEnv)
|
|
6161
|
-
return
|
|
6211
|
+
return N(f);
|
|
6162
6212
|
return C(f);
|
|
6163
6213
|
function g() {
|
|
6164
6214
|
if (i === u)
|
|
@@ -6166,7 +6216,7 @@ const ref_error_1 = ref_error, code_1$8 = code, codegen_1$l = codegen, names_1$1
|
|
|
6166
6216
|
const S = t.scopeValue("root", { ref: u });
|
|
6167
6217
|
return callRef(e, (0, codegen_1$l._)`${S}.validate`, u, u.$async);
|
|
6168
6218
|
}
|
|
6169
|
-
function
|
|
6219
|
+
function N(S) {
|
|
6170
6220
|
const R = getValidate(e, S);
|
|
6171
6221
|
callRef(e, R, S, S.$async);
|
|
6172
6222
|
}
|
|
@@ -6197,13 +6247,13 @@ function callRef(e, t, r, n) {
|
|
|
6197
6247
|
s.try(() => {
|
|
6198
6248
|
s.code((0, codegen_1$l._)`await ${(0, code_1$8.callValidateCode)(e, t, u)}`), C(t), o || s.assign(S, !0);
|
|
6199
6249
|
}, (R) => {
|
|
6200
|
-
s.if((0, codegen_1$l._)`!(${R} instanceof ${i.ValidationError})`, () => s.throw(R)),
|
|
6250
|
+
s.if((0, codegen_1$l._)`!(${R} instanceof ${i.ValidationError})`, () => s.throw(R)), N(R), o || s.assign(S, !1);
|
|
6201
6251
|
}), e.ok(S);
|
|
6202
6252
|
}
|
|
6203
6253
|
function g() {
|
|
6204
|
-
e.result((0, code_1$8.callValidateCode)(e, t, u), () => C(t), () =>
|
|
6254
|
+
e.result((0, code_1$8.callValidateCode)(e, t, u), () => C(t), () => N(t));
|
|
6205
6255
|
}
|
|
6206
|
-
function
|
|
6256
|
+
function N(S) {
|
|
6207
6257
|
const R = (0, codegen_1$l._)`${S}.errors`;
|
|
6208
6258
|
s.assign(names_1$1.default.vErrors, (0, codegen_1$l._)`${names_1$1.default.vErrors} === null ? ${R} : ${names_1$1.default.vErrors}.concat(${R})`), s.assign(names_1$1.default.errors, (0, codegen_1$l._)`${names_1$1.default.vErrors}.length`);
|
|
6209
6259
|
}
|
|
@@ -6383,7 +6433,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6383
6433
|
const C = t.let("missing");
|
|
6384
6434
|
if (d || i) {
|
|
6385
6435
|
const S = t.let("valid", !0);
|
|
6386
|
-
e.block$data(S, () =>
|
|
6436
|
+
e.block$data(S, () => N(C, S)), e.ok(S);
|
|
6387
6437
|
} else
|
|
6388
6438
|
t.if((0, code_1$6.checkMissingProp)(e, r, C)), (0, code_1$6.reportMissingProp)(e, C), t.else();
|
|
6389
6439
|
}
|
|
@@ -6392,7 +6442,7 @@ const code_1$6 = code, codegen_1$f = codegen, util_1$h = util, error$d = {
|
|
|
6392
6442
|
e.setParams({ missingProperty: C }), t.if((0, code_1$6.noPropertyInData)(t, s, C, l.ownProperties), () => e.error());
|
|
6393
6443
|
});
|
|
6394
6444
|
}
|
|
6395
|
-
function
|
|
6445
|
+
function N(C, S) {
|
|
6396
6446
|
e.setParams({ missingProperty: C }), t.forOf(C, n, () => {
|
|
6397
6447
|
t.assign(S, (0, code_1$6.propertyInData)(t, s, C, l.ownProperties)), t.if((0, codegen_1$f.not)(S), () => {
|
|
6398
6448
|
e.error(), t.break();
|
|
@@ -6445,12 +6495,12 @@ const dataType_1 = dataType, codegen_1$d = codegen, util_1$g = util, equal_1$2 =
|
|
|
6445
6495
|
e.block$data(d, f, (0, codegen_1$d._)`${o} === false`), e.ok(d);
|
|
6446
6496
|
function f() {
|
|
6447
6497
|
const S = t.let("i", (0, codegen_1$d._)`${r}.length`), R = t.let("j");
|
|
6448
|
-
e.setParams({ i: S, j: R }), t.assign(d, !0), t.if((0, codegen_1$d._)`${S} > 1`, () => (g() ?
|
|
6498
|
+
e.setParams({ i: S, j: R }), t.assign(d, !0), t.if((0, codegen_1$d._)`${S} > 1`, () => (g() ? N : C)(S, R));
|
|
6449
6499
|
}
|
|
6450
6500
|
function g() {
|
|
6451
6501
|
return u.length > 0 && !u.some((S) => S === "object" || S === "array");
|
|
6452
6502
|
}
|
|
6453
|
-
function
|
|
6503
|
+
function N(S, R) {
|
|
6454
6504
|
const y = t.name("item"), _ = (0, dataType_1.checkDataTypes)(u, y, l.opts.strictNumbers, dataType_1.DataType.Wrong), $ = t.const("indices", (0, codegen_1$d._)`{}`);
|
|
6455
6505
|
t.for((0, codegen_1$d._)`;${S}--;`, () => {
|
|
6456
6506
|
t.let(y, (0, codegen_1$d._)`${r}[${S}]`), t.if(_, (0, codegen_1$d._)`continue`), u.length > 1 && t.if((0, codegen_1$d._)`typeof ${y} == "string"`, (0, codegen_1$d._)`${y} += "_"`), t.if((0, codegen_1$d._)`typeof ${$}[${y}] == "number"`, () => {
|
|
@@ -6506,13 +6556,13 @@ const codegen_1$b = codegen, util_1$e = util, equal_1 = equal$1, error$9 = {
|
|
|
6506
6556
|
if (!Array.isArray(s))
|
|
6507
6557
|
throw new Error("ajv implementation error");
|
|
6508
6558
|
const C = t.const("vSchema", i);
|
|
6509
|
-
f = (0, codegen_1$b.or)(...s.map((S, R) =>
|
|
6559
|
+
f = (0, codegen_1$b.or)(...s.map((S, R) => N(C, R)));
|
|
6510
6560
|
}
|
|
6511
6561
|
e.pass(f);
|
|
6512
6562
|
function g() {
|
|
6513
6563
|
t.assign(f, !1), t.forOf("v", i, (C) => t.if((0, codegen_1$b._)`${u()}(${r}, ${C})`, () => t.assign(f, !0).break()));
|
|
6514
6564
|
}
|
|
6515
|
-
function
|
|
6565
|
+
function N(C, S) {
|
|
6516
6566
|
const R = s[S];
|
|
6517
6567
|
return typeof R == "object" && R !== null ? (0, codegen_1$b._)`${u()}(${r}, ${C}[${S}])` : (0, codegen_1$b._)`${r} === ${R}`;
|
|
6518
6568
|
}
|
|
@@ -6598,18 +6648,18 @@ function validateTuple(e, t, r = e.schema) {
|
|
|
6598
6648
|
const { gen: n, parentSchema: s, data: i, keyword: o, it: l } = e;
|
|
6599
6649
|
f(s), l.opts.unevaluated && r.length && l.items !== !0 && (l.items = util_1$c.mergeEvaluated.items(n, r.length, l.items));
|
|
6600
6650
|
const d = n.name("valid"), u = n.const("len", (0, codegen_1$9._)`${i}.length`);
|
|
6601
|
-
r.forEach((g,
|
|
6602
|
-
(0, util_1$c.alwaysValidSchema)(l, g) || (n.if((0, codegen_1$9._)`${u} > ${
|
|
6651
|
+
r.forEach((g, N) => {
|
|
6652
|
+
(0, util_1$c.alwaysValidSchema)(l, g) || (n.if((0, codegen_1$9._)`${u} > ${N}`, () => e.subschema({
|
|
6603
6653
|
keyword: o,
|
|
6604
|
-
schemaProp:
|
|
6605
|
-
dataProp:
|
|
6654
|
+
schemaProp: N,
|
|
6655
|
+
dataProp: N
|
|
6606
6656
|
}, d)), e.ok(d));
|
|
6607
6657
|
});
|
|
6608
6658
|
function f(g) {
|
|
6609
|
-
const { opts:
|
|
6610
|
-
if (
|
|
6659
|
+
const { opts: N, errSchemaPath: C } = l, S = r.length, R = S === g.minItems && (S === g.maxItems || g[t] === !1);
|
|
6660
|
+
if (N.strictTuples && !R) {
|
|
6611
6661
|
const y = `"${o}" is ${S}-tuple, but minItems or maxItems/${t} are not specified or different at path "${C}"`;
|
|
6612
|
-
(0, util_1$c.checkStrictMode)(l, y,
|
|
6662
|
+
(0, util_1$c.checkStrictMode)(l, y, N.strictTuples);
|
|
6613
6663
|
}
|
|
6614
6664
|
}
|
|
6615
6665
|
}
|
|
@@ -6674,8 +6724,8 @@ const codegen_1$7 = codegen, util_1$a = util, error$6 = {
|
|
|
6674
6724
|
}
|
|
6675
6725
|
i.items = !0;
|
|
6676
6726
|
const g = t.name("valid");
|
|
6677
|
-
l === void 0 && o === 1 ? C(g, () => t.if(g, () => t.break())) : o === 0 ? (t.let(g, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`,
|
|
6678
|
-
function
|
|
6727
|
+
l === void 0 && o === 1 ? C(g, () => t.if(g, () => t.break())) : o === 0 ? (t.let(g, !0), l !== void 0 && t.if((0, codegen_1$7._)`${s}.length > 0`, N)) : (t.let(g, !1), N()), e.result(g, () => e.reset());
|
|
6728
|
+
function N() {
|
|
6679
6729
|
const R = t.name("_valid"), y = t.let("count", 0);
|
|
6680
6730
|
C(R, () => t.if(R, () => S(y)));
|
|
6681
6731
|
}
|
|
@@ -6725,13 +6775,13 @@ var dependencies = {};
|
|
|
6725
6775
|
for (const g in d) {
|
|
6726
6776
|
if (g === "__proto__")
|
|
6727
6777
|
continue;
|
|
6728
|
-
const
|
|
6729
|
-
|
|
6778
|
+
const N = Array.isArray(d[g]) ? u : f;
|
|
6779
|
+
N[g] = d[g];
|
|
6730
6780
|
}
|
|
6731
6781
|
return [u, f];
|
|
6732
6782
|
}
|
|
6733
6783
|
function o(d, u = d.schema) {
|
|
6734
|
-
const { gen: f, data: g, it:
|
|
6784
|
+
const { gen: f, data: g, it: N } = d;
|
|
6735
6785
|
if (Object.keys(u).length === 0)
|
|
6736
6786
|
return;
|
|
6737
6787
|
const C = f.let("missing");
|
|
@@ -6739,12 +6789,12 @@ var dependencies = {};
|
|
|
6739
6789
|
const R = u[S];
|
|
6740
6790
|
if (R.length === 0)
|
|
6741
6791
|
continue;
|
|
6742
|
-
const y = (0, n.propertyInData)(f, g, S,
|
|
6792
|
+
const y = (0, n.propertyInData)(f, g, S, N.opts.ownProperties);
|
|
6743
6793
|
d.setParams({
|
|
6744
6794
|
property: S,
|
|
6745
6795
|
depsCount: R.length,
|
|
6746
6796
|
deps: R.join(", ")
|
|
6747
|
-
}),
|
|
6797
|
+
}), N.allErrors ? f.if(y, () => {
|
|
6748
6798
|
for (const _ of R)
|
|
6749
6799
|
(0, n.checkReportMissingProp)(d, _);
|
|
6750
6800
|
}) : (f.if((0, t._)`${y} && (${(0, n.checkMissingProp)(d, R, C)})`), (0, n.reportMissingProp)(d, C), f.else());
|
|
@@ -6752,12 +6802,12 @@ var dependencies = {};
|
|
|
6752
6802
|
}
|
|
6753
6803
|
e.validatePropertyDeps = o;
|
|
6754
6804
|
function l(d, u = d.schema) {
|
|
6755
|
-
const { gen: f, data: g, keyword:
|
|
6805
|
+
const { gen: f, data: g, keyword: N, it: C } = d, S = f.name("valid");
|
|
6756
6806
|
for (const R in u)
|
|
6757
6807
|
(0, r.alwaysValidSchema)(C, u[R]) || (f.if(
|
|
6758
6808
|
(0, n.propertyInData)(f, g, R, C.opts.ownProperties),
|
|
6759
6809
|
() => {
|
|
6760
|
-
const y = d.subschema({ keyword:
|
|
6810
|
+
const y = d.subschema({ keyword: N, schemaProp: R }, S);
|
|
6761
6811
|
d.mergeValidEvaluated(y, S);
|
|
6762
6812
|
},
|
|
6763
6813
|
() => f.var(S, !0)
|
|
@@ -6818,10 +6868,10 @@ const code_1$3 = code, codegen_1$5 = codegen, names_1 = names$1, util_1$8 = util
|
|
|
6818
6868
|
g(), e.ok((0, codegen_1$5._)`${i} === ${names_1.default.errors}`);
|
|
6819
6869
|
function g() {
|
|
6820
6870
|
t.forIn("key", s, (y) => {
|
|
6821
|
-
!u.length && !f.length ? S(y) : t.if(
|
|
6871
|
+
!u.length && !f.length ? S(y) : t.if(N(y), () => S(y));
|
|
6822
6872
|
});
|
|
6823
6873
|
}
|
|
6824
|
-
function
|
|
6874
|
+
function N(y) {
|
|
6825
6875
|
let _;
|
|
6826
6876
|
if (u.length > 8) {
|
|
6827
6877
|
const $ = (0, util_1$8.schemaRefOrVal)(o, n.properties, "properties");
|
|
@@ -6909,8 +6959,8 @@ const code_1$1 = code, codegen_1$4 = codegen, util_1$6 = util, util_2 = util, de
|
|
|
6909
6959
|
const u = o.strictSchema && !o.allowMatchingProperties && s.properties, f = t.name("valid");
|
|
6910
6960
|
i.props !== !0 && !(i.props instanceof codegen_1$4.Name) && (i.props = (0, util_2.evaluatedPropsToName)(t, i.props));
|
|
6911
6961
|
const { props: g } = i;
|
|
6912
|
-
|
|
6913
|
-
function
|
|
6962
|
+
N();
|
|
6963
|
+
function N() {
|
|
6914
6964
|
for (const R of l)
|
|
6915
6965
|
u && C(R), i.allErrors ? S(R) : (t.var(f, !0), S(R), t.if(f));
|
|
6916
6966
|
}
|
|
@@ -6987,13 +7037,13 @@ const codegen_1$3 = codegen, util_1$4 = util, error$3 = {
|
|
|
6987
7037
|
e.setParams({ passing: l }), t.block(u), e.result(o, () => e.reset(), () => e.error(!0));
|
|
6988
7038
|
function u() {
|
|
6989
7039
|
i.forEach((f, g) => {
|
|
6990
|
-
let
|
|
6991
|
-
(0, util_1$4.alwaysValidSchema)(s, f) ? t.var(d, !0) :
|
|
7040
|
+
let N;
|
|
7041
|
+
(0, util_1$4.alwaysValidSchema)(s, f) ? t.var(d, !0) : N = e.subschema({
|
|
6992
7042
|
keyword: "oneOf",
|
|
6993
7043
|
schemaProp: g,
|
|
6994
7044
|
compositeRule: !0
|
|
6995
7045
|
}, d), g > 0 && t.if((0, codegen_1$3._)`${d} && ${o}`).assign(o, !1).assign(l, (0, codegen_1$3._)`[${l}, ${g}]`).else(), t.if(d, () => {
|
|
6996
|
-
t.assign(o, !0), t.assign(l, g),
|
|
7046
|
+
t.assign(o, !0), t.assign(l, g), N && e.mergeEvaluated(N, codegen_1$3.Name);
|
|
6997
7047
|
});
|
|
6998
7048
|
});
|
|
6999
7049
|
}
|
|
@@ -7053,8 +7103,8 @@ const codegen_1$2 = codegen, util_1$2 = util, error$2 = {
|
|
|
7053
7103
|
}
|
|
7054
7104
|
function u(f, g) {
|
|
7055
7105
|
return () => {
|
|
7056
|
-
const
|
|
7057
|
-
t.assign(o, l), e.mergeValidEvaluated(
|
|
7106
|
+
const N = e.subschema({ keyword: f }, l);
|
|
7107
|
+
t.assign(o, l), e.mergeValidEvaluated(N, o), g ? t.assign(g, (0, codegen_1$2._)`${f}`) : e.setParams({ ifClause: f });
|
|
7058
7108
|
};
|
|
7059
7109
|
}
|
|
7060
7110
|
}
|
|
@@ -7110,8 +7160,8 @@ const codegen_1$1 = codegen, error$1 = {
|
|
|
7110
7160
|
const { gen: r, data: n, $data: s, schema: i, schemaCode: o, it: l } = e, { opts: d, errSchemaPath: u, schemaEnv: f, self: g } = l;
|
|
7111
7161
|
if (!d.validateFormats)
|
|
7112
7162
|
return;
|
|
7113
|
-
s ?
|
|
7114
|
-
function
|
|
7163
|
+
s ? N() : C();
|
|
7164
|
+
function N() {
|
|
7115
7165
|
const S = r.scopeValue("formats", {
|
|
7116
7166
|
ref: g.formats,
|
|
7117
7167
|
code: d.code.formats
|
|
@@ -7220,7 +7270,7 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7220
7270
|
const d = t.let("valid", !1), u = t.const("tag", (0, codegen_1._)`${r}${(0, codegen_1.getProperty)(l)}`);
|
|
7221
7271
|
t.if((0, codegen_1._)`typeof ${u} == "string"`, () => f(), () => e.error(!1, { discrError: types_1.DiscrError.Tag, tag: u, tagName: l })), e.ok(d);
|
|
7222
7272
|
function f() {
|
|
7223
|
-
const C =
|
|
7273
|
+
const C = N();
|
|
7224
7274
|
t.if(!1);
|
|
7225
7275
|
for (const S in C)
|
|
7226
7276
|
t.elseIf((0, codegen_1._)`${u} === ${S}`), t.assign(d, g(C[S]));
|
|
@@ -7230,7 +7280,7 @@ const codegen_1 = codegen, types_1 = types, compile_1 = compile, util_1 = util,
|
|
|
7230
7280
|
const S = t.name("valid"), R = e.subschema({ keyword: "oneOf", schemaProp: C }, S);
|
|
7231
7281
|
return e.mergeEvaluated(R, codegen_1.Name), S;
|
|
7232
7282
|
}
|
|
7233
|
-
function
|
|
7283
|
+
function N() {
|
|
7234
7284
|
var C;
|
|
7235
7285
|
const S = {}, R = _(s);
|
|
7236
7286
|
let y = !0;
|
|
@@ -7547,9 +7597,9 @@ const $schema$1 = "http://json-schema.org/draft-07/schema#", $id = "http://json-
|
|
|
7547
7597
|
Object.defineProperty(t, "ValidationError", { enumerable: !0, get: function() {
|
|
7548
7598
|
return g.default;
|
|
7549
7599
|
} });
|
|
7550
|
-
var
|
|
7600
|
+
var N = ref_error;
|
|
7551
7601
|
Object.defineProperty(t, "MissingRefError", { enumerable: !0, get: function() {
|
|
7552
|
-
return
|
|
7602
|
+
return N.default;
|
|
7553
7603
|
} });
|
|
7554
7604
|
})(ajv$1, ajv$1.exports);
|
|
7555
7605
|
var ajvExports = ajv$1.exports;
|
|
@@ -8057,9 +8107,10 @@ const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports), $schema = "http
|
|
|
8057
8107
|
"rewrite-wp-config",
|
|
8058
8108
|
"define-before-run"
|
|
8059
8109
|
],
|
|
8060
|
-
description: `The method of defining the constants. Possible values are:
|
|
8110
|
+
description: `The method of defining the constants in wp-config.php. Possible values are:
|
|
8061
8111
|
|
|
8062
8112
|
- rewrite-wp-config: Default. Rewrites the wp-config.php file to explicitly call define() with the requested name and value. This method alters the file on the disk, but it doesn't conflict with existing define() calls in wp-config.php.
|
|
8113
|
+
|
|
8063
8114
|
- define-before-run: Defines the constant before running the requested script. It doesn't alter any files on the disk, but constants defined this way may conflict with existing define() calls in wp-config.php.`
|
|
8064
8115
|
},
|
|
8065
8116
|
virtualize: {
|
|
@@ -8529,7 +8580,7 @@ for existing apps using this option.`
|
|
|
8529
8580
|
},
|
|
8530
8581
|
options: {
|
|
8531
8582
|
$ref: "#/definitions/PHPRunOptions",
|
|
8532
|
-
description: "Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions)"
|
|
8583
|
+
description: "Run options (See /wordpress-playground/api/universal/interface/PHPRunOptions/))"
|
|
8533
8584
|
}
|
|
8534
8585
|
},
|
|
8535
8586
|
required: [
|
|
@@ -9123,7 +9174,7 @@ function compileBlueprint(e, {
|
|
|
9123
9174
|
onStepCompleted: n = () => {
|
|
9124
9175
|
}
|
|
9125
9176
|
} = {}) {
|
|
9126
|
-
var g,
|
|
9177
|
+
var g, N, C, S, R, y, _;
|
|
9127
9178
|
e = {
|
|
9128
9179
|
...e,
|
|
9129
9180
|
steps: (e.steps || []).filter(isStepDefinition).filter(isStepStillSupported)
|
|
@@ -9162,7 +9213,7 @@ function compileBlueprint(e, {
|
|
|
9162
9213
|
($) => $ !== "light"
|
|
9163
9214
|
), logger.warn(
|
|
9164
9215
|
"The wpCli step used in your Blueprint requires the iconv and mbstring PHP extensions. However, you did not specify the kitchen-sink extension bundle. Playground will override your choice and load the kitchen-sink PHP extensions bundle to prevent the WP-CLI step from failing. "
|
|
9165
|
-
)), (
|
|
9216
|
+
)), (N = e.steps) == null || N.splice(s, 0, {
|
|
9166
9217
|
step: "writeFile",
|
|
9167
9218
|
data: {
|
|
9168
9219
|
resource: "url",
|
|
@@ -9309,20 +9360,20 @@ function compileStep(e, {
|
|
|
9309
9360
|
(((f = e.progress) == null ? void 0 : f.weight) || 1) / n
|
|
9310
9361
|
), i = {};
|
|
9311
9362
|
for (const g of Object.keys(e)) {
|
|
9312
|
-
let
|
|
9313
|
-
isFileReference(
|
|
9363
|
+
let N = e[g];
|
|
9364
|
+
isFileReference(N) && (N = Resource.create(N, {
|
|
9314
9365
|
semaphore: t
|
|
9315
|
-
})), i[g] =
|
|
9366
|
+
})), i[g] = N;
|
|
9316
9367
|
}
|
|
9317
9368
|
const o = async (g) => {
|
|
9318
|
-
var
|
|
9369
|
+
var N;
|
|
9319
9370
|
try {
|
|
9320
9371
|
return s.fillSlowly(), await keyedStepHandlers[e.step](
|
|
9321
9372
|
g,
|
|
9322
9373
|
await resolveArguments(i),
|
|
9323
9374
|
{
|
|
9324
9375
|
tracker: s,
|
|
9325
|
-
initialCaption: (
|
|
9376
|
+
initialCaption: (N = e.progress) == null ? void 0 : N.caption
|
|
9326
9377
|
}
|
|
9327
9378
|
);
|
|
9328
9379
|
} finally {
|