wp-studio 1.7.7-alpha1

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.
Files changed (48) hide show
  1. package/LICENSE.md +257 -0
  2. package/README.md +87 -0
  3. package/dist/cli/_events-BeOo0LuG.js +116 -0
  4. package/dist/cli/appdata-07CF2rhg.js +21090 -0
  5. package/dist/cli/archive-xDmkN4wb.js +15942 -0
  6. package/dist/cli/browser-CgWK-yoe.js +44 -0
  7. package/dist/cli/certificate-manager-DdBumKZp.js +250 -0
  8. package/dist/cli/create-BHVhkvTx.js +80 -0
  9. package/dist/cli/create-ZS29BDDi.js +40999 -0
  10. package/dist/cli/delete-BgQn-elT.js +56 -0
  11. package/dist/cli/delete-g8pgaLna.js +132 -0
  12. package/dist/cli/get-wordpress-version-BwSCJujO.js +18 -0
  13. package/dist/cli/index-7pbG_s_U.js +434 -0
  14. package/dist/cli/index-BXRYeCYG.js +1393 -0
  15. package/dist/cli/index-T3F1GwxX.js +2668 -0
  16. package/dist/cli/is-errno-exception-t38xF2pB.js +6 -0
  17. package/dist/cli/list-BE_UBjL5.js +105 -0
  18. package/dist/cli/list-DKz0XxM7.js +1032 -0
  19. package/dist/cli/logger-actions-OaIvl-ai.js +45 -0
  20. package/dist/cli/login-B4PkfKOu.js +82 -0
  21. package/dist/cli/logout-BC9gKlTj.js +48 -0
  22. package/dist/cli/main.js +5 -0
  23. package/dist/cli/mu-plugins-GEfKsl5U.js +530 -0
  24. package/dist/cli/passwords-DyzWd9Xi.js +80 -0
  25. package/dist/cli/process-manager-daemon.js +327 -0
  26. package/dist/cli/process-manager-ipc-AUZeYYDT.js +454 -0
  27. package/dist/cli/proxy-daemon.js +197 -0
  28. package/dist/cli/run-wp-cli-command-BctnMDWG.js +88 -0
  29. package/dist/cli/sequential-BQFuixXz.js +46 -0
  30. package/dist/cli/server-files-C_oy-mnI.js +26 -0
  31. package/dist/cli/set-DknhAZpw.js +327 -0
  32. package/dist/cli/site-utils-CfsabjUn.js +243 -0
  33. package/dist/cli/snapshots-6XE53y_F.js +874 -0
  34. package/dist/cli/sqlite-integration-H4OwSlwR.js +83 -0
  35. package/dist/cli/start-CRJqm09_.js +90 -0
  36. package/dist/cli/status-CWNHIOaY.js +44 -0
  37. package/dist/cli/status-CWWx9jYF.js +110 -0
  38. package/dist/cli/stop-CQosmjqA.js +117 -0
  39. package/dist/cli/update-BgL2HKHW.js +101 -0
  40. package/dist/cli/validation-error-DqLxqQuA.js +40 -0
  41. package/dist/cli/wordpress-server-child.js +514 -0
  42. package/dist/cli/wordpress-server-ipc-Dwsg9jSb.js +140 -0
  43. package/dist/cli/wordpress-server-manager-CtiuJqEb.js +566 -0
  44. package/dist/cli/wordpress-version-utils-B6UVeTh_.js +51 -0
  45. package/dist/cli/wp-UGSnlkN0.js +103 -0
  46. package/package.json +73 -0
  47. package/patches/@wp-playground+wordpress+3.1.12.patch +28 -0
  48. package/scripts/postinstall-npm.mjs +38 -0
@@ -0,0 +1,45 @@
1
+ var AuthCommandLoggerAction = /* @__PURE__ */ ((AuthCommandLoggerAction2) => {
2
+ AuthCommandLoggerAction2["LOGIN"] = "login";
3
+ AuthCommandLoggerAction2["LOGOUT"] = "logout";
4
+ AuthCommandLoggerAction2["STATUS_CHECK"] = "status_check";
5
+ return AuthCommandLoggerAction2;
6
+ })(AuthCommandLoggerAction || {});
7
+ var PreviewCommandLoggerAction = /* @__PURE__ */ ((PreviewCommandLoggerAction2) => {
8
+ PreviewCommandLoggerAction2["VALIDATE"] = "validate";
9
+ PreviewCommandLoggerAction2["ARCHIVE"] = "archive";
10
+ PreviewCommandLoggerAction2["LOAD"] = "load";
11
+ PreviewCommandLoggerAction2["DELETE"] = "delete";
12
+ PreviewCommandLoggerAction2["UPLOAD"] = "upload";
13
+ PreviewCommandLoggerAction2["READY"] = "ready";
14
+ PreviewCommandLoggerAction2["APPDATA"] = "appdata";
15
+ return PreviewCommandLoggerAction2;
16
+ })(PreviewCommandLoggerAction || {});
17
+ var SiteCommandLoggerAction = /* @__PURE__ */ ((SiteCommandLoggerAction2) => {
18
+ SiteCommandLoggerAction2["START_DAEMON"] = "startDaemon";
19
+ SiteCommandLoggerAction2["LOAD_SITES"] = "loadSites";
20
+ SiteCommandLoggerAction2["START_PROXY"] = "startProxy";
21
+ SiteCommandLoggerAction2["STOP_PROXY"] = "stopProxy";
22
+ SiteCommandLoggerAction2["GENERATE_CERT"] = "generateCert";
23
+ SiteCommandLoggerAction2["DELETE_CERT"] = "deleteCert";
24
+ SiteCommandLoggerAction2["ADD_DOMAIN_TO_HOSTS"] = "addDomainToHosts";
25
+ SiteCommandLoggerAction2["REMOVE_DOMAIN_FROM_HOSTS"] = "removeDomainFromHosts";
26
+ SiteCommandLoggerAction2["START_SITE"] = "startSite";
27
+ SiteCommandLoggerAction2["STOP_SITE"] = "stopSite";
28
+ SiteCommandLoggerAction2["STOP_ALL_SITES"] = "stopAllSites";
29
+ SiteCommandLoggerAction2["SET_WP_VERSION"] = "setWpVersion";
30
+ SiteCommandLoggerAction2["VALIDATE"] = "validate";
31
+ SiteCommandLoggerAction2["CREATE_DIRECTORY"] = "createDirectory";
32
+ SiteCommandLoggerAction2["INSTALL_SQLITE"] = "installSqlite";
33
+ SiteCommandLoggerAction2["ASSIGN_PORT"] = "assignPort";
34
+ SiteCommandLoggerAction2["SETUP_WORDPRESS"] = "setupWordPress";
35
+ SiteCommandLoggerAction2["SAVE_SITE"] = "saveSite";
36
+ SiteCommandLoggerAction2["APPLY_BLUEPRINT"] = "applyBlueprint";
37
+ SiteCommandLoggerAction2["DELETE_PREVIEW_SITES"] = "deletePreviewSites";
38
+ SiteCommandLoggerAction2["DELETE_FILES"] = "deleteFiles";
39
+ return SiteCommandLoggerAction2;
40
+ })(SiteCommandLoggerAction || {});
41
+ export {
42
+ AuthCommandLoggerAction as A,
43
+ PreviewCommandLoggerAction as P,
44
+ SiteCommandLoggerAction as S
45
+ };
@@ -0,0 +1,82 @@
1
+ import { a as Logger, g as getAuthToken, b as getAuthenticationUrl, L as LoggerError, c as getUserInfo, l as lockAppdata, r as readAppdata, d as DEFAULT_TOKEN_LIFETIME_MS, s as saveAppdata, u as unlockAppdata } from "./appdata-07CF2rhg.js";
2
+ import { A as AuthCommandLoggerAction } from "./logger-actions-OaIvl-ai.js";
3
+ import { __, sprintf } from "@wordpress/i18n";
4
+ import { o as openBrowser } from "./browser-CgWK-yoe.js";
5
+ import { g as getAppLocale } from "./index-7pbG_s_U.js";
6
+ import { i as input } from "./index-T3F1GwxX.js";
7
+ const CLI_REDIRECT_URI = `https://developer.wordpress.com/copy-oauth-token`;
8
+ async function runCommand() {
9
+ const logger = new Logger();
10
+ try {
11
+ await getAuthToken();
12
+ logger.reportSuccess(__("Already authenticated with WordPress.com"));
13
+ return;
14
+ } catch (error) {
15
+ }
16
+ logger.reportStart(AuthCommandLoggerAction.LOGIN, __("Opening browser for authentication…"));
17
+ const appLocale = await getAppLocale();
18
+ const authUrl = getAuthenticationUrl(appLocale, CLI_REDIRECT_URI);
19
+ try {
20
+ await openBrowser(authUrl);
21
+ logger.reportSuccess(__("Browser opened successfully"));
22
+ } catch (error) {
23
+ const loggerError = new LoggerError(
24
+ sprintf(__("Failed to open browser. Please open the URL manually: %s"), authUrl),
25
+ error
26
+ );
27
+ logger.reportError(loggerError);
28
+ }
29
+ console.log(
30
+ __("Please complete authentication in your browser and paste the generated token here.")
31
+ );
32
+ console.log("");
33
+ let accessToken;
34
+ let user;
35
+ try {
36
+ accessToken = await input({ message: __("Authentication token:") });
37
+ user = await getUserInfo(accessToken);
38
+ logger.reportSuccess(__("Authentication completed successfully!"));
39
+ } catch (error) {
40
+ logger.reportError(new LoggerError(__("Authentication failed. Please try again.")));
41
+ return;
42
+ }
43
+ try {
44
+ await lockAppdata();
45
+ const userData = await readAppdata();
46
+ userData.authToken = {
47
+ accessToken,
48
+ id: user.ID,
49
+ email: user.email,
50
+ displayName: user.display_name,
51
+ expiresIn: DEFAULT_TOKEN_LIFETIME_MS / 1e3,
52
+ expirationTime: Date.now() + DEFAULT_TOKEN_LIFETIME_MS
53
+ };
54
+ await saveAppdata(userData);
55
+ } catch (error) {
56
+ if (error instanceof LoggerError) {
57
+ logger.reportError(error);
58
+ } else {
59
+ logger.reportError(new LoggerError(__("Authentication failed"), error));
60
+ }
61
+ } finally {
62
+ await unlockAppdata();
63
+ }
64
+ }
65
+ const registerCommand = (yargs) => {
66
+ return yargs.command({
67
+ command: "login",
68
+ describe: __("Log in to WordPress.com"),
69
+ builder: (yargs2) => {
70
+ return yargs2.option("path", {
71
+ hidden: true
72
+ });
73
+ },
74
+ handler: async () => {
75
+ await runCommand();
76
+ }
77
+ });
78
+ };
79
+ export {
80
+ registerCommand,
81
+ runCommand
82
+ };
@@ -0,0 +1,48 @@
1
+ import { A as AuthCommandLoggerAction } from "./logger-actions-OaIvl-ai.js";
2
+ import { __ } from "@wordpress/i18n";
3
+ import { a as Logger, g as getAuthToken, l as lockAppdata, e as revokeAuthToken, r as readAppdata, s as saveAppdata, L as LoggerError, u as unlockAppdata } from "./appdata-07CF2rhg.js";
4
+ async function runCommand() {
5
+ const logger = new Logger();
6
+ logger.reportStart(AuthCommandLoggerAction.LOGOUT, __("Logging out…"));
7
+ let token;
8
+ try {
9
+ token = await getAuthToken();
10
+ } catch (error) {
11
+ logger.reportSuccess(__("Already logged out"));
12
+ return;
13
+ }
14
+ try {
15
+ await lockAppdata();
16
+ await revokeAuthToken(token.accessToken);
17
+ const userData = await readAppdata();
18
+ delete userData.authToken;
19
+ await saveAppdata(userData);
20
+ logger.reportSuccess(__("Successfully logged out"));
21
+ } catch (error) {
22
+ if (error instanceof LoggerError) {
23
+ logger.reportError(error);
24
+ } else {
25
+ logger.reportError(new LoggerError(__("Failed to log out"), error));
26
+ }
27
+ } finally {
28
+ await unlockAppdata();
29
+ }
30
+ }
31
+ const registerCommand = (yargs) => {
32
+ return yargs.command({
33
+ command: "logout",
34
+ describe: __("Log out and clear WordPress.com authentication"),
35
+ builder: (yargs2) => {
36
+ return yargs2.option("path", {
37
+ hidden: true
38
+ });
39
+ },
40
+ handler: async () => {
41
+ await runCommand();
42
+ }
43
+ });
44
+ };
45
+ export {
46
+ registerCommand,
47
+ runCommand
48
+ };
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import "node:path";
3
+ import "./index-7pbG_s_U.js";
4
+ import "@wordpress/i18n";
5
+ import "yargs";