mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
[webapp] Remove underscore
This commit is contained in:
@@ -15,6 +15,7 @@ Npm.depends({
|
||||
qs: '6.10.1',
|
||||
useragent: '2.3.0',
|
||||
'@vlasky/whomst': '0.1.7',
|
||||
'lodash.has': '4.5.2'
|
||||
});
|
||||
|
||||
Npm.strip({
|
||||
@@ -32,7 +33,6 @@ Package.onUse(function(api) {
|
||||
api.use(
|
||||
[
|
||||
'logging',
|
||||
'underscore',
|
||||
'routepolicy',
|
||||
'modern-browsers',
|
||||
'boilerplate-generator',
|
||||
@@ -60,7 +60,7 @@ Package.onUse(function(api) {
|
||||
});
|
||||
|
||||
Package.onTest(function(api) {
|
||||
api.use(['tinytest', 'ecmascript', 'webapp', 'http', 'underscore']);
|
||||
api.use(['tinytest', 'ecmascript', 'webapp', 'http']);
|
||||
api.addFiles('webapp_tests.js', 'server');
|
||||
api.addFiles('webapp_client_tests.js', 'client');
|
||||
api.addFiles('socket_file_tests.js', 'server');
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
} from './socket_file.js';
|
||||
import cluster from 'cluster';
|
||||
import whomst from '@vlasky/whomst';
|
||||
import has from 'lodash.has';
|
||||
|
||||
var SHORT_SOCKET_TIMEOUT = 5 * 1000;
|
||||
var LONG_SOCKET_TIMEOUT = 120 * 1000;
|
||||
@@ -194,12 +195,12 @@ WebApp.categorizeRequest = function(req) {
|
||||
var htmlAttributeHooks = [];
|
||||
var getHtmlAttributes = function(request) {
|
||||
var combinedAttributes = {};
|
||||
_.each(htmlAttributeHooks || [], function(hook) {
|
||||
(htmlAttributeHooks || []).forEach(function(hook) {
|
||||
var attributes = hook(request);
|
||||
if (attributes === null) return;
|
||||
if (typeof attributes !== 'object')
|
||||
throw Error('HTML attribute hook must return null or object');
|
||||
_.extend(combinedAttributes, attributes);
|
||||
Object.assign(combinedAttributes, attributes);
|
||||
});
|
||||
return combinedAttributes;
|
||||
};
|
||||
@@ -282,7 +283,7 @@ WebApp._timeoutAdjustmentRequestCallback = function(req, res) {
|
||||
res.on('finish', function() {
|
||||
res.setTimeout(SHORT_SOCKET_TIMEOUT);
|
||||
});
|
||||
_.each(finishListeners, function(l) {
|
||||
finishListeners.forEach(function(l) {
|
||||
res.on('finish', l);
|
||||
});
|
||||
};
|
||||
@@ -435,13 +436,14 @@ function getBoilerplateAsync(request, arch) {
|
||||
});
|
||||
});
|
||||
runtimeConfig.isUpdatedByArch[arch] = false;
|
||||
const { dynamicHead, dynamicBody } = request;
|
||||
const data = Object.assign(
|
||||
{},
|
||||
boilerplate.baseData,
|
||||
{
|
||||
htmlAttributes: getHtmlAttributes(request),
|
||||
},
|
||||
_.pick(request, 'dynamicHead', 'dynamicBody')
|
||||
{ dynamicHead, dynamicBody }
|
||||
);
|
||||
|
||||
let madeChanges = false;
|
||||
@@ -524,9 +526,8 @@ WebAppInternals.generateBoilerplateInstance = function(
|
||||
return pathJoin(archPath[arch], itemPath);
|
||||
},
|
||||
baseDataExtension: {
|
||||
additionalStaticJs: _.map(additionalStaticJs || [], function(
|
||||
contents,
|
||||
pathname
|
||||
additionalStaticJs: (Object.entries(additionalStaticJs) || []).map(function(
|
||||
[pathname, contents]
|
||||
) {
|
||||
return {
|
||||
pathname: pathname,
|
||||
@@ -603,7 +604,7 @@ WebAppInternals.staticFilesMiddleware = async function(
|
||||
};
|
||||
|
||||
if (
|
||||
_.has(additionalStaticJs, pathname) &&
|
||||
has(additionalStaticJs, pathname) &&
|
||||
!WebAppInternals.inlineScriptsAllowed()
|
||||
) {
|
||||
serveStaticJs(additionalStaticJs[pathname]);
|
||||
@@ -1338,7 +1339,7 @@ function runWebAppServer() {
|
||||
});
|
||||
|
||||
// start up app
|
||||
_.extend(WebApp, {
|
||||
Object.assign(WebApp, {
|
||||
connectHandlers: packageAndAppHandlers,
|
||||
rawConnectHandlers: rawConnectHandlers,
|
||||
httpServer: httpServer,
|
||||
|
||||
Reference in New Issue
Block a user