frosty 0.0.80 → 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
|
@@ -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,11 +44,10 @@ export default async (env, argv) => {
|
|
|
44
44
|
} = env;
|
|
45
45
|
|
|
46
46
|
const serverConfig = await (async () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
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;
|
|
52
51
|
})();
|
|
53
52
|
|
|
54
53
|
const config = _.isFunction(serverConfig) ? serverConfig(env, argv) : serverConfig;
|
|
@@ -199,7 +198,7 @@ export default async (env, argv) => {
|
|
|
199
198
|
...config.options?.plugins ?? [],
|
|
200
199
|
];
|
|
201
200
|
|
|
202
|
-
const server = config.serverEntry ? path.resolve(process.cwd(), config.serverEntry) : path.resolve(__dirname, './src/server/default.
|
|
201
|
+
const server = config.serverEntry ? path.resolve(process.cwd(), config.serverEntry) : path.resolve(__dirname, './src/server/default.ts');
|
|
203
202
|
|
|
204
203
|
const random = crypto.randomUUID();
|
|
205
204
|
const tempDir = fs.mkdtempSync(`${os.tmpdir()}${path.sep}`);
|