Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
serverConf.paths.bundler = serverConf.paths.lazoBundle;
}
if (fs.existsSync(customAssetPath)) {
serverConf.paths.assets = path.resolve(path.normalize(LAZO.FILE_REPO_DIR + '/app/assets'));
}
if (fs.existsSync(customServerSetup)) {
serverConf.paths.appServerSetup = path.resolve(path.normalize(LAZO.FILE_REPO_DIR + '/app/server/server'));
}
if (fs.existsSync(customPageTemplate)) {
serverConf.paths.pageTemplate = path.resolve(path.normalize(LAZO.FILE_REPO_DIR + '/app/views/page.hbs'));
}
return serverConf;
}
LAZO.require = requirejs.config(addPaths(serverConf));
LAZO.contexts = {
request: JSON.parse(JSON.stringify(clientConf)), // request combo handling
lib: JSON.parse(JSON.stringify(clientConf)), // lib combo handling
server: JSON.parse(JSON.stringify(serverConf)), // paths are used for generating combo handled file
app: {
shim: conf.shim,
paths: conf.paths
}
};
// these are needed by dependencies of lazoApp
LAZO.isServer = true;
LAZO.isClient = false;
// these cannot be loaded until the requirejs app config has been set
LAZO.require(['config'], function (config) {
LAZO.config = config;
// switch some of the libraries to mocked versions so that we can require
// the App component outside of a browser
config.paths = _.assign(config.paths, {
cp: "../../build/mock/cp",
// the mock tracker needs to create a window global and then require
// the original tracker module
"original-tracker": "background/tracker",
"background/tracker": "../../build/mock/tracker"
});
// we're running in the top level directory, so add src to get to the
// normal baseUrl that the app uses
config.baseUrl = "src" + config.baseUrl;
requirejs.config(config);
// requirejs seems to run asynchronously and the paths get all weird running
// this from grunt, so we have to run it as a plain node script and do the
// writing of the rendered HTML inside the required module
requirejs([
"jsx!popup/app"
], function(
App
) {
const newReactMarkup = ReactDOMServer.renderToString(React.createElement(App, {
initialQuery: "",
initialShortcuts: [],
platform: "win",
tracker: {
set: function() {}
},
// Add requirejs build settings.
config.inlineText = config.inlineText || true;
config.isBuild = true;
config.nodeRequire = require;
config.config = config.config || {};
config.config["requirejs-dplugins/has"] = config.config["requirejs-dplugins/has"] || {};
config.config["requirejs-dplugins/has"].builder = true;
// Set up global config
requirejs.config(config);
// Set up context config
config.context = context;
var req = requirejs.config(config);
// Take a path relative to the Gruntfile and return the node equivalent.
req.getNodePath = requirejs.getNodePath;
return req;
};
(function() {
'use strict';
// Exports
module.exports = require('requirejs').config({baseUrl: __dirname, nodeRequire: require})('./RCSDK')({
CryptoJS: require('crypto-js'),
localStorage: require('dom-storage'),
Promise: require('es6-promise').Promise,
PUBNUB: require('pubnub'),
XHR: require('xhr2')
});
})();
var requirejs = require('requirejs');
var metadata = require('./metadata')();
var pkg = require('../package.json');
requirejs.define('metadata', [], function() {return metadata;});
requirejs.define('package', function() {return pkg;});
baseRequireConfig.baseUrl = __dirname + '/../src';
baseRequireConfig.paths = {
lodash: __dirname + '/../node_modules/lodash/lodash',
test: __dirname + '/../feature-detects',
lib: __dirname
};
}
requirejs.config(baseRequireConfig);
if (inBrowser) {
define('build', ['generate', 'lib/generate-banner', 'package'], build);
} else {
var generateBanner = requirejs(__dirname + '/generate-banner.js');
var generate = requirejs('generate');
var pkg = requirejs('package');
var _build = build;
module.exports = function build() {
return _build(generate, generateBanner, pkg).apply(undefined, arguments);
};
}
var requirejs = require('requirejs');
var metadata = require('./metadata')();
var pkg = require('../package.json');
requirejs.define('metadata', [], function() {return metadata;});
requirejs.define('package', function() {return pkg;});
baseRequireConfig.baseUrl = __dirname + '/../src';
baseRequireConfig.paths = {
lodash: __dirname + '/../node_modules/lodash/lodash',
test: __dirname + '/../feature-detects',
lib: __dirname
};
}
requirejs.config(baseRequireConfig);
if (inBrowser) {
define('build', ['generate', 'lib/generate-banner', 'package'], build);
} else {
var generateBanner = requirejs(__dirname + '/generate-banner.js');
var generate = requirejs('generate');
var pkg = requirejs('package');
var _build = build;
module.exports = function build() {
return _build(generate, generateBanner, pkg).apply(undefined, arguments);
};
}