oc-server 1.1.0 → 1.1.1
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/dist/cli.js +5 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ const cssModulesPlugin_1 = __importDefault(require("oc-vite-compiler/dist/lib/cs
|
|
|
16
16
|
const get_mocked_plugins_js_1 = __importDefault(require("oc/dist/cli/domain/get-mocked-plugins.js"));
|
|
17
17
|
const node_util_1 = require("node:util");
|
|
18
18
|
const promisify = (fn) => (...args) => new Promise((resolve, reject) => fn(...args, (err, data) => (err ? reject(err) : resolve(data))));
|
|
19
|
-
const plugins = (0, get_mocked_plugins_js_1.default)({ err: () => { }, log: () => { }, ok: () => { }, warn: () => { } }, process.cwd());
|
|
19
|
+
const plugins = (0, get_mocked_plugins_js_1.default)({ err: () => { }, log: () => { }, ok: () => { }, warn: () => { } }, node_path_1.default.join(process.cwd(), '..'));
|
|
20
20
|
const pkg = require(node_path_1.default.join(process.cwd(), 'package.json'));
|
|
21
21
|
const serverEntry = pkg.oc?.files?.data;
|
|
22
22
|
let appEntry = pkg.oc?.files?.template?.src || '';
|
|
@@ -65,7 +65,7 @@ function getContext(req, params, action) {
|
|
|
65
65
|
easeUrl: '/',
|
|
66
66
|
env: { name: 'local' },
|
|
67
67
|
params,
|
|
68
|
-
plugins,
|
|
68
|
+
plugins: Object.fromEntries(plugins.map((plugin) => [plugin.name, plugin.register.execute])),
|
|
69
69
|
renderComponent: () => {
|
|
70
70
|
throw new Error('renderComponent is not implemented in the server context');
|
|
71
71
|
},
|
|
@@ -130,6 +130,9 @@ async function createServer({ template, port, }) {
|
|
|
130
130
|
const { dev: clientJs } = oc_client_browser_1.default.compileSync();
|
|
131
131
|
const app = (0, express_1.default)();
|
|
132
132
|
const dataProvider = getDataProvider();
|
|
133
|
+
for (const plugin of plugins) {
|
|
134
|
+
plugin.register.register(null, null, () => { });
|
|
135
|
+
}
|
|
133
136
|
app.use(express_1.default.json());
|
|
134
137
|
const vite = await (0, vite_1.createServer)({
|
|
135
138
|
server: { middlewareMode: true },
|