eddev 0.2.0-beta.9 → 0.2.2-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocks/ContentBlocks.js +4 -1
- package/blocks/blockAttributes.d.ts +4 -0
- package/blocks/blockAttributes.js +23 -7
- package/blocks/inlineEditing.d.ts +9 -3
- package/blocks/inlineEditing.js +28 -5
- package/blocks/installGutenbergHooks.js +24 -3
- package/build/build-favicon.d.ts +1 -0
- package/build/build-favicon.js +71 -0
- package/build/create-serverless-dev-worker.d.ts +3 -0
- package/build/create-serverless-dev-worker.js +99 -0
- package/build/get-webpack-config.js +11 -1
- package/build/graphql-codegen/graphql-codegen-blocks.js +0 -1
- package/build/manifests/manifest-views.js +1 -1
- package/build/reporter.js +0 -109
- package/build/serverless/create-next-app.d.ts +2 -0
- package/build/serverless/create-next-app.js +239 -47
- package/build/state/serverless-state.d.ts +26 -0
- package/{config/schema.js → build/state/serverless-state.js} +0 -0
- package/build/workers/codegen-worker-script.js +36 -1
- package/{config/schema.d.ts → build/workers/serverless-worker-dev-script.d.ts} +0 -0
- package/build/workers/serverless-worker-dev-script.js +21 -0
- package/cli/build.dev.js +34 -6
- package/cli/build.prod.js +13 -1
- package/cli/cli.js +32 -17
- package/cli/display/components/DevCLIDisplay.d.ts +3 -0
- package/cli/display/components/DevCLIDisplay.js +20 -1
- package/cli/display/components/ServerlessDisplay.d.ts +9 -0
- package/cli/display/components/ServerlessDisplay.js +68 -0
- package/cli/preinstall.d.ts +1 -0
- package/cli/preinstall.js +19 -0
- package/components/NextRouter.js +3 -2
- package/config/config-schema.d.ts +17 -9
- package/config/config-schema.js +3 -1
- package/config/get-config.d.ts +39 -0
- package/config/get-config.js +32 -0
- package/config/parse-config.d.ts +8 -4
- package/config/print-zod-errors.d.ts +2 -0
- package/config/print-zod-errors.js +14 -0
- package/dev-ui/components/BreakpointColumnHeader.d.ts +11 -0
- package/dev-ui/components/BreakpointColumnHeader.js +47 -0
- package/dev-ui/components/BreakpointIndicator.d.ts +2 -0
- package/dev-ui/components/BreakpointIndicator.js +138 -0
- package/dev-ui/components/DevUI.d.ts +2 -0
- package/dev-ui/components/DevUI.js +28 -0
- package/dev-ui/components/Launcher.d.ts +98 -0
- package/dev-ui/components/Launcher.js +94 -0
- package/dev-ui/components/PanelWrapper.d.ts +8 -0
- package/dev-ui/components/PanelWrapper.js +37 -0
- package/dev-ui/components/ResponsiveLerpControl.d.ts +8 -0
- package/dev-ui/components/ResponsiveLerpControl.js +177 -0
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +26 -0
- package/dev-ui/components/ResponsiveScaleEditor.js +233 -0
- package/dev-ui/components/atoms/Button.d.ts +47 -0
- package/dev-ui/components/atoms/Button.js +67 -0
- package/dev-ui/components/atoms/Dropdown.d.ts +13 -0
- package/dev-ui/components/atoms/Dropdown.js +50 -0
- package/dev-ui/components/atoms/NumberField.d.ts +12 -0
- package/dev-ui/components/atoms/NumberField.js +111 -0
- package/dev-ui/components/atoms/Spacer.d.ts +42 -0
- package/dev-ui/components/atoms/Spacer.js +8 -0
- package/dev-ui/components/atoms/Text.d.ts +45 -0
- package/dev-ui/components/atoms/Text.js +39 -0
- package/dev-ui/components/atoms/ToggleButton.d.ts +8 -0
- package/dev-ui/components/atoms/ToggleButton.js +41 -0
- package/dev-ui/components/atoms/Tooltip.d.ts +9 -0
- package/dev-ui/components/atoms/Tooltip.js +66 -0
- package/dev-ui/components/panels/PageDataDebugger.d.ts +2 -0
- package/dev-ui/components/panels/PageDataDebugger.js +30 -0
- package/dev-ui/components/panels/SpacingEditor.d.ts +2 -0
- package/dev-ui/components/panels/SpacingEditor.js +88 -0
- package/dev-ui/components/panels/TypographyEditor.d.ts +2 -0
- package/dev-ui/components/panels/TypographyEditor.js +95 -0
- package/dev-ui/hooks/useBreakpoint.d.ts +11 -0
- package/dev-ui/hooks/useBreakpoint.js +59 -0
- package/dev-ui/hooks/usePersistState.d.ts +1 -0
- package/dev-ui/hooks/usePersistState.js +36 -0
- package/dev-ui/hooks/useStylesheet.d.ts +4 -0
- package/dev-ui/hooks/useStylesheet.js +31 -0
- package/dev-ui/icons.d.ts +15 -0
- package/dev-ui/icons.js +29 -0
- package/dev-ui/index.d.ts +1 -0
- package/dev-ui/index.js +13 -0
- package/dev-ui/loader.d.ts +2 -0
- package/dev-ui/loader.js +42 -0
- package/dev-ui/panels.d.ts +11 -0
- package/dev-ui/panels.js +33 -0
- package/dev-ui/theme.d.ts +151 -0
- package/dev-ui/theme.js +50 -0
- package/entry/Root.d.ts +3 -1
- package/entry/Root.js +18 -6
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useAppData.js +4 -0
- package/{serverless/create-rpc-client.d.ts → hooks/useRPC.d.ts} +18 -18
- package/hooks/useRPC.js +18 -0
- package/package.json +17 -9
- package/routing/routing.js +1 -1
- package/serverless/define-rpc-router.d.ts +5 -1
- package/serverless/define-rpc-router.js +11 -3
- package/serverless/index.d.ts +2 -1
- package/serverless/index.js +3 -1
- package/serverless-template/_utils/PageMeta.tsx +44 -0
- package/serverless-template/_utils/fetch-wordpress-props.ts +14 -3
- package/serverless-template/_utils/fetch-wp.ts +17 -0
- package/serverless-template/global.d.ts +7 -1
- package/serverless-template/next.config.js +10 -3
- package/serverless-template/package.json +6 -4
- package/serverless-template/pages/404.tsx +12 -0
- package/serverless-template/pages/[...slug].tsx +7 -2
- package/serverless-template/pages/_app.tsx +34 -12
- package/serverless-template/pages/_document.tsx +19 -0
- package/serverless-template/pages/api/rest/{[...method].ts → [method].ts} +4 -2
- package/serverless-template/pages/api/trpc/[...trpc].ts +26 -0
- package/serverless-template/pages/index.tsx +2 -2
- package/style/createStitches.d.ts +71 -1
- package/style/createStitches.js +181 -74
- package/utils/getRepoName.js +13 -5
- package/utils/updateEnvFile.d.ts +1 -0
- package/utils/updateEnvFile.js +76 -0
- package/cli/prepare-next.d.ts +0 -0
- package/cli/prepare-next.js +0 -1
- package/entry/entry.serverless.dev.d.ts +0 -0
- package/entry/entry.serverless.dev.js +0 -2
- package/fields/ImageWell.d.ts +0 -8
- package/fields/ImageWell.js +0 -64
- package/serverless/create-rpc-client.js +0 -20
- package/serverless-template/package-lock.json +0 -641
- package/serverless-template/pages/api/hello.ts +0 -10
package/blocks/ContentBlocks.js
CHANGED
|
@@ -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 should only be used on the frontend.");
|
|
37
|
+
}
|
|
35
38
|
if (!Array.isArray(props.blocks))
|
|
36
39
|
return null;
|
|
37
40
|
var parentContext = (0, react_1.useContext)(exports.BlocksContext);
|
|
@@ -45,7 +48,7 @@ function ContentBlocks(props) {
|
|
|
45
48
|
var Component = blocks_1.default[block.blockName];
|
|
46
49
|
if (!Component)
|
|
47
50
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {}, void 0);
|
|
48
|
-
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ values: block.inline, innerBlocks: block.innerBlocks }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
51
|
+
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ block: [block.blockName, block.props], values: block.inline, innerBlocks: block.innerBlocks }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
49
52
|
// innerBlocks={block.innerBlocks}
|
|
50
53
|
children: Array.isArray(block.innerBlocks) && block.innerBlocks.length ? ((0, jsx_runtime_1.jsx)(ContentBlocks, { blocks: block.innerBlocks }, void 0)) : null }), void 0) }), void 0));
|
|
51
54
|
}
|
|
@@ -6,9 +6,13 @@ interface Attributes {
|
|
|
6
6
|
declare type ProviderProps = PropsWithChildren<{
|
|
7
7
|
values: Attributes;
|
|
8
8
|
innerBlocks: ContentBlock[];
|
|
9
|
+
block: [string, Attributes];
|
|
9
10
|
onChange?: (attrs: Attributes) => void;
|
|
11
|
+
insertBlocksAfter?: (block: any) => void;
|
|
10
12
|
}>;
|
|
11
13
|
export declare function InlineEditingContextProvider(props: ProviderProps): JSX.Element;
|
|
12
14
|
export declare function useInlineEditableValue<T>(key: string, defaultValue?: T): [T, (value: T) => void];
|
|
15
|
+
export declare function useBlockAppender(): ((block: any) => void) | undefined;
|
|
13
16
|
export declare function useInnerBlocks(): ContentBlock[];
|
|
17
|
+
export declare function useBlockParents(): [string, Attributes][];
|
|
14
18
|
export {};
|
|
@@ -10,15 +10,26 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
13
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.useInnerBlocks = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
23
|
+
exports.useBlockParents = exports.useInnerBlocks = exports.useBlockAppender = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
15
24
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
25
|
var react_1 = require("react");
|
|
17
26
|
var InlineEditingContext = (0, react_1.createContext)(undefined);
|
|
18
27
|
function InlineEditingContextProvider(props) {
|
|
28
|
+
var parentContext = (0, react_1.useContext)(InlineEditingContext);
|
|
19
29
|
return ((0, jsx_runtime_1.jsx)(InlineEditingContext.Provider, __assign({ value: {
|
|
20
30
|
values: props.values,
|
|
21
31
|
innerBlocks: props.innerBlocks,
|
|
32
|
+
parents: __spreadArray(__spreadArray([], ((parentContext === null || parentContext === void 0 ? void 0 : parentContext.parents) || []), true), [props.block], false).filter(Boolean),
|
|
22
33
|
getValue: function (key) {
|
|
23
34
|
var _a;
|
|
24
35
|
return (_a = props.values) === null || _a === void 0 ? void 0 : _a[key];
|
|
@@ -29,6 +40,7 @@ function InlineEditingContextProvider(props) {
|
|
|
29
40
|
props.onChange(__assign(__assign({}, (props.values || {})), (_a = {}, _a[key] = value, _a)));
|
|
30
41
|
}
|
|
31
42
|
},
|
|
43
|
+
insertBlocksAfter: props.insertBlocksAfter,
|
|
32
44
|
} }, { children: props.children }), void 0));
|
|
33
45
|
}
|
|
34
46
|
exports.InlineEditingContextProvider = InlineEditingContextProvider;
|
|
@@ -43,14 +55,18 @@ function useInlineEditableValue(key, defaultValue) {
|
|
|
43
55
|
];
|
|
44
56
|
}
|
|
45
57
|
exports.useInlineEditableValue = useInlineEditableValue;
|
|
58
|
+
function useBlockAppender() {
|
|
59
|
+
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
60
|
+
return ctx === null || ctx === void 0 ? void 0 : ctx.insertBlocksAfter;
|
|
61
|
+
}
|
|
62
|
+
exports.useBlockAppender = useBlockAppender;
|
|
46
63
|
function useInnerBlocks() {
|
|
47
64
|
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
48
65
|
return (ctx === null || ctx === void 0 ? void 0 : ctx.innerBlocks) || [];
|
|
49
|
-
// return [
|
|
50
|
-
// attrs?.getValue(key),
|
|
51
|
-
// (value: any) => {
|
|
52
|
-
// attrs?.setValue(key, value)
|
|
53
|
-
// },
|
|
54
|
-
// ] as [T, (value: T) => void]
|
|
55
66
|
}
|
|
56
67
|
exports.useInnerBlocks = useInnerBlocks;
|
|
68
|
+
function useBlockParents() {
|
|
69
|
+
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
70
|
+
return (ctx === null || ctx === void 0 ? void 0 : ctx.parents) || [];
|
|
71
|
+
}
|
|
72
|
+
exports.useBlockParents = useBlockParents;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementType } from "react";
|
|
1
|
+
import { ElementType, FunctionComponent } from "react";
|
|
2
2
|
import { ContentBlocksSettings } from ".";
|
|
3
3
|
declare type PropTypes<T extends ElementType> = {
|
|
4
4
|
/** The 'key' of this editable text value */
|
|
@@ -11,14 +11,20 @@ declare type PropTypes<T extends ElementType> = {
|
|
|
11
11
|
inlineToolbar?: boolean;
|
|
12
12
|
/** Specify default content to use on the frontend if nothing has been entered */
|
|
13
13
|
defaultValue?: string;
|
|
14
|
+
/** Append a new block when the user hits 'Enter' */
|
|
15
|
+
appendOnEnter?: boolean;
|
|
14
16
|
} & React.ComponentPropsWithoutRef<T>;
|
|
15
|
-
export declare function EditableText<T extends ElementType>({ id, as, ...props }: PropTypes<T>): JSX.Element | null;
|
|
17
|
+
export declare function EditableText<T extends ElementType>({ id, as, appendOnEnter, ...props }: PropTypes<T>): JSX.Element | null;
|
|
18
|
+
declare type AppenderConfig = {
|
|
19
|
+
type: "default" | "button" | FunctionComponent<any>;
|
|
20
|
+
block?: boolean;
|
|
21
|
+
};
|
|
16
22
|
declare type InnerBlocksProps = {
|
|
17
23
|
allowedBlocks?: string[];
|
|
18
24
|
orientation?: "horizontal" | "vertical";
|
|
19
25
|
templateLock?: any;
|
|
20
26
|
template?: any;
|
|
21
|
-
|
|
27
|
+
appender?: AppenderConfig;
|
|
22
28
|
} & ContentBlocksSettings;
|
|
23
29
|
export declare function InnerBlocks(props: InnerBlocksProps): JSX.Element;
|
|
24
30
|
export {};
|
package/blocks/inlineEditing.js
CHANGED
|
@@ -24,8 +24,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.InnerBlocks = exports.EditableText = void 0;
|
|
26
26
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
-
// @ts-ignore
|
|
28
27
|
var block_editor_1 = require("@wordpress/block-editor");
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
var blocks_1 = require("@wordpress/blocks");
|
|
29
30
|
var ContentBlocks_1 = require("./ContentBlocks");
|
|
30
31
|
var react_1 = require("react");
|
|
31
32
|
var blockAttributes_1 = require("./blockAttributes");
|
|
@@ -33,10 +34,17 @@ var react_2 = require("@stitches/react");
|
|
|
33
34
|
var remoteProps_1 = require("../routing/remoteProps");
|
|
34
35
|
var __1 = require("..");
|
|
35
36
|
function EditableText(_a) {
|
|
36
|
-
var id = _a.id, as = _a.as, props = __rest(_a, ["id", "as"]);
|
|
37
|
+
var id = _a.id, as = _a.as, appendOnEnter = _a.appendOnEnter, props = __rest(_a, ["id", "as", "appendOnEnter"]);
|
|
37
38
|
if (process.admin) {
|
|
38
39
|
var _b = (0, blockAttributes_1.useInlineEditableValue)(id), value = _b[0], setValue = _b[1];
|
|
39
|
-
|
|
40
|
+
var appendBlocks_1 = (0, blockAttributes_1.useBlockAppender)();
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(block_editor_1.RichText, __assign({}, props, { tagName: as, value: value || "", onChange: setValue, disableLineBreaks: props.disableLineBreaks, onKeyDownCapture: function (e) {
|
|
42
|
+
if (e.key === "Enter" && appendOnEnter && appendBlocks_1) {
|
|
43
|
+
appendBlocks_1([(0, blocks_1.createBlock)("core/paragraph")]);
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
}
|
|
47
|
+
} }), void 0));
|
|
40
48
|
}
|
|
41
49
|
else {
|
|
42
50
|
var value = (0, blockAttributes_1.useInlineEditableValue)(id)[0];
|
|
@@ -66,11 +74,23 @@ function EditableText(_a) {
|
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
exports.EditableText = EditableText;
|
|
77
|
+
var Appender = function (props) {
|
|
78
|
+
if (props.type === "button") {
|
|
79
|
+
return (0, jsx_runtime_1.jsx)(block_editor_1.ButtonBlockAppender, {}, void 0);
|
|
80
|
+
}
|
|
81
|
+
else if (typeof props.type === "function") {
|
|
82
|
+
return props.type({});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
return (0, jsx_runtime_1.jsx)(block_editor_1.DefaultBlockAppender, {}, void 0);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
69
88
|
function InnerBlocks(props) {
|
|
70
89
|
if (process.admin) {
|
|
71
90
|
var allowedBlocks = props.allowedBlocks;
|
|
72
|
-
|
|
73
|
-
|
|
91
|
+
return ((0, jsx_runtime_1.jsx)(InnerBlocksAdminWrapper, __assign({ orientation: props.orientation || "vertical" }, { children: (0, jsx_runtime_1.jsx)(block_editor_1.InnerBlocks, { orientation: props.orientation, allowedBlocks: allowedBlocks,
|
|
92
|
+
// renderAppender={() => <Appender {...props.appender} />}
|
|
93
|
+
templateLock: props.templateLock, template: props.template }, void 0) }), void 0));
|
|
74
94
|
}
|
|
75
95
|
else {
|
|
76
96
|
var blocks = (0, blockAttributes_1.useInnerBlocks)();
|
|
@@ -87,6 +107,9 @@ var InnerBlocksAdminWrapper = (0, react_2.styled)("div", {
|
|
|
87
107
|
// marginRight: "auto",
|
|
88
108
|
maxWidth: "var(--grid-inner-width)",
|
|
89
109
|
},
|
|
110
|
+
".block-editor-block-list__block .block-list-appender:only-child": {
|
|
111
|
+
alignSelf: "auto !important",
|
|
112
|
+
},
|
|
90
113
|
variants: {
|
|
91
114
|
orientation: {
|
|
92
115
|
vertical: {
|
|
@@ -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");
|
|
@@ -45,6 +47,11 @@ function installEDGutenbergHooks() {
|
|
|
45
47
|
if (!window.wp.blockEditor)
|
|
46
48
|
return;
|
|
47
49
|
(0, react_2.globalCss)({
|
|
50
|
+
".edit-post-visual-editor__post-title-wrapper": {
|
|
51
|
+
width: "var(--grid-inner-width)",
|
|
52
|
+
marginLeft: "auto",
|
|
53
|
+
marginRight: "auto",
|
|
54
|
+
},
|
|
48
55
|
".block-editor-block-list__block:hover": {
|
|
49
56
|
outline: "1px solid #e1e1e1",
|
|
50
57
|
},
|
|
@@ -82,9 +89,17 @@ function installEDGutenbergHooks() {
|
|
|
82
89
|
// @ts-ignore
|
|
83
90
|
window.wp.data.dispatch("core/block-editor").setTemplateValidity(true);
|
|
84
91
|
}, []);
|
|
85
|
-
|
|
92
|
+
var children = (0, data_1.useSelect)(function (select) {
|
|
93
|
+
var _a = select("core/block-editor"), getBlock = _a.getBlock, getBlockOrder = _a.getBlockOrder;
|
|
94
|
+
var innerBlockIDs = getBlockOrder(props.clientId);
|
|
95
|
+
var children = innerBlockIDs.map(function (id) {
|
|
96
|
+
return getBlock(id);
|
|
97
|
+
});
|
|
98
|
+
return children;
|
|
99
|
+
}, []);
|
|
100
|
+
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, block: [name, props], onChange: function (attrs) {
|
|
86
101
|
props.setAttributes(__assign(__assign({}, props.attributes), { inline: attrs }));
|
|
87
|
-
} }, { children: edit_1.call(self, props) }), void 0) }), void 0));
|
|
102
|
+
}, insertBlocksAfter: props.insertBlocksAfter }, { children: edit_1.call(self, props) }), void 0) }), void 0));
|
|
88
103
|
};
|
|
89
104
|
}
|
|
90
105
|
// Remember the block type name
|
|
@@ -154,7 +169,13 @@ function installEDGutenbergHooks() {
|
|
|
154
169
|
var parseJSX = acf.parseJSX;
|
|
155
170
|
// @ts-ignore
|
|
156
171
|
acf.parseJSX = function (html) {
|
|
157
|
-
var payload
|
|
172
|
+
var payload;
|
|
173
|
+
try {
|
|
174
|
+
payload = JSON.parse(html.replace(/(^[^>]+>|<[^>]+>$)/g, ""));
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
throw new Error("eddev: Error parsing block data from: \n" + html);
|
|
178
|
+
}
|
|
158
179
|
return (0, jsx_runtime_1.jsx)(BlockRenderer, { payload: payload }, void 0);
|
|
159
180
|
};
|
|
160
181
|
}
|
|
@@ -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,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(
|