Skip to content

Commit

Permalink
remove all old exports
Browse files Browse the repository at this point in the history
  • Loading branch information
nleush committed Oct 14, 2021
1 parent 0ee79cf commit e5a824d
Show file tree
Hide file tree
Showing 20 changed files with 64 additions and 109 deletions.
8 changes: 2 additions & 6 deletions ansible-docker-iframely/templates/config.local.js.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(function() {
var config = {
export default {

// Specify a path for custom plugins. Custom plugins will override core plugins.
// CUSTOM_PLUGINS_PATH: __dirname + '/yourcustom-plugin-folder',
Expand Down Expand Up @@ -259,7 +258,4 @@
}
}
*/
};

module.exports = config;
})();
};
7 changes: 2 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ if (!CONFIG.baseAppUrl) {
console.warn('Warning: CONFIG.baseAppUrl not set, default value used');
}

import * as path from 'path';
import * as express from 'express';
import * as jsonxml from 'jsontoxml';

var NotFound = sysUtils.NotFound;

var app = express();
export const app = express();

app.set('view engine', 'ejs');

Expand Down Expand Up @@ -174,6 +173,4 @@ app.get('/', function(req, res) {
});

process.title = "iframely";
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

module.exports = app;
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const json = JSON.parse(await readFile(new URL('./package.json', import.meta.url)));
var version = json.version;

var config = {
const config = {

baseAppUrl: "",
port: 8061,
Expand Down Expand Up @@ -430,4 +430,4 @@
config.HTTP2_RETRY_CODES[item] = 1;
});

export default config;
export default config;
8 changes: 2 additions & 6 deletions config.local.js.SAMPLE
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(function() {
var config = {
export default {

// Specify a path for custom plugins. Custom plugins will override core plugins.
// CUSTOM_PLUGINS_PATH: __dirname + '/yourcustom-plugin-folder',
Expand Down Expand Up @@ -325,7 +324,4 @@
// Endpoint for prerender service, if you need it. Used to parse React apps. Very slow.
// Tested with https://github.com/prerender/prerender
// PRERENDER_URL: "https://domain/render?url="
};

module.exports = config;
})();
};
10 changes: 2 additions & 8 deletions config.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
(function() {

var config = {

export default {
DEBUG: true,
RICH_LOG_ENABLED: true,

Expand All @@ -11,7 +8,4 @@
RESPONSE_TIMEOUT: 1 * 100, //ms

IGNORE_DOMAINS_RE: /blacklisted.*/
};

module.exports = config;
})();
};
9 changes: 2 additions & 7 deletions config.test_with_custom_plugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
(function() {

var config = {
export default {

CUSTOM_PLUGINS_PATH: __dirname + '/test/fixtures/custom-plugins',

Expand All @@ -14,7 +12,4 @@
RESPONSE_TIMEOUT: 1 * 100, //ms

IGNORE_DOMAINS_RE: /blacklisted.*/
};

module.exports = config;
})();
};
20 changes: 10 additions & 10 deletions lib/cache-engines/memcached.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(function(engine) {
import * as sysUtils from '../../logging.js';
import * as crypto from 'crypto';
import * as Memcached from 'memcached';

import * as sysUtils from '../../logging.js';
import * as crypto from 'crypto';
import * as Memcached from 'memcached';
import * as _ from 'underscore';

var memcached = new Memcached(CONFIG.MEMCACHED_OPTIONS && CONFIG.MEMCACHED_OPTIONS.locations, CONFIG.MEMCACHED_OPTIONS && CONFIG.MEMCACHED_OPTIONS.options);

var timeout = CONFIG.MEMCACHED_OPTIONS && CONFIG.MEMCACHED_OPTIONS.options && CONFIG.MEMCACHED_OPTIONS.options.timeout;
Expand All @@ -13,7 +15,7 @@ import * as Memcached from 'memcached';
}

function _findKeyMeta(k) {
import * as _ from 'underscore';


var sk = safeKey(k);

Expand Down Expand Up @@ -51,7 +53,7 @@ import * as _ from 'underscore';
});
}

engine.set = function(_key, data, options) {
export function set(_key, data, options) {

var key = (!options || !options.raw) ? safeKey(_key) : _key;

Expand All @@ -75,7 +77,7 @@ import * as _ from 'underscore';
}
};

engine.get = function(_key, cb) {
export function get(_key, cb) {

var key = safeKey(_key);

Expand Down Expand Up @@ -127,8 +129,6 @@ import * as _ from 'underscore';
});
};

engine.getClient = function() {
export function getClient() {
return memcached;
};

})(exports);
10 changes: 3 additions & 7 deletions lib/cache-engines/no-cache.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
(function(engine) {

engine.set = function(key, data) {
export function set(key, data) {

};

engine.get = function(key, cb) {
export function get(key, cb) {
cb(null, null);
};

})(exports);
};
20 changes: 8 additions & 12 deletions lib/cache-engines/redis.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
(function(engine) {
import * as sysUtils from '../../logging.js';
import * as sysUtils from '../../logging.js';

var client;

if (CONFIG.REDIS_MODE === 'cluster') {
import * as RedisClustr from 'redis-clustr';

client = new RedisClustr(CONFIG.REDIS_CLUSTER_OPTIONS);
var pkg = await import('redis-clustr');
client = new pkg.RedisClustr(CONFIG.REDIS_CLUSTER_OPTIONS);
} else {
import * as redis from 'redis';
client = redis.createClient(CONFIG.REDIS_OPTIONS);
var pkg = await import('redis');
client = pkg.redis.createClient(CONFIG.REDIS_OPTIONS);
}

engine.set = function(key, data, options) {
export function set(key, data, options) {
var multi = client.multi();
multi.set(key, JSON.stringify(data));
multi.expire(key, options && options.ttl || CONFIG.CACHE_TTL);
Expand All @@ -24,7 +22,7 @@ import * as redis from 'redis';
});
};

engine.get = function(key, cb) {
export function get(key, cb) {

client.get(key, function(error, data) {

Expand All @@ -45,6 +43,4 @@ import * as redis from 'redis';

cb(null, parsedData);
});
};

})(exports);
};
4 changes: 0 additions & 4 deletions lib/loader/pluginLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@
return;
}

if (!plugin) {
console.error("Error loading plugin", pluginPath);
}

if (notPlugin || plugin.notPlugin) {
// Skip utils modules.
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* */

function CollectingHandlerForMutliTarget(cbsArray){
export function CollectingHandlerForMutliTarget(cbsArray){
this._cbsArray = cbsArray || [];
this.events = [];
}
Expand Down Expand Up @@ -143,6 +143,4 @@ CollectingHandlerForMutliTarget.prototype._emitEventsFor = function(cbs) {
}
};

module.exports = CollectingHandlerForMutliTarget;

module.exports.notPlugin = true;
export const notPlugin = true;
8 changes: 3 additions & 5 deletions lib/plugins/system/meta/HTMLMetaHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { decodeHTML5 } from 'entities';
import * as _ from 'underscore';
import * as url from 'url';
import * as utils from '../../../utils.js';
import * as ldParser from './ld-json.js';
import { ldParser } from './ld-json.js';

var getCharset = utils.getCharset;
var encodeText = utils.encodeText;
Expand All @@ -23,7 +23,7 @@ var LINK_REL_ARRAY_VALUES = [
'alternative'
];

function HTMLMetaHandler(uri, contentType, callback) {
export function HTMLMetaHandler(uri, contentType, callback) {
this._uri = uri;
this._charset = getCharset(contentType);
this._callback = callback;
Expand Down Expand Up @@ -582,6 +582,4 @@ function merge(parentObj, props, value) {
}
}

module.exports = HTMLMetaHandler;

module.exports.notPlugin = true;
export const notPlugin = true;
4 changes: 2 additions & 2 deletions lib/plugins/system/meta/ld-json.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as sysUtils from '../../../../logging.js';
import * as utils from '../../../utils.js';

module.exports = function(result, decode, uri) {
export function ldParser(result, decode, uri) {

var ld = result["ld-json"];
delete result["ld-json"];
Expand Down Expand Up @@ -51,4 +51,4 @@ module.exports = function(result, decode, uri) {
}
};

module.exports.notPlugin = true;
export const notPlugin = true;
4 changes: 2 additions & 2 deletions lib/plugins/system/meta/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exports.getMetaCacheKey = function(url, whitelistRecord, options) {
export function getMetaCacheKey(url, whitelistRecord, options) {

var meta_key = 'meta:' + url;

Expand All @@ -15,4 +15,4 @@ exports.getMetaCacheKey = function(url, whitelistRecord, options) {
return meta_key;
};

module.exports.notPlugin = true;
export const notPlugin = true;
6 changes: 3 additions & 3 deletions lib/plugins/system/oembed/oembedUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var getCharset = utils.getCharset;
var encodeText = utils.encodeText;
var lowerCaseKeys = utils.lowerCaseKeys;

exports.notPlugin = true;
export const notPlugin = true;

/**
* @private
Expand Down Expand Up @@ -84,7 +84,7 @@ function lookupStaticProviders(uri) {
return links;
}

module.exports.findOembedLinks = function(uri, meta) {
export function findOembedLinks(uri, meta) {
// Filter oembed from meta.

// allow misspelled discovery links
Expand Down Expand Up @@ -126,7 +126,7 @@ module.exports.findOembedLinks = function(uri, meta) {
* @param {String} uri Full oEmbed endpoint plus URL and any needed format parameter.
* @param {Function} callback Completion callback function. The callback gets two arguments (error, oembed) where oembed is json parsed oEmbed object.
* */
module.exports.getOembed = function(uri, options, callback) {
export function getOembed(uri, options, callback) {

if (typeof options === 'function') {
callback = options;
Expand Down
11 changes: 4 additions & 7 deletions modules/tests-ui/models.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
if (!CONFIG.tests) {
return;
}
import * as moment from 'moment';

var mongoose, db;
Expand Down Expand Up @@ -166,7 +163,7 @@
return moment(this.created_at).format("DD-MM-YY HH:mm");
};

exports.PluginTest = db.model('PluginTest', PluginTestSchema);
exports.PageTestLog = db.model('PageTestLog', PageTestLogSchema);
exports.TestUrlsSet = db.model('TestUrlsSet', TestUrlsSetSchema);
exports.TestingProgress = db.model('TestingProgress', TestingProgressSchema);
export const PluginTest = db.model('PluginTest', PluginTestSchema);
export const PageTestLog = db.model('PageTestLog', PageTestLogSchema);
export const TestUrlsSet = db.model('TestUrlsSet', TestUrlsSetSchema);
export const TestingProgress = db.model('TestingProgress', TestingProgressSchema);
Loading

0 comments on commit e5a824d

Please sign in to comment.