eddev 0.2.67-beta1 → 0.3.0-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 -2
- package/admin/components/ImageWell.js +51 -39
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +1 -5
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +28 -17
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +66 -58
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +45 -16
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +45 -16
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +44 -24
- package/blocks/index.js +1 -5
- package/blocks/inlineEditing.d.ts +6 -6
- package/blocks/inlineEditing.js +55 -36
- package/blocks/installGutenbergHooks.js +68 -48
- package/build/babel/plugin-name-defined-components.js +16 -15
- package/build/build-favicon.js +62 -11
- package/build/clean.js +52 -5
- package/build/create-codegen-worker.js +33 -78
- package/build/create-serverless-dev-worker.js +39 -61
- package/build/create-webpack-worker.js +33 -65
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +395 -341
- package/build/graphql-codegen/graphql-codegen-files.js +25 -31
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +29 -37
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +21 -23
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +25 -32
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +20 -22
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +94 -30
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +32 -29
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +467 -245
- 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 +519 -393
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +156 -90
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +126 -79
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +98 -42
- package/cli/cli.js +28 -19
- package/cli/display/components/BundleDisplay.d.ts +1 -1
- package/cli/display/components/BundleDisplay.js +24 -13
- package/cli/display/components/CodegenDisplay.d.ts +1 -1
- package/cli/display/components/CodegenDisplay.js +25 -14
- package/cli/display/components/DevCLIDisplay.d.ts +2 -2
- package/cli/display/components/DevCLIDisplay.js +25 -14
- package/cli/display/components/Fullscreen.js +20 -9
- package/cli/display/components/ServerlessDisplay.d.ts +2 -2
- package/cli/display/components/ServerlessDisplay.js +26 -15
- package/cli/display/components/StatusIcon.d.ts +2 -2
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +5 -4
- package/cli/setup.js +73 -25
- package/components/AdminBar.d.ts +1 -1
- package/components/AdminBar.js +3 -37
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +54 -41
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +29 -17
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +29 -20
- package/components/index.js +1 -5
- 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 +13 -10
- package/config/index.js +1 -5
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
- package/dev-ui/components/BreakpointColumnHeader.js +18 -7
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
- package/dev-ui/components/BreakpointIndicator.js +32 -25
- package/dev-ui/components/DevUI.d.ts +1 -1
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +25 -13
- 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 -2
- package/dev-ui/components/ResponsiveLerpControl.js +38 -27
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
- package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
- 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 +9 -8
- package/dev-ui/components/atoms/NumberField.d.ts +2 -2
- package/dev-ui/components/atoms/NumberField.js +42 -29
- 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 +16 -5
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +20 -8
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/AppDataDebugger.js +19 -8
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
- package/dev-ui/components/panels/ColorEditor.js +42 -35
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/PageDataDebugger.js +20 -8
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
- package/dev-ui/components/panels/QueryDebugger.js +24 -12
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
- package/dev-ui/components/panels/SpacingEditor.js +48 -34
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
- package/dev-ui/components/panels/TypographyEditor.js +46 -38
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +7 -6
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -15
- package/dev-ui/icons.js +27 -16
- package/dev-ui/index.js +1 -5
- package/dev-ui/loader.d.ts +1 -1
- package/dev-ui/loader.js +9 -13
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +1 -5
- package/entry/Root.d.ts +2 -2
- package/entry/Root.js +26 -16
- 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 +1 -5
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +130 -126
- package/hooks/index.js +1 -5
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +192 -101
- 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 +11 -11
- package/routing/index.js +1 -5
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +72 -31
- package/routing/routing.d.ts +25 -15
- package/routing/routing.js +200 -112
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +4 -8
- package/serverless/index.js +2 -6
- package/style/createStitches.js +142 -164
- package/style/index.js +1 -5
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +15 -12
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +64 -18
- 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 +69 -19
- package/utils/useObservable.js +3 -3
- package/views/index.js +1 -5
package/cli/build.prod.js
CHANGED
|
@@ -1,51 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
2
38
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
40
|
};
|
|
5
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
42
|
exports.prodCommand = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
var get_webpack_config_1 = __importDefault(require("../build/get-webpack-config"));
|
|
44
|
+
var webpack_1 = require("webpack");
|
|
45
|
+
var promptIfRepoNameIncorrect_1 = require("../utils/promptIfRepoNameIncorrect");
|
|
46
|
+
var path_1 = __importDefault(require("path"));
|
|
47
|
+
var clean_1 = require("../build/clean");
|
|
48
|
+
var build_favicon_1 = require("../build/build-favicon");
|
|
49
|
+
function prodCommand(opts) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
var contentBase, themeName, compiler, _a, _b;
|
|
52
|
+
return __generator(this, function (_c) {
|
|
53
|
+
switch (_c.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
contentBase = process.cwd() + "/dist/";
|
|
56
|
+
(0, build_favicon_1.buildFavicon)().catch(function (err) {
|
|
57
|
+
console.log("Error building favicon:");
|
|
58
|
+
console.error(err);
|
|
59
|
+
});
|
|
60
|
+
return [4 /*yield*/, (0, promptIfRepoNameIncorrect_1.promptIfRepoThemeMismatch)()];
|
|
61
|
+
case 1:
|
|
62
|
+
_c.sent();
|
|
63
|
+
themeName = path_1.default.basename(process.cwd());
|
|
64
|
+
return [4 /*yield*/, (0, clean_1.cleanOutput)()];
|
|
65
|
+
case 2:
|
|
66
|
+
_c.sent();
|
|
67
|
+
_a = webpack_1.webpack;
|
|
68
|
+
return [4 /*yield*/, (0, get_webpack_config_1.default)({
|
|
69
|
+
title: "Frontend Client",
|
|
70
|
+
baseDirectory: process.cwd() + "/",
|
|
71
|
+
mode: "production",
|
|
72
|
+
target: "client",
|
|
73
|
+
serverless: opts.serverless,
|
|
74
|
+
themeName: themeName,
|
|
75
|
+
isAdmin: false,
|
|
76
|
+
})];
|
|
77
|
+
case 3:
|
|
78
|
+
_b = [
|
|
79
|
+
_c.sent()
|
|
80
|
+
];
|
|
81
|
+
return [4 /*yield*/, (0, get_webpack_config_1.default)({
|
|
82
|
+
title: "Admin Client",
|
|
83
|
+
baseDirectory: process.cwd() + "/",
|
|
84
|
+
mode: "production",
|
|
85
|
+
target: "client",
|
|
86
|
+
serverless: opts.serverless,
|
|
87
|
+
themeName: themeName,
|
|
88
|
+
isAdmin: true,
|
|
89
|
+
})];
|
|
90
|
+
case 4:
|
|
91
|
+
compiler = _a.apply(void 0, [_b.concat([
|
|
92
|
+
_c.sent()
|
|
93
|
+
])]);
|
|
94
|
+
compiler.run(function (err, stats) {
|
|
95
|
+
if (stats === null || stats === void 0 ? void 0 : stats.hasErrors()) {
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
if (err) {
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
49
105
|
});
|
|
50
106
|
}
|
|
51
107
|
exports.prodCommand = prodCommand;
|
package/cli/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
var commander_1 = require("commander");
|
|
4
|
+
var create_next_app_1 = require("../build/serverless/create-next-app");
|
|
5
|
+
var setup_1 = require("./setup");
|
|
6
|
+
var program = new commander_1.Command();
|
|
7
7
|
program.version("0.0.1");
|
|
8
8
|
require("dotenv").config();
|
|
9
9
|
program
|
|
@@ -12,8 +12,8 @@ program
|
|
|
12
12
|
.option("-s, --serverless", 'Build in "serverless" mode', false)
|
|
13
13
|
.option("-m, --mode <mode>", 'Defaults to all modes, but use "frontend", "admin" or "codegen" to run in just one mode', undefined)
|
|
14
14
|
.option("--verbose", "Enables log retention", false)
|
|
15
|
-
.action((options)
|
|
16
|
-
|
|
15
|
+
.action(function (options) {
|
|
16
|
+
var devCommand = require("./build.dev").devCommand;
|
|
17
17
|
devCommand({
|
|
18
18
|
serverless: options.serverless,
|
|
19
19
|
mode: options.mode,
|
|
@@ -23,14 +23,14 @@ program
|
|
|
23
23
|
program
|
|
24
24
|
.command("preinstall")
|
|
25
25
|
.description("Pre-installs for Vercel")
|
|
26
|
-
.action((options)
|
|
27
|
-
|
|
26
|
+
.action(function (options) {
|
|
27
|
+
var main = require("./preinstall").main;
|
|
28
28
|
main();
|
|
29
29
|
});
|
|
30
30
|
program
|
|
31
31
|
.command("build")
|
|
32
32
|
.description("Build in production mode")
|
|
33
|
-
.action((options)
|
|
33
|
+
.action(function (options) {
|
|
34
34
|
if (process.env.VERCEL) {
|
|
35
35
|
(0, create_next_app_1.createNextApp)({
|
|
36
36
|
baseDirectory: process.cwd(),
|
|
@@ -39,13 +39,29 @@ program
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
|
|
42
|
+
var prodCommand = require("./build.prod").prodCommand;
|
|
43
43
|
prodCommand({
|
|
44
44
|
serverless: options.serverless,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
// program
|
|
49
|
+
// .command("watch-frontend")
|
|
50
|
+
// .description("Build in production mode")
|
|
51
|
+
// .action((options) => {
|
|
52
|
+
// beginWork({
|
|
53
|
+
// baseDirectory: process.cwd(),
|
|
54
|
+
// isAdmin: false,
|
|
55
|
+
// mode: "development",
|
|
56
|
+
// serverless: false,
|
|
57
|
+
// target: "client",
|
|
58
|
+
// themeName: "eddev-starter-theme",
|
|
59
|
+
// title: "Frontend",
|
|
60
|
+
// retainLog: true,
|
|
61
|
+
// hotPort: 64572,
|
|
62
|
+
// })
|
|
63
|
+
// })
|
|
64
|
+
// program
|
|
49
65
|
// .command("vercel-build")
|
|
50
66
|
// .description("Create and build a Next.js project in .serverless")
|
|
51
67
|
// .action((options) => {
|
|
@@ -58,7 +74,7 @@ program
|
|
|
58
74
|
program
|
|
59
75
|
.command("next")
|
|
60
76
|
.description("Run the serverless app in standalone mode")
|
|
61
|
-
.action((options)
|
|
77
|
+
.action(function (options) {
|
|
62
78
|
(0, create_next_app_1.createNextApp)({
|
|
63
79
|
baseDirectory: process.cwd(),
|
|
64
80
|
dev: true,
|
|
@@ -68,14 +84,7 @@ program
|
|
|
68
84
|
program
|
|
69
85
|
.command("setup")
|
|
70
86
|
.description("Initialize the WordPress theme interactively")
|
|
71
|
-
.action(()
|
|
87
|
+
.action(function () {
|
|
72
88
|
(0, setup_1.setupTheme)();
|
|
73
89
|
});
|
|
74
|
-
program
|
|
75
|
-
.command("generate")
|
|
76
|
-
.description("Generate GraphQL Schemas")
|
|
77
|
-
.action(async () => {
|
|
78
|
-
console.log("This command has been deprecated! Please use `yarn dev` instead.");
|
|
79
|
-
process.exit();
|
|
80
|
-
});
|
|
81
90
|
program.parse(process.argv);
|
|
@@ -2,4 +2,4 @@ import { CompilerState } from "../../../build/state/compiler-state";
|
|
|
2
2
|
import { Observable } from "../../../utils/Observable";
|
|
3
3
|
export declare function BundleDisplay(props: {
|
|
4
4
|
bundle: Observable<CompilerState>;
|
|
5
|
-
}):
|
|
5
|
+
}): JSX.Element;
|
|
@@ -1,12 +1,23 @@
|
|
|
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.BundleDisplay = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var ink_1 = require("ink");
|
|
17
|
+
var react_1 = require("react");
|
|
18
|
+
var useObservable_1 = require("../../../utils/useObservable");
|
|
19
|
+
var StatusIcon_1 = require("./StatusIcon");
|
|
20
|
+
var statusLabels = {
|
|
10
21
|
compiling: "Compiling...",
|
|
11
22
|
error: "Error!",
|
|
12
23
|
starting: "Preparing to start...",
|
|
@@ -14,7 +25,7 @@ const statusLabels = {
|
|
|
14
25
|
waiting: "Success! Watching for file changes...",
|
|
15
26
|
};
|
|
16
27
|
function StatusLabel(props) {
|
|
17
|
-
|
|
28
|
+
var color = (0, react_1.useMemo)(function () {
|
|
18
29
|
if (props.status === "compiling") {
|
|
19
30
|
return "yellowBright";
|
|
20
31
|
}
|
|
@@ -28,18 +39,18 @@ function StatusLabel(props) {
|
|
|
28
39
|
return "whiteBright";
|
|
29
40
|
}
|
|
30
41
|
}, [props.status]);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(ink_1.Text, { color: color, children: [label, " ", duration] }));
|
|
42
|
+
var label = props.statusLabel || statusLabels[props.status];
|
|
43
|
+
var duration = props.duration ? "(".concat(props.duration, "ms)") : "";
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)(ink_1.Text, __assign({ color: color }, { children: [label, " ", duration] }), void 0));
|
|
34
45
|
}
|
|
35
46
|
function BundleDisplay(props) {
|
|
36
|
-
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(ink_1.Box, { width: "100%", flexDirection: "column", children: [(0, jsx_runtime_1.jsxs)(ink_1.Box, { width: "100%", paddingX: 1, borderStyle: "round", borderColor: data.status === "success" ? "green" : data.status === "error" ? "red" : "yellow", flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(ink_1.Box, { width: 2, flexGrow: 0, flexShrink: 0, children: (0, jsx_runtime_1.jsx)(StatusIcon_1.StatusIcon, { icon: data.status === "success" || data.status === "waiting"
|
|
47
|
+
var data = (0, useObservable_1.useObservable)(props.bundle);
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ width: "100%", flexDirection: "column" }, { children: [(0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ width: "100%", paddingX: 1, borderStyle: "round", borderColor: data.status === "success" ? "green" : data.status === "error" ? "red" : "yellow", flexDirection: "row" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ width: 2, flexGrow: 0, flexShrink: 0 }, { children: (0, jsx_runtime_1.jsx)(StatusIcon_1.StatusIcon, { icon: data.status === "success" || data.status === "waiting"
|
|
38
49
|
? "tick"
|
|
39
50
|
: data.status === "compiling"
|
|
40
51
|
? "loading"
|
|
41
52
|
: data.status === "error"
|
|
42
53
|
? "error"
|
|
43
|
-
: "none" }) }), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { children: [(0, jsx_runtime_1.jsxs)(ink_1.Text, { bold: true, children: [data.title, " "] }), (0, jsx_runtime_1.jsx)(StatusLabel, { status: data.status, statusLabel: data.statusLabel, duration: data.duration })] }) })] }), (0, jsx_runtime_1.jsxs)(ink_1.Box, { flexGrow: 1, flexDirection: "column", children: [Array.isArray(data.errors) && data.errors.length > 0 ? ((0, jsx_runtime_1.jsx)(ink_1.Box, { flexDirection: "column", children: data.errors.map((err, i)
|
|
54
|
+
: "none" }, void 0) }), void 0), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { children: [(0, jsx_runtime_1.jsxs)(ink_1.Text, __assign({ bold: true }, { children: [data.title, " "] }), void 0), (0, jsx_runtime_1.jsx)(StatusLabel, { status: data.status, statusLabel: data.statusLabel, duration: data.duration }, void 0)] }, void 0) }, void 0)] }), void 0), (0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ flexGrow: 1, flexDirection: "column" }, { children: [Array.isArray(data.errors) && data.errors.length > 0 ? ((0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ flexDirection: "column" }, { children: data.errors.map(function (err, i) { return ((0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ flexDirection: "column" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ color: err.type === "error" ? "red" : "yellow", bold: true }, { children: err.type === "error" ? "The following error occurred" : "Please be aware of the following warning" }), void 0) }, void 0), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsx)(ink_1.Text, { children: err.message }, void 0) }, void 0)] }), void 0)); }) }), void 0)) : null, data.log ? ((0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsx)(ink_1.Text, { children: data.log }, void 0) }, void 0)) : null] }), void 0)] }), void 0));
|
|
44
55
|
}
|
|
45
56
|
exports.BundleDisplay = BundleDisplay;
|
|
@@ -2,4 +2,4 @@ import { CodegenState } from "../../../build/state/codegen-state";
|
|
|
2
2
|
import { Observable } from "../../../utils/Observable";
|
|
3
3
|
export declare function CodegenDisplay(props: {
|
|
4
4
|
codegen: Observable<CodegenState>;
|
|
5
|
-
}):
|
|
5
|
+
}): JSX.Element;
|
|
@@ -1,12 +1,23 @@
|
|
|
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.CodegenDisplay = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var ink_1 = require("ink");
|
|
17
|
+
var react_1 = require("react");
|
|
18
|
+
var useObservable_1 = require("../../../utils/useObservable");
|
|
19
|
+
var StatusIcon_1 = require("./StatusIcon");
|
|
20
|
+
var statusLabels = {
|
|
10
21
|
generating: "Generating...",
|
|
11
22
|
error: "Error!",
|
|
12
23
|
success: "Complete",
|
|
@@ -15,7 +26,7 @@ const statusLabels = {
|
|
|
15
26
|
invalidated: "Detected file change",
|
|
16
27
|
};
|
|
17
28
|
function StatusLabel(props) {
|
|
18
|
-
|
|
29
|
+
var color = (0, react_1.useMemo)(function () {
|
|
19
30
|
if (props.status === "generating" || props.status === "fetching" || props.status === "invalidated") {
|
|
20
31
|
return "yellowBright";
|
|
21
32
|
}
|
|
@@ -29,23 +40,23 @@ function StatusLabel(props) {
|
|
|
29
40
|
return "whiteBright";
|
|
30
41
|
}
|
|
31
42
|
}, [props.status]);
|
|
32
|
-
|
|
43
|
+
var label = props.statusLabel || statusLabels[props.status];
|
|
33
44
|
if (props.reason) {
|
|
34
|
-
label +=
|
|
45
|
+
label += " (".concat(props.reason, ")");
|
|
35
46
|
}
|
|
36
47
|
if (props.duration) {
|
|
37
|
-
label +=
|
|
48
|
+
label += " (".concat(props.duration, "ms)");
|
|
38
49
|
}
|
|
39
|
-
return (0, jsx_runtime_1.jsx)(ink_1.Text, { color: color, children: label });
|
|
50
|
+
return (0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ color: color }, { children: label }), void 0);
|
|
40
51
|
}
|
|
41
52
|
function CodegenDisplay(props) {
|
|
42
|
-
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)(ink_1.Box, { width: "100%", flexDirection: "column", children: [(0, jsx_runtime_1.jsxs)(ink_1.Box, { width: "100%", paddingX: 1, borderStyle: "round", borderColor: data.status === "success" ? "green" : data.status === "error" ? "red" : "yellow", flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(ink_1.Box, { width: 2, flexGrow: 0, flexShrink: 0, children: (0, jsx_runtime_1.jsx)(StatusIcon_1.StatusIcon, { icon: data.status === "success" || data.status === "ready"
|
|
53
|
+
var data = (0, useObservable_1.useObservable)(props.codegen);
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ width: "100%", flexDirection: "column" }, { children: [(0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ width: "100%", paddingX: 1, borderStyle: "round", borderColor: data.status === "success" ? "green" : data.status === "error" ? "red" : "yellow", flexDirection: "row" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ width: 2, flexGrow: 0, flexShrink: 0 }, { children: (0, jsx_runtime_1.jsx)(StatusIcon_1.StatusIcon, { icon: data.status === "success" || data.status === "ready"
|
|
44
55
|
? "tick"
|
|
45
56
|
: data.status === "generating" || data.status === "fetching" || data.status === "invalidated"
|
|
46
57
|
? "loading"
|
|
47
58
|
: data.status === "error"
|
|
48
59
|
? "error"
|
|
49
|
-
: "none" }) }), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { children: [(0, jsx_runtime_1.jsxs)(ink_1.Text, { bold: true, children: [data.title, " "] }), (0, jsx_runtime_1.jsx)(StatusLabel, { status: data.status, statusLabel: "", reason: data.reason, duration: data.duration })] }) })] }), (0, jsx_runtime_1.jsxs)(ink_1.Box, { flexGrow: 1, flexDirection: "column", children: [Array.isArray(data.errors) && data.errors.length > 0 ? ((0, jsx_runtime_1.jsx)(ink_1.Box, { flexDirection: "column", children: data.errors.map((err, i)
|
|
60
|
+
: "none" }, void 0) }), void 0), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { children: [(0, jsx_runtime_1.jsxs)(ink_1.Text, __assign({ bold: true }, { children: [data.title, " "] }), void 0), (0, jsx_runtime_1.jsx)(StatusLabel, { status: data.status, statusLabel: "", reason: data.reason, duration: data.duration }, void 0)] }, void 0) }, void 0)] }), void 0), (0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ flexGrow: 1, flexDirection: "column" }, { children: [Array.isArray(data.errors) && data.errors.length > 0 ? ((0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ flexDirection: "column" }, { children: data.errors.map(function (err, i) { return ((0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ flexDirection: "column" }, { children: (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsx)(ink_1.Text, { children: err }, void 0) }, void 0) }), void 0)); }) }), void 0)) : null, data.log ? ((0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsx)(ink_1.Text, { children: data.log }, void 0) }, void 0)) : null] }), void 0)] }), void 0));
|
|
50
61
|
}
|
|
51
62
|
exports.CodegenDisplay = CodegenDisplay;
|
|
@@ -2,11 +2,11 @@ import { CodegenState } from "../../../build/state/codegen-state";
|
|
|
2
2
|
import { CompilerState } from "../../../build/state/compiler-state";
|
|
3
3
|
import { ServerlessState } from "../../../build/state/serverless-state";
|
|
4
4
|
import { Observable } from "../../../utils/Observable";
|
|
5
|
-
type Props = {
|
|
5
|
+
declare type Props = {
|
|
6
6
|
bundles: Observable<CompilerState>[];
|
|
7
7
|
serverless?: Observable<ServerlessState>;
|
|
8
8
|
codegen?: Observable<CodegenState>;
|
|
9
9
|
configChanged: Observable<boolean>;
|
|
10
10
|
};
|
|
11
|
-
export declare function DevCLIDisplay(props: Props):
|
|
11
|
+
export declare function DevCLIDisplay(props: Props): JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -1,31 +1,42 @@
|
|
|
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.DevCLIDisplay = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var ink_1 = require("ink");
|
|
17
|
+
var react_1 = require("react");
|
|
18
|
+
var useObservable_1 = require("../../../utils/useObservable");
|
|
19
|
+
var BundleDisplay_1 = require("./BundleDisplay");
|
|
20
|
+
var CodegenDisplay_1 = require("./CodegenDisplay");
|
|
21
|
+
var Fullscreen_1 = require("./Fullscreen");
|
|
22
|
+
var ServerlessDisplay_1 = require("./ServerlessDisplay");
|
|
23
|
+
var MODE_LABELS = {
|
|
13
24
|
serverless: "Serverless Log",
|
|
14
25
|
bundles: "Build Log",
|
|
15
26
|
};
|
|
16
27
|
function DevCLIDisplay(props) {
|
|
17
|
-
|
|
18
|
-
(0, ink_1.useInput)((ev, key)
|
|
28
|
+
var _a = (0, react_1.useState)("bundles"), mode = _a[0], setMode = _a[1];
|
|
29
|
+
(0, ink_1.useInput)(function (ev, key) {
|
|
19
30
|
if (ev.charAt(0) === "z") {
|
|
20
31
|
if (props.serverless) {
|
|
21
|
-
setMode((mode)
|
|
32
|
+
setMode(function (mode) { return (mode === "bundles" ? "serverless" : "bundles"); });
|
|
22
33
|
}
|
|
23
34
|
}
|
|
24
35
|
else if (ev.charAt(0) === "c" || ev.charAt(0) === "q" || key.escape) {
|
|
25
36
|
process.exit(0);
|
|
26
37
|
}
|
|
27
38
|
});
|
|
28
|
-
|
|
29
|
-
return ((0, jsx_runtime_1.jsx)(Fullscreen_1.Fullscreen, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { width: "100%", height: "100%", flexDirection: "column", minHeight: "100%", children: [mode === "bundles" ? ((0, jsx_runtime_1.jsxs)(ink_1.Box, { width: "100%", flexGrow: 1, flexDirection: "column", children: [props.bundles.map((bundle, i)
|
|
39
|
+
var configChanged = (0, useObservable_1.useObservable)(props.configChanged);
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(Fullscreen_1.Fullscreen, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ width: "100%", height: "100%", flexDirection: "column", minHeight: "100%" }, { children: [mode === "bundles" ? ((0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ width: "100%", flexGrow: 1, flexDirection: "column" }, { children: [props.bundles.map(function (bundle, i) { return ((0, jsx_runtime_1.jsx)(BundleDisplay_1.BundleDisplay, { bundle: bundle }, i)); }), props.codegen && (0, jsx_runtime_1.jsx)(CodegenDisplay_1.CodegenDisplay, { codegen: props.codegen }, void 0), props.serverless && (0, jsx_runtime_1.jsx)(ServerlessDisplay_1.ServerlessDisplay, { serverless: props.serverless }, void 0)] }), void 0)) : mode === "serverless" ? ((0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ width: "100%", flexGrow: 1, flexDirection: "column" }, { children: (0, jsx_runtime_1.jsx)(ServerlessDisplay_1.ServerlessLog, { serverless: props.serverless }, void 0) }), void 0)) : null, configChanged && ((0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ paddingX: 1, borderColor: "yellow", borderStyle: "round" }, { children: (0, jsx_runtime_1.jsxs)(ink_1.Text, __assign({ color: "yellow" }, { children: ["\uD83D\uDEA8 Change detected in ", (0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ color: "yellowBright" }, { children: "ed.config.json" }), void 0), " \u2014 Please restart", " ", (0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ color: "yellowBright" }, { children: "yarn dev" }), void 0)] }), void 0) }), void 0)), (0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ paddingX: 1, borderColor: "cyan", borderStyle: "round", flexDirection: "row", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ bold: true, color: "cyanBright" }, { children: MODE_LABELS[mode] }), void 0) }, void 0), (0, jsx_runtime_1.jsxs)(ink_1.Box, { children: [props.serverless && ((0, jsx_runtime_1.jsxs)(ink_1.Text, { children: [(0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ bold: true, color: "white" }, { children: "z" }), void 0), ": Toggle Serverless Log", " "] }, void 0)), (0, jsx_runtime_1.jsxs)(ink_1.Text, { children: [(0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ bold: true, color: "white" }, { children: "q" }), void 0), ": Quit"] }, void 0)] }, void 0)] }), void 0)] }), void 0) }, void 0));
|
|
30
41
|
}
|
|
31
42
|
exports.DevCLIDisplay = DevCLIDisplay;
|
|
@@ -1,15 +1,26 @@
|
|
|
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.Fullscreen = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var ink_1 = require("ink");
|
|
17
|
+
var react_1 = require("react");
|
|
18
|
+
var Fullscreen = function (props) {
|
|
19
|
+
var _a = (0, react_1.useState)({
|
|
9
20
|
columns: process.stdout.columns,
|
|
10
21
|
rows: process.stdout.rows,
|
|
11
|
-
});
|
|
12
|
-
(0, react_1.useEffect)(()
|
|
22
|
+
}), size = _a[0], setSize = _a[1];
|
|
23
|
+
(0, react_1.useEffect)(function () {
|
|
13
24
|
function onResize() {
|
|
14
25
|
setSize({
|
|
15
26
|
columns: process.stdout.columns,
|
|
@@ -18,11 +29,11 @@ const Fullscreen = (props) => {
|
|
|
18
29
|
}
|
|
19
30
|
process.stdout.on("resize", onResize);
|
|
20
31
|
// process.stdout.write("\x1b[?1049h")
|
|
21
|
-
return ()
|
|
32
|
+
return function () {
|
|
22
33
|
process.stdout.off("resize", onResize);
|
|
23
34
|
// process.stdout.write("\x1b[?1049l")
|
|
24
35
|
};
|
|
25
36
|
}, []);
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(ink_1.Box, { width: size.columns, minHeight: size.rows, children: props.children }));
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ width: size.columns, minHeight: size.rows }, { children: props.children }), void 0));
|
|
27
38
|
};
|
|
28
39
|
exports.Fullscreen = Fullscreen;
|
|
@@ -2,7 +2,7 @@ import { ServerlessState } from "../../../build/state/serverless-state";
|
|
|
2
2
|
import { Observable } from "../../../utils/Observable";
|
|
3
3
|
export declare function ServerlessDisplay(props: {
|
|
4
4
|
serverless: Observable<ServerlessState>;
|
|
5
|
-
}):
|
|
5
|
+
}): JSX.Element;
|
|
6
6
|
export declare function ServerlessLog(props: {
|
|
7
7
|
serverless: Observable<ServerlessState>;
|
|
8
|
-
}):
|
|
8
|
+
}): JSX.Element;
|
|
@@ -1,12 +1,23 @@
|
|
|
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.ServerlessLog = exports.ServerlessDisplay = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var ink_1 = require("ink");
|
|
17
|
+
var react_1 = require("react");
|
|
18
|
+
var useObservable_1 = require("../../../utils/useObservable");
|
|
19
|
+
var StatusIcon_1 = require("./StatusIcon");
|
|
20
|
+
var statusLabels = {
|
|
10
21
|
starting: "Starting",
|
|
11
22
|
compiling: "Compiling...",
|
|
12
23
|
error: "Error! See log for details.",
|
|
@@ -16,7 +27,7 @@ const statusLabels = {
|
|
|
16
27
|
waiting: "Waiting...",
|
|
17
28
|
};
|
|
18
29
|
function StatusLabel(props) {
|
|
19
|
-
|
|
30
|
+
var color = (0, react_1.useMemo)(function () {
|
|
20
31
|
if (props.status === "packaging" ||
|
|
21
32
|
props.status === "preparing" ||
|
|
22
33
|
props.status === "waiting" ||
|
|
@@ -33,25 +44,25 @@ function StatusLabel(props) {
|
|
|
33
44
|
return "whiteBright";
|
|
34
45
|
}
|
|
35
46
|
}, [props.status]);
|
|
36
|
-
|
|
47
|
+
var label = props.statusLabel || statusLabels[props.status];
|
|
37
48
|
if (props.duration) {
|
|
38
|
-
label +=
|
|
49
|
+
label += " (".concat(props.duration, "ms)");
|
|
39
50
|
}
|
|
40
|
-
return ((0, jsx_runtime_1.jsxs)(ink_1.Box, { paddingX: 1, width: "100%", flexGrow: 1, flexDirection: "row", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsx)(ink_1.Text, { color: color, children: label }), props.url && (0, jsx_runtime_1.jsxs)(ink_1.Text, { color: "white", children: ["\u2728 ", props.url] })] }));
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ paddingX: 1, width: "100%", flexGrow: 1, flexDirection: "row", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ color: color }, { children: label }), void 0), props.url && (0, jsx_runtime_1.jsxs)(ink_1.Text, __assign({ color: "white" }, { children: ["\u2728 ", props.url] }), void 0)] }), void 0));
|
|
41
52
|
}
|
|
42
53
|
function ServerlessDisplay(props) {
|
|
43
|
-
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(ink_1.Box, { width: "100%", flexDirection: "column", children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { width: "100%", paddingX: 1, borderStyle: "round", borderColor: data.status === "success" ? "green" : data.status === "error" ? "red" : "yellow", flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(ink_1.Box, { width: 2, flexGrow: 0, flexShrink: 0, children: (0, jsx_runtime_1.jsx)(StatusIcon_1.StatusIcon, { icon: data.status === "success"
|
|
54
|
+
var data = (0, useObservable_1.useObservable)(props.serverless);
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ width: "100%", flexDirection: "column" }, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ width: "100%", paddingX: 1, borderStyle: "round", borderColor: data.status === "success" ? "green" : data.status === "error" ? "red" : "yellow", flexDirection: "row" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Box, __assign({ width: 2, flexGrow: 0, flexShrink: 0 }, { children: (0, jsx_runtime_1.jsx)(StatusIcon_1.StatusIcon, { icon: data.status === "success"
|
|
45
56
|
? "tick"
|
|
46
57
|
: data.status === "preparing" || data.status === "packaging" || data.status === "compiling"
|
|
47
58
|
? "loading"
|
|
48
59
|
: data.status === "error"
|
|
49
60
|
? "error"
|
|
50
|
-
: "none" }) }), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, { flexDirection: "row", children: [(0, jsx_runtime_1.jsx)(ink_1.Text, { bold: true, children: data.title }), (0, jsx_runtime_1.jsx)(StatusLabel, { status: data.status, statusLabel: "", duration: data.status === "success" ? data.duration : undefined, url: data.url })] }) })] }) }));
|
|
61
|
+
: "none" }, void 0) }), void 0), (0, jsx_runtime_1.jsx)(ink_1.Box, { children: (0, jsx_runtime_1.jsxs)(ink_1.Box, __assign({ flexDirection: "row" }, { children: [(0, jsx_runtime_1.jsx)(ink_1.Text, __assign({ bold: true }, { children: data.title }), void 0), (0, jsx_runtime_1.jsx)(StatusLabel, { status: data.status, statusLabel: "", duration: data.status === "success" ? data.duration : undefined, url: data.url }, void 0)] }), void 0) }, void 0)] }), void 0) }), void 0));
|
|
51
62
|
}
|
|
52
63
|
exports.ServerlessDisplay = ServerlessDisplay;
|
|
53
64
|
function ServerlessLog(props) {
|
|
54
|
-
|
|
55
|
-
return (0, jsx_runtime_1.jsx)(ink_1.Text, { children: log });
|
|
65
|
+
var log = (0, useObservable_1.useObservable)(props.serverless).log;
|
|
66
|
+
return (0, jsx_runtime_1.jsx)(ink_1.Text, { children: log }, void 0);
|
|
56
67
|
}
|
|
57
68
|
exports.ServerlessLog = ServerlessLog;
|