eddev 0.2.0-beta.40 → 0.2.0-beta.41
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/serverless/create-next-app.js +39 -35
- package/hooks/rpc-client.d.ts +3 -0
- package/hooks/rpc-client.js +15 -0
- package/package.json +1 -1
- package/serverless/create-rpc-client.d.ts +5 -18
- package/serverless/rpc-client.d.ts +3 -0
- package/serverless/rpc-client.js +15 -0
- package/entry/entry.serverless.dev.d.ts +0 -0
- package/entry/entry.serverless.dev.js +0 -2
|
@@ -112,10 +112,14 @@ function createNextApp(opts) {
|
|
|
112
112
|
return [4 /*yield*/, updatePackagesFile(opts.baseDirectory, serverlessDirectory)];
|
|
113
113
|
case 4:
|
|
114
114
|
_b.sent();
|
|
115
|
-
|
|
116
|
-
case 5:
|
|
115
|
+
return [3 /*break*/, 7];
|
|
116
|
+
case 5: return [4 /*yield*/, updatePackagesFile(opts.baseDirectory, (0, path_1.resolve)(__dirname, "../../serverless-template"))];
|
|
117
|
+
case 6:
|
|
118
|
+
_b.sent();
|
|
119
|
+
_b.label = 7;
|
|
120
|
+
case 7:
|
|
117
121
|
assetPaths = ((_a = requireConfig(opts.baseDirectory).serverless) === null || _a === void 0 ? void 0 : _a.themeAssets) || [];
|
|
118
|
-
if (!!isVercel) return [3 /*break*/,
|
|
122
|
+
if (!!isVercel) return [3 /*break*/, 14];
|
|
119
123
|
// Sync important files during development, as they change
|
|
120
124
|
return [4 /*yield*/, syncFiles(opts.baseDirectory, serverlessDirectory, [
|
|
121
125
|
"blocks/**/*",
|
|
@@ -134,50 +138,50 @@ function createNextApp(opts) {
|
|
|
134
138
|
])
|
|
135
139
|
// Also sync APIs into the APIs folder
|
|
136
140
|
];
|
|
137
|
-
case
|
|
141
|
+
case 8:
|
|
138
142
|
// Sync important files during development, as they change
|
|
139
143
|
_b.sent();
|
|
140
144
|
// Also sync APIs into the APIs folder
|
|
141
145
|
return [4 /*yield*/, syncFiles((0, path_1.join)(opts.baseDirectory, "apis"), (0, path_1.join)(serverlessDirectory, "apis"), ["**/*.{tsx,ts,js,jsx}"])];
|
|
142
|
-
case
|
|
146
|
+
case 9:
|
|
143
147
|
// Also sync APIs into the APIs folder
|
|
144
148
|
_b.sent();
|
|
145
149
|
return [4 /*yield*/, syncAPIProxies((0, path_1.join)(opts.baseDirectory, "apis"), (0, path_1.join)(serverlessDirectory, "pages/api"))
|
|
146
150
|
// Sync the public folder
|
|
147
151
|
];
|
|
148
|
-
case
|
|
152
|
+
case 10:
|
|
149
153
|
_b.sent();
|
|
150
|
-
if (!assetPaths.length) return [3 /*break*/,
|
|
154
|
+
if (!assetPaths.length) return [3 /*break*/, 12];
|
|
151
155
|
return [4 /*yield*/, syncFiles(opts.baseDirectory, (0, path_1.join)(serverlessDirectory, "public/wp-content/themes/".concat(repoName.repoName)), assetPaths)];
|
|
152
|
-
case
|
|
156
|
+
case 11:
|
|
153
157
|
_b.sent();
|
|
154
|
-
_b.label =
|
|
155
|
-
case
|
|
158
|
+
_b.label = 12;
|
|
159
|
+
case 12:
|
|
156
160
|
// Sync favicon
|
|
157
161
|
return [4 /*yield*/, syncFiles((0, path_1.join)(opts.baseDirectory), (0, path_1.join)(serverlessDirectory, "public/"), ["favicon.ico"])];
|
|
158
|
-
case
|
|
162
|
+
case 13:
|
|
159
163
|
// Sync favicon
|
|
160
164
|
_b.sent();
|
|
161
|
-
return [3 /*break*/,
|
|
162
|
-
case
|
|
163
|
-
if (!assetPaths.length) return [3 /*break*/,
|
|
165
|
+
return [3 /*break*/, 19];
|
|
166
|
+
case 14:
|
|
167
|
+
if (!assetPaths.length) return [3 /*break*/, 16];
|
|
164
168
|
return [4 /*yield*/, copyFiles(opts.baseDirectory, (0, path_1.join)(serverlessDirectory, "public/wp-content/themes/".concat(repoName.repoName)), assetPaths)];
|
|
165
|
-
case
|
|
169
|
+
case 15:
|
|
166
170
|
_b.sent();
|
|
167
|
-
_b.label =
|
|
168
|
-
case
|
|
171
|
+
_b.label = 16;
|
|
172
|
+
case 16:
|
|
169
173
|
// Sync favicon
|
|
170
174
|
return [4 /*yield*/, copyFiles((0, path_1.join)(opts.baseDirectory), (0, path_1.join)(serverlessDirectory, "public/"), ["favicon.ico"])
|
|
171
175
|
// Write APIs proxy code
|
|
172
176
|
];
|
|
173
|
-
case
|
|
177
|
+
case 17:
|
|
174
178
|
// Sync favicon
|
|
175
179
|
_b.sent();
|
|
176
180
|
// Write APIs proxy code
|
|
177
181
|
return [4 /*yield*/, writeAPIProxies((0, path_1.join)(opts.baseDirectory, "apis"), (0, path_1.join)(serverlessDirectory, "pages/api"))
|
|
178
182
|
// Remove pages/api/trpc directory if no _rpc is found
|
|
179
183
|
];
|
|
180
|
-
case
|
|
184
|
+
case 18:
|
|
181
185
|
// Write APIs proxy code
|
|
182
186
|
_b.sent();
|
|
183
187
|
// Remove pages/api/trpc directory if no _rpc is found
|
|
@@ -189,28 +193,28 @@ function createNextApp(opts) {
|
|
|
189
193
|
!(0, fs_1.existsSync)((0, path_1.join)(opts.baseDirectory, "apis/_rpc.ts"))) {
|
|
190
194
|
// removeSync(join(serverlessDirectory, "pages/api/trpc"))
|
|
191
195
|
}
|
|
192
|
-
_b.label =
|
|
193
|
-
case
|
|
196
|
+
_b.label = 19;
|
|
197
|
+
case 19:
|
|
194
198
|
// Create manifests
|
|
195
199
|
return [4 /*yield*/, initManifests(serverlessDirectory, opts.dev)
|
|
196
200
|
// Update packages
|
|
197
201
|
];
|
|
198
|
-
case
|
|
202
|
+
case 20:
|
|
199
203
|
// Create manifests
|
|
200
204
|
_b.sent();
|
|
201
|
-
if (!!isVercel) return [3 /*break*/,
|
|
205
|
+
if (!!isVercel) return [3 /*break*/, 22];
|
|
202
206
|
sendSignal({ code: "packaging" });
|
|
203
207
|
return [4 /*yield*/, updatePackages(serverlessDirectory)];
|
|
204
|
-
case
|
|
208
|
+
case 21:
|
|
205
209
|
_b.sent();
|
|
206
|
-
_b.label =
|
|
207
|
-
case
|
|
210
|
+
_b.label = 22;
|
|
211
|
+
case 22:
|
|
208
212
|
sendSignal({ code: "compiling" });
|
|
209
|
-
if (!opts.dev) return [3 /*break*/,
|
|
213
|
+
if (!opts.dev) return [3 /*break*/, 25];
|
|
210
214
|
return [4 /*yield*/, getPort(3000)
|
|
211
215
|
// Write the endpoint URL to .env
|
|
212
216
|
];
|
|
213
|
-
case
|
|
217
|
+
case 23:
|
|
214
218
|
port = _b.sent();
|
|
215
219
|
// Write the endpoint URL to .env
|
|
216
220
|
(0, updateEnvFile_1.updateEnvFile)({
|
|
@@ -219,17 +223,17 @@ function createNextApp(opts) {
|
|
|
219
223
|
sendSignal({ code: "url", url: "http://127.0.0.1:".concat(port) });
|
|
220
224
|
// await devNext(serverlessDirectory, port)
|
|
221
225
|
return [4 /*yield*/, runScript(serverlessDirectory, ["dev", "--port", String(port)])];
|
|
222
|
-
case
|
|
226
|
+
case 24:
|
|
223
227
|
// await devNext(serverlessDirectory, port)
|
|
224
228
|
_b.sent();
|
|
225
|
-
return [3 /*break*/,
|
|
226
|
-
case
|
|
227
|
-
if (!opts.build) return [3 /*break*/,
|
|
229
|
+
return [3 /*break*/, 27];
|
|
230
|
+
case 25:
|
|
231
|
+
if (!opts.build) return [3 /*break*/, 27];
|
|
228
232
|
return [4 /*yield*/, runScript(serverlessDirectory, ["build"])];
|
|
229
|
-
case
|
|
233
|
+
case 26:
|
|
230
234
|
_b.sent();
|
|
231
|
-
_b.label =
|
|
232
|
-
case
|
|
235
|
+
_b.label = 27;
|
|
236
|
+
case 27: return [2 /*return*/];
|
|
233
237
|
}
|
|
234
238
|
});
|
|
235
239
|
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const useRPCQuery: <TPath extends string>(pathAndInput: [TPath, (null | undefined)?], opts?: import("@trpc/react").UseTRPCQueryOptions<TPath, RPCRouter, RPCRouter, import("@trpc/react").TRPCClientErrorLike<RPCRouter>> | undefined) => import("react-query").UseQueryResult<RPCRouter, import("@trpc/react").TRPCClientErrorLike<RPCRouter>>;
|
|
2
|
+
export declare const useRPCMutation: <TPath_1 extends string>(path: TPath_1 | [TPath_1], opts?: import("@trpc/react").UseTRPCMutationOptions<RPCRouter, import("@trpc/react").TRPCClientErrorLike<RPCRouter>, RPCRouter> | undefined) => import("react-query").UseMutationResult<RPCRouter, import("@trpc/react").TRPCClientErrorLike<RPCRouter>, RPCRouter, unknown>;
|
|
3
|
+
export declare const rpcClient: import("@trpc/react").TRPCClient<RPCRouter>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rpcClient = exports.useRPCMutation = exports.useRPCQuery = void 0;
|
|
4
|
+
var react_1 = require("@trpc/react");
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
var _a = (0, react_1.createReactQueryHooks)({
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
url: process.serverlessEndpoint + "/api/trpc",
|
|
9
|
+
}), useQuery = _a.useQuery, useMutation = _a.useMutation, createClient = _a.createClient;
|
|
10
|
+
exports.useRPCQuery = useQuery;
|
|
11
|
+
exports.useRPCMutation = useMutation;
|
|
12
|
+
exports.rpcClient = createClient({
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
url: process.serverlessEndpoint + "/api/trpc",
|
|
15
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare function createRPCClient(): {
|
|
3
2
|
Provider: ({ client, queryClient, children, isPrepass, ssrContext, }: {
|
|
4
|
-
queryClient: QueryClient;
|
|
3
|
+
queryClient: import("react-query").QueryClient;
|
|
5
4
|
client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>;
|
|
6
5
|
children: import("react").ReactNode;
|
|
7
6
|
isPrepass?: boolean | undefined;
|
|
@@ -9,25 +8,13 @@ export declare function createRPCClient(): {
|
|
|
9
8
|
}) => JSX.Element;
|
|
10
9
|
createClient: (opts: import("@trpc/react").CreateTRPCClientOptions<import("@trpc/server").AnyRouter<any>>) => import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>;
|
|
11
10
|
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<
|
|
13
|
-
|
|
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>;
|
|
11
|
+
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) => import("react-query").UseQueryResult<any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>>;
|
|
12
|
+
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) => import("react-query").UseMutationResult<any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>, unknown, unknown>;
|
|
23
13
|
useSubscription: <TPath_2 extends string, TOutput extends any>(pathAndInput: [TPath_2, (null | undefined)?], opts: {
|
|
24
14
|
enabled?: boolean | undefined;
|
|
25
15
|
onError?: ((err: import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>) => void) | undefined;
|
|
26
16
|
onNext: (data: TOutput) => void;
|
|
27
17
|
}) => void;
|
|
28
|
-
useDehydratedState: (client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>, trpcState:
|
|
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<
|
|
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>>;
|
|
18
|
+
useDehydratedState: (client: import("@trpc/react").TRPCClient<import("@trpc/server").AnyRouter<any>>, trpcState: import("react-query").DehydratedState | undefined) => import("react-query").DehydratedState | undefined;
|
|
19
|
+
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) => import("react-query").UseInfiniteQueryResult<any, import("@trpc/react").TRPCClientErrorLike<import("@trpc/server").AnyRouter<any>>>;
|
|
33
20
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const useRPCQuery: <TPath extends string>(pathAndInput: [TPath, (null | undefined)?], opts?: import("@trpc/react").UseTRPCQueryOptions<TPath, RPCRouter, RPCRouter, import("@trpc/react").TRPCClientErrorLike<RPCRouter>> | undefined) => import("react-query").UseQueryResult<RPCRouter, import("@trpc/react").TRPCClientErrorLike<RPCRouter>>;
|
|
2
|
+
export declare const useRPCMutation: <TPath_1 extends string>(path: TPath_1 | [TPath_1], opts?: import("@trpc/react").UseTRPCMutationOptions<RPCRouter, import("@trpc/react").TRPCClientErrorLike<RPCRouter>, RPCRouter> | undefined) => import("react-query").UseMutationResult<RPCRouter, import("@trpc/react").TRPCClientErrorLike<RPCRouter>, RPCRouter, unknown>;
|
|
3
|
+
export declare const rpcClient: import("@trpc/react").TRPCClient<RPCRouter>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rpcClient = exports.useRPCMutation = exports.useRPCQuery = void 0;
|
|
4
|
+
var react_1 = require("@trpc/react");
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
var _a = (0, react_1.createReactQueryHooks)({
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
url: process.serverlessEndpoint + "/api/trpc",
|
|
9
|
+
}), useQuery = _a.useQuery, useMutation = _a.useMutation, createClient = _a.createClient;
|
|
10
|
+
exports.useRPCQuery = useQuery;
|
|
11
|
+
exports.useRPCMutation = useMutation;
|
|
12
|
+
exports.rpcClient = createClient({
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
url: process.serverlessEndpoint + "/api/trpc",
|
|
15
|
+
});
|
|
File without changes
|