对native增加了对page注入path,修改了server中的个别环境参数侦测
This commit is contained in:
parent
44c9616456
commit
a0cc0c8ee1
|
|
@ -21,6 +21,7 @@ const nullthrows = require("nullthrows");
|
||||||
const replaceEnvExpressionPlugin = require('./babelEnvPlugin');
|
const replaceEnvExpressionPlugin = require('./babelEnvPlugin');
|
||||||
|
|
||||||
const { injectGetRender } = require('../utils/injectGetRender');
|
const { injectGetRender } = require('../utils/injectGetRender');
|
||||||
|
const oakPathTsxPlugin = require('../babel-plugin/oakPath');
|
||||||
|
|
||||||
async function renderToCSS({ src, filename, options = {} }) {
|
async function renderToCSS({ src, filename, options = {} }) {
|
||||||
const { lessOptions = {} } = options;
|
const { lessOptions = {} } = options;
|
||||||
|
|
@ -50,7 +51,7 @@ function transform({ filename, options, plugins, src }) {
|
||||||
cwd: options.projectRoot,
|
cwd: options.projectRoot,
|
||||||
highlightCode: true,
|
highlightCode: true,
|
||||||
filename,
|
filename,
|
||||||
plugins: plugins.concat(replaceEnvExpressionPlugin),
|
plugins: plugins.concat([replaceEnvExpressionPlugin, oakPathTsxPlugin]),
|
||||||
sourceType: "module",
|
sourceType: "module",
|
||||||
// NOTE(EvanBacon): We split the parse/transform steps up to accommodate
|
// NOTE(EvanBacon): We split the parse/transform steps up to accommodate
|
||||||
// Hermes parsing, but this defaults to cloning the AST which increases
|
// Hermes parsing, but this defaults to cloning the AST which increases
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ async function startup(path, contextBuilder, connector, omitWatchers, omitTimers
|
||||||
allowedHeaders: ["oak-cxt"],
|
allowedHeaders: ["oak-cxt"],
|
||||||
};
|
};
|
||||||
const io = new socket_io_1.Server(httpServer, socketOption);
|
const io = new socket_io_1.Server(httpServer, socketOption);
|
||||||
if (process.env.PM2_STATUS) {
|
if (process.env.pm_id || process.env.PM_ID) {
|
||||||
// pm2环境下要接入clusterAdapter
|
// pm2环境下要接入clusterAdapter
|
||||||
// https://socket.io/zh-CN/docs/v4/pm2/
|
// https://socket.io/zh-CN/docs/v4/pm2/
|
||||||
io.adapter((0, cluster_adapter_1.createAdapter)());
|
io.adapter((0, cluster_adapter_1.createAdapter)());
|
||||||
|
|
@ -148,5 +148,9 @@ async function startup(path, contextBuilder, connector, omitWatchers, omitTimers
|
||||||
if (!omitTimers) {
|
if (!omitTimers) {
|
||||||
appLoader.startTimers();
|
appLoader.startTimers();
|
||||||
}
|
}
|
||||||
|
process.on('SIGINT', async () => {
|
||||||
|
await appLoader.unmount();
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
exports.startup = startup;
|
exports.startup = startup;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export async function startup<ED extends EntityDict & BaseEntityDict, Cxt extend
|
||||||
allowedHeaders: ["oak-cxt"],
|
allowedHeaders: ["oak-cxt"],
|
||||||
};
|
};
|
||||||
const io = new Server(httpServer, socketOption);
|
const io = new Server(httpServer, socketOption);
|
||||||
if (process.env.PM2_STATUS) {
|
if (process.env.pm_id || process.env.PM_ID) {
|
||||||
// pm2环境下要接入clusterAdapter
|
// pm2环境下要接入clusterAdapter
|
||||||
// https://socket.io/zh-CN/docs/v4/pm2/
|
// https://socket.io/zh-CN/docs/v4/pm2/
|
||||||
io.adapter(createAdapter());
|
io.adapter(createAdapter());
|
||||||
|
|
@ -170,4 +170,9 @@ export async function startup<ED extends EntityDict & BaseEntityDict, Cxt extend
|
||||||
if (!omitTimers) {
|
if (!omitTimers) {
|
||||||
appLoader.startTimers();
|
appLoader.startTimers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.on('SIGINT', async () => {
|
||||||
|
await appLoader.unmount();
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue