eddev 0.1.33-beta-7 → 0.1.34
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/blocks/installGutenbergHooks.js +4 -0
- package/build/create-codegen-worker.d.ts +1 -2
- package/build/create-codegen-worker.js +5 -5
- package/build/create-webpack-worker.d.ts +1 -2
- package/build/create-webpack-worker.js +8 -4
- package/build/get-webpack-config.d.ts +1 -10
- package/build/state/codegen-state.d.ts +5 -0
- package/build/state/compiler-state.d.ts +11 -0
- package/build/workers/codegen-worker-script.d.ts +1 -4
- package/build/workers/webpack-worker-script.d.ts +1 -1
- package/build/workers/webpack-worker-script.js +1 -0
- package/cli/build.dev.d.ts +2 -0
- package/cli/build.dev.js +39 -26
- package/cli/cli.js +4 -0
- package/package.json +1 -1
|
@@ -74,6 +74,10 @@ function installEDGutenbergHooks() {
|
|
|
74
74
|
item.supports.customClassName = false;
|
|
75
75
|
item.edit = function (props) {
|
|
76
76
|
var self = this;
|
|
77
|
+
(0, react_1.useEffect)(function () {
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
window.wp.data.dispatch("core/block-editor").setTemplateValidity(true);
|
|
80
|
+
}, []);
|
|
77
81
|
return ((0, jsx_runtime_1.jsx)(BlockContext.Provider, __assign({ value: { name: name, props: props } }, { children: (0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ values: props.attributes.inline || {}, innerBlocks: props.innerBlocks, onChange: function (attrs) {
|
|
78
82
|
props.setAttributes(__assign(__assign({}, props.attributes), { inline: attrs }));
|
|
79
83
|
} }, { children: edit_1.call(self, props) }), void 0) }), void 0));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Observable } from "../utils/Observable";
|
|
2
|
-
import { CodegenOptions } from "./
|
|
3
|
-
import { CodegenState } from "./state/codegen-state";
|
|
2
|
+
import { CodegenOptions, CodegenState } from "./state/codegen-state";
|
|
4
3
|
export declare function createCodegenWorker(opts: CodegenOptions): Observable<CodegenState>;
|
|
@@ -45,26 +45,26 @@ function createCodegenWorker(opts) {
|
|
|
45
45
|
});
|
|
46
46
|
worker.on("message", function (data) {
|
|
47
47
|
if (data.code === "ready") {
|
|
48
|
-
subject.update(function (state) { return (__assign(__assign({}, state), { status: "ready", log: "", duration: 0, errors: [] })); });
|
|
48
|
+
subject.update(function (state) { return (__assign(__assign({}, state), { status: "ready", log: opts.retainLog ? state.log : "", duration: 0, errors: [] })); });
|
|
49
49
|
}
|
|
50
50
|
else if (data.code === "fetching") {
|
|
51
|
-
subject.update(function (state) { return (__assign(__assign({}, state), { status: "fetching", log: "", duration: 0, errors: [] })); });
|
|
51
|
+
subject.update(function (state) { return (__assign(__assign({}, state), { status: "fetching", log: opts.retainLog ? state.log : "", duration: 0, errors: [] })); });
|
|
52
52
|
}
|
|
53
53
|
else if (data.code === "generating") {
|
|
54
|
-
subject.update(function (state) { return (__assign(__assign({}, state), { status: "generating", errors: [], duration: 0, log: "" })); });
|
|
54
|
+
subject.update(function (state) { return (__assign(__assign({}, state), { status: "generating", errors: [], duration: 0, log: opts.retainLog ? state.log : "" })); });
|
|
55
55
|
}
|
|
56
56
|
else if (data.code === "error") {
|
|
57
57
|
subject.update(function (state) { return (__assign(__assign({}, state), { status: "error", statusLabel: "", duration: 0, reason: undefined, errors: data.errors })); });
|
|
58
58
|
}
|
|
59
59
|
else if (data.code === "success") {
|
|
60
|
-
subject.update(function (state) { return (__assign(__assign({}, state), { status: "success", duration: data.duration, reason: data.reason, errors: [], log: "" })); });
|
|
60
|
+
subject.update(function (state) { return (__assign(__assign({}, state), { status: "success", duration: data.duration, reason: data.reason, errors: [], log: opts.retainLog ? state.log : "" })); });
|
|
61
61
|
}
|
|
62
62
|
else if (data.code === "invalidated") {
|
|
63
63
|
subject.update(function (state) { return (__assign(__assign({}, state), { status: "invalidated", reason: data.reason, duration: 0 })); });
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
worker.on("exit", function () {
|
|
67
|
-
subject.update(function (state) { return (__assign(__assign({}, state), { status: "success", log: "" })); });
|
|
67
|
+
subject.update(function (state) { return (__assign(__assign({}, state), { status: "success", log: opts.retainLog ? state.log : "" })); });
|
|
68
68
|
});
|
|
69
69
|
return subject;
|
|
70
70
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WebpackWorkerOptions } from "./get-webpack-config";
|
|
2
1
|
import { Observable } from "../utils/Observable";
|
|
3
|
-
import { CompilerState } from "./state/compiler-state";
|
|
2
|
+
import { CompilerState, WebpackWorkerOptions } from "./state/compiler-state";
|
|
4
3
|
export declare function createWebpackWorker(opts: WebpackWorkerOptions): Observable<CompilerState>;
|
|
@@ -27,7 +27,11 @@ function createWebpackWorker(opts) {
|
|
|
27
27
|
subject.update(function (state) { return (__assign(__assign({}, state), { log: (state.log || "") + chunk })); });
|
|
28
28
|
});
|
|
29
29
|
worker.stdout.on("data", function (chunk) {
|
|
30
|
-
|
|
30
|
+
var str = chunk.toString();
|
|
31
|
+
if (str.includes("Project is running at") || str.includes("webpack output is served from")) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
subject.update(function (state) { return (__assign(__assign({}, state), { log: (state.log || "") + str })); });
|
|
31
35
|
});
|
|
32
36
|
var subject = new Observable_1.Observable({
|
|
33
37
|
title: opts.title,
|
|
@@ -38,18 +42,18 @@ function createWebpackWorker(opts) {
|
|
|
38
42
|
});
|
|
39
43
|
worker.on("message", function (data) {
|
|
40
44
|
if (data.code === "compiling") {
|
|
41
|
-
subject.update(function (state) { return (__assign(__assign({}, state), { status: "compiling", statusLabel: state.status === "compiling" ? state.statusLabel : "", log: "", duration: 0, errors: [] })); });
|
|
45
|
+
subject.update(function (state) { return (__assign(__assign({}, state), { status: "compiling", statusLabel: state.status === "compiling" ? state.statusLabel : "", log: opts.retainLog ? state.log : "", duration: 0, errors: [] })); });
|
|
42
46
|
}
|
|
43
47
|
else if (data.code === "error") {
|
|
44
48
|
subject.update(function (state) { return (__assign(__assign({}, state), { status: "error", statusLabel: "", duration: 0, errors: data.errors })); });
|
|
45
49
|
}
|
|
46
50
|
else if (data.code === "finished") {
|
|
47
|
-
subject.update(function (state) { return (__assign(__assign({}, state), { status: data.watching ? "waiting" : "success", statusLabel: "", duration: data.duration, log: "", errors: data.errors })); });
|
|
51
|
+
subject.update(function (state) { return (__assign(__assign({}, state), { status: data.watching ? "waiting" : "success", statusLabel: "", duration: data.duration, log: opts.retainLog ? state.log : "", errors: data.errors })); });
|
|
48
52
|
}
|
|
49
53
|
else if (data.code === "invalidated") {
|
|
50
54
|
subject.update(function (state) { return (__assign(__assign({}, state), { status: "compiling", statusLabel: data.changedFile
|
|
51
55
|
? "Rebuilding (".concat(data.changedFile.replace(opts.baseDirectory, ""), ")")
|
|
52
|
-
: "Rebuilding (changes detected)", log: "", duration: 0, errors: [] })); });
|
|
56
|
+
: "Rebuilding (changes detected)", log: opts.retainLog ? state.log : "", duration: 0, errors: [] })); });
|
|
53
57
|
}
|
|
54
58
|
});
|
|
55
59
|
worker.on("exit", function () {
|
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
import { Configuration } from "webpack";
|
|
2
|
-
|
|
3
|
-
title: string;
|
|
4
|
-
baseDirectory: string;
|
|
5
|
-
themeName: string;
|
|
6
|
-
mode: "development" | "production";
|
|
7
|
-
target: "client" | "ssr";
|
|
8
|
-
isAdmin: boolean;
|
|
9
|
-
serverless: boolean;
|
|
10
|
-
hotPort?: number;
|
|
11
|
-
};
|
|
2
|
+
import { WebpackWorkerOptions } from "./state/compiler-state";
|
|
12
3
|
export default function getWebpackConfig(opts: WebpackWorkerOptions): Promise<Configuration>;
|
|
@@ -36,3 +36,14 @@ export declare type CompilerSignal = {
|
|
|
36
36
|
watching?: boolean;
|
|
37
37
|
errors?: CompilerError[];
|
|
38
38
|
};
|
|
39
|
+
export declare type WebpackWorkerOptions = {
|
|
40
|
+
title: string;
|
|
41
|
+
baseDirectory: string;
|
|
42
|
+
themeName: string;
|
|
43
|
+
mode: "development" | "production";
|
|
44
|
+
target: "client" | "ssr";
|
|
45
|
+
isAdmin: boolean;
|
|
46
|
+
serverless: boolean;
|
|
47
|
+
hotPort?: number;
|
|
48
|
+
retainLog?: boolean;
|
|
49
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WebpackWorkerOptions } from "../
|
|
1
|
+
import { WebpackWorkerOptions } from "../state/compiler-state";
|
|
2
2
|
export declare function beginWork(opts: WebpackWorkerOptions): Promise<void>;
|
package/cli/build.dev.d.ts
CHANGED
package/cli/build.dev.js
CHANGED
|
@@ -50,40 +50,53 @@ var create_webpack_worker_1 = require("../build/create-webpack-worker");
|
|
|
50
50
|
var create_codegen_worker_1 = require("../build/create-codegen-worker");
|
|
51
51
|
function devCommand(opts) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var themeName, frontendObservable, adminObservable, codegenObservable;
|
|
53
|
+
var themeName, enableFrontend, enableAdmin, enableCodegen, frontendObservable, adminObservable, codegenObservable;
|
|
54
54
|
return __generator(this, function (_a) {
|
|
55
55
|
switch (_a.label) {
|
|
56
56
|
case 0: return [4 /*yield*/, (0, promptIfRepoNameIncorrect_1.promptIfRepoThemeMismatch)()];
|
|
57
57
|
case 1:
|
|
58
58
|
_a.sent();
|
|
59
59
|
themeName = path_1.default.basename(process.cwd());
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
60
|
+
enableFrontend = !opts.mode || opts.mode === "frontend";
|
|
61
|
+
enableAdmin = !opts.mode || opts.mode === "admin";
|
|
62
|
+
enableCodegen = !opts.mode || opts.mode === "codegen";
|
|
63
|
+
console.log(opts);
|
|
64
|
+
frontendObservable = enableFrontend
|
|
65
|
+
? (0, create_webpack_worker_1.createWebpackWorker)({
|
|
66
|
+
title: "Frontend Bundle",
|
|
67
|
+
baseDirectory: process.cwd() + "/",
|
|
68
|
+
mode: "development",
|
|
69
|
+
target: "client",
|
|
70
|
+
serverless: opts.serverless,
|
|
71
|
+
themeName: themeName,
|
|
72
|
+
isAdmin: false,
|
|
73
|
+
hotPort: 8991,
|
|
74
|
+
retainLog: opts.retainLog,
|
|
75
|
+
})
|
|
76
|
+
: undefined;
|
|
77
|
+
adminObservable = enableAdmin
|
|
78
|
+
? (0, create_webpack_worker_1.createWebpackWorker)({
|
|
79
|
+
title: "Admin Client",
|
|
80
|
+
baseDirectory: process.cwd() + "/",
|
|
81
|
+
mode: "development",
|
|
82
|
+
target: "client",
|
|
83
|
+
serverless: false,
|
|
84
|
+
themeName: themeName,
|
|
85
|
+
isAdmin: true,
|
|
86
|
+
hotPort: 8992,
|
|
87
|
+
retainLog: opts.retainLog,
|
|
88
|
+
})
|
|
89
|
+
: undefined;
|
|
90
|
+
codegenObservable = enableCodegen
|
|
91
|
+
? (0, create_codegen_worker_1.createCodegenWorker)({
|
|
92
|
+
baseDirectory: process.cwd() + "/",
|
|
93
|
+
watch: true,
|
|
94
|
+
retainLog: opts.retainLog,
|
|
95
|
+
})
|
|
96
|
+
: undefined;
|
|
84
97
|
// Set up a process which will regenerate schemas, and watch for changes
|
|
85
98
|
// Render output to screen
|
|
86
|
-
(0, ink_1.render)((0, jsx_runtime_1.jsx)(DevCLIDisplay_1.DevCLIDisplay, { bundles: [frontendObservable, adminObservable], codegen: codegenObservable }, void 0));
|
|
99
|
+
(0, ink_1.render)((0, jsx_runtime_1.jsx)(DevCLIDisplay_1.DevCLIDisplay, { bundles: [frontendObservable, adminObservable].filter(Boolean), codegen: codegenObservable }, void 0));
|
|
87
100
|
return [2 /*return*/];
|
|
88
101
|
}
|
|
89
102
|
});
|
package/cli/cli.js
CHANGED
|
@@ -47,9 +47,13 @@ program
|
|
|
47
47
|
.command("dev")
|
|
48
48
|
.description("Build in dev mode")
|
|
49
49
|
.option("-s, --serverless", 'Build in "serverless" mode', false)
|
|
50
|
+
.option("-m, --mode <mode>", 'Defaults to all modes, but use "frontend", "admin" or "codegen" to run in just one mode', undefined)
|
|
51
|
+
.option("--verbose", "Enables log retention", false)
|
|
50
52
|
.action(function (options) {
|
|
51
53
|
(0, build_dev_1.devCommand)({
|
|
52
54
|
serverless: options.serverless,
|
|
55
|
+
mode: options.mode,
|
|
56
|
+
retainLog: options.verbose,
|
|
53
57
|
});
|
|
54
58
|
});
|
|
55
59
|
program
|