eddev 0.1.50 → 0.2.0-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/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/file-tree.js +4 -0
- package/build/get-webpack-config.js +58 -143
- package/build/manifests/manifest-blocks.d.ts +12 -0
- package/build/manifests/manifest-blocks.js +61 -0
- package/build/manifests/manifest-fields.d.ts +12 -0
- package/build/manifests/manifest-fields.js +42 -0
- package/build/manifests/manifest-views.d.ts +12 -0
- package/build/manifests/manifest-views.js +49 -0
- package/build/manifests/manifest.d.ts +11 -0
- package/build/manifests/manifest.js +96 -0
- package/build/reporter.js +0 -109
- package/build/serverless/create-next-app.d.ts +9 -0
- package/build/serverless/create-next-app.js +434 -0
- package/build/state/serverless-state.d.ts +26 -0
- package/build/state/serverless-state.js +2 -0
- package/build/workers/serverless-worker-dev-script.d.ts +1 -0
- package/build/workers/serverless-worker-dev-script.js +21 -0
- package/build/workers/serverless-worker-script.d.ts +0 -0
- package/build/workers/serverless-worker-script.js +1 -0
- package/cli/build.dev.js +30 -7
- package/cli/build.prod.js +5 -0
- package/cli/cli.js +32 -3
- 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/components/NextRouter.d.ts +9 -0
- package/components/NextRouter.js +36 -0
- package/components/ServerlessRouter.d.ts +0 -0
- package/components/ServerlessRouter.js +1 -0
- package/config/config-schema.d.ts +65 -0
- package/config/config-schema.js +23 -0
- package/config/create-schema-file.d.ts +1 -0
- package/config/create-schema-file.js +20 -0
- package/config/get-config.d.ts +45 -0
- package/config/get-config.js +32 -0
- package/config/index.d.ts +2 -0
- package/config/index.js +14 -0
- package/config/parse-config.d.ts +29 -0
- package/config/parse-config.js +8 -0
- package/config/print-zod-errors.d.ts +2 -0
- package/config/print-zod-errors.js +14 -0
- package/dynamic/dynamic-component.d.ts +10 -0
- package/dynamic/dynamic-component.js +8 -0
- package/dynamic/index.d.ts +1 -0
- package/dynamic/index.js +13 -0
- package/gravityforms/useGravityForm.js +1 -1
- package/hooks/queryUtils.js +2 -2
- package/hooks/useAppData.js +15 -4
- package/package.json +11 -6
- package/routing/routing.js +5 -0
- package/serverless/create-rpc-client.d.ts +33 -0
- package/serverless/create-rpc-client.js +20 -0
- package/serverless/define-api.d.ts +2 -0
- package/serverless/define-api.js +66 -0
- package/serverless/define-rpc-router.d.ts +2 -0
- package/serverless/define-rpc-router.js +27 -0
- package/serverless/error-codes.d.ts +2 -0
- package/serverless/error-codes.js +14 -0
- package/serverless/index.d.ts +4 -0
- package/serverless/index.js +16 -0
- package/serverless/rpc-provider.d.ts +1 -0
- package/serverless/rpc-provider.js +5 -0
- package/serverless-template/README.md +34 -0
- package/serverless-template/_utils/ed-config.ts +5 -0
- package/serverless-template/_utils/fetch-wordpress-props.ts +39 -0
- package/serverless-template/global.d.ts +9 -0
- package/serverless-template/next-env.d.ts +3 -0
- package/serverless-template/next.config.js +69 -0
- package/serverless-template/null.ts +1 -0
- package/serverless-template/package-lock.json +641 -0
- package/serverless-template/package.json +19 -0
- package/serverless-template/pages/[...slug].tsx +20 -0
- package/serverless-template/pages/_app.tsx +34 -0
- package/serverless-template/pages/_document.tsx +19 -0
- package/serverless-template/pages/api/hello.ts +10 -0
- package/serverless-template/pages/api/rest/[...method].ts +38 -0
- package/serverless-template/pages/index.tsx +12 -0
- package/serverless-template/tsconfig.json +37 -0
- package/utils/getRepoName.d.ts +2 -2
- package/utils/getRepoName.js +6 -52
- package/utils/serverlessAppContext.d.ts +3 -0
- package/utils/serverlessAppContext.js +6 -0
- package/fields/ImageWell.d.ts +0 -8
- package/fields/ImageWell.js +0 -64
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AppProps } from "next/app"
|
|
2
|
+
import { App } from "@manifest/views"
|
|
3
|
+
import manifest from "@manifest/views"
|
|
4
|
+
import { NextRouter } from "eddev/components/NextRouter"
|
|
5
|
+
import { ServerlessAppDataProvider } from "eddev/utils/serverlessAppContext"
|
|
6
|
+
import { useMemo } from "react"
|
|
7
|
+
import { useRouter } from "next/router"
|
|
8
|
+
|
|
9
|
+
function MyApp({ Component, pageProps }: AppProps) {
|
|
10
|
+
if (!pageProps.appData) return <div />
|
|
11
|
+
|
|
12
|
+
const appData = useMemo(() => {
|
|
13
|
+
return pageProps.appData.data
|
|
14
|
+
}, [])
|
|
15
|
+
|
|
16
|
+
const route = useRouter()
|
|
17
|
+
|
|
18
|
+
const viewProps = pageProps?.viewData?.data
|
|
19
|
+
|
|
20
|
+
const View = manifest[pageProps.view]
|
|
21
|
+
|
|
22
|
+
console.log("ROUTE", pageProps, route.pathname)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<ServerlessAppDataProvider value={appData}>
|
|
26
|
+
<NextRouter data={pageProps} path={route.pathname}>
|
|
27
|
+
<App>
|
|
28
|
+
<View {...viewProps} />
|
|
29
|
+
</App>
|
|
30
|
+
</NextRouter>
|
|
31
|
+
</ServerlessAppDataProvider>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
export default MyApp
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import NextDocument, { Html, Head, Main, NextScript } from "next/document"
|
|
3
|
+
import { getCssText } from "@theme"
|
|
4
|
+
|
|
5
|
+
export default class Document extends NextDocument {
|
|
6
|
+
render() {
|
|
7
|
+
return (
|
|
8
|
+
<Html lang="en">
|
|
9
|
+
<Head>
|
|
10
|
+
<style id="stitches" dangerouslySetInnerHTML={{ __html: getCssText() }} />
|
|
11
|
+
</Head>
|
|
12
|
+
<body>
|
|
13
|
+
<Main />
|
|
14
|
+
<NextScript />
|
|
15
|
+
</body>
|
|
16
|
+
</Html>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
|
2
|
+
import type { NextApiRequest, NextApiResponse } from 'next'
|
|
3
|
+
|
|
4
|
+
type Data = {
|
|
5
|
+
name: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default (req: NextApiRequest, res: NextApiResponse<Data>) => {
|
|
9
|
+
res.status(200).json({ name: 'John Doe' })
|
|
10
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const validProxyPaths = {
|
|
2
|
+
"form-submit": {
|
|
3
|
+
path: "/wp-json/ed/v1/gf/submit",
|
|
4
|
+
method: "GET",
|
|
5
|
+
},
|
|
6
|
+
query: {
|
|
7
|
+
path: "/wp-json/ed/v1/query/*",
|
|
8
|
+
method: "GET",
|
|
9
|
+
},
|
|
10
|
+
mutation: {
|
|
11
|
+
path: "/wp-json/ed/v1/mutation/*",
|
|
12
|
+
method: "POST",
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default async function (req: any, res: any) {
|
|
17
|
+
// Ensure that the request is for a proxy path
|
|
18
|
+
const proxyPath = validProxyPaths[req.query.method[0] as keyof typeof validProxyPaths]!
|
|
19
|
+
|
|
20
|
+
if (!proxyPath) {
|
|
21
|
+
return res.status(404).json({
|
|
22
|
+
error: "Not found",
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const finalPath = proxyPath.path.replace("*", req.query.method.slice(1).join("/"))
|
|
27
|
+
|
|
28
|
+
const response = await fetch(process.env.SITE_URL + finalPath, {
|
|
29
|
+
method: proxyPath.method,
|
|
30
|
+
headers: {
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const payload = await response.json()
|
|
36
|
+
|
|
37
|
+
res.status(200).json(payload)
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { fetchWordpressProps } from "../_utils/fetch-wordpress-props"
|
|
2
|
+
|
|
3
|
+
export default function Home() {
|
|
4
|
+
return <div>Test</div>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export async function getStaticProps({ params }: any) {
|
|
8
|
+
const result = await fetchWordpressProps("/")
|
|
9
|
+
return {
|
|
10
|
+
props: result,
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"module": "esnext",
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"jsx": "preserve",
|
|
16
|
+
"incremental": true,
|
|
17
|
+
"baseUrl": ".",
|
|
18
|
+
"paths": {
|
|
19
|
+
"@manifest/views": ["manifest_views.ts"],
|
|
20
|
+
"@manifest/blocks": ["manifest_blocks.ts"],
|
|
21
|
+
"@components/*": ["components/*"],
|
|
22
|
+
"@views/*": ["views/*"],
|
|
23
|
+
"@hooks/*": ["hooks/*"],
|
|
24
|
+
"@queries/*": ["hooks/queries/*"],
|
|
25
|
+
"@theme": ["theme.css.tsx"],
|
|
26
|
+
"@wordpress/components": ["null.ts"],
|
|
27
|
+
"@wordpress/element": ["null.ts"],
|
|
28
|
+
"@wordpress/blocks": ["null.ts"],
|
|
29
|
+
"@wordpress/utils": ["null.ts"],
|
|
30
|
+
"@wordpress/data": ["null.ts"],
|
|
31
|
+
"@wordpress/hooks": ["null.ts"],
|
|
32
|
+
"@wordpress/block-editor": ["null.ts"]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"include": ["next-env.d.ts", "global.d.ts", "**/*.ts", "**/*.tsx"],
|
|
36
|
+
"exclude": ["node_modules"]
|
|
37
|
+
}
|
package/utils/getRepoName.d.ts
CHANGED
package/utils/getRepoName.js
CHANGED
|
@@ -1,62 +1,16 @@
|
|
|
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
|
-
};
|
|
38
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
4
|
};
|
|
41
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
6
|
exports.getRepoName = void 0;
|
|
43
|
-
var
|
|
7
|
+
var git_repo_name_1 = __importDefault(require("git-repo-name"));
|
|
44
8
|
var path_1 = __importDefault(require("path"));
|
|
45
9
|
function getRepoName(dir) {
|
|
46
|
-
var
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
case 0: return [4 /*yield*/, (0, git_remote_origin_url_1.default)(dir)];
|
|
52
|
-
case 1:
|
|
53
|
-
info = _b.sent();
|
|
54
|
-
return [2 /*return*/, {
|
|
55
|
-
repoName: (_a = info.match(/([^\/]+).git$/)) === null || _a === void 0 ? void 0 : _a[1],
|
|
56
|
-
themeName: path_1.default.basename(dir),
|
|
57
|
-
}];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
10
|
+
var info = git_repo_name_1.default.sync(dir);
|
|
11
|
+
return {
|
|
12
|
+
repoName: info || "",
|
|
13
|
+
themeName: path_1.default.basename(dir),
|
|
14
|
+
};
|
|
61
15
|
}
|
|
62
16
|
exports.getRepoName = getRepoName;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServerlessAppDataProvider = exports.ServerlessAppDataContext = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
exports.ServerlessAppDataContext = (0, react_1.createContext)(undefined);
|
|
6
|
+
exports.ServerlessAppDataProvider = exports.ServerlessAppDataContext.Provider;
|
package/fields/ImageWell.d.ts
DELETED
package/fields/ImageWell.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImageWell = void 0;
|
|
4
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
var react_1 = require("@stitches/react");
|
|
6
|
-
var react_2 = require("react");
|
|
7
|
-
function ImageWell(props) {
|
|
8
|
-
var _a = (0, react_2.useState)(null), selectedImage = _a[0], setSelectedImage = _a[1];
|
|
9
|
-
var _b = (0, react_2.useState)(false), imageIsLoading = _b[0], setImageIsLoading = _b[1];
|
|
10
|
-
(0, react_2.useEffect)(function () {
|
|
11
|
-
if (props.value) {
|
|
12
|
-
var cancelled = false;
|
|
13
|
-
setImageIsLoading(true);
|
|
14
|
-
fetch("/wp-json/ed/v1/media/" + Number(props.value))
|
|
15
|
-
.then(function (response) { return response.json(); })
|
|
16
|
-
.then(function (image) {
|
|
17
|
-
setImageIsLoading(false);
|
|
18
|
-
setSelectedImage(image);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}, [props.value]);
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [imageIsLoading ? ((0, jsx_runtime_1.jsx)(Loading, { children: (0, jsx_runtime_1.jsx)(Spinner, {}, void 0) }, void 0)) : selectedImage ? ((0, jsx_runtime_1.jsx)(ImageContainer, { children: (0, jsx_runtime_1.jsx)("img", { src: selectedImage.sizes[props.previewSize] || selectedImage.sizes["thumbnail"] }, void 0) }, void 0)) : null, (0, jsx_runtime_1.jsx)(Toolbar, { children: selectedImage || imageIsLoading ? ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button, { children: "Remove" }, void 0), (0, jsx_runtime_1.jsx)(Button, { children: "Edit" }, void 0), (0, jsx_runtime_1.jsx)(Button, { children: "View" }, void 0)] }, void 0)) : null }, void 0)] }, void 0));
|
|
23
|
-
}
|
|
24
|
-
exports.ImageWell = ImageWell;
|
|
25
|
-
var Wrapper = (0, react_1.styled)("div", {
|
|
26
|
-
position: "relative",
|
|
27
|
-
display: "block",
|
|
28
|
-
width: "100%",
|
|
29
|
-
border: "1px solid #aaaaaa",
|
|
30
|
-
});
|
|
31
|
-
var ImageContainer = (0, react_1.styled)("div", {
|
|
32
|
-
padding: "4px",
|
|
33
|
-
img: {
|
|
34
|
-
maxWidth: "100%",
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
var spin = (0, react_1.keyframes)({
|
|
38
|
-
from: {
|
|
39
|
-
transform: "rotate(0deg)",
|
|
40
|
-
},
|
|
41
|
-
to: {
|
|
42
|
-
transform: "rotate(360deg)",
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
var Spinner = (0, react_1.styled)("div", {
|
|
46
|
-
display: "block",
|
|
47
|
-
width: "32px",
|
|
48
|
-
height: "32px",
|
|
49
|
-
border: "4px solid transparent",
|
|
50
|
-
borderTop: "currentColor",
|
|
51
|
-
animation: "".concat(spin, " 1s linear infinite"),
|
|
52
|
-
});
|
|
53
|
-
var Loading = (0, react_1.styled)("div", {
|
|
54
|
-
display: "flex",
|
|
55
|
-
justifyContent: "center",
|
|
56
|
-
alignItems: "center",
|
|
57
|
-
padding: "8px",
|
|
58
|
-
});
|
|
59
|
-
var Toolbar = (0, react_1.styled)("div", {
|
|
60
|
-
position: "absolute",
|
|
61
|
-
top: 0,
|
|
62
|
-
right: 0,
|
|
63
|
-
padding: "4px",
|
|
64
|
-
});
|