@wp-playground/cli 1.2.3 → 2.0.0
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/blueprints-BQYAZ9gc.js +9 -0
- package/blueprints-BQYAZ9gc.js.map +1 -0
- package/blueprints-DLntJtVr.js +9 -0
- package/blueprints-DLntJtVr.js.map +1 -0
- package/blueprints-ZBrY1bvK.cjs +2 -0
- package/blueprints-ZBrY1bvK.cjs.map +1 -0
- package/blueprints-v1/blueprints-v1-handler.d.ts +31 -0
- package/{worker-thread.d.ts → blueprints-v1/worker-thread-v1.d.ts} +4 -3
- package/blueprints-v2/blueprint-v2-declaration.d.ts +10 -0
- package/blueprints-v2/blueprints-v2-handler.d.ts +31 -0
- package/blueprints-v2/get-v2-runner.d.ts +1 -0
- package/{v2.d.ts → blueprints-v2/run-blueprint-v2.d.ts} +1 -11
- package/blueprints-v2/worker-thread-v2.d.ts +49 -0
- package/cli.cjs +1 -1
- package/cli.cjs.map +1 -1
- package/cli.js +2 -4
- package/cli.js.map +1 -1
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/load-balancer.d.ts +3 -1
- package/package.json +11 -11
- package/run-cli-CY1lYIJH.js +674 -0
- package/run-cli-CY1lYIJH.js.map +1 -0
- package/run-cli-opqDVXKw.cjs +27 -0
- package/run-cli-opqDVXKw.cjs.map +1 -0
- package/run-cli.d.ts +27 -5
- package/{worker-thread-CYvRK9UX.js → worker-thread-v1-BTJIbQLy.js} +47 -44
- package/worker-thread-v1-BTJIbQLy.js.map +1 -0
- package/worker-thread-v1.cjs +3 -0
- package/worker-thread-v1.cjs.map +1 -0
- package/{worker-thread.js → worker-thread-v1.js} +34 -31
- package/worker-thread-v1.js.map +1 -0
- package/worker-thread-v2-Pfv6UYF4.js +429 -0
- package/worker-thread-v2-Pfv6UYF4.js.map +1 -0
- package/worker-thread-v2.cjs +92 -0
- package/worker-thread-v2.cjs.map +1 -0
- package/worker-thread-v2.js +432 -0
- package/worker-thread-v2.js.map +1 -0
- package/reportable-error.d.ts +0 -5
- package/run-cli-B5BfXxxJ.cjs +0 -24
- package/run-cli-B5BfXxxJ.cjs.map +0 -1
- package/run-cli-W9VNXESj.js +0 -586
- package/run-cli-W9VNXESj.js.map +0 -1
- package/worker-thread-CYvRK9UX.js.map +0 -1
- package/worker-thread.cjs +0 -3
- package/worker-thread.cjs.map +0 -1
- package/worker-thread.js.map +0 -1
- /package/{download.d.ts → blueprints-v1/download.d.ts} +0 -0
- /package/{server.d.ts → start-server.d.ts} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { PlaygroundCliBlueprintV1Worker } from './worker-thread-v1';
|
|
4
|
+
import type { MessagePort as NodeMessagePort } from 'worker_threads';
|
|
5
|
+
import type { RunCLIArgs, SpawnedWorker } from '../run-cli';
|
|
6
|
+
/**
|
|
7
|
+
* Boots Playground CLI workers using Blueprint version 1.
|
|
8
|
+
*
|
|
9
|
+
* Progress tracking, downloads, steps, and all other features are
|
|
10
|
+
* implemented in TypeScript and orchestrated by this class.
|
|
11
|
+
*/
|
|
12
|
+
export declare class BlueprintsV1Handler {
|
|
13
|
+
private phpVersion;
|
|
14
|
+
private lastProgressMessage;
|
|
15
|
+
private siteUrl;
|
|
16
|
+
private processIdSpaceLength;
|
|
17
|
+
private args;
|
|
18
|
+
constructor(args: RunCLIArgs, options: {
|
|
19
|
+
siteUrl: string;
|
|
20
|
+
processIdSpaceLength: number;
|
|
21
|
+
});
|
|
22
|
+
getWorkerUrl(): any;
|
|
23
|
+
bootPrimaryWorker(phpPort: NodeMessagePort, fileLockManagerPort: NodeMessagePort): Promise<import("@php-wasm/universal").RemoteAPI<PlaygroundCliBlueprintV1Worker>>;
|
|
24
|
+
bootSecondaryWorker({ worker, fileLockManagerPort, firstProcessId, }: {
|
|
25
|
+
worker: SpawnedWorker;
|
|
26
|
+
fileLockManagerPort: NodeMessagePort;
|
|
27
|
+
firstProcessId: number;
|
|
28
|
+
}): Promise<import("@php-wasm/universal").RemoteAPI<PlaygroundCliBlueprintV1Worker>>;
|
|
29
|
+
compileInputBlueprint(additionalBlueprintSteps: any[]): Promise<import("@wp-playground/blueprints").CompiledBlueprint>;
|
|
30
|
+
writeProgressUpdate(writeStream: NodeJS.WriteStream, message: string, finalUpdate: boolean): void;
|
|
31
|
+
}
|
|
@@ -8,7 +8,7 @@ export interface Mount {
|
|
|
8
8
|
hostPath: string;
|
|
9
9
|
vfsPath: string;
|
|
10
10
|
}
|
|
11
|
-
export type
|
|
11
|
+
export type WorkerBootOptions = {
|
|
12
12
|
wpVersion?: string;
|
|
13
13
|
phpVersion?: SupportedPHPVersion;
|
|
14
14
|
absoluteUrl: string;
|
|
@@ -31,7 +31,7 @@ export type PrimaryWorkerBootOptions = {
|
|
|
31
31
|
internalCookieStore?: boolean;
|
|
32
32
|
withXdebug?: boolean;
|
|
33
33
|
};
|
|
34
|
-
export declare class
|
|
34
|
+
export declare class PlaygroundCliBlueprintV1Worker extends PHPWorker {
|
|
35
35
|
booted: boolean;
|
|
36
36
|
fileLockManager: RemoteAPI<FileLockManager> | FileLockManager | undefined;
|
|
37
37
|
constructor(monitor: EmscriptenDownloadMonitor);
|
|
@@ -45,6 +45,7 @@ export declare class PlaygroundCliWorker extends PHPWorker {
|
|
|
45
45
|
* @see phpwasm-emscripten-library-file-locking-for-node.js
|
|
46
46
|
*/
|
|
47
47
|
useFileLockManager(port: MessagePort): Promise<void>;
|
|
48
|
-
|
|
48
|
+
bootAsPrimaryWorker({ absoluteUrl, mountsBeforeWpInstall, mountsAfterWpInstall, phpVersion, wordPressZip, sqliteIntegrationPluginZip, firstProcessId, processIdSpaceLength, dataSqlPath, followSymlinks, trace, internalCookieStore, withXdebug, }: WorkerBootOptions): Promise<void>;
|
|
49
|
+
bootAsSecondaryWorker(args: WorkerBootOptions): Promise<void>;
|
|
49
50
|
dispose(): Promise<void>;
|
|
50
51
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BlueprintDeclaration } from '@wp-playground/blueprints';
|
|
2
|
+
export type BlueprintV2Declaration = string | BlueprintDeclaration | undefined;
|
|
3
|
+
export type ParsedBlueprintV2Declaration = {
|
|
4
|
+
type: 'inline-file';
|
|
5
|
+
contents: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'file-reference';
|
|
8
|
+
reference: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function parseBlueprintDeclaration(source: BlueprintV2Declaration | ParsedBlueprintV2Declaration): ParsedBlueprintV2Declaration;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import type { RemoteAPI } from '@php-wasm/universal';
|
|
4
|
+
import type { PlaygroundCliBlueprintV2Worker } from './worker-thread-v2';
|
|
5
|
+
import type { MessagePort as NodeMessagePort } from 'worker_threads';
|
|
6
|
+
import type { RunCLIArgs, SpawnedWorker } from '../run-cli';
|
|
7
|
+
/**
|
|
8
|
+
* Boots Playground CLI workers using Blueprint version 2.
|
|
9
|
+
*
|
|
10
|
+
* Progress tracking, downloads, steps, and all other features are
|
|
11
|
+
* implemented in PHP and orchestrated by the worker thread.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BlueprintsV2Handler {
|
|
14
|
+
private phpVersion;
|
|
15
|
+
private lastProgressMessage;
|
|
16
|
+
private siteUrl;
|
|
17
|
+
private processIdSpaceLength;
|
|
18
|
+
private args;
|
|
19
|
+
constructor(args: RunCLIArgs, options: {
|
|
20
|
+
siteUrl: string;
|
|
21
|
+
processIdSpaceLength: number;
|
|
22
|
+
});
|
|
23
|
+
getWorkerUrl(): any;
|
|
24
|
+
bootPrimaryWorker(phpPort: NodeMessagePort, fileLockManagerPort: NodeMessagePort): Promise<RemoteAPI<PlaygroundCliBlueprintV2Worker>>;
|
|
25
|
+
bootSecondaryWorker({ worker, fileLockManagerPort, firstProcessId, }: {
|
|
26
|
+
worker: SpawnedWorker;
|
|
27
|
+
fileLockManagerPort: NodeMessagePort;
|
|
28
|
+
firstProcessId: number;
|
|
29
|
+
}): Promise<RemoteAPI<PlaygroundCliBlueprintV2Worker>>;
|
|
30
|
+
writeProgressUpdate(writeStream: NodeJS.WriteStream, message: string, finalUpdate: boolean): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getV2Runner(): Promise<File>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StreamedPHPResponse, type UniversalPHP } from '@php-wasm/universal';
|
|
2
|
-
import type
|
|
2
|
+
import { type BlueprintV2Declaration, type ParsedBlueprintV2Declaration } from './blueprint-v2-declaration';
|
|
3
3
|
export type PHPExceptionDetails = {
|
|
4
4
|
exception: string;
|
|
5
5
|
message: string;
|
|
@@ -31,15 +31,5 @@ interface RunV2Options {
|
|
|
31
31
|
};
|
|
32
32
|
onMessage?: (message: BlueprintMessage) => void | Promise<void>;
|
|
33
33
|
}
|
|
34
|
-
export type BlueprintV2Declaration = string | BlueprintDeclaration | undefined;
|
|
35
|
-
export type ParsedBlueprintV2Declaration = {
|
|
36
|
-
type: 'inline-file';
|
|
37
|
-
contents: string;
|
|
38
|
-
} | {
|
|
39
|
-
type: 'file-reference';
|
|
40
|
-
reference: string;
|
|
41
|
-
};
|
|
42
|
-
export declare function parseBlueprintDeclaration(source: BlueprintV2Declaration | ParsedBlueprintV2Declaration): ParsedBlueprintV2Declaration;
|
|
43
|
-
export declare function getV2Runner(): Promise<File>;
|
|
44
34
|
export declare function runBlueprintV2(options: RunV2Options): Promise<StreamedPHPResponse>;
|
|
45
35
|
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { FileLockManager } from '@php-wasm/node';
|
|
3
|
+
import { EmscriptenDownloadMonitor } from '@php-wasm/progress';
|
|
4
|
+
import type { RemoteAPI, SupportedPHPVersion } from '@php-wasm/universal';
|
|
5
|
+
import { PHPWorker } from '@php-wasm/universal';
|
|
6
|
+
import { type ParsedBlueprintV2Declaration, type BlueprintV2Declaration } from './blueprint-v2-declaration';
|
|
7
|
+
import { type MessagePort } from 'worker_threads';
|
|
8
|
+
import { type RunCLIArgs } from '../run-cli';
|
|
9
|
+
export type WorkerBootArgs = RunCLIArgs & {
|
|
10
|
+
php: SupportedPHPVersion;
|
|
11
|
+
siteUrl: string;
|
|
12
|
+
firstProcessId: number;
|
|
13
|
+
processIdSpaceLength: number;
|
|
14
|
+
trace: boolean;
|
|
15
|
+
blueprint: BlueprintV2Declaration | ParsedBlueprintV2Declaration;
|
|
16
|
+
};
|
|
17
|
+
type WorkerRunBlueprintArgs = RunCLIArgs & {
|
|
18
|
+
siteUrl: string;
|
|
19
|
+
blueprint: BlueprintV2Declaration | ParsedBlueprintV2Declaration;
|
|
20
|
+
};
|
|
21
|
+
interface WorkerBootRequestHandlerOptions {
|
|
22
|
+
siteUrl: string;
|
|
23
|
+
php: SupportedPHPVersion;
|
|
24
|
+
allow?: string;
|
|
25
|
+
firstProcessId: number;
|
|
26
|
+
processIdSpaceLength: number;
|
|
27
|
+
trace: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare class PlaygroundCliBlueprintV2Worker extends PHPWorker {
|
|
30
|
+
booted: boolean;
|
|
31
|
+
fileLockManager: RemoteAPI<FileLockManager> | FileLockManager | undefined;
|
|
32
|
+
constructor(monitor: EmscriptenDownloadMonitor);
|
|
33
|
+
/**
|
|
34
|
+
* Call this method before boot() to use file locking.
|
|
35
|
+
*
|
|
36
|
+
* This method is separate from boot() to simplify the related Comlink.transferHandlers
|
|
37
|
+
* setup – if an argument is a MessagePort, we're transferring it, not copying it.
|
|
38
|
+
*
|
|
39
|
+
* @see comlink-sync.ts
|
|
40
|
+
* @see phpwasm-emscripten-library-file-locking-for-node.js
|
|
41
|
+
*/
|
|
42
|
+
useFileLockManager(port: MessagePort): Promise<void>;
|
|
43
|
+
bootAsPrimaryWorker(args: WorkerBootArgs): Promise<void>;
|
|
44
|
+
bootAsSecondaryWorker(args: WorkerBootArgs): Promise<void>;
|
|
45
|
+
runBlueprintV2(args: WorkerRunBlueprintArgs): Promise<void>;
|
|
46
|
+
bootRequestHandler({ siteUrl, allow, php, firstProcessId, processIdSpaceLength, trace, }: WorkerBootRequestHandlerOptions): Promise<void>;
|
|
47
|
+
dispose(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
package/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("./run-cli-opqDVXKw.cjs");n.parseOptionsAndRunCLI();
|
|
2
2
|
//# sourceMappingURL=cli.cjs.map
|
package/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","sources":["../../../../packages/playground/cli/src/cli.ts"],"sourcesContent":["import { parseOptionsAndRunCLI } from './run-cli';\n\n// Do not await this as top-level await is not supported in all environments.\nparseOptionsAndRunCLI()
|
|
1
|
+
{"version":3,"file":"cli.cjs","sources":["../../../../packages/playground/cli/src/cli.ts"],"sourcesContent":["import { parseOptionsAndRunCLI } from './run-cli';\n\n// Do not await this as top-level await is not supported in all environments.\nparseOptionsAndRunCLI();\n"],"names":["parseOptionsAndRunCLI"],"mappings":"uDAGAA,EAAAA,sBAAsB"}
|
package/cli.js
CHANGED
package/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sources":["../../../../packages/playground/cli/src/cli.ts"],"sourcesContent":["import { parseOptionsAndRunCLI } from './run-cli';\n\n// Do not await this as top-level await is not supported in all environments.\nparseOptionsAndRunCLI()
|
|
1
|
+
{"version":3,"file":"cli.js","sources":["../../../../packages/playground/cli/src/cli.ts"],"sourcesContent":["import { parseOptionsAndRunCLI } from './run-cli';\n\n// Do not await this as top-level await is not supported in all environments.\nparseOptionsAndRunCLI();\n"],"names":["parseOptionsAndRunCLI"],"mappings":";AAGAA,EAAsB;"}
|
package/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./run-cli-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./run-cli-opqDVXKw.cjs");exports.parseOptionsAndRunCLI=n.parseOptionsAndRunCLI;exports.runCLI=n.runCLI;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/index.js
CHANGED
package/load-balancer.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PHPRequest, PHPResponse, RemoteAPI } from '@php-wasm/universal';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PlaygroundCliBlueprintV1Worker as PlaygroundCliWorkerV1 } from './blueprints-v1/worker-thread-v1';
|
|
3
|
+
import type { PlaygroundCliBlueprintV2Worker as PlaygroundCliWorkerV2 } from './blueprints-v2/worker-thread-v2';
|
|
4
|
+
type PlaygroundCliWorker = PlaygroundCliWorkerV1 | PlaygroundCliWorkerV2;
|
|
3
5
|
type WorkerLoad = {
|
|
4
6
|
worker: RemoteAPI<PlaygroundCliWorker>;
|
|
5
7
|
activeRequests: Set<Promise<PHPResponse>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "WordPress Playground CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"module": "./index.js",
|
|
33
33
|
"types": "index.d.ts",
|
|
34
34
|
"bin": "wp-playground.js",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "4aa6ec4f0fe23920f735c0050228a509d94ce077",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@zip.js/zip.js": "2.7.57",
|
|
38
38
|
"ajv": "8.12.0",
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
"wasm-feature-detect": "1.8.0",
|
|
56
56
|
"ws": "8.18.1",
|
|
57
57
|
"yargs": "17.7.2",
|
|
58
|
-
"@php-wasm/
|
|
59
|
-
"@php-wasm/
|
|
60
|
-
"@php-wasm/
|
|
61
|
-
"@
|
|
62
|
-
"@wp-playground/
|
|
63
|
-
"@wp-playground/
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
58
|
+
"@php-wasm/logger": "2.0.0",
|
|
59
|
+
"@php-wasm/progress": "2.0.0",
|
|
60
|
+
"@php-wasm/universal": "2.0.0",
|
|
61
|
+
"@wp-playground/blueprints": "2.0.0",
|
|
62
|
+
"@wp-playground/common": "2.0.0",
|
|
63
|
+
"@wp-playground/wordpress": "2.0.0",
|
|
64
|
+
"@php-wasm/node": "2.0.0",
|
|
65
|
+
"@php-wasm/util": "2.0.0",
|
|
66
|
+
"@wp-playground/storage": "2.0.0"
|
|
67
67
|
},
|
|
68
68
|
"overrides": {
|
|
69
69
|
"rollup": "^4.34.6",
|