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,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function createRPCClient(): {
|
|
3
|
+
Provider: ({ client, queryClient, children, isPrepass, ssrContext, }: {
|
|
4
|
+
queryClient: QueryClient;
|
|
5
|
+
client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>;
|
|
6
|
+
children: import("react").ReactNode;
|
|
7
|
+
isPrepass?: boolean | undefined;
|
|
8
|
+
ssrContext?: unknown;
|
|
9
|
+
}) => JSX.Element;
|
|
10
|
+
createClient: (opts: import("@trpc/react").CreateTRPCClientOptions<import("@trpc/server").AnyRouter<any>>) => import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>;
|
|
11
|
+
useContext: () => import("@trpc/react/dist/declarations/src/internals/context").TRPCContextState<import("@trpc/server").AnyRouter<any>, unknown>;
|
|
12
|
+
useQuery: <TPath extends string>(pathAndInput: [TPath, (null | undefined)?], opts?: import("@trpc/react").UseTRPCQueryOptions<TPath, unknown, any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>> | undefined) => UseQueryResult<{ [TPath_1 in keyof TRouter["_def"]["queries"]]: {
|
|
13
|
+
input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["queries"][TPath_1]>;
|
|
14
|
+
output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["queries"][TPath_1]["call"]>>;
|
|
15
|
+
}; }[TPath_2]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>>;
|
|
16
|
+
useMutation: <TPath_1 extends string>(path: TPath_1 | [TPath_1], opts?: import("@trpc/react").UseTRPCMutationOptions<unknown, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>, any> | undefined) => UseMutationResult<{ [TPath_3 in keyof TRouter["_def"]["mutations"]]: {
|
|
17
|
+
input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["mutations"][TPath_3]>;
|
|
18
|
+
output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["mutations"][TPath_3]["call"]>>;
|
|
19
|
+
}; }[TPath_1_1]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>, { [TPath_3 in keyof TRouter["_def"]["mutations"]]: {
|
|
20
|
+
input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["mutations"][TPath_3]>;
|
|
21
|
+
output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["mutations"][TPath_3]["call"]>>;
|
|
22
|
+
}; }[TPath_1_1]["input"], unknown>;
|
|
23
|
+
useSubscription: <TPath_2 extends string, TOutput extends any>(pathAndInput: [TPath_2, (null | undefined)?], opts: {
|
|
24
|
+
enabled?: boolean | undefined;
|
|
25
|
+
onError?: ((err: import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>) => void) | undefined;
|
|
26
|
+
onNext: (data: TOutput) => void;
|
|
27
|
+
}) => void;
|
|
28
|
+
useDehydratedState: (client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>, trpcState: any) => any;
|
|
29
|
+
useInfiniteQuery: <TPath_3 extends never>(pathAndInput: [path: TPath_3, input: Omit<unknown, "cursor">], opts?: import("@trpc/react").UseTRPCInfiniteQueryOptions<TPath_3, Omit<unknown, "cursor">, any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>> | undefined) => UseInfiniteQueryResult<{ [TPath_1 in keyof TRouter["_def"]["queries"]]: {
|
|
30
|
+
input: import("@trpc/server").inferProcedureInput<TRouter["_def"]["queries"][TPath_1]>;
|
|
31
|
+
output: import("@trpc/server").ThenArg<ReturnType<TRouter["_def"]["queries"][TPath_1]["call"]>>;
|
|
32
|
+
}; }[TPath_3_1]["output"], import("@trpc/react").TRPCClientErrorLike<TRouter>>;
|
|
33
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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.createRPCClient = void 0;
|
|
15
|
+
var react_1 = require("@trpc/react");
|
|
16
|
+
function createRPCClient() {
|
|
17
|
+
var trpc = (0, react_1.createReactQueryHooks)();
|
|
18
|
+
return __assign({}, trpc);
|
|
19
|
+
}
|
|
20
|
+
exports.createRPCClient = createRPCClient;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defineAPI = void 0;
|
|
4
|
+
// import { ZodSchema, z, AnyZodObject, ZodError } from "zod"
|
|
5
|
+
// import { RESTErrorCodes } from "./error-codes"
|
|
6
|
+
function defineAPI(handler) {
|
|
7
|
+
return handler;
|
|
8
|
+
}
|
|
9
|
+
exports.defineAPI = defineAPI;
|
|
10
|
+
// type RESTAPIRequest<
|
|
11
|
+
// TQuery extends ZodSchema<any> | undefined,
|
|
12
|
+
// TBody extends ZodSchema<any> | undefined
|
|
13
|
+
// > = NextApiRequest & {
|
|
14
|
+
// query: TQuery extends AnyZodObject ? z.infer<TQuery> : NextApiRequest["query"]
|
|
15
|
+
// body: TBody extends AnyZodObject ? z.infer<TBody> : NextApiRequest["body"]
|
|
16
|
+
// }
|
|
17
|
+
// type RESTAPIResponse = NextApiResponse & {
|
|
18
|
+
// error(type: keyof typeof RESTErrorCodes, message: string, data: any): void
|
|
19
|
+
// }
|
|
20
|
+
// type AnyRESTAPIRequest = RESTAPIRequest<any, any>
|
|
21
|
+
// const CacheKeyGenerators = {
|
|
22
|
+
// url: (req: AnyRESTAPIRequest) => req.url,
|
|
23
|
+
// query: (req: AnyRESTAPIRequest) => req.url + "." + JSON.stringify(req.query),
|
|
24
|
+
// }
|
|
25
|
+
// type RESTOptions<TResult, TQuery extends ZodSchema<any> | undefined, TBody extends ZodSchema<any> | undefined> = {
|
|
26
|
+
// method: "get" | "post" | "put" | "delete" | "patch"
|
|
27
|
+
// cacheKey?: keyof typeof CacheKeyGenerators
|
|
28
|
+
// cacheTime?: number
|
|
29
|
+
// querystring?: TQuery
|
|
30
|
+
// handle(req: RESTAPIRequest<TQuery, TBody>, res: RESTAPIResponse): void
|
|
31
|
+
// }
|
|
32
|
+
// function stringifyZodError(err: ZodError) {
|
|
33
|
+
// return err.toString()
|
|
34
|
+
// }
|
|
35
|
+
// export function defineRESTAPI<
|
|
36
|
+
// TResult,
|
|
37
|
+
// TQuery extends ZodSchema<any> | undefined,
|
|
38
|
+
// TBody extends ZodSchema<any> | undefined
|
|
39
|
+
// >(opts: RESTOptions<TResult, TQuery, TBody>) {
|
|
40
|
+
// return (_req: NextApiRequest, _res: NextApiResponse) => {
|
|
41
|
+
// // Standard function for error codes/messages
|
|
42
|
+
// const sendError = (type: keyof typeof RESTErrorCodes, message: string, details?: any) => {
|
|
43
|
+
// _res.status(RESTErrorCodes[type] || 500)
|
|
44
|
+
// _res.json({
|
|
45
|
+
// error: true,
|
|
46
|
+
// message,
|
|
47
|
+
// details,
|
|
48
|
+
// })
|
|
49
|
+
// }
|
|
50
|
+
// // Ensure the correct method
|
|
51
|
+
// if (_req.method?.toLowerCase() !== opts.method) {
|
|
52
|
+
// return sendError("invalidverb", `Invalid verb: ${_req.method}`)
|
|
53
|
+
// }
|
|
54
|
+
// // Validate the querystring
|
|
55
|
+
// try {
|
|
56
|
+
// _req.query = opts.querystring ? (opts.querystring.safeParse(_req.query) as any) : _req.query
|
|
57
|
+
// } catch (err) {
|
|
58
|
+
// if (err instanceof ZodError) {
|
|
59
|
+
// return sendError("querystring", stringifyZodError(err), _req.query)
|
|
60
|
+
// } else {
|
|
61
|
+
// return sendError("querystring", err instanceof Error ? err.message : String(err))
|
|
62
|
+
// }
|
|
63
|
+
// }
|
|
64
|
+
// opts.handle(req, res)
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.defineRPC = void 0;
|
|
23
|
+
var trpc = __importStar(require("@trpc/server"));
|
|
24
|
+
function defineRPC() {
|
|
25
|
+
return trpc.router();
|
|
26
|
+
}
|
|
27
|
+
exports.defineRPC = defineRPC;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// export const RESTErrorCodes = {
|
|
3
|
+
// notfound: 404,
|
|
4
|
+
// badrequest: 400,
|
|
5
|
+
// unauthorized: 401,
|
|
6
|
+
// forbidden: 403,
|
|
7
|
+
// invalidverb: 400,
|
|
8
|
+
// querystring: 400,
|
|
9
|
+
// body: 400,
|
|
10
|
+
// params: 400,
|
|
11
|
+
// internal: 500,
|
|
12
|
+
// }
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.default = {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./define-api"), exports);
|
|
14
|
+
__exportStar(require("./define-rpc-router"), exports);
|
|
15
|
+
__exportStar(require("./create-rpc-client"), exports);
|
|
16
|
+
__exportStar(require("./error-codes"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function RPCProvider(): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First, run the development server:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# or
|
|
10
|
+
yarn dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
14
|
+
|
|
15
|
+
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
|
16
|
+
|
|
17
|
+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
|
|
18
|
+
|
|
19
|
+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
|
20
|
+
|
|
21
|
+
## Learn More
|
|
22
|
+
|
|
23
|
+
To learn more about Next.js, take a look at the following resources:
|
|
24
|
+
|
|
25
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
26
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
27
|
+
|
|
28
|
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
29
|
+
|
|
30
|
+
## Deploy on Vercel
|
|
31
|
+
|
|
32
|
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
33
|
+
|
|
34
|
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import config from "./ed-config"
|
|
2
|
+
|
|
3
|
+
const settings = config.serverless
|
|
4
|
+
|
|
5
|
+
export async function fetchWordpressProps(pathname: string) {
|
|
6
|
+
const origin = (process.env.SITE_URL as string).replace(/\/$/, "")
|
|
7
|
+
pathname = pathname.replace(/(^\/|\/$)/g, "")
|
|
8
|
+
const propsURL = origin + ("/" + pathname + "/?_props=all").replace(/\/+/, "/")
|
|
9
|
+
console.log("Fetching", propsURL)
|
|
10
|
+
let response = await fetch(propsURL)
|
|
11
|
+
let text = await response.text()
|
|
12
|
+
|
|
13
|
+
// Convert absolute site URL details to relative paths
|
|
14
|
+
text = text.replace(new RegExp(origin.replace(/(http|https)/, `https?`) + "([a-z0-9-_./]+)", "g"), (url) => {
|
|
15
|
+
const path = url.replace(/https?:\/\/[a-z0-9\-\_\.]+/, "")
|
|
16
|
+
if (path.startsWith("/wp-content/uploads/")) {
|
|
17
|
+
if (settings?.uploads === "proxy") {
|
|
18
|
+
return path
|
|
19
|
+
} else if (settings?.uploads === "remote") {
|
|
20
|
+
return url
|
|
21
|
+
}
|
|
22
|
+
} else if (path.startsWith("/wp-content/themes/")) {
|
|
23
|
+
if (settings?.uploads === "proxy") {
|
|
24
|
+
return path
|
|
25
|
+
} else if (settings?.uploads === "remote") {
|
|
26
|
+
return url
|
|
27
|
+
}
|
|
28
|
+
} else if (path.startsWith("/wp-content/plugins/")) {
|
|
29
|
+
if (settings?.uploads === "proxy") {
|
|
30
|
+
return path
|
|
31
|
+
} else if (settings?.uploads === "remote") {
|
|
32
|
+
return url
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return url
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return JSON.parse(text)
|
|
39
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const withTM = require("next-transpile-modules")
|
|
2
|
+
const { resolve } = require("path")
|
|
3
|
+
const { DefinePlugin } = require("webpack")
|
|
4
|
+
const settings = require("./ed.config.json")
|
|
5
|
+
const { getRepoName } = require("eddev/utils/getRepoName")
|
|
6
|
+
|
|
7
|
+
module.exports = (() => {
|
|
8
|
+
const cwd = process.cwd()
|
|
9
|
+
const REPO_NAME = getRepoName(cwd.replace(/\/\.serverless/, "")).repoName
|
|
10
|
+
|
|
11
|
+
return withTM(["eddev"])({
|
|
12
|
+
rewrites() {
|
|
13
|
+
return {
|
|
14
|
+
afterFiles: [
|
|
15
|
+
settings.serverless.uploads === "proxy" && {
|
|
16
|
+
source: "/wp-content/uploads/:path*",
|
|
17
|
+
destination: process.env.SITE_URL + "/wp-content/uploads/:path*",
|
|
18
|
+
},
|
|
19
|
+
settings.serverless.plugin === "proxy" && {
|
|
20
|
+
source: "/wp-content/plugins/:path*",
|
|
21
|
+
destination: process.env.SITE_URL + "/wp-content/plugins/:path*",
|
|
22
|
+
},
|
|
23
|
+
settings.serverless.theme === "proxy" && {
|
|
24
|
+
source: "/wp-content/themes/:path*",
|
|
25
|
+
destination: process.env.SITE_URL + "/wp-content/themes/:path*",
|
|
26
|
+
},
|
|
27
|
+
].filter(Boolean),
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
typescript: {
|
|
31
|
+
ignoreBuildErrors: true,
|
|
32
|
+
},
|
|
33
|
+
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
|
|
34
|
+
config.resolve.alias = {
|
|
35
|
+
...config.resolve.alias,
|
|
36
|
+
"@manifest/views": resolve(cwd, "manifest_views.ts"),
|
|
37
|
+
"@manifest/blocks": resolve(cwd, "manifest_blocks.ts"),
|
|
38
|
+
"@theme": resolve(cwd, "theme.css.tsx"),
|
|
39
|
+
"@wordpress/components": resolve(cwd, "null.ts"),
|
|
40
|
+
"@wordpress/element": resolve(cwd, "null.ts"),
|
|
41
|
+
"@wordpress/blocks": resolve(cwd, "null.ts"),
|
|
42
|
+
"@wordpress/utils": resolve(cwd, "null.ts"),
|
|
43
|
+
"@wordpress/data": resolve(cwd, "null.ts"),
|
|
44
|
+
"@wordpress/hooks": resolve(cwd, "null.ts"),
|
|
45
|
+
"@wordpress/block-editor": resolve(cwd, "null.ts"),
|
|
46
|
+
}
|
|
47
|
+
// config.defines["process.dev"] = isDev ? "true" : "false"
|
|
48
|
+
const define = config.plugins.find((plugin) => plugin instanceof DefinePlugin)
|
|
49
|
+
define.definitions["process.serverless"] = "true"
|
|
50
|
+
define.definitions["process.admin"] = "false"
|
|
51
|
+
define.definitions["process.dev"] = process.env.NODE_ENV === "development"
|
|
52
|
+
|
|
53
|
+
const themePath =
|
|
54
|
+
(settings.serverless.theme === "remote" ? process.env.SITE_URL : "") + "/wp-content/themes/" + REPO_NAME
|
|
55
|
+
|
|
56
|
+
define.definitions["process.env.themePath"] = JSON.stringify(themePath)
|
|
57
|
+
define.definitions["process.themePath"] = JSON.stringify(themePath)
|
|
58
|
+
// config.plugins.push(
|
|
59
|
+
// new DefinePlugin({
|
|
60
|
+
// "process.serverless": "true",
|
|
61
|
+
// "process.admin": "false",
|
|
62
|
+
// // "process.env.themePath": JSON.stringify(`/wp-content/themes/${opts.themeName}`),
|
|
63
|
+
// // "process.themePath": JSON.stringify(`/wp-content/themes/${opts.themeName}`),
|
|
64
|
+
// })
|
|
65
|
+
// )
|
|
66
|
+
return config
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
})()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|