eddev 0.2.0-beta.9 → 0.2.2-beta.2

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.
Files changed (122) hide show
  1. package/blocks/ContentBlocks.js +3 -0
  2. package/blocks/installGutenbergHooks.js +19 -2
  3. package/build/build-favicon.d.ts +1 -0
  4. package/build/build-favicon.js +71 -0
  5. package/build/create-serverless-dev-worker.d.ts +3 -0
  6. package/build/create-serverless-dev-worker.js +99 -0
  7. package/build/get-webpack-config.js +11 -1
  8. package/build/manifests/manifest-views.js +1 -1
  9. package/build/reporter.js +0 -109
  10. package/build/serverless/create-next-app.d.ts +2 -0
  11. package/build/serverless/create-next-app.js +243 -47
  12. package/build/state/serverless-state.d.ts +26 -0
  13. package/{config/schema.js → build/state/serverless-state.js} +0 -0
  14. package/build/workers/codegen-worker-script.js +33 -0
  15. package/{config/schema.d.ts → build/workers/serverless-worker-dev-script.d.ts} +0 -0
  16. package/build/workers/serverless-worker-dev-script.js +21 -0
  17. package/cli/build.dev.js +34 -6
  18. package/cli/build.prod.js +13 -1
  19. package/cli/cli.js +32 -17
  20. package/cli/display/components/DevCLIDisplay.d.ts +3 -0
  21. package/cli/display/components/DevCLIDisplay.js +20 -1
  22. package/cli/display/components/ServerlessDisplay.d.ts +9 -0
  23. package/cli/display/components/ServerlessDisplay.js +68 -0
  24. package/cli/preinstall.d.ts +1 -0
  25. package/cli/preinstall.js +14 -0
  26. package/components/NextRouter.js +3 -2
  27. package/config/config-schema.d.ts +17 -9
  28. package/config/config-schema.js +3 -1
  29. package/config/get-config.d.ts +39 -0
  30. package/config/get-config.js +32 -0
  31. package/config/parse-config.d.ts +8 -4
  32. package/config/print-zod-errors.d.ts +2 -0
  33. package/config/print-zod-errors.js +14 -0
  34. package/dev-ui/components/BreakpointColumnHeader.d.ts +11 -0
  35. package/dev-ui/components/BreakpointColumnHeader.js +47 -0
  36. package/dev-ui/components/BreakpointIndicator.d.ts +2 -0
  37. package/dev-ui/components/BreakpointIndicator.js +138 -0
  38. package/dev-ui/components/DevUI.d.ts +2 -0
  39. package/dev-ui/components/DevUI.js +28 -0
  40. package/dev-ui/components/Launcher.d.ts +98 -0
  41. package/dev-ui/components/Launcher.js +94 -0
  42. package/dev-ui/components/PanelWrapper.d.ts +8 -0
  43. package/dev-ui/components/PanelWrapper.js +37 -0
  44. package/dev-ui/components/ResponsiveLerpControl.d.ts +8 -0
  45. package/dev-ui/components/ResponsiveLerpControl.js +177 -0
  46. package/dev-ui/components/ResponsiveScaleEditor.d.ts +26 -0
  47. package/dev-ui/components/ResponsiveScaleEditor.js +233 -0
  48. package/dev-ui/components/atoms/Button.d.ts +47 -0
  49. package/dev-ui/components/atoms/Button.js +67 -0
  50. package/dev-ui/components/atoms/Dropdown.d.ts +13 -0
  51. package/dev-ui/components/atoms/Dropdown.js +50 -0
  52. package/dev-ui/components/atoms/NumberField.d.ts +12 -0
  53. package/dev-ui/components/atoms/NumberField.js +111 -0
  54. package/dev-ui/components/atoms/Spacer.d.ts +42 -0
  55. package/dev-ui/components/atoms/Spacer.js +8 -0
  56. package/dev-ui/components/atoms/Text.d.ts +45 -0
  57. package/dev-ui/components/atoms/Text.js +39 -0
  58. package/dev-ui/components/atoms/ToggleButton.d.ts +8 -0
  59. package/dev-ui/components/atoms/ToggleButton.js +41 -0
  60. package/dev-ui/components/atoms/Tooltip.d.ts +9 -0
  61. package/dev-ui/components/atoms/Tooltip.js +66 -0
  62. package/dev-ui/components/panels/PageDataDebugger.d.ts +2 -0
  63. package/dev-ui/components/panels/PageDataDebugger.js +30 -0
  64. package/dev-ui/components/panels/SpacingEditor.d.ts +2 -0
  65. package/dev-ui/components/panels/SpacingEditor.js +88 -0
  66. package/dev-ui/components/panels/TypographyEditor.d.ts +2 -0
  67. package/dev-ui/components/panels/TypographyEditor.js +88 -0
  68. package/dev-ui/hooks/useBreakpoint.d.ts +11 -0
  69. package/dev-ui/hooks/useBreakpoint.js +59 -0
  70. package/dev-ui/hooks/usePersistState.d.ts +1 -0
  71. package/dev-ui/hooks/usePersistState.js +36 -0
  72. package/dev-ui/hooks/useStylesheet.d.ts +4 -0
  73. package/dev-ui/hooks/useStylesheet.js +31 -0
  74. package/dev-ui/icons.d.ts +15 -0
  75. package/dev-ui/icons.js +29 -0
  76. package/dev-ui/index.d.ts +1 -0
  77. package/dev-ui/index.js +13 -0
  78. package/dev-ui/loader.d.ts +2 -0
  79. package/dev-ui/loader.js +42 -0
  80. package/dev-ui/panels.d.ts +11 -0
  81. package/dev-ui/panels.js +33 -0
  82. package/dev-ui/theme.d.ts +151 -0
  83. package/dev-ui/theme.js +50 -0
  84. package/entry/Root.d.ts +3 -1
  85. package/entry/Root.js +18 -6
  86. package/hooks/index.d.ts +1 -0
  87. package/hooks/index.js +1 -0
  88. package/{serverless/create-rpc-client.d.ts → hooks/useRPC.d.ts} +18 -18
  89. package/hooks/useRPC.js +18 -0
  90. package/package.json +15 -7
  91. package/routing/routing.js +1 -1
  92. package/serverless/define-rpc-router.d.ts +5 -1
  93. package/serverless/define-rpc-router.js +11 -3
  94. package/serverless/index.d.ts +2 -1
  95. package/serverless/index.js +3 -1
  96. package/serverless-template/_utils/PageMeta.tsx +44 -0
  97. package/serverless-template/_utils/fetch-wordpress-props.ts +14 -3
  98. package/serverless-template/_utils/fetch-wp.ts +16 -0
  99. package/serverless-template/global.d.ts +7 -1
  100. package/serverless-template/next.config.js +10 -3
  101. package/serverless-template/package.json +5 -3
  102. package/serverless-template/pages/404.tsx +12 -0
  103. package/serverless-template/pages/[...slug].tsx +7 -2
  104. package/serverless-template/pages/_app.tsx +32 -12
  105. package/serverless-template/pages/_document.tsx +19 -0
  106. package/serverless-template/pages/api/rest/{[...method].ts → [method].ts} +4 -2
  107. package/serverless-template/pages/api/trpc/[...trpc].ts +26 -0
  108. package/serverless-template/pages/index.tsx +2 -2
  109. package/style/createStitches.d.ts +71 -1
  110. package/style/createStitches.js +151 -45
  111. package/utils/getRepoName.js +13 -5
  112. package/utils/updateEnvFile.d.ts +1 -0
  113. package/utils/updateEnvFile.js +76 -0
  114. package/cli/prepare-next.d.ts +0 -0
  115. package/cli/prepare-next.js +0 -1
  116. package/entry/entry.serverless.dev.d.ts +0 -0
  117. package/entry/entry.serverless.dev.js +0 -2
  118. package/fields/ImageWell.d.ts +0 -8
  119. package/fields/ImageWell.js +0 -64
  120. package/serverless/create-rpc-client.js +0 -20
  121. package/serverless-template/package-lock.json +0 -641
  122. package/serverless-template/pages/api/hello.ts +0 -10
@@ -32,6 +32,9 @@ var react_1 = require("react");
32
32
  var ErrorBoundaryFrontend_1 = require("./ErrorBoundaryFrontend");
33
33
  exports.BlocksContext = (0, react_1.createContext)(undefined);
34
34
  function ContentBlocks(props) {
35
+ if (process.admin) {
36
+ throw new Error("ContentBlocks cannot be used in the admin");
37
+ }
35
38
  if (!Array.isArray(props.blocks))
36
39
  return null;
37
40
  var parentContext = (0, react_1.useContext)(exports.BlocksContext);
@@ -27,6 +27,8 @@ exports.setBlockManifest = exports.installEDGutenbergHooks = void 0;
27
27
  var jsx_runtime_1 = require("react/jsx-runtime");
28
28
  // @ts-ignore
29
29
  var hooks_1 = require("@wordpress/hooks");
30
+ // @ts-ignore
31
+ var data_1 = require("@wordpress/data");
30
32
  var react_1 = require("react");
31
33
  // @ts-ignore
32
34
  var blockAttributes_1 = require("./blockAttributes");
@@ -82,7 +84,16 @@ function installEDGutenbergHooks() {
82
84
  // @ts-ignore
83
85
  window.wp.data.dispatch("core/block-editor").setTemplateValidity(true);
84
86
  }, []);
85
- 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) {
87
+ // console.log(useBlockProps(), useBlockEditContext(), useInnerBlocksProps())
88
+ var children = (0, data_1.useSelect)(function (select) {
89
+ var _a = select('core/block-editor'), getBlock = _a.getBlock, getBlockOrder = _a.getBlockOrder;
90
+ var innerBlockIDs = getBlockOrder(props.clientId);
91
+ var children = innerBlockIDs.map(function (id) {
92
+ return getBlock(id);
93
+ });
94
+ return children;
95
+ }, []);
96
+ 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: children, onChange: function (attrs) {
86
97
  props.setAttributes(__assign(__assign({}, props.attributes), { inline: attrs }));
87
98
  } }, { children: edit_1.call(self, props) }), void 0) }), void 0));
88
99
  };
@@ -154,7 +165,13 @@ function installEDGutenbergHooks() {
154
165
  var parseJSX = acf.parseJSX;
155
166
  // @ts-ignore
156
167
  acf.parseJSX = function (html) {
157
- var payload = JSON.parse(html.replace(/(^[^>]+>|<[^>]+>$)/g, ""));
168
+ var payload;
169
+ try {
170
+ payload = JSON.parse(html.replace(/(^[^>]+>|<[^>]+>$)/g, ""));
171
+ }
172
+ catch (err) {
173
+ throw new Error("eddev: Error parsing block data from: \n" + html);
174
+ }
158
175
  return (0, jsx_runtime_1.jsx)(BlockRenderer, { payload: payload }, void 0);
159
176
  };
160
177
  }
@@ -0,0 +1 @@
1
+ export declare function buildFavicon(output?: string): Promise<void>;
@@ -0,0 +1,71 @@
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
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.buildFavicon = void 0;
43
+ // @ts-ignore
44
+ var to_icon_1 = __importDefault(require("to-icon"));
45
+ var promises_1 = require("fs/promises");
46
+ var glob_promise_1 = __importDefault(require("glob-promise"));
47
+ var path_1 = require("path");
48
+ function buildFavicon(output) {
49
+ if (output === void 0) { output = (0, path_1.join)(process.cwd(), "favicon.ico"); }
50
+ return __awaiter(this, void 0, void 0, function () {
51
+ var files, buffers, buf;
52
+ return __generator(this, function (_a) {
53
+ switch (_a.label) {
54
+ case 0: return [4 /*yield*/, (0, glob_promise_1.default)((0, path_1.join)(process.cwd(), "assets/favicon/favicon-*.png"))];
55
+ case 1:
56
+ files = _a.sent();
57
+ if (!files.length)
58
+ return [2 /*return*/];
59
+ return [4 /*yield*/, Promise.all(files.map(function (file) { return (0, promises_1.readFile)(file); }))];
60
+ case 2:
61
+ buffers = _a.sent();
62
+ return [4 /*yield*/, (0, to_icon_1.default)(buffers)];
63
+ case 3:
64
+ buf = _a.sent();
65
+ (0, promises_1.writeFile)(output, buf);
66
+ return [2 /*return*/];
67
+ }
68
+ });
69
+ });
70
+ }
71
+ exports.buildFavicon = buildFavicon;
@@ -0,0 +1,3 @@
1
+ import { Observable } from "../utils/Observable";
2
+ import { ServerlessState } from "./state/serverless-state";
3
+ export declare function createServerlessWorker(): Observable<ServerlessState>;
@@ -0,0 +1,99 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.createServerlessWorker = void 0;
15
+ var worker_threads_1 = require("worker_threads");
16
+ var path_1 = require("path");
17
+ var Observable_1 = require("../utils/Observable");
18
+ function createServerlessWorker() {
19
+ var worker = new worker_threads_1.Worker((0, path_1.join)(__dirname, "workers/serverless-worker-dev-script.js"), {
20
+ workerData: {},
21
+ stderr: true,
22
+ stdin: false,
23
+ stdout: true,
24
+ env: __assign(__assign({}, process.env), { FORCE_COLOR: "1" }),
25
+ });
26
+ var subject = new Observable_1.Observable({
27
+ title: "Serverless",
28
+ status: "starting",
29
+ log: "",
30
+ });
31
+ var parseChunk = function (str) {
32
+ var escaped = JSON.stringify(str).replace(/(^"|"$)/g, "");
33
+ var status;
34
+ var duration = 0;
35
+ if (str.includes("\u001b[31merror\u001b[39m")) {
36
+ status = "error";
37
+ }
38
+ else if (str.includes("\u001b[35mevent\u001b[39m") && str.includes("successfully")) {
39
+ status = "success";
40
+ var secondsMatch = str.match(/[0-9.]+s/);
41
+ var msMatch = str.match(/[0-9.]+ ms/);
42
+ if (secondsMatch) {
43
+ duration = parseFloat(secondsMatch[0].replace("s", "")) * 1000;
44
+ }
45
+ if (msMatch) {
46
+ duration = parseFloat(msMatch[0].replace(" ms", ""));
47
+ }
48
+ }
49
+ else if (str.includes("\u001b[36mwait\u001b[39m")) {
50
+ status = "compiling";
51
+ }
52
+ return {
53
+ text: str,
54
+ status: status,
55
+ duration: duration,
56
+ };
57
+ };
58
+ var handleChunk = function (chunk) {
59
+ var result = parseChunk(String(chunk));
60
+ subject.update(function (state) { return (__assign(__assign({}, state), { log: (state.log || "") + result.text, status: result.status ? result.status : state.status, duration: result.status === "success" ? result.duration : state.duration })); });
61
+ };
62
+ worker.stderr.on("data", handleChunk);
63
+ worker.stdout.on("data", handleChunk);
64
+ worker.on("error", function (err) {
65
+ console.log(err);
66
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error" })); });
67
+ });
68
+ worker.on("exit", function (code) {
69
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error" })); });
70
+ });
71
+ worker.on("message", function (data) {
72
+ if (data.code === "preparing") {
73
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "preparing" })); });
74
+ }
75
+ else if (data.code === "packaging") {
76
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "packaging" })); });
77
+ }
78
+ else if (data.code === "compiling") {
79
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "compiling" })); });
80
+ }
81
+ else if (data.code === "finished") {
82
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "success", duration: data.duration })); });
83
+ }
84
+ else if (data.code === "error") {
85
+ subject.update(function (state) { return (__assign(__assign({}, state), { status: "error" })); });
86
+ }
87
+ else if (data.code === "url") {
88
+ subject.update(function (state) { return (__assign(__assign({}, state), { url: data.url })); });
89
+ }
90
+ });
91
+ // worker.on("exit", () => {
92
+ // subject.update((state) => ({
93
+ // ...state,
94
+ // status: "success",
95
+ // }))
96
+ // })
97
+ return subject;
98
+ }
99
+ exports.createServerlessWorker = createServerlessWorker;
@@ -74,16 +74,19 @@ var mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin
74
74
  var autoprefixer_1 = __importDefault(require("autoprefixer"));
75
75
  // Custom Babel plugins
76
76
  var plugin_name_defined_components_1 = __importDefault(require("./babel/plugin-name-defined-components"));
77
+ var fs_1 = require("fs");
77
78
  var manifest_blocks_1 = require("./manifests/manifest-blocks");
78
79
  var manifest_fields_1 = require("./manifests/manifest-fields");
79
80
  var manifest_views_1 = require("./manifests/manifest-views");
81
+ var get_config_1 = require("../config/get-config");
80
82
  function getWebpackConfig(opts) {
81
83
  return __awaiter(this, void 0, void 0, function () {
82
- var compiling, ALIAS, ENTRY, PLUGINS, RULES, DEFINES, VIRTUAL_MODULES, EXTERNALS, virtualModules, isServerless, isBrowser, isSSR, isDev, entryDir, distSuffix, outputFolder, loadableManifestFile, writeVirtualModule, manifestLoaders, buildID;
84
+ var compiling, config, ALIAS, ENTRY, PLUGINS, RULES, DEFINES, VIRTUAL_MODULES, EXTERNALS, virtualModules, isServerless, isBrowser, isSSR, isDev, entryDir, distSuffix, outputFolder, loadableManifestFile, writeVirtualModule, manifestLoaders, rpcExists, buildID;
83
85
  return __generator(this, function (_a) {
84
86
  switch (_a.label) {
85
87
  case 0:
86
88
  compiling = false;
89
+ config = (0, get_config_1.getEDConfigUnwrapped)();
87
90
  ALIAS = {};
88
91
  ENTRY = {};
89
92
  PLUGINS = [];
@@ -127,6 +130,7 @@ function getWebpackConfig(opts) {
127
130
  ALIAS["@views"] = path_1.default.join(opts.baseDirectory, "views");
128
131
  ALIAS["@hooks"] = path_1.default.join(opts.baseDirectory, "hooks");
129
132
  ALIAS["@queries"] = path_1.default.join(opts.baseDirectory, "hooks/queries");
133
+ ALIAS["@utils"] = path_1.default.join(opts.baseDirectory, "utils");
130
134
  RULES.push({
131
135
  test: /\.[jt]sx?$/,
132
136
  exclude: /node_modules/,
@@ -319,6 +323,7 @@ function getWebpackConfig(opts) {
319
323
  }
320
324
  // Define some values
321
325
  DEFINES["process.browser"] = JSON.stringify(isBrowser);
326
+ DEFINES["process.client"] = JSON.stringify(isBrowser);
322
327
  DEFINES["process.serverless"] = "false";
323
328
  DEFINES["process.ssr"] = JSON.stringify(isServerless && !isBrowser);
324
329
  DEFINES["process.LOADABLE_STATS_FILE"] = JSON.stringify(loadableManifestFile);
@@ -329,6 +334,11 @@ function getWebpackConfig(opts) {
329
334
  if (isDev && opts.isAdmin) {
330
335
  DEFINES["process.BLOCK_MANIFEST_FILE"] = JSON.stringify(ALIAS["@manifest/blocks"]);
331
336
  }
337
+ DEFINES["process.devUI"] = config.devUI === "enabled";
338
+ DEFINES["process.serverlessEndpoint"] = "(window.SERVERLESS_ENDPOINT || '')";
339
+ rpcExists = (0, fs_1.existsSync)(path_1.default.join(opts.baseDirectory, "apis/_rpc.ts")) ||
340
+ (0, fs_1.existsSync)(path_1.default.join(opts.baseDirectory, "apis/_rpc/index.ts"));
341
+ DEFINES["process.rpcEnabled"] = rpcExists ? "true" : "false";
332
342
  if (isBrowser) {
333
343
  DEFINES["process.env.themePath"] = "window.THEME_PATH || ".concat(DEFINES["process.env.themePath"]);
334
344
  }
@@ -23,7 +23,7 @@ function createViewManifestGenerator(opts) {
23
23
  var componentName = "View" + (0, change_case_1.pascalCase)(name);
24
24
  return { relative: relative, name: name, module: module, componentName: componentName };
25
25
  });
26
- var useDynamicViews = opts.isServerless;
26
+ var useDynamicViews = false; //opts.isServerless
27
27
  return "\n ".concat(useDynamicViews && "import { dynamic } from 'eddev/dynamic';", "\n import App from ").concat(JSON.stringify("./views/_app"), "\n\n ").concat(!useDynamicViews
28
28
  ? files.map(function (_a) {
29
29
  var componentName = _a.componentName, module = _a.module;
package/build/reporter.js CHANGED
@@ -5,37 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ReporterPlugin = void 0;
7
7
  var chalk_1 = __importDefault(require("chalk"));
8
- // type StatusItem = {
9
- // statusType: "success" | "waiting" | "error" | "warning"
10
- // message: string
11
- // issues: string[]
12
- // }
13
- // class GlobalReporter {
14
- // status: {
15
- // [key: string]: StatusItem
16
- // } = {}
17
- // setStatus(name: string, status: StatusItem) {
18
- // this.status[name] = status
19
- // this.redraw()
20
- // }
21
- // redraw() {
22
- // console.clear()
23
- // for (const [name, status] of Object.entries(this.status)) {
24
- // console.log(name, status.statusType, status.message, status.issues)
25
- // }
26
- // }
27
- // }
28
- // export const globalReporter = new GlobalReporter()
29
- // const log = (item: {
30
- // label: string
31
- // status: "success" | "waiting" | "error" | "warning"
32
- // message: string
33
- // }) => {
34
- // console.log(
35
- // chalk.bgCyan(" " + item.status + " / " + item.label + " "),
36
- // item.message
37
- // )
38
- // }
39
8
  var ReporterPlugin = /** @class */ (function () {
40
9
  function ReporterPlugin(opts) {
41
10
  this.title = opts.title;
@@ -43,23 +12,6 @@ var ReporterPlugin = /** @class */ (function () {
43
12
  ReporterPlugin.prototype.apply = function (compiler) {
44
13
  var _this = this;
45
14
  var plugin = { name: "EDDevReporterPlugin" };
46
- // const log = createLogger({
47
- // name: "boost",
48
- // labels: {
49
- // error: chalk.bgRed.black(" FAIL "),
50
- // info: chalk.bgGreen.black(" DONE "),
51
- // },
52
- // // transports: [
53
- // // new ConsoleTransport({
54
- // // format: (item) => `${item.level} ${this.title} ${item.message}`,
55
- // // // Or a pre-built format
56
- // // // format: formats.json,
57
- // // }),
58
- // // ],
59
- // // transports: [
60
- // // new StreamTransport({ levels: ["error"], stream: process.stderr }),
61
- // // ],
62
- // })
63
15
  var log = function (type, message, errors) {
64
16
  var label = " ".concat(type.toUpperCase(), " (").concat(_this.title, ") ");
65
17
  if (type === "done") {
@@ -90,17 +42,6 @@ var ReporterPlugin = /** @class */ (function () {
90
42
  // }
91
43
  if (!hasErrors && !hasWarnings) {
92
44
  log("done", "Compiled successfully");
93
- // log({
94
- // status: "success",
95
- // label: this.title,
96
- // message: "Compiled Successfully",
97
- // })
98
- // globalReporter.setStatus(this.title, {
99
- // statusType: "success",
100
- // message: "Finished compiling",
101
- // issues: [],
102
- // })
103
- // this.displaySuccess(stats)
104
45
  return;
105
46
  }
106
47
  if (hasErrors) {
@@ -108,22 +49,6 @@ var ReporterPlugin = /** @class */ (function () {
108
49
  .map(function (err) { return err.message; })
109
50
  .join("\n");
110
51
  log("error", "Error compiling", errors);
111
- // log.error("Error compiling %s", errors)
112
- // log({
113
- // status: "error",
114
- // label: this.title,
115
- // message: extractErrorsFromStats(stats, "errors")
116
- // .map((err) => err.message)
117
- // .join("\n"),
118
- // })
119
- // globalReporter.setStatus(this.title, {
120
- // statusType: "error",
121
- // message: "Error compiling",
122
- // issues: extractErrorsFromStats(stats, "errors").map(
123
- // (err) => err.message
124
- // ),
125
- // })
126
- // this.displayErrors(extractErrorsFromStats(stats, "errors"), "error")
127
52
  return;
128
53
  }
129
54
  if (hasWarnings) {
@@ -137,18 +62,6 @@ var ReporterPlugin = /** @class */ (function () {
137
62
  });
138
63
  compiler.hooks.invalid.tap(plugin, function () {
139
64
  log("wait", "Building...");
140
- // log.warn("Recompiling...")
141
- // log({
142
- // status: "waiting",
143
- // message: "Compiling...",
144
- // label: this.title,
145
- // })
146
- // globalReporter.setStatus(this.title, {
147
- // statusType: "waiting",
148
- // message: "Compiling...",
149
- // issues: [],
150
- // })
151
- // console.log(this.title + ": Compiling...")
152
65
  });
153
66
  };
154
67
  ReporterPlugin.prototype.displaySuccess = function (stats) {
@@ -161,16 +74,6 @@ var ReporterPlugin = /** @class */ (function () {
161
74
  }());
162
75
  exports.ReporterPlugin = ReporterPlugin;
163
76
  function extractErrorsFromStats(stats, type) {
164
- // if (isMultiStats(stats)) {
165
- // process.exit()
166
- // const errors = stats.stats.reduce(
167
- // (errors, stats) => errors.concat(extractErrorsFromStats(stats, type)),
168
- // []
169
- // )
170
- // // Dedupe to avoid showing the same error many times when multiple
171
- // // compilers depend on the same module.
172
- // return uniqueBy(errors, (error) => error.message)
173
- // }
174
77
  var findErrorsRecursive = function (compilation) {
175
78
  var errors = compilation[type];
176
79
  if (errors.length === 0 && compilation.children) {
@@ -183,18 +86,6 @@ function extractErrorsFromStats(stats, type) {
183
86
  };
184
87
  return findErrorsRecursive(stats.compilation);
185
88
  }
186
- // function isMultiStats(stats: Stats) {
187
- // return stats.stats
188
- // }
189
- /**
190
- * Concat and flattens non-null values.
191
- * Ex: concat(1, undefined, 2, [3, 4]) = [1, 2, 3, 4]
192
- */
193
- function concat() {
194
- var args = Array.from(arguments).filter(function (e) { return e != null; });
195
- var baseArray = Array.isArray(args[0]) ? args[0] : [args[0]];
196
- return Array.prototype.concat.apply(baseArray, args.slice(1));
197
- }
198
89
  /**
199
90
  * Dedupes array based on criterion returned from iteratee function.
200
91
  * Ex: uniqueBy(
@@ -1,7 +1,9 @@
1
+ import { ServerlessSignal } from "../state/serverless-state";
1
2
  declare type Options = {
2
3
  baseDirectory: string;
3
4
  dev: boolean;
4
5
  build: boolean;
6
+ sendSignal?: (signal: ServerlessSignal) => void;
5
7
  };
6
8
  export declare function createNextApp(opts: Options): Promise<void>;
7
9
  export {};