wp-studio 1.7.10 → 1.7.11
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/dist/cli/{_events-BcapW3eh.mjs → _events-B8xQ_baD.mjs} +4 -5
- package/dist/cli/appdata-D-luHxJU.mjs +19 -0
- package/dist/cli/{certificate-manager-SVYcCL_i.mjs → certificate-manager-v-yNLDFJ.mjs} +134 -15
- package/dist/cli/{delete-D1924O3o.mjs → delete-BG-E-HsW.mjs} +3 -3
- package/dist/cli/{helpers-oQuItT8n.mjs → helpers-CIAgfdq8.mjs} +2 -2
- package/dist/cli/{index-4lan3TI_.mjs → index-Bej4fL6n.mjs} +31 -4
- package/dist/cli/{index-BjzOJKPi.mjs → index-Dhun0W1n.mjs} +90 -52
- package/dist/cli/{index-DRQnCQvM.mjs → index-ul3DeWvy.mjs} +1308 -1109
- package/dist/cli/{list-DOFyyV1f.mjs → list-ck0oK4vb.mjs} +3 -3
- package/dist/cli/{login-BtPZeZ4G.mjs → login-Dz63Zdfn.mjs} +3 -3
- package/dist/cli/{logout-Cr631QzG.mjs → logout-CLUKQeZh.mjs} +2 -3
- package/dist/cli/main.mjs +2 -2
- package/dist/cli/{paths-CqXGLB7R.mjs → paths-D7DniT1Q.mjs} +7 -6
- package/dist/cli/plugin/skills/rank-me-up/SKILL.md +166 -0
- package/dist/cli/plugin/skills/site-spec/SKILL.md +4 -0
- package/dist/cli/process-manager-daemon.mjs +29 -5
- package/dist/cli/{process-manager-ipc-BisO0qtU.mjs → process-manager-ipc-GCdebuBH.mjs} +4 -1
- package/dist/cli/proxy-daemon.mjs +1 -1
- package/dist/cli/{prune-pm-logs-COryxqeo.mjs → prune-pm-logs-Dm_Bwi7l.mjs} +1 -1
- package/dist/cli/{resume-BwDwdJtq.mjs → resume-BSIOJnyM.mjs} +4 -15
- package/dist/cli/{rewrite-wp-cli-post-content-2zlfFnKT.mjs → rewrite-wp-cli-post-content-Beo5_Ojo.mjs} +32 -531
- package/dist/cli/{set-D5eeqHbp.mjs → set-CtDZnARG.mjs} +2 -3
- package/dist/cli/{set-DYnzUz_G.mjs → set-PJvs-Yw5.mjs} +4 -5
- package/dist/cli/{status-DNvMZBqD.mjs → status-DU07aAtD.mjs} +2 -2
- package/dist/cli/well-known-paths-QcSJNi_l.mjs +95 -0
- package/dist/cli/wordpress-server-child.mjs +5 -3
- package/dist/cli/{wp-DD2-QiiP.mjs → wp-_X-h-yuW.mjs} +2 -2
- package/dist/cli/wp-files/latest/available-site-translations.json +1 -1
- package/dist/cli/wp-files/sqlite-database-integration/admin-page.php +1 -2
- package/dist/cli/wp-files/sqlite-database-integration/constants.php +0 -5
- package/dist/cli/wp-files/sqlite-database-integration/load.php +1 -1
- package/dist/cli/wp-files/sqlite-database-integration/readme.txt +6 -3
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/database/sqlite/class-wp-pdo-mysql-on-sqlite.php +22 -3
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/database/version.php +1 -1
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php +41 -89
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/db.php +2 -24
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/install-functions.php +7 -16
- package/package.json +2 -1
- package/dist/cli/well-known-paths-BYA1Bw5o.mjs +0 -214
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-lexer.php +0 -2575
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-pdo-user-defined-functions.php +0 -899
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-query-rewriter.php +0 -343
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-token.php +0 -327
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-translator.php +0 -4543
- package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/php-polyfills.php +0 -68
|
@@ -1,488 +1,13 @@
|
|
|
1
1
|
import fs__default, { promises } from "fs";
|
|
2
2
|
import path__default, { join } from "path";
|
|
3
|
-
import
|
|
3
|
+
import ignore from "ignore";
|
|
4
4
|
import { i as isErrnoException } from "./wordpress-server-ipc-D-8mLjOF.mjs";
|
|
5
|
-
import os, { tmpdir } from "os";
|
|
6
|
-
import { __ } from "@wordpress/i18n";
|
|
7
5
|
import { readdir, unlink, mkdtemp, writeFile } from "fs/promises";
|
|
6
|
+
import { tmpdir } from "os";
|
|
7
|
+
import { g as getServerFilesPath } from "./well-known-paths-QcSJNi_l.mjs";
|
|
8
|
+
import { __ } from "@wordpress/i18n";
|
|
8
9
|
import { randomUUID } from "crypto";
|
|
9
|
-
var ignore$1 = { exports: {} };
|
|
10
|
-
var hasRequiredIgnore;
|
|
11
|
-
function requireIgnore() {
|
|
12
|
-
if (hasRequiredIgnore) return ignore$1.exports;
|
|
13
|
-
hasRequiredIgnore = 1;
|
|
14
|
-
(function(module) {
|
|
15
|
-
function makeArray(subject) {
|
|
16
|
-
return Array.isArray(subject) ? subject : [subject];
|
|
17
|
-
}
|
|
18
|
-
const UNDEFINED = void 0;
|
|
19
|
-
const EMPTY = "";
|
|
20
|
-
const SPACE = " ";
|
|
21
|
-
const ESCAPE = "\\";
|
|
22
|
-
const REGEX_TEST_BLANK_LINE = /^\s+$/;
|
|
23
|
-
const REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
24
|
-
const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
25
|
-
const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
26
|
-
const REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
27
|
-
const REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
|
|
28
|
-
const REGEX_TEST_TRAILING_SLASH = /\/$/;
|
|
29
|
-
const SLASH = "/";
|
|
30
|
-
let TMP_KEY_IGNORE = "node-ignore";
|
|
31
|
-
if (typeof Symbol !== "undefined") {
|
|
32
|
-
TMP_KEY_IGNORE = /* @__PURE__ */ Symbol.for("node-ignore");
|
|
33
|
-
}
|
|
34
|
-
const KEY_IGNORE = TMP_KEY_IGNORE;
|
|
35
|
-
const define = (object, key, value) => {
|
|
36
|
-
Object.defineProperty(object, key, { value });
|
|
37
|
-
return value;
|
|
38
|
-
};
|
|
39
|
-
const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
40
|
-
const RETURN_FALSE = () => false;
|
|
41
|
-
const sanitizeRange = (range) => range.replace(
|
|
42
|
-
REGEX_REGEXP_RANGE,
|
|
43
|
-
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
|
|
44
|
-
);
|
|
45
|
-
const cleanRangeBackSlash = (slashes) => {
|
|
46
|
-
const { length } = slashes;
|
|
47
|
-
return slashes.slice(0, length - length % 2);
|
|
48
|
-
};
|
|
49
|
-
const REPLACERS = [
|
|
50
|
-
[
|
|
51
|
-
// Remove BOM
|
|
52
|
-
// TODO:
|
|
53
|
-
// Other similar zero-width characters?
|
|
54
|
-
/^\uFEFF/,
|
|
55
|
-
() => EMPTY
|
|
56
|
-
],
|
|
57
|
-
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
58
|
-
[
|
|
59
|
-
// (a\ ) -> (a )
|
|
60
|
-
// (a ) -> (a)
|
|
61
|
-
// (a ) -> (a)
|
|
62
|
-
// (a \ ) -> (a )
|
|
63
|
-
/((?:\\\\)*?)(\\?\s+)$/,
|
|
64
|
-
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
|
|
65
|
-
],
|
|
66
|
-
// Replace (\ ) with ' '
|
|
67
|
-
// (\ ) -> ' '
|
|
68
|
-
// (\\ ) -> '\\ '
|
|
69
|
-
// (\\\ ) -> '\\ '
|
|
70
|
-
[
|
|
71
|
-
/(\\+?)\s/g,
|
|
72
|
-
(_, m1) => {
|
|
73
|
-
const { length } = m1;
|
|
74
|
-
return m1.slice(0, length - length % 2) + SPACE;
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
|
-
// Escape metacharacters
|
|
78
|
-
// which is written down by users but means special for regular expressions.
|
|
79
|
-
// > There are 12 characters with special meanings:
|
|
80
|
-
// > - the backslash \,
|
|
81
|
-
// > - the caret ^,
|
|
82
|
-
// > - the dollar sign $,
|
|
83
|
-
// > - the period or dot .,
|
|
84
|
-
// > - the vertical bar or pipe symbol |,
|
|
85
|
-
// > - the question mark ?,
|
|
86
|
-
// > - the asterisk or star *,
|
|
87
|
-
// > - the plus sign +,
|
|
88
|
-
// > - the opening parenthesis (,
|
|
89
|
-
// > - the closing parenthesis ),
|
|
90
|
-
// > - and the opening square bracket [,
|
|
91
|
-
// > - the opening curly brace {,
|
|
92
|
-
// > These special characters are often called "metacharacters".
|
|
93
|
-
[
|
|
94
|
-
/[\\$.|*+(){^]/g,
|
|
95
|
-
(match) => `\\${match}`
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
-
// > a question mark (?) matches a single character
|
|
99
|
-
/(?!\\)\?/g,
|
|
100
|
-
() => "[^/]"
|
|
101
|
-
],
|
|
102
|
-
// leading slash
|
|
103
|
-
[
|
|
104
|
-
// > A leading slash matches the beginning of the pathname.
|
|
105
|
-
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
106
|
-
// A leading slash matches the beginning of the pathname
|
|
107
|
-
/^\//,
|
|
108
|
-
() => "^"
|
|
109
|
-
],
|
|
110
|
-
// replace special metacharacter slash after the leading slash
|
|
111
|
-
[
|
|
112
|
-
/\//g,
|
|
113
|
-
() => "\\/"
|
|
114
|
-
],
|
|
115
|
-
[
|
|
116
|
-
// > A leading "**" followed by a slash means match in all directories.
|
|
117
|
-
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
118
|
-
// > the same as pattern "foo".
|
|
119
|
-
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
|
120
|
-
// > under directory "foo".
|
|
121
|
-
// Notice that the '*'s have been replaced as '\\*'
|
|
122
|
-
/^\^*\\\*\\\*\\\//,
|
|
123
|
-
// '**/foo' <-> 'foo'
|
|
124
|
-
() => "^(?:.*\\/)?"
|
|
125
|
-
],
|
|
126
|
-
// starting
|
|
127
|
-
[
|
|
128
|
-
// there will be no leading '/'
|
|
129
|
-
// (which has been replaced by section "leading slash")
|
|
130
|
-
// If starts with '**', adding a '^' to the regular expression also works
|
|
131
|
-
/^(?=[^^])/,
|
|
132
|
-
function startingReplacer() {
|
|
133
|
-
return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
|
|
134
|
-
}
|
|
135
|
-
],
|
|
136
|
-
// two globstars
|
|
137
|
-
[
|
|
138
|
-
// Use lookahead assertions so that we could match more than one `'/**'`
|
|
139
|
-
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
140
|
-
// Zero, one or several directories
|
|
141
|
-
// should not use '*', or it will be replaced by the next replacer
|
|
142
|
-
// Check if it is not the last `'/**'`
|
|
143
|
-
(_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
|
|
144
|
-
],
|
|
145
|
-
// normal intermediate wildcards
|
|
146
|
-
[
|
|
147
|
-
// Never replace escaped '*'
|
|
148
|
-
// ignore rule '\*' will match the path '*'
|
|
149
|
-
// 'abc.*/' -> go
|
|
150
|
-
// 'abc.*' -> skip this rule,
|
|
151
|
-
// coz trailing single wildcard will be handed by [trailing wildcard]
|
|
152
|
-
/(^|[^\\]+)(\\\*)+(?=.+)/g,
|
|
153
|
-
// '*.js' matches '.js'
|
|
154
|
-
// '*.js' doesn't match 'abc'
|
|
155
|
-
(_, p1, p2) => {
|
|
156
|
-
const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
|
|
157
|
-
return p1 + unescaped;
|
|
158
|
-
}
|
|
159
|
-
],
|
|
160
|
-
[
|
|
161
|
-
// unescape, revert step 3 except for back slash
|
|
162
|
-
// For example, if a user escape a '\\*',
|
|
163
|
-
// after step 3, the result will be '\\\\\\*'
|
|
164
|
-
/\\\\\\(?=[$.|*+(){^])/g,
|
|
165
|
-
() => ESCAPE
|
|
166
|
-
],
|
|
167
|
-
[
|
|
168
|
-
// '\\\\' -> '\\'
|
|
169
|
-
/\\\\/g,
|
|
170
|
-
() => ESCAPE
|
|
171
|
-
],
|
|
172
|
-
[
|
|
173
|
-
// > The range notation, e.g. [a-zA-Z],
|
|
174
|
-
// > can be used to match one of the characters in a range.
|
|
175
|
-
// `\` is escaped by step 3
|
|
176
|
-
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
|
177
|
-
(match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
|
|
178
|
-
],
|
|
179
|
-
// ending
|
|
180
|
-
[
|
|
181
|
-
// 'js' will not match 'js.'
|
|
182
|
-
// 'ab' will not match 'abc'
|
|
183
|
-
/(?:[^*])$/,
|
|
184
|
-
// WTF!
|
|
185
|
-
// https://git-scm.com/docs/gitignore
|
|
186
|
-
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
|
187
|
-
// which re-fixes #24, #38
|
|
188
|
-
// > If there is a separator at the end of the pattern then the pattern
|
|
189
|
-
// > will only match directories, otherwise the pattern can match both
|
|
190
|
-
// > files and directories.
|
|
191
|
-
// 'js*' will not match 'a.js'
|
|
192
|
-
// 'js/' will not match 'a.js'
|
|
193
|
-
// 'js' will match 'a.js' and 'a.js/'
|
|
194
|
-
(match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
|
|
195
|
-
]
|
|
196
|
-
];
|
|
197
|
-
const REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
|
|
198
|
-
const MODE_IGNORE = "regex";
|
|
199
|
-
const MODE_CHECK_IGNORE = "checkRegex";
|
|
200
|
-
const UNDERSCORE = "_";
|
|
201
|
-
const TRAILING_WILD_CARD_REPLACERS = {
|
|
202
|
-
[MODE_IGNORE](_, p1) {
|
|
203
|
-
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
|
204
|
-
return `${prefix}(?=$|\\/$)`;
|
|
205
|
-
},
|
|
206
|
-
[MODE_CHECK_IGNORE](_, p1) {
|
|
207
|
-
const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
|
|
208
|
-
return `${prefix}(?=$|\\/$)`;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
const makeRegexPrefix = (pattern) => REPLACERS.reduce(
|
|
212
|
-
(prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)),
|
|
213
|
-
pattern
|
|
214
|
-
);
|
|
215
|
-
const isString = (subject) => typeof subject === "string";
|
|
216
|
-
const checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
|
|
217
|
-
const splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
|
|
218
|
-
class IgnoreRule {
|
|
219
|
-
constructor(pattern, mark, body, ignoreCase, negative, prefix) {
|
|
220
|
-
this.pattern = pattern;
|
|
221
|
-
this.mark = mark;
|
|
222
|
-
this.negative = negative;
|
|
223
|
-
define(this, "body", body);
|
|
224
|
-
define(this, "ignoreCase", ignoreCase);
|
|
225
|
-
define(this, "regexPrefix", prefix);
|
|
226
|
-
}
|
|
227
|
-
get regex() {
|
|
228
|
-
const key = UNDERSCORE + MODE_IGNORE;
|
|
229
|
-
if (this[key]) {
|
|
230
|
-
return this[key];
|
|
231
|
-
}
|
|
232
|
-
return this._make(MODE_IGNORE, key);
|
|
233
|
-
}
|
|
234
|
-
get checkRegex() {
|
|
235
|
-
const key = UNDERSCORE + MODE_CHECK_IGNORE;
|
|
236
|
-
if (this[key]) {
|
|
237
|
-
return this[key];
|
|
238
|
-
}
|
|
239
|
-
return this._make(MODE_CHECK_IGNORE, key);
|
|
240
|
-
}
|
|
241
|
-
_make(mode, key) {
|
|
242
|
-
const str = this.regexPrefix.replace(
|
|
243
|
-
REGEX_REPLACE_TRAILING_WILDCARD,
|
|
244
|
-
// It does not need to bind pattern
|
|
245
|
-
TRAILING_WILD_CARD_REPLACERS[mode]
|
|
246
|
-
);
|
|
247
|
-
const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
|
|
248
|
-
return define(this, key, regex);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
const createRule = ({
|
|
252
|
-
pattern,
|
|
253
|
-
mark
|
|
254
|
-
}, ignoreCase) => {
|
|
255
|
-
let negative = false;
|
|
256
|
-
let body = pattern;
|
|
257
|
-
if (body.indexOf("!") === 0) {
|
|
258
|
-
negative = true;
|
|
259
|
-
body = body.substr(1);
|
|
260
|
-
}
|
|
261
|
-
body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
|
262
|
-
const regexPrefix = makeRegexPrefix(body);
|
|
263
|
-
return new IgnoreRule(
|
|
264
|
-
pattern,
|
|
265
|
-
mark,
|
|
266
|
-
body,
|
|
267
|
-
ignoreCase,
|
|
268
|
-
negative,
|
|
269
|
-
regexPrefix
|
|
270
|
-
);
|
|
271
|
-
};
|
|
272
|
-
class RuleManager {
|
|
273
|
-
constructor(ignoreCase) {
|
|
274
|
-
this._ignoreCase = ignoreCase;
|
|
275
|
-
this._rules = [];
|
|
276
|
-
}
|
|
277
|
-
_add(pattern) {
|
|
278
|
-
if (pattern && pattern[KEY_IGNORE]) {
|
|
279
|
-
this._rules = this._rules.concat(pattern._rules._rules);
|
|
280
|
-
this._added = true;
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
if (isString(pattern)) {
|
|
284
|
-
pattern = {
|
|
285
|
-
pattern
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
if (checkPattern(pattern.pattern)) {
|
|
289
|
-
const rule = createRule(pattern, this._ignoreCase);
|
|
290
|
-
this._added = true;
|
|
291
|
-
this._rules.push(rule);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
// @param {Array<string> | string | Ignore} pattern
|
|
295
|
-
add(pattern) {
|
|
296
|
-
this._added = false;
|
|
297
|
-
makeArray(
|
|
298
|
-
isString(pattern) ? splitPattern(pattern) : pattern
|
|
299
|
-
).forEach(this._add, this);
|
|
300
|
-
return this._added;
|
|
301
|
-
}
|
|
302
|
-
// Test one single path without recursively checking parent directories
|
|
303
|
-
//
|
|
304
|
-
// - checkUnignored `boolean` whether should check if the path is unignored,
|
|
305
|
-
// setting `checkUnignored` to `false` could reduce additional
|
|
306
|
-
// path matching.
|
|
307
|
-
// - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
|
|
308
|
-
// @returns {TestResult} true if a file is ignored
|
|
309
|
-
test(path, checkUnignored, mode) {
|
|
310
|
-
let ignored = false;
|
|
311
|
-
let unignored = false;
|
|
312
|
-
let matchedRule;
|
|
313
|
-
this._rules.forEach((rule) => {
|
|
314
|
-
const { negative } = rule;
|
|
315
|
-
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
const matched = rule[mode].test(path);
|
|
319
|
-
if (!matched) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
ignored = !negative;
|
|
323
|
-
unignored = negative;
|
|
324
|
-
matchedRule = negative ? UNDEFINED : rule;
|
|
325
|
-
});
|
|
326
|
-
const ret = {
|
|
327
|
-
ignored,
|
|
328
|
-
unignored
|
|
329
|
-
};
|
|
330
|
-
if (matchedRule) {
|
|
331
|
-
ret.rule = matchedRule;
|
|
332
|
-
}
|
|
333
|
-
return ret;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
const throwError = (message, Ctor) => {
|
|
337
|
-
throw new Ctor(message);
|
|
338
|
-
};
|
|
339
|
-
const checkPath = (path, originalPath, doThrow) => {
|
|
340
|
-
if (!isString(path)) {
|
|
341
|
-
return doThrow(
|
|
342
|
-
`path must be a string, but got \`${originalPath}\``,
|
|
343
|
-
TypeError
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
if (!path) {
|
|
347
|
-
return doThrow(`path must not be empty`, TypeError);
|
|
348
|
-
}
|
|
349
|
-
if (checkPath.isNotRelative(path)) {
|
|
350
|
-
const r = "`path.relative()`d";
|
|
351
|
-
return doThrow(
|
|
352
|
-
`path should be a ${r} string, but got "${originalPath}"`,
|
|
353
|
-
RangeError
|
|
354
|
-
);
|
|
355
|
-
}
|
|
356
|
-
return true;
|
|
357
|
-
};
|
|
358
|
-
const isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
|
|
359
|
-
checkPath.isNotRelative = isNotRelative;
|
|
360
|
-
checkPath.convert = (p) => p;
|
|
361
|
-
class Ignore {
|
|
362
|
-
constructor({
|
|
363
|
-
ignorecase = true,
|
|
364
|
-
ignoreCase = ignorecase,
|
|
365
|
-
allowRelativePaths = false
|
|
366
|
-
} = {}) {
|
|
367
|
-
define(this, KEY_IGNORE, true);
|
|
368
|
-
this._rules = new RuleManager(ignoreCase);
|
|
369
|
-
this._strictPathCheck = !allowRelativePaths;
|
|
370
|
-
this._initCache();
|
|
371
|
-
}
|
|
372
|
-
_initCache() {
|
|
373
|
-
this._ignoreCache = /* @__PURE__ */ Object.create(null);
|
|
374
|
-
this._testCache = /* @__PURE__ */ Object.create(null);
|
|
375
|
-
}
|
|
376
|
-
add(pattern) {
|
|
377
|
-
if (this._rules.add(pattern)) {
|
|
378
|
-
this._initCache();
|
|
379
|
-
}
|
|
380
|
-
return this;
|
|
381
|
-
}
|
|
382
|
-
// legacy
|
|
383
|
-
addPattern(pattern) {
|
|
384
|
-
return this.add(pattern);
|
|
385
|
-
}
|
|
386
|
-
// @returns {TestResult}
|
|
387
|
-
_test(originalPath, cache, checkUnignored, slices) {
|
|
388
|
-
const path = originalPath && checkPath.convert(originalPath);
|
|
389
|
-
checkPath(
|
|
390
|
-
path,
|
|
391
|
-
originalPath,
|
|
392
|
-
this._strictPathCheck ? throwError : RETURN_FALSE
|
|
393
|
-
);
|
|
394
|
-
return this._t(path, cache, checkUnignored, slices);
|
|
395
|
-
}
|
|
396
|
-
checkIgnore(path) {
|
|
397
|
-
if (!REGEX_TEST_TRAILING_SLASH.test(path)) {
|
|
398
|
-
return this.test(path);
|
|
399
|
-
}
|
|
400
|
-
const slices = path.split(SLASH).filter(Boolean);
|
|
401
|
-
slices.pop();
|
|
402
|
-
if (slices.length) {
|
|
403
|
-
const parent = this._t(
|
|
404
|
-
slices.join(SLASH) + SLASH,
|
|
405
|
-
this._testCache,
|
|
406
|
-
true,
|
|
407
|
-
slices
|
|
408
|
-
);
|
|
409
|
-
if (parent.ignored) {
|
|
410
|
-
return parent;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
return this._rules.test(path, false, MODE_CHECK_IGNORE);
|
|
414
|
-
}
|
|
415
|
-
_t(path, cache, checkUnignored, slices) {
|
|
416
|
-
if (path in cache) {
|
|
417
|
-
return cache[path];
|
|
418
|
-
}
|
|
419
|
-
if (!slices) {
|
|
420
|
-
slices = path.split(SLASH).filter(Boolean);
|
|
421
|
-
}
|
|
422
|
-
slices.pop();
|
|
423
|
-
if (!slices.length) {
|
|
424
|
-
return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
425
|
-
}
|
|
426
|
-
const parent = this._t(
|
|
427
|
-
slices.join(SLASH) + SLASH,
|
|
428
|
-
cache,
|
|
429
|
-
checkUnignored,
|
|
430
|
-
slices
|
|
431
|
-
);
|
|
432
|
-
return cache[path] = parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
433
|
-
}
|
|
434
|
-
ignores(path) {
|
|
435
|
-
return this._test(path, this._ignoreCache, false).ignored;
|
|
436
|
-
}
|
|
437
|
-
createFilter() {
|
|
438
|
-
return (path) => !this.ignores(path);
|
|
439
|
-
}
|
|
440
|
-
filter(paths) {
|
|
441
|
-
return makeArray(paths).filter(this.createFilter());
|
|
442
|
-
}
|
|
443
|
-
// @returns {TestResult}
|
|
444
|
-
test(path) {
|
|
445
|
-
return this._test(path, this._testCache, true);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
const factory = (options) => new Ignore(options);
|
|
449
|
-
const isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
|
|
450
|
-
const setupWindows = () => {
|
|
451
|
-
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
452
|
-
checkPath.convert = makePosix;
|
|
453
|
-
const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
454
|
-
checkPath.isNotRelative = (path) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
|
|
455
|
-
};
|
|
456
|
-
if (
|
|
457
|
-
// Detect `process` so that it can run in browsers.
|
|
458
|
-
typeof process !== "undefined" && process.platform === "win32"
|
|
459
|
-
) {
|
|
460
|
-
setupWindows();
|
|
461
|
-
}
|
|
462
|
-
module.exports = factory;
|
|
463
|
-
factory.default = factory;
|
|
464
|
-
module.exports.isPathValid = isPathValid;
|
|
465
|
-
define(module.exports, /* @__PURE__ */ Symbol.for("setupWindows"), setupWindows);
|
|
466
|
-
})(ignore$1);
|
|
467
|
-
return ignore$1.exports;
|
|
468
|
-
}
|
|
469
|
-
var ignoreExports = requireIgnore();
|
|
470
|
-
const ignore = /* @__PURE__ */ getDefaultExportFromCjs(ignoreExports);
|
|
471
10
|
const DEPLOY_IGNORE_DEFAULTS = [".git", "node_modules", ".DS_Store", "Thumbs.db"];
|
|
472
|
-
const DEPLOY_IGNORE_FILENAME = ".deployignore";
|
|
473
|
-
async function createDeployIgnoreFilter(rootPath) {
|
|
474
|
-
const ig = ignore().add(DEPLOY_IGNORE_DEFAULTS);
|
|
475
|
-
const deployIgnorePath = path__default.join(rootPath, DEPLOY_IGNORE_FILENAME);
|
|
476
|
-
try {
|
|
477
|
-
const content = await promises.readFile(deployIgnorePath, "utf-8");
|
|
478
|
-
ig.add(content);
|
|
479
|
-
} catch (error) {
|
|
480
|
-
if (!isErrnoException(error) || error.code !== "ENOENT") {
|
|
481
|
-
console.warn(`Failed to read ${deployIgnorePath}:`, error);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
return ig;
|
|
485
|
-
}
|
|
486
11
|
function calculateDirectorySizeForArchive(directoryPath, deployIgnore, pathPrefix) {
|
|
487
12
|
const ig = deployIgnore ?? ignore().add(DEPLOY_IGNORE_DEFAULTS);
|
|
488
13
|
return new Promise((resolve, reject) => {
|
|
@@ -493,8 +18,8 @@ function calculateDirectorySizeForArchive(directoryPath, deployIgnore, pathPrefi
|
|
|
493
18
|
await Promise.all(
|
|
494
19
|
files.map(async (file) => {
|
|
495
20
|
const filePath = path__default.join(dirPath, file.name);
|
|
496
|
-
const fileRelativeToRoot = path__default.relative(directoryPath, filePath)
|
|
497
|
-
const ignorePath = pathPrefix ?
|
|
21
|
+
const fileRelativeToRoot = path__default.relative(directoryPath, filePath);
|
|
22
|
+
const ignorePath = pathPrefix ? path__default.join(pathPrefix, fileRelativeToRoot) : fileRelativeToRoot;
|
|
498
23
|
try {
|
|
499
24
|
if (ig.ignores(ignorePath)) {
|
|
500
25
|
return;
|
|
@@ -613,19 +138,6 @@ function isWordPressVersionAtLeast(version, minimumVersion) {
|
|
|
613
138
|
}
|
|
614
139
|
const WP_CLI_PHAR_FILENAME = "wp-cli.phar";
|
|
615
140
|
const SQLITE_COMMAND_DIRNAME = "sqlite-command";
|
|
616
|
-
const SQLITE_PLUGIN_DIRNAME = "sqlite-database-integration";
|
|
617
|
-
function getAppdataDirectory() {
|
|
618
|
-
if (process.env.E2E && process.env.E2E_APP_DATA_PATH) {
|
|
619
|
-
return path__default.join(process.env.E2E_APP_DATA_PATH, "Studio");
|
|
620
|
-
}
|
|
621
|
-
if (process.platform === "win32") {
|
|
622
|
-
if (!process.env.APPDATA) {
|
|
623
|
-
throw new LoggerError(__("Studio config file path not found."));
|
|
624
|
-
}
|
|
625
|
-
return path__default.join(process.env.APPDATA, "Studio");
|
|
626
|
-
}
|
|
627
|
-
return path__default.join(os.homedir(), "Library", "Application Support", "Studio");
|
|
628
|
-
}
|
|
629
141
|
function getWpFilesPath() {
|
|
630
142
|
return path__default.join(import.meta.dirname, "wp-files");
|
|
631
143
|
}
|
|
@@ -633,22 +145,19 @@ function getWordPressVersionPath(version) {
|
|
|
633
145
|
return path__default.join(getServerFilesPath(), "wordpress-versions", version);
|
|
634
146
|
}
|
|
635
147
|
function getWpCliPharPath() {
|
|
636
|
-
return path__default.join(
|
|
637
|
-
}
|
|
638
|
-
function getSqlitePluginPath() {
|
|
639
|
-
return path__default.join(getServerFilesPath(), SQLITE_PLUGIN_DIRNAME);
|
|
148
|
+
return path__default.join(getWpFilesPath(), "wp-cli", WP_CLI_PHAR_FILENAME);
|
|
640
149
|
}
|
|
641
150
|
function getSqliteCommandPath() {
|
|
642
|
-
return path__default.join(
|
|
151
|
+
return path__default.join(getWpFilesPath(), SQLITE_COMMAND_DIRNAME);
|
|
643
152
|
}
|
|
644
153
|
function getLanguagePacksPath() {
|
|
645
154
|
return path__default.join(getServerFilesPath(), "language-packs");
|
|
646
155
|
}
|
|
647
156
|
function getAiInstructionsPath() {
|
|
648
|
-
return path__default.join(
|
|
157
|
+
return path__default.join(getWpFilesPath(), "skills");
|
|
649
158
|
}
|
|
650
159
|
function getPhpMyAdminPath() {
|
|
651
|
-
return path__default.join(
|
|
160
|
+
return path__default.join(getWpFilesPath(), "phpmyadmin");
|
|
652
161
|
}
|
|
653
162
|
const IS_JSPI_AVAILABLE = "Suspending" in WebAssembly;
|
|
654
163
|
async function createLoaderMuPlugin() {
|
|
@@ -1175,9 +684,6 @@ async function cleanupLegacyMuPlugins(sitePath) {
|
|
|
1175
684
|
);
|
|
1176
685
|
}
|
|
1177
686
|
class SqliteIntegrationProvider {
|
|
1178
|
-
getSqlitePluginSourcePath() {
|
|
1179
|
-
return path__default.join(this.getServerFilesPath(), this.getSqliteDirname());
|
|
1180
|
-
}
|
|
1181
687
|
async isSqliteIntegrationAvailable() {
|
|
1182
688
|
const sqliteSourcePath = this.getSqlitePluginSourcePath();
|
|
1183
689
|
const dbCopyPath = path__default.join(sqliteSourcePath, "db.copy");
|
|
@@ -1220,6 +726,7 @@ class SqliteIntegrationProvider {
|
|
|
1220
726
|
);
|
|
1221
727
|
await fs__default.promises.writeFile(path__default.join(wpContentPath, "db.php"), updatedContent);
|
|
1222
728
|
const sqliteDestPath = path__default.join(wpContentPath, "mu-plugins", sqliteDirname);
|
|
729
|
+
await fs__default.promises.rm(sqliteDestPath, { recursive: true, force: true });
|
|
1223
730
|
await fs__default.promises.cp(sqliteSourcePath, sqliteDestPath, {
|
|
1224
731
|
recursive: true,
|
|
1225
732
|
verbatimSymlinks: true
|
|
@@ -1238,12 +745,12 @@ class SqliteIntegrationProvider {
|
|
|
1238
745
|
}
|
|
1239
746
|
const SQLITE_FILENAME = "sqlite-database-integration";
|
|
1240
747
|
class CliSqliteProvider extends SqliteIntegrationProvider {
|
|
1241
|
-
getServerFilesPath() {
|
|
1242
|
-
return getServerFilesPath();
|
|
1243
|
-
}
|
|
1244
748
|
getSqliteDirname() {
|
|
1245
749
|
return SQLITE_FILENAME;
|
|
1246
750
|
}
|
|
751
|
+
getSqlitePluginSourcePath() {
|
|
752
|
+
return path__default.join(getWpFilesPath(), SQLITE_FILENAME);
|
|
753
|
+
}
|
|
1247
754
|
}
|
|
1248
755
|
const provider = new CliSqliteProvider();
|
|
1249
756
|
async function keepSqliteIntegrationUpdated(sitePath) {
|
|
@@ -1252,9 +759,6 @@ async function keepSqliteIntegrationUpdated(sitePath) {
|
|
|
1252
759
|
async function isSqliteIntegrationInstalled(sitePath) {
|
|
1253
760
|
return provider.isSqliteInstalled(sitePath);
|
|
1254
761
|
}
|
|
1255
|
-
async function getSqliteVersionFromInstallation(sqlitePath) {
|
|
1256
|
-
return provider.getSqliteVersionFromInstallation(sqlitePath);
|
|
1257
|
-
}
|
|
1258
762
|
var cjs = {};
|
|
1259
763
|
var hasRequiredCjs;
|
|
1260
764
|
function requireCjs() {
|
|
@@ -1390,13 +894,10 @@ async function rewriteWpCliPostContentToFile(args, writeFile2) {
|
|
|
1390
894
|
return result.args;
|
|
1391
895
|
}
|
|
1392
896
|
export {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
isSqliteIntegrationInstalled as E,
|
|
1398
|
-
rewriteWpCliPostContentToFile as F,
|
|
1399
|
-
getAppdataDirectory as G,
|
|
897
|
+
getPhpMyAdminPath as A,
|
|
898
|
+
isSqliteIntegrationInstalled as B,
|
|
899
|
+
rewriteWpCliPostContentToFile as C,
|
|
900
|
+
DEPLOY_IGNORE_DEFAULTS as D,
|
|
1400
901
|
IS_JSPI_AVAILABLE as I,
|
|
1401
902
|
arePathsEqual as a,
|
|
1402
903
|
getWordPressVersionUrl as b,
|
|
@@ -1405,23 +906,23 @@ export {
|
|
|
1405
906
|
getWpCliPharPath as e,
|
|
1406
907
|
getSqliteCommandPath as f,
|
|
1407
908
|
getWordPressVersionPath as g,
|
|
1408
|
-
|
|
909
|
+
calculateDirectorySizeForArchive as h,
|
|
1409
910
|
isWordPressDirectory as i,
|
|
1410
|
-
|
|
911
|
+
isWordPressBetaVersion as j,
|
|
1411
912
|
keepSqliteIntegrationUpdated as k,
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
913
|
+
isWordPressDevVersion as l,
|
|
914
|
+
getWpFilesPath as m,
|
|
915
|
+
getLanguagePacksPath as n,
|
|
916
|
+
isEmptyDir as o,
|
|
1416
917
|
pathExists as p,
|
|
1417
|
-
|
|
918
|
+
decodePassword as q,
|
|
1418
919
|
recursiveCopyDirectory as r,
|
|
1419
920
|
getAiInstructionsPath as s,
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
921
|
+
validateAdminEmail as t,
|
|
922
|
+
encodePassword as u,
|
|
923
|
+
validateAdminUsername as v,
|
|
924
|
+
createPassword as w,
|
|
925
|
+
isValidWordPressVersion as x,
|
|
926
|
+
isWordPressVersionAtLeast as y,
|
|
927
|
+
getUnsupportedWpCliPostContentMessage as z
|
|
1427
928
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as normalizeHostname, P as PreviewCommandLoggerAction, v as setSnapshotInConfig, q as emitCliEvent } from "./index-
|
|
1
|
+
import { L as LoggerError, c as Logger, f as SNAPSHOT_EVENTS } from "./certificate-manager-v-yNLDFJ.mjs";
|
|
2
|
+
import { t as normalizeHostname, P as PreviewCommandLoggerAction, v as setSnapshotInConfig, q as emitCliEvent } from "./index-ul3DeWvy.mjs";
|
|
3
3
|
import { __ } from "@wordpress/i18n";
|
|
4
|
-
import { L as LoggerError, d as Logger } from "./well-known-paths-BYA1Bw5o.mjs";
|
|
5
4
|
async function runCommand(host, options) {
|
|
6
5
|
const { name } = options;
|
|
7
6
|
const logger2 = new Logger();
|
|
@@ -44,10 +44,10 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
44
44
|
return next();
|
|
45
45
|
};
|
|
46
46
|
import { SupportedPHPVersions } from "@php-wasm/universal";
|
|
47
|
-
import {
|
|
48
|
-
import { r as readCliConfig, l as lockCliConfig, s as saveCliConfig, u as unlockCliConfig,
|
|
49
|
-
import { V as ValidationError, w as SiteCommandLoggerAction, x as getSiteByFolder, y as getDomainNameValidationError, z as updateDomainInHosts, B as connectToDaemon, C as isServerRunning, D as stopWordPressServer, E as validatePhpVersion, F as runWpCliCommand, G as setupCustomDomain, H as startWordPressServer, I as updateSiteLatestCliPid, q as emitCliEvent, J as disconnectFromDaemon } from "./index-
|
|
50
|
-
import {
|
|
47
|
+
import { M as MINIMUM_WORDPRESS_VERSION, m as DEFAULT_WORDPRESS_VERSION } from "./well-known-paths-QcSJNi_l.mjs";
|
|
48
|
+
import { L as LoggerError, c as Logger, r as readCliConfig, l as lockCliConfig, s as saveCliConfig, u as unlockCliConfig, n as generateSiteCertificate, S as SITE_EVENTS } from "./certificate-manager-v-yNLDFJ.mjs";
|
|
49
|
+
import { V as ValidationError, w as SiteCommandLoggerAction, x as getSiteByFolder, y as getDomainNameValidationError, z as updateDomainInHosts, B as connectToDaemon, C as isServerRunning, D as stopWordPressServer, E as validatePhpVersion, F as runWpCliCommand, G as setupCustomDomain, H as startWordPressServer, I as updateSiteLatestCliPid, q as emitCliEvent, J as disconnectFromDaemon } from "./index-ul3DeWvy.mjs";
|
|
50
|
+
import { x as isValidWordPressVersion, y as isWordPressVersionAtLeast, v as validateAdminUsername, t as validateAdminEmail, a as arePathsEqual, u as encodePassword, b as getWordPressVersionUrl } from "./rewrite-wp-cli-post-content-Beo5_Ojo.mjs";
|
|
51
51
|
import { __, sprintf } from "@wordpress/i18n";
|
|
52
52
|
function siteNeedsRestart(changes) {
|
|
53
53
|
const {
|
|
@@ -280,7 +280,6 @@ async function runCommand(sitePath, options) {
|
|
|
280
280
|
}
|
|
281
281
|
logger.reportSuccess(__("Site configuration updated"));
|
|
282
282
|
await emitCliEvent({ event: SITE_EVENTS.UPDATED, data: { siteId: site.id } });
|
|
283
|
-
return;
|
|
284
283
|
} finally {
|
|
285
284
|
await disconnectFromDaemon();
|
|
286
285
|
}
|