@wp-playground/cli 3.0.43 → 3.0.44

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.
@@ -26,6 +26,11 @@ export type WorkerBootOptions = {
26
26
  withIntl?: boolean;
27
27
  withXdebug?: boolean;
28
28
  nativeInternalDirPath: string;
29
+ /**
30
+ * PHP constants to define via php.defineConstant().
31
+ * Process-specific, set for each PHP instance.
32
+ */
33
+ constants?: Record<string, string | number | boolean | null>;
29
34
  };
30
35
  export type PrimaryWorkerBootOptions = WorkerBootOptions & {
31
36
  wordpressInstallMode: WordPressInstallMode;
@@ -2,7 +2,7 @@
2
2
  import type { RemoteAPI } from '@php-wasm/universal';
3
3
  import type { PlaygroundCliBlueprintV2Worker } from './worker-thread-v2';
4
4
  import type { MessagePort as NodeMessagePort } from 'worker_threads';
5
- import type { RunCLIArgs, SpawnedWorker, WorkerType } from '../run-cli';
5
+ import { type RunCLIArgs, type SpawnedWorker, type WorkerType } from '../run-cli';
6
6
  import type { CLIOutput } from '../cli-output';
7
7
  /**
8
8
  * Boots Playground CLI workers using Blueprint version 2.
@@ -19,6 +19,11 @@ export type PrimaryWorkerBootArgs = Omit<RunCLIArgs, 'mount-before-install' | 'm
19
19
  nativeInternalDirPath: string;
20
20
  mountsBeforeWpInstall?: Array<Mount>;
21
21
  mountsAfterWpInstall?: Array<Mount>;
22
+ /**
23
+ * PHP constants to define via php.defineConstant().
24
+ * Process-specific, set for each PHP instance.
25
+ */
26
+ constants?: Record<string, string | number | boolean | null>;
22
27
  };
23
28
  type WorkerRunBlueprintArgs = Omit<RunCLIArgs, 'mount-before-install' | 'mount'> & {
24
29
  siteUrl: string;
package/cli.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";const s=require("./run-cli-B8Dv6R-o.cjs"),r=process.argv.slice(2);s.parseOptionsAndRunCLI(r);
1
+ "use strict";const s=require("./run-cli-le2xCSBZ.cjs"),r=process.argv.slice(2);s.parseOptionsAndRunCLI(r);
2
2
  //# sourceMappingURL=cli.cjs.map
package/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as s } from "./run-cli-NcKUE5gJ.js";
1
+ import { p as s } from "./run-cli-DOpShCrT.js";
2
2
  const r = process.argv.slice(2);
3
3
  s(r);
4
4
  //# sourceMappingURL=cli.js.map
package/defines.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Parse an array of constant name-value pairs into a constants object.
3
+ * Works similarly to parseMountDirArguments - each pair of array elements
4
+ * represents a constant name and its value.
5
+ *
6
+ * Format: --define NAME value
7
+ * Examples:
8
+ * --define API_KEY secret
9
+ * --define CON=ST "va=lu=e"
10
+ *
11
+ * @param defines - An array where each pair is [name, value]
12
+ * @returns An object mapping constant names to their string values
13
+ */
14
+ export declare function parseDefineStringArguments(defines: string[]): Record<string, string>;
15
+ /**
16
+ * Parse an array of constant name-value pairs into a boolean constants object.
17
+ * Works similarly to parseMountDirArguments - each pair of array elements
18
+ * represents a constant name and its value.
19
+ *
20
+ * Format: --define-bool NAME value
21
+ * Examples:
22
+ * --define-bool WP_DEBUG true
23
+ * --define-bool WP_DEBUG_LOG false
24
+ *
25
+ * @param defines - An array where each pair is [name, value]
26
+ * @returns An object mapping constant names to their boolean values
27
+ */
28
+ export declare function parseDefineBoolArguments(defines: string[]): Record<string, boolean>;
29
+ /**
30
+ * Parse an array of constant name-value pairs into a number constants object.
31
+ * Works similarly to parseMountDirArguments - each pair of array elements
32
+ * represents a constant name and its value.
33
+ *
34
+ * Format: --define-number NAME value
35
+ * Examples:
36
+ * --define-number LIMIT 100
37
+ * --define-number RATE 45.67
38
+ *
39
+ * @param defines - An array where each pair is [name, value]
40
+ * @returns An object mapping constant names to their numeric values
41
+ */
42
+ export declare function parseDefineNumberArguments(defines: string[]): Record<string, number>;
43
+ /**
44
+ * Merge all constants from CLI arguments.
45
+ *
46
+ * @param args - CLI arguments
47
+ * @returns Merged constants
48
+ */
49
+ export declare function mergeDefinedConstants(args: {
50
+ define?: Record<string, string>;
51
+ 'define-bool'?: Record<string, boolean>;
52
+ 'define-number'?: Record<string, number>;
53
+ }): Record<string, string | number | boolean>;
package/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./run-cli-B8Dv6R-o.cjs");exports.LogVerbosity=e.LogVerbosity;exports.internalsKeyForTesting=e.internalsKeyForTesting;exports.parseOptionsAndRunCLI=e.parseOptionsAndRunCLI;exports.runCLI=e.runCLI;exports.spawnWorkerThread=e.spawnWorkerThread;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./run-cli-le2xCSBZ.cjs");exports.LogVerbosity=e.LogVerbosity;exports.internalsKeyForTesting=e.internalsKeyForTesting;exports.mergeDefinedConstants=e.mergeDefinedConstants;exports.parseOptionsAndRunCLI=e.parseOptionsAndRunCLI;exports.runCLI=e.runCLI;exports.spawnWorkerThread=e.spawnWorkerThread;
2
2
  //# sourceMappingURL=index.cjs.map
package/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { L as a, i as e, p as n, r as o, s as i } from "./run-cli-NcKUE5gJ.js";
1
+ import { L as r, i as a, m as n, p as o, r as t, s as i } from "./run-cli-DOpShCrT.js";
2
2
  export {
3
- a as LogVerbosity,
4
- e as internalsKeyForTesting,
5
- n as parseOptionsAndRunCLI,
6
- o as runCLI,
3
+ r as LogVerbosity,
4
+ a as internalsKeyForTesting,
5
+ n as mergeDefinedConstants,
6
+ o as parseOptionsAndRunCLI,
7
+ t as runCLI,
7
8
  i as spawnWorkerThread
8
9
  };
9
10
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-playground/cli",
3
- "version": "3.0.43",
3
+ "version": "3.0.44",
4
4
  "description": "WordPress Playground CLI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "bin": {
35
35
  "wp-playground-cli": "wp-playground.js"
36
36
  },
37
- "gitHead": "a73661b5ec1f5d4bd2b1cd29789625d80561ff85",
37
+ "gitHead": "16881b9b024e961a5254be5b366fad096585c310",
38
38
  "dependencies": {
39
39
  "@zip.js/zip.js": "2.7.57",
40
40
  "ajv": "8.12.0",
@@ -62,17 +62,17 @@
62
62
  "ws": "8.18.3",
63
63
  "xml2js": "0.6.2",
64
64
  "yargs": "17.7.2",
65
- "@php-wasm/logger": "3.0.43",
66
- "@php-wasm/progress": "3.0.43",
67
- "@php-wasm/universal": "3.0.43",
68
- "@wp-playground/blueprints": "3.0.43",
69
- "@wp-playground/common": "3.0.43",
70
- "@wp-playground/wordpress": "3.0.43",
71
- "@php-wasm/node": "3.0.43",
72
- "@php-wasm/util": "3.0.43",
73
- "@php-wasm/cli-util": "3.0.43",
74
- "@wp-playground/storage": "3.0.43",
75
- "@php-wasm/xdebug-bridge": "3.0.43"
65
+ "@php-wasm/logger": "3.0.44",
66
+ "@php-wasm/progress": "3.0.44",
67
+ "@php-wasm/universal": "3.0.44",
68
+ "@wp-playground/blueprints": "3.0.44",
69
+ "@wp-playground/common": "3.0.44",
70
+ "@wp-playground/wordpress": "3.0.44",
71
+ "@php-wasm/node": "3.0.44",
72
+ "@php-wasm/util": "3.0.44",
73
+ "@php-wasm/cli-util": "3.0.44",
74
+ "@wp-playground/storage": "3.0.44",
75
+ "@php-wasm/xdebug-bridge": "3.0.44"
76
76
  },
77
77
  "packageManager": "npm@10.9.2",
78
78
  "overrides": {