eddev 0.2.0-beta.33 → 0.2.0-beta.36
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/get-webpack-config.js +2 -2
- package/build/serverless/create-next-app.js +20 -19
- package/build/workers/codegen-worker-script.js +1 -1
- package/dev-ui/theme.d.ts +1 -0
- package/dynamic/dynamic-component.d.ts +1 -0
- package/package.json +1 -1
- package/serverless-template/next.config.js +1 -1
- package/serverless-template/pages/api/trpc/[...trpc].ts +2 -5
- package/style/createStitches.d.ts +1 -0
|
@@ -334,8 +334,8 @@ function getWebpackConfig(opts) {
|
|
|
334
334
|
}
|
|
335
335
|
DEFINES["process.devUI"] = config.devUI === "enabled";
|
|
336
336
|
DEFINES["process.serverlessEndpoint"] = "window.SERVERLESS_ENDPOINT";
|
|
337
|
-
rpcExists = (0, fs_1.existsSync)(path_1.default.join(opts.baseDirectory, "
|
|
338
|
-
(0, fs_1.existsSync)(path_1.default.join(opts.baseDirectory, "
|
|
337
|
+
rpcExists = (0, fs_1.existsSync)(path_1.default.join(opts.baseDirectory, "apis/_rpc.ts")) ||
|
|
338
|
+
(0, fs_1.existsSync)(path_1.default.join(opts.baseDirectory, "apis/_rpc/index.ts"));
|
|
339
339
|
DEFINES["process.rpcEnabled"] = rpcExists ? "true" : "false";
|
|
340
340
|
if (isBrowser) {
|
|
341
341
|
DEFINES["process.env.themePath"] = "window.THEME_PATH || ".concat(DEFINES["process.env.themePath"]);
|
|
@@ -138,11 +138,11 @@ function createNextApp(opts) {
|
|
|
138
138
|
// Sync important files during development, as they change
|
|
139
139
|
_b.sent();
|
|
140
140
|
// Also sync APIs into the APIs folder
|
|
141
|
-
return [4 /*yield*/, syncFiles((0, path_1.join)(opts.baseDirectory, "
|
|
141
|
+
return [4 /*yield*/, syncFiles((0, path_1.join)(opts.baseDirectory, "apis"), (0, path_1.join)(serverlessDirectory, "apis"), ["**/*.{tsx,ts,js,jsx}"])];
|
|
142
142
|
case 7:
|
|
143
143
|
// Also sync APIs into the APIs folder
|
|
144
144
|
_b.sent();
|
|
145
|
-
return [4 /*yield*/, syncAPIProxies((0, path_1.join)(opts.baseDirectory, "
|
|
145
|
+
return [4 /*yield*/, syncAPIProxies((0, path_1.join)(opts.baseDirectory, "apis"), (0, path_1.join)(serverlessDirectory, "pages/api"))
|
|
146
146
|
// Sync the public folder
|
|
147
147
|
];
|
|
148
148
|
case 8:
|
|
@@ -174,7 +174,7 @@ function createNextApp(opts) {
|
|
|
174
174
|
// Sync favicon
|
|
175
175
|
_b.sent();
|
|
176
176
|
// Write APIs proxy code
|
|
177
|
-
return [4 /*yield*/, writeAPIProxies((0, path_1.join)(opts.baseDirectory, "
|
|
177
|
+
return [4 /*yield*/, writeAPIProxies((0, path_1.join)(opts.baseDirectory, "apis"), (0, path_1.join)(serverlessDirectory, "pages/api"))
|
|
178
178
|
// Remove pages/api/trpc directory if no _rpc is found
|
|
179
179
|
];
|
|
180
180
|
case 16:
|
|
@@ -182,30 +182,30 @@ function createNextApp(opts) {
|
|
|
182
182
|
_b.sent();
|
|
183
183
|
// Remove pages/api/trpc directory if no _rpc is found
|
|
184
184
|
console.log({
|
|
185
|
-
index: (0, path_1.join)(opts.baseDirectory, "
|
|
186
|
-
rpc: (0, path_1.join)(opts.baseDirectory, "
|
|
185
|
+
index: (0, path_1.join)(opts.baseDirectory, "apis/_rpc/index.ts"),
|
|
186
|
+
rpc: (0, path_1.join)(opts.baseDirectory, "apis/_rpc.ts"),
|
|
187
187
|
});
|
|
188
|
-
if (!(0, fs_1.existsSync)((0, path_1.join)(opts.baseDirectory, "
|
|
189
|
-
!(0, fs_1.existsSync)((0, path_1.join)(opts.baseDirectory, "
|
|
188
|
+
if (!(0, fs_1.existsSync)((0, path_1.join)(opts.baseDirectory, "apis/_rpc/index.ts")) &&
|
|
189
|
+
!(0, fs_1.existsSync)((0, path_1.join)(opts.baseDirectory, "apis/_rpc.ts"))) {
|
|
190
190
|
// removeSync(join(serverlessDirectory, "pages/api/trpc"))
|
|
191
191
|
}
|
|
192
192
|
_b.label = 17;
|
|
193
|
-
case 17:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
case 17:
|
|
194
|
+
// Create manifests
|
|
195
|
+
return [4 /*yield*/, initManifests(serverlessDirectory, opts.dev)
|
|
196
|
+
// Update packages
|
|
197
|
+
];
|
|
197
198
|
case 18:
|
|
199
|
+
// Create manifests
|
|
198
200
|
_b.sent();
|
|
199
|
-
|
|
201
|
+
if (!!isVercel) return [3 /*break*/, 20];
|
|
202
|
+
sendSignal({ code: "packaging" });
|
|
203
|
+
return [4 /*yield*/, updatePackages(serverlessDirectory)];
|
|
200
204
|
case 19:
|
|
201
|
-
sendSignal({ code: "compiling" });
|
|
202
|
-
// Create manifests
|
|
203
|
-
return [4 /*yield*/, initManifests(serverlessDirectory, opts.dev)
|
|
204
|
-
// Start
|
|
205
|
-
];
|
|
206
|
-
case 20:
|
|
207
|
-
// Create manifests
|
|
208
205
|
_b.sent();
|
|
206
|
+
_b.label = 20;
|
|
207
|
+
case 20:
|
|
208
|
+
sendSignal({ code: "compiling" });
|
|
209
209
|
if (!opts.dev) return [3 /*break*/, 23];
|
|
210
210
|
return [4 /*yield*/, getPort(3000)
|
|
211
211
|
// Write the endpoint URL to .env
|
|
@@ -326,6 +326,7 @@ function writeAPIProxies(sourceFolder, targetFolder) {
|
|
|
326
326
|
var outputPath = (0, path_1.join)(targetFolder, name);
|
|
327
327
|
if (name.includes("_rpc"))
|
|
328
328
|
return;
|
|
329
|
+
(0, fs_extra_1.ensureFileSync)((0, path_1.join)(outputPath));
|
|
329
330
|
return (0, fs_extra_1.writeFile)(outputPath, "import handler from \"".concat(file, "\"; export default handler;"));
|
|
330
331
|
}))];
|
|
331
332
|
case 2:
|
|
@@ -163,7 +163,7 @@ function beginWork(opts) {
|
|
|
163
163
|
});
|
|
164
164
|
}); };
|
|
165
165
|
// Create RPC/API types
|
|
166
|
-
(0, promises_1.writeFile)(Path.join(opts.baseDirectory, "types.api.ts"), "\n import type { router, createContext } from \"./
|
|
166
|
+
(0, promises_1.writeFile)(Path.join(opts.baseDirectory, "types.api.ts"), "\n import type { router, createContext } from \"./apis/_rpc\"\n import { createReactQueryHooks } from \"@trpc/react\"\n export {}\n \n const createQueryHooks = () => createReactQueryHooks<typeof router>()\n \n declare global {\n type RPCUse = ReturnType<typeof createQueryHooks>\n type RPCRouter = typeof router\n type RPCContextType = Awaited<ReturnType<typeof createContext>>\n type RPCClient = ReturnType<RPCUse[\"createClient\"]>\n type RPCUseQuery = RPCUse[\"useQuery\"]\n type RPCUseMutation = RPCUse[\"useMutation\"]\n type RPCUseInfiniteQuery = RPCUse[\"useInfiniteQuery\"]\n } \n ");
|
|
167
167
|
regenerate = debounce(100, function () { return __awaiter(_this, void 0, void 0, function () {
|
|
168
168
|
var startTime, hasChanged, err_1, documentSets, parseErrors, _loop_1, _a, _b, _i, key, generates, errors, _c, _d, _e, file, base, config, output, err_2;
|
|
169
169
|
var _this = this;
|
package/dev-ui/theme.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const styled: <Type extends import("react").ComponentType<any> | keyof JSX.IntrinsicElements | import("@stitches/react/types/util").Function, Composers extends (string | import("react").ComponentType<any> | import("@stitches/react/types/util").Function | {
|
|
2
3
|
[name: string]: unknown;
|
|
3
4
|
})[], CSS = import("@stitches/react/types/css-util").CSS<{}, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const dynamic: {
|
|
2
3
|
<Props, Module = import("@loadable/component").DefaultComponent<Props>>(loadFn: (props: Props) => Promise<Module>, options: import("@loadable/component").OptionsWithResolver<Props, Module>): import("@loadable/component").LoadableComponent<Props>;
|
|
3
4
|
<Props_1>(loadFn: (props: Props_1) => Promise<import("@loadable/component").DefaultComponent<Props_1>>, options?: import("@loadable/component").OptionsWithoutResolver<Props_1> | undefined): import("@loadable/component").LoadableComponent<Props_1>;
|
package/package.json
CHANGED
|
@@ -61,7 +61,7 @@ module.exports = (() => {
|
|
|
61
61
|
define.definitions["process.serverlessEndpoint"] = JSON.stringify("/")
|
|
62
62
|
|
|
63
63
|
const rpcExists =
|
|
64
|
-
existsSync(join(process.cwd(), "
|
|
64
|
+
existsSync(join(process.cwd(), "apis/_rpc.ts")) || existsSync(join(process.cwd(), "apis/_rpc/index.ts"))
|
|
65
65
|
define.definitions["process.rpcEnabled"] = rpcExists ? "true" : "false"
|
|
66
66
|
// config.plugins.push(
|
|
67
67
|
// new DefinePlugin({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
-
import { router, createContext } from "../../../
|
|
2
|
+
import { router, createContext } from "../../../apis/_rpc"
|
|
3
3
|
import * as trpcNext from "@trpc/server/adapters/next"
|
|
4
4
|
import type { NextApiRequest, NextApiResponse } from "next"
|
|
5
5
|
|
|
@@ -22,8 +22,5 @@ export default function (req: NextApiRequest, res: NextApiResponse) {
|
|
|
22
22
|
return
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
res.json("Test")
|
|
27
|
-
return
|
|
28
|
-
// return handler(req, res)
|
|
25
|
+
return handler(req, res)
|
|
29
26
|
}
|