frosty 0.0.81 → 0.0.82

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frosty",
3
- "version": "0.0.81",
3
+ "version": "0.0.82",
4
4
  "main": "dist/index",
5
5
  "module": "dist/index",
6
6
  "types": "dist/index",
@@ -28,14 +28,10 @@ import fs from 'fs';
28
28
  import path from 'path';
29
29
  import { Server } from '@o2ter/server-js';
30
30
  import { ReactRoute } from './route';
31
+ import __SERVER__ from '__SERVER__';
31
32
  import * as __APPLICATIONS__ from '__APPLICATIONS__';
32
33
  import { PORT } from './env';
33
34
 
34
- let __SERVER__ = {};
35
- try {
36
- __SERVER__ = await import('__SERVER__');
37
- } catch {};
38
-
39
35
  const app = 'serverOptions' in __SERVER__ ? new Server(__SERVER__.serverOptions) : new Server;
40
36
 
41
37
  app.use(Server.static(path.join(__dirname, 'public'), { cacheControl: true }));
@@ -44,13 +44,10 @@ export default async (env, argv) => {
44
44
  } = env;
45
45
 
46
46
  const serverConfig = await (async () => {
47
- try {
48
- const { default: resolved } = await import(path.resolve(process.cwd(), CONFIG_FILE));
49
- return resolved;
50
- } catch (e) {
51
- console.log(e);
52
- return {};
53
- }
47
+ const configPath = path.resolve(process.cwd(), CONFIG_FILE);
48
+ if (!fs.existsSync(configPath)) return {};
49
+ const { default: resolved } = await import(configPath);
50
+ return resolved;
54
51
  })();
55
52
 
56
53
  const config = _.isFunction(serverConfig) ? serverConfig(env, argv) : serverConfig;
@@ -201,7 +198,7 @@ export default async (env, argv) => {
201
198
  ...config.options?.plugins ?? [],
202
199
  ];
203
200
 
204
- const server = config.serverEntry ? path.resolve(process.cwd(), config.serverEntry) : path.resolve(__dirname, './src/server/default.js');
201
+ const server = config.serverEntry ? path.resolve(process.cwd(), config.serverEntry) : path.resolve(__dirname, './src/server/default.ts');
205
202
 
206
203
  const random = crypto.randomUUID();
207
204
  const tempDir = fs.mkdtempSync(`${os.tmpdir()}${path.sep}`);