Repository URL to install this package:
|
Version:
2.0.0-beta.20 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var di_1 = require("@skava/di");
var scoped = Object.seal({
OmniStore: undefined,
client: undefined,
App: undefined,
});
// default it to this for now
if (process.env.MOCK_CLIENT_DEPS_ON_SERVER || true) {
console.log('[react-server] mocking client');
scoped.App = function () { return 'no ssr'; };
scoped.client = {
extract: function () {
return {
// extracted
};
},
};
scoped.OmniStore = {
create: function () {
return {
// created
};
},
};
}
/**
* @see https://www.apollographql.com/docs/react/features/server-side-rendering.html#server-initialization
*/
function requireClient() {
if (process.env.REQUIRE_CLIENT_UNCACHED) {
throw new Error('requiring uncached client unsupported. please do not use REQUIRE_CLIENT_UNCACHED');
}
else {
console.log('[react-server] getting dependencies from @skava/di');
if (di_1.config.has('OmniStore') === true) {
scoped.OmniStore = di_1.config.get('OmniStore');
}
if (di_1.config.has('client') === true) {
scoped.client = di_1.config.get('client');
}
if (di_1.config.has('App') === true) {
scoped.App = di_1.config.get('App');
}
}
return scoped;
}
exports.requireClient = requireClient;
//# sourceMappingURL=requireClient.js.map