eddev 0.2.65 → 0.2.67-beta1
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/admin/components/ImageWell.d.ts +2 -3
- package/admin/components/ImageWell.js +39 -51
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +5 -1
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +17 -28
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +58 -66
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +16 -45
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +16 -45
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +24 -44
- package/blocks/index.js +5 -1
- package/blocks/inlineEditing.d.ts +7 -7
- package/blocks/inlineEditing.js +36 -55
- package/blocks/installGutenbergHooks.js +48 -68
- package/build/babel/plugin-name-defined-components.js +15 -16
- package/build/build-favicon.js +11 -62
- package/build/clean.js +5 -52
- package/build/create-codegen-worker.js +78 -33
- package/build/create-serverless-dev-worker.js +61 -39
- package/build/create-webpack-worker.js +65 -33
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +341 -395
- package/build/graphql-codegen/graphql-codegen-files.js +31 -25
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +102 -99
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +37 -29
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +23 -21
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +32 -25
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +22 -20
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +30 -90
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +29 -32
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +245 -467
- package/build/state/codegen-state.d.ts +4 -4
- package/build/state/compiler-state.d.ts +5 -5
- package/build/state/serverless-state.d.ts +3 -3
- package/build/workers/codegen-worker-script.js +392 -507
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +89 -150
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +79 -126
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +42 -98
- package/cli/cli.js +16 -55
- package/cli/display/components/BundleDisplay.d.ts +1 -2
- package/cli/display/components/BundleDisplay.js +13 -24
- package/cli/display/components/CodegenDisplay.d.ts +1 -2
- package/cli/display/components/CodegenDisplay.js +14 -25
- package/cli/display/components/DevCLIDisplay.d.ts +2 -3
- package/cli/display/components/DevCLIDisplay.js +14 -25
- package/cli/display/components/Fullscreen.js +9 -20
- package/cli/display/components/ServerlessDisplay.d.ts +2 -3
- package/cli/display/components/ServerlessDisplay.js +15 -26
- package/cli/display/components/StatusIcon.d.ts +2 -3
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +4 -5
- package/cli/setup.js +25 -73
- package/components/AdminBar.d.ts +1 -2
- package/components/AdminBar.js +37 -3
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +41 -54
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +17 -29
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +20 -29
- package/components/index.js +5 -1
- package/config/config-schema.d.ts +1 -1
- package/config/config-schema.js +1 -1
- package/config/create-schema-file.js +6 -6
- package/config/get-config.js +10 -13
- package/config/index.js +5 -1
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -3
- package/dev-ui/components/BreakpointColumnHeader.js +7 -18
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -2
- package/dev-ui/components/BreakpointIndicator.js +25 -32
- package/dev-ui/components/DevUI.d.ts +1 -2
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +13 -25
- package/dev-ui/components/PanelWrapper.d.ts +2 -2
- package/dev-ui/components/PanelWrapper.js +8 -8
- package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -3
- package/dev-ui/components/ResponsiveLerpControl.js +27 -38
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -5
- package/dev-ui/components/ResponsiveScaleEditor.js +64 -78
- package/dev-ui/components/atoms/Button.js +1 -1
- package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
- package/dev-ui/components/atoms/Dropdown.js +8 -9
- package/dev-ui/components/atoms/NumberField.d.ts +2 -3
- package/dev-ui/components/atoms/NumberField.js +29 -42
- package/dev-ui/components/atoms/Spacer.js +1 -1
- package/dev-ui/components/atoms/Text.js +1 -1
- package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
- package/dev-ui/components/atoms/ToggleButton.js +5 -16
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +8 -20
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -2
- package/dev-ui/components/panels/AppDataDebugger.js +8 -19
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -2
- package/dev-ui/components/panels/ColorEditor.js +35 -42
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -2
- package/dev-ui/components/panels/PageDataDebugger.js +8 -20
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -2
- package/dev-ui/components/panels/QueryDebugger.js +12 -24
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -2
- package/dev-ui/components/panels/SpacingEditor.js +34 -48
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -2
- package/dev-ui/components/panels/TypographyEditor.js +38 -46
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +6 -7
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -16
- package/dev-ui/icons.js +16 -27
- package/dev-ui/index.js +5 -1
- package/dev-ui/loader.d.ts +1 -2
- package/dev-ui/loader.js +13 -9
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.d.ts +96 -70
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.d.ts +1 -10
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +5 -1
- package/entry/Root.d.ts +2 -3
- package/entry/Root.js +16 -26
- package/entry/entry.admin.dev.js +4 -4
- package/entry/entry.admin.prod.js +4 -4
- package/entry/entry.monolith.dev.js +5 -5
- package/entry/entry.monolith.prod.js +5 -5
- package/gravityforms/gravity-forms.d.ts +2 -2
- package/gravityforms/index.js +5 -1
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +126 -130
- package/hooks/index.js +5 -1
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +101 -192
- package/hooks/useAppData.d.ts +2 -2
- package/hooks/useAppData.js +9 -9
- package/hooks/usePageLoad.js +4 -4
- package/hooks/useQueryDebug.d.ts +1 -1
- package/hooks/useQueryDebug.js +7 -7
- package/hooks/useRPC.d.ts +4 -4
- package/hooks/useRPC.js +3 -3
- package/package.json +7 -7
- package/routing/index.js +5 -1
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +31 -72
- package/routing/routing.d.ts +15 -15
- package/routing/routing.js +108 -170
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +8 -4
- package/serverless/index.js +6 -2
- package/serverless-template/_utils/fetch-wordpress-props.ts +0 -4
- package/serverless-template/_utils/fetch-wp.ts +0 -1
- package/style/createStitches.d.ts +375 -783
- package/style/createStitches.js +164 -142
- package/style/index.js +5 -1
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +12 -15
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +18 -64
- package/utils/refreshOverlayInterop.js +1 -1
- package/utils/reportErrorStack.d.ts +1 -1
- package/utils/reportErrorStack.js +1 -1
- package/utils/serverlessAppContext.js +1 -1
- package/utils/updateEnvFile.js +19 -69
- package/utils/useObservable.js +3 -3
- package/views/index.js +5 -1
|
@@ -1,70 +1,115 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.createCodegenWorker = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const worker_threads_1 = require("worker_threads");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const Observable_1 = require("../utils/Observable");
|
|
18
7
|
function createCodegenWorker(opts) {
|
|
19
|
-
|
|
8
|
+
const worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/codegen-worker-script.js"), {
|
|
20
9
|
workerData: opts,
|
|
21
10
|
stderr: true,
|
|
22
11
|
stdin: false,
|
|
23
12
|
stdout: true,
|
|
24
|
-
env:
|
|
13
|
+
env: {
|
|
14
|
+
...process.env,
|
|
15
|
+
FORCE_COLOR: "1",
|
|
16
|
+
},
|
|
25
17
|
});
|
|
26
|
-
worker.stderr.on("data",
|
|
27
|
-
subject.update(
|
|
18
|
+
worker.stderr.on("data", (chunk) => {
|
|
19
|
+
subject.update((state) => ({
|
|
20
|
+
...state,
|
|
21
|
+
log: (state.log || "") + chunk,
|
|
22
|
+
}));
|
|
28
23
|
});
|
|
29
|
-
worker.stdout.on("data",
|
|
24
|
+
worker.stdout.on("data", (chunk) => {
|
|
30
25
|
if (subject.value.status === "generating") {
|
|
31
|
-
subject.update(
|
|
26
|
+
subject.update((state) => ({
|
|
27
|
+
...state,
|
|
28
|
+
log: String(chunk),
|
|
29
|
+
}));
|
|
32
30
|
}
|
|
33
31
|
else {
|
|
34
|
-
subject.update(
|
|
32
|
+
subject.update((state) => ({
|
|
33
|
+
...state,
|
|
34
|
+
log: (state.log || "") + chunk,
|
|
35
|
+
}));
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
|
-
|
|
38
|
+
const subject = new Observable_1.Observable({
|
|
38
39
|
title: "GraphQL Codegen",
|
|
39
40
|
status: "ready",
|
|
40
41
|
log: "",
|
|
41
42
|
});
|
|
42
|
-
worker.on("error",
|
|
43
|
+
worker.on("error", (err) => {
|
|
43
44
|
console.log(err);
|
|
44
|
-
subject.update(
|
|
45
|
+
subject.update((state) => ({
|
|
46
|
+
...state,
|
|
47
|
+
status: "error",
|
|
48
|
+
}));
|
|
45
49
|
});
|
|
46
|
-
worker.on("message",
|
|
50
|
+
worker.on("message", (data) => {
|
|
47
51
|
if (data.code === "ready") {
|
|
48
|
-
subject.update(
|
|
52
|
+
subject.update((state) => ({
|
|
53
|
+
...state,
|
|
54
|
+
status: "ready",
|
|
55
|
+
log: opts.retainLog ? state.log : "",
|
|
56
|
+
duration: 0,
|
|
57
|
+
errors: [],
|
|
58
|
+
}));
|
|
49
59
|
}
|
|
50
60
|
else if (data.code === "fetching") {
|
|
51
|
-
subject.update(
|
|
61
|
+
subject.update((state) => ({
|
|
62
|
+
...state,
|
|
63
|
+
status: "fetching",
|
|
64
|
+
log: opts.retainLog ? state.log : "",
|
|
65
|
+
duration: 0,
|
|
66
|
+
errors: [],
|
|
67
|
+
}));
|
|
52
68
|
}
|
|
53
69
|
else if (data.code === "generating") {
|
|
54
|
-
subject.update(
|
|
70
|
+
subject.update((state) => ({
|
|
71
|
+
...state,
|
|
72
|
+
status: "generating",
|
|
73
|
+
errors: [],
|
|
74
|
+
duration: 0,
|
|
75
|
+
log: opts.retainLog ? state.log : "",
|
|
76
|
+
}));
|
|
55
77
|
}
|
|
56
78
|
else if (data.code === "error") {
|
|
57
|
-
subject.update(
|
|
79
|
+
subject.update((state) => ({
|
|
80
|
+
...state,
|
|
81
|
+
status: "error",
|
|
82
|
+
statusLabel: "",
|
|
83
|
+
duration: 0,
|
|
84
|
+
reason: undefined,
|
|
85
|
+
errors: data.errors,
|
|
86
|
+
}));
|
|
58
87
|
}
|
|
59
88
|
else if (data.code === "success") {
|
|
60
|
-
subject.update(
|
|
89
|
+
subject.update((state) => ({
|
|
90
|
+
...state,
|
|
91
|
+
status: "success",
|
|
92
|
+
duration: data.duration,
|
|
93
|
+
reason: data.reason,
|
|
94
|
+
errors: [],
|
|
95
|
+
log: opts.retainLog ? state.log : "",
|
|
96
|
+
}));
|
|
61
97
|
}
|
|
62
98
|
else if (data.code === "invalidated") {
|
|
63
|
-
subject.update(
|
|
99
|
+
subject.update((state) => ({
|
|
100
|
+
...state,
|
|
101
|
+
status: "invalidated",
|
|
102
|
+
reason: data.reason,
|
|
103
|
+
duration: 0,
|
|
104
|
+
}));
|
|
64
105
|
}
|
|
65
106
|
});
|
|
66
|
-
worker.on("exit",
|
|
67
|
-
subject.update(
|
|
107
|
+
worker.on("exit", () => {
|
|
108
|
+
subject.update((state) => ({
|
|
109
|
+
...state,
|
|
110
|
+
status: "success",
|
|
111
|
+
log: opts.retainLog ? state.log : "",
|
|
112
|
+
}));
|
|
68
113
|
});
|
|
69
114
|
return subject;
|
|
70
115
|
}
|
|
@@ -1,44 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.createServerlessWorker = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const worker_threads_1 = require("worker_threads");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const Observable_1 = require("../utils/Observable");
|
|
18
7
|
function createServerlessWorker() {
|
|
19
|
-
|
|
8
|
+
const worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/serverless-worker-dev-script.js"), {
|
|
20
9
|
workerData: {},
|
|
21
10
|
stderr: true,
|
|
22
11
|
stdin: false,
|
|
23
12
|
stdout: true,
|
|
24
|
-
env:
|
|
13
|
+
env: {
|
|
14
|
+
...process.env,
|
|
15
|
+
FORCE_COLOR: "1",
|
|
16
|
+
},
|
|
25
17
|
});
|
|
26
|
-
|
|
18
|
+
const subject = new Observable_1.Observable({
|
|
27
19
|
title: "Serverless",
|
|
28
20
|
status: "starting",
|
|
29
21
|
log: "",
|
|
30
22
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
const parseChunk = (str) => {
|
|
24
|
+
const escaped = JSON.stringify(str).replace(/(^"|"$)/g, "");
|
|
25
|
+
let status;
|
|
26
|
+
let duration = 0;
|
|
35
27
|
if (str.includes("\u001b[31merror\u001b[39m")) {
|
|
36
28
|
status = "error";
|
|
37
29
|
}
|
|
38
30
|
else if (str.includes("\u001b[35mevent\u001b[39m") && str.includes("successfully")) {
|
|
39
31
|
status = "success";
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
const secondsMatch = str.match(/[0-9.]+s/);
|
|
33
|
+
const msMatch = str.match(/[0-9.]+ ms/);
|
|
42
34
|
if (secondsMatch) {
|
|
43
35
|
duration = parseFloat(secondsMatch[0].replace("s", "")) * 1000;
|
|
44
36
|
}
|
|
@@ -51,41 +43,71 @@ function createServerlessWorker() {
|
|
|
51
43
|
}
|
|
52
44
|
return {
|
|
53
45
|
text: str,
|
|
54
|
-
status
|
|
55
|
-
duration
|
|
46
|
+
status,
|
|
47
|
+
duration,
|
|
56
48
|
};
|
|
57
49
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
subject.update(
|
|
50
|
+
const handleChunk = (chunk) => {
|
|
51
|
+
const result = parseChunk(String(chunk));
|
|
52
|
+
subject.update((state) => ({
|
|
53
|
+
...state,
|
|
54
|
+
log: (state.log || "") + result.text,
|
|
55
|
+
status: result.status ? result.status : state.status,
|
|
56
|
+
duration: result.status === "success" ? result.duration : state.duration,
|
|
57
|
+
}));
|
|
61
58
|
};
|
|
62
59
|
worker.stderr.on("data", handleChunk);
|
|
63
60
|
worker.stdout.on("data", handleChunk);
|
|
64
|
-
worker.on("error",
|
|
61
|
+
worker.on("error", (err) => {
|
|
65
62
|
console.log(err);
|
|
66
|
-
subject.update(
|
|
63
|
+
subject.update((state) => ({
|
|
64
|
+
...state,
|
|
65
|
+
status: "error",
|
|
66
|
+
}));
|
|
67
67
|
});
|
|
68
|
-
worker.on("exit",
|
|
69
|
-
subject.update(
|
|
68
|
+
worker.on("exit", (code) => {
|
|
69
|
+
subject.update((state) => ({
|
|
70
|
+
...state,
|
|
71
|
+
status: "error",
|
|
72
|
+
}));
|
|
70
73
|
});
|
|
71
|
-
worker.on("message",
|
|
74
|
+
worker.on("message", (data) => {
|
|
72
75
|
if (data.code === "preparing") {
|
|
73
|
-
subject.update(
|
|
76
|
+
subject.update((state) => ({
|
|
77
|
+
...state,
|
|
78
|
+
status: "preparing",
|
|
79
|
+
}));
|
|
74
80
|
}
|
|
75
81
|
else if (data.code === "packaging") {
|
|
76
|
-
subject.update(
|
|
82
|
+
subject.update((state) => ({
|
|
83
|
+
...state,
|
|
84
|
+
status: "packaging",
|
|
85
|
+
}));
|
|
77
86
|
}
|
|
78
87
|
else if (data.code === "compiling") {
|
|
79
|
-
subject.update(
|
|
88
|
+
subject.update((state) => ({
|
|
89
|
+
...state,
|
|
90
|
+
status: "compiling",
|
|
91
|
+
}));
|
|
80
92
|
}
|
|
81
93
|
else if (data.code === "finished") {
|
|
82
|
-
subject.update(
|
|
94
|
+
subject.update((state) => ({
|
|
95
|
+
...state,
|
|
96
|
+
status: "success",
|
|
97
|
+
duration: data.duration,
|
|
98
|
+
}));
|
|
83
99
|
}
|
|
84
100
|
else if (data.code === "error") {
|
|
85
|
-
subject.update(
|
|
101
|
+
subject.update((state) => ({
|
|
102
|
+
...state,
|
|
103
|
+
status: "error",
|
|
104
|
+
}));
|
|
86
105
|
}
|
|
87
106
|
else if (data.code === "url") {
|
|
88
|
-
subject.update(
|
|
107
|
+
subject.update((state) => ({
|
|
108
|
+
...state,
|
|
109
|
+
url: data.url,
|
|
110
|
+
}));
|
|
89
111
|
}
|
|
90
112
|
});
|
|
91
113
|
// worker.on("exit", () => {
|
|
@@ -1,63 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.createWebpackWorker = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const worker_threads_1 = require("worker_threads");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const Observable_1 = require("../utils/Observable");
|
|
18
7
|
function createWebpackWorker(opts) {
|
|
19
|
-
|
|
8
|
+
const worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/webpack-worker-script.js"), {
|
|
20
9
|
workerData: opts,
|
|
21
10
|
stderr: true,
|
|
22
11
|
stdin: false,
|
|
23
12
|
stdout: true,
|
|
24
|
-
env:
|
|
13
|
+
env: {
|
|
14
|
+
...process.env,
|
|
15
|
+
FORCE_COLOR: "1",
|
|
16
|
+
},
|
|
25
17
|
});
|
|
26
|
-
worker.stderr.on("data",
|
|
27
|
-
subject.update(
|
|
18
|
+
worker.stderr.on("data", (chunk) => {
|
|
19
|
+
subject.update((state) => ({
|
|
20
|
+
...state,
|
|
21
|
+
log: (state.log || "") + chunk,
|
|
22
|
+
}));
|
|
28
23
|
});
|
|
29
|
-
worker.stdout.on("data",
|
|
30
|
-
|
|
24
|
+
worker.stdout.on("data", (chunk) => {
|
|
25
|
+
const str = chunk.toString();
|
|
31
26
|
if (str.includes("Project is running at") || str.includes("webpack output is served from")) {
|
|
32
27
|
return;
|
|
33
28
|
}
|
|
34
|
-
subject.update(
|
|
29
|
+
subject.update((state) => ({
|
|
30
|
+
...state,
|
|
31
|
+
log: (state.log || "") + str,
|
|
32
|
+
}));
|
|
35
33
|
});
|
|
36
|
-
|
|
34
|
+
const subject = new Observable_1.Observable({
|
|
37
35
|
title: opts.title,
|
|
38
36
|
status: "starting",
|
|
39
37
|
});
|
|
40
|
-
worker.on("error",
|
|
41
|
-
subject.update(
|
|
38
|
+
worker.on("error", (err) => {
|
|
39
|
+
subject.update((state) => ({
|
|
40
|
+
...state,
|
|
41
|
+
status: "error",
|
|
42
|
+
error: err,
|
|
43
|
+
}));
|
|
42
44
|
});
|
|
43
|
-
worker.on("message",
|
|
45
|
+
worker.on("message", (data) => {
|
|
44
46
|
if (data.code === "compiling") {
|
|
45
|
-
subject.update(
|
|
47
|
+
subject.update((state) => ({
|
|
48
|
+
...state,
|
|
49
|
+
status: "compiling",
|
|
50
|
+
statusLabel: state.status === "compiling" ? state.statusLabel : "",
|
|
51
|
+
log: opts.retainLog ? state.log : "",
|
|
52
|
+
duration: 0,
|
|
53
|
+
errors: [],
|
|
54
|
+
}));
|
|
46
55
|
}
|
|
47
56
|
else if (data.code === "error") {
|
|
48
|
-
subject.update(
|
|
57
|
+
subject.update((state) => ({
|
|
58
|
+
...state,
|
|
59
|
+
status: "error",
|
|
60
|
+
statusLabel: "",
|
|
61
|
+
duration: 0,
|
|
62
|
+
errors: data.errors,
|
|
63
|
+
}));
|
|
49
64
|
}
|
|
50
65
|
else if (data.code === "finished") {
|
|
51
|
-
subject.update(
|
|
66
|
+
subject.update((state) => ({
|
|
67
|
+
...state,
|
|
68
|
+
status: data.watching ? "waiting" : "success",
|
|
69
|
+
statusLabel: "",
|
|
70
|
+
duration: data.duration,
|
|
71
|
+
log: opts.retainLog ? state.log : "",
|
|
72
|
+
errors: data.errors,
|
|
73
|
+
}));
|
|
52
74
|
}
|
|
53
75
|
else if (data.code === "invalidated") {
|
|
54
|
-
subject.update(
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
subject.update((state) => ({
|
|
77
|
+
...state,
|
|
78
|
+
status: "compiling",
|
|
79
|
+
statusLabel: data.changedFile
|
|
80
|
+
? `Rebuilding (${data.changedFile.replace(opts.baseDirectory, "")})`
|
|
81
|
+
: "Rebuilding (changes detected)",
|
|
82
|
+
log: opts.retainLog ? state.log : "",
|
|
83
|
+
duration: 0,
|
|
84
|
+
errors: [],
|
|
85
|
+
}));
|
|
57
86
|
}
|
|
58
87
|
});
|
|
59
|
-
worker.on("exit",
|
|
60
|
-
subject.update(
|
|
88
|
+
worker.on("exit", () => {
|
|
89
|
+
subject.update((state) => ({
|
|
90
|
+
...state,
|
|
91
|
+
status: "success",
|
|
92
|
+
}));
|
|
61
93
|
});
|
|
62
94
|
return subject;
|
|
63
95
|
}
|
package/build/file-tree.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type FileList = string[];
|
|
2
|
+
type Disposer = () => void;
|
|
3
3
|
export declare function watchFileTree(pattern: string, callback: (files: FileList) => void): Promise<Disposer>;
|
|
4
4
|
export declare function getFileTree(pattern: string): Promise<FileList>;
|
|
5
5
|
export {};
|
package/build/file-tree.js
CHANGED
|
@@ -4,35 +4,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getFileTree = exports.watchFileTree = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
|
+
const glob_promise_1 = __importDefault(require("glob-promise"));
|
|
9
9
|
function watchFileTree(pattern, callback) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return new Promise(
|
|
10
|
+
const files = [];
|
|
11
|
+
let ready = false;
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
13
|
// Watch, according
|
|
14
|
-
|
|
14
|
+
const watcher = chokidar_1.default
|
|
15
15
|
.watch(pattern)
|
|
16
|
-
.on("add",
|
|
16
|
+
.on("add", (path) => {
|
|
17
17
|
files.push(path);
|
|
18
18
|
if (ready)
|
|
19
19
|
callback(files);
|
|
20
20
|
})
|
|
21
|
-
.on("unlink",
|
|
22
|
-
|
|
21
|
+
.on("unlink", (path) => {
|
|
22
|
+
const i = files.indexOf(path);
|
|
23
23
|
if (i !== -1)
|
|
24
24
|
files.splice(i, 1);
|
|
25
25
|
if (ready)
|
|
26
26
|
callback(files);
|
|
27
27
|
})
|
|
28
|
-
.on("change",
|
|
28
|
+
.on("change", () => {
|
|
29
29
|
if (ready)
|
|
30
30
|
callback(files);
|
|
31
31
|
})
|
|
32
|
-
.on("ready",
|
|
32
|
+
.on("ready", () => {
|
|
33
33
|
ready = true;
|
|
34
34
|
callback(files);
|
|
35
|
-
resolve(
|
|
35
|
+
resolve(() => {
|
|
36
36
|
watcher.close();
|
|
37
37
|
});
|
|
38
38
|
});
|