Replace intel with sitespeed.io/log (#4381)
* Replace intel with sitespeed.io/log
This commit is contained in:
parent
6b7aecc401
commit
b9456eef6e
|
|
@ -283,7 +283,7 @@ In the [open](#opencontext-options) function you can add something like this:
|
||||||
~~~javascript
|
~~~javascript
|
||||||
// Register a logger for this plugin, a unique name so we can filter the log
|
// Register a logger for this plugin, a unique name so we can filter the log
|
||||||
// And save the log for later
|
// And save the log for later
|
||||||
this.log = context.intel.getLogger('sitespeedio.plugin.PLUGIN_NAME');
|
this.log = context.getLogger('sitespeedio.plugin.PLUGIN_NAME');
|
||||||
this.log.info('Plugin PLUGIN_NAME started');
|
this.log.info('Plugin PLUGIN_NAME started');
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2040,12 +2040,6 @@ export async function parseCommandLine() {
|
||||||
default: false,
|
default: false,
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
})
|
})
|
||||||
.option('logToFile', {
|
|
||||||
describe:
|
|
||||||
'Store the log for your run into a file in logs/sitespeed.io.log',
|
|
||||||
default: false,
|
|
||||||
type: 'boolean'
|
|
||||||
})
|
|
||||||
.option('useHash', {
|
.option('useHash', {
|
||||||
describe:
|
describe:
|
||||||
'If your site uses # for URLs and # give you unique URLs you need to turn on useHash. By default is it turned off, meaning URLs with hash and without hash are treated as the same URL',
|
'If your site uses # for URLs and # give you unique URLs you need to turn on useHash. By default is it turned off, meaning URLs with hash and without hash are treated as the same URL',
|
||||||
|
|
|
||||||
|
|
@ -1,100 +1,8 @@
|
||||||
import intel from 'intel';
|
import { configureLog } from '@sitespeed.io/log';
|
||||||
import { createWriteStream } from 'node:fs';
|
|
||||||
import { inherits } from 'node:util';
|
|
||||||
const {
|
|
||||||
INFO,
|
|
||||||
DEBUG,
|
|
||||||
VERBOSE,
|
|
||||||
TRACE,
|
|
||||||
NONE,
|
|
||||||
basicConfig,
|
|
||||||
Logger,
|
|
||||||
Handler,
|
|
||||||
Formatter
|
|
||||||
} = intel;
|
|
||||||
|
|
||||||
// FileHandler isn't exposed in Intel when we moved to ESM.
|
export function configure(options = {}) {
|
||||||
// To fix that for now we just use the same code as Intel.
|
configureLog({
|
||||||
|
verbose: options.verbose ?? 0,
|
||||||
function StreamHandler(options) {
|
silent: options.silent ?? false
|
||||||
options = options || {};
|
});
|
||||||
if (!options.stream) {
|
|
||||||
options = { stream: options };
|
|
||||||
}
|
|
||||||
Handler.call(this, options);
|
|
||||||
this._stream = options.stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
inherits(StreamHandler, Handler);
|
|
||||||
|
|
||||||
StreamHandler.prototype.emit = function streamEmit(record) {
|
|
||||||
this._stream.write(this.format(record) + '\n');
|
|
||||||
};
|
|
||||||
|
|
||||||
function FileHandler(options) {
|
|
||||||
if (typeof options === 'string') {
|
|
||||||
options = { file: options };
|
|
||||||
}
|
|
||||||
this._file = options.file;
|
|
||||||
|
|
||||||
options.stream = this._open();
|
|
||||||
StreamHandler.call(this, options);
|
|
||||||
}
|
|
||||||
inherits(FileHandler, StreamHandler);
|
|
||||||
|
|
||||||
FileHandler.prototype._open = function open() {
|
|
||||||
return createWriteStream(this._file, { flags: 'a' });
|
|
||||||
};
|
|
||||||
|
|
||||||
export function configure(options, logDir) {
|
|
||||||
options = options || {};
|
|
||||||
|
|
||||||
let level = INFO;
|
|
||||||
|
|
||||||
switch (options.verbose) {
|
|
||||||
case 1: {
|
|
||||||
level = DEBUG;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2: {
|
|
||||||
level = VERBOSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3: {
|
|
||||||
level = TRACE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.silent) {
|
|
||||||
level = NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (level === INFO) {
|
|
||||||
basicConfig({
|
|
||||||
format: '[%(date)s] %(levelname)s: %(message)s',
|
|
||||||
level: level
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
basicConfig({
|
|
||||||
format: '[%(date)s] %(levelname)s: [%(name)s] %(message)s',
|
|
||||||
level: level
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.logToFile) {
|
|
||||||
let logger = new Logger();
|
|
||||||
logger.addHandler(
|
|
||||||
new FileHandler({
|
|
||||||
file: logDir + '/sitespeed.io.log',
|
|
||||||
formatter: new Formatter({
|
|
||||||
format: '[%(date)s] %(levelname)s: [%(name)s] %(message)s',
|
|
||||||
level: level
|
|
||||||
})
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* eslint no-console:0 */
|
/* eslint no-console:0 */
|
||||||
|
|
||||||
import cq from 'concurrent-queue';
|
import cq from 'concurrent-queue';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
|
|
||||||
import { messageMaker } from '../support/messageMaker.js';
|
import { messageMaker } from '../support/messageMaker.js';
|
||||||
import {
|
import {
|
||||||
|
|
@ -11,7 +11,7 @@ import {
|
||||||
} from './queueStatistics.js';
|
} from './queueStatistics.js';
|
||||||
|
|
||||||
const make = messageMaker('queueHandler').make;
|
const make = messageMaker('queueHandler').make;
|
||||||
const log = intel.getLogger('sitespeedio.queuehandler');
|
const log = getLogger('sitespeedio.queuehandler');
|
||||||
|
|
||||||
function shortenData(key, value) {
|
function shortenData(key, value) {
|
||||||
if (key === 'data') {
|
if (key === 'data') {
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ import { parse } from 'node:url';
|
||||||
import { createHash } from 'node:crypto';
|
import { createHash } from 'node:crypto';
|
||||||
|
|
||||||
import isEmpty from 'lodash.isempty';
|
import isEmpty from 'lodash.isempty';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.file');
|
const log = getLogger('sitespeedio.file');
|
||||||
|
|
||||||
function toSafeKey(key) {
|
function toSafeKey(key) {
|
||||||
// U+2013 : EN DASH – as used on https://en.wikipedia.org/wiki/2019–20_coronavirus_pandemic
|
// U+2013 : EN DASH – as used on https://en.wikipedia.org/wiki/2019–20_coronavirus_pandemic
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ import {
|
||||||
} from 'node:fs';
|
} from 'node:fs';
|
||||||
|
|
||||||
import { cp } from 'node:fs/promises';
|
import { cp } from 'node:fs/promises';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
|
|
||||||
import { pathToFolder } from './pathToFolder.js';
|
import { pathToFolder } from './pathToFolder.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.storageManager');
|
const log = getLogger('sitespeedio.storageManager');
|
||||||
const mkdir = promisify(_mkdir);
|
const mkdir = promisify(_mkdir);
|
||||||
const readdir = promisify(_readdir);
|
const readdir = promisify(_readdir);
|
||||||
const lstat = promisify(_lstat);
|
const lstat = promisify(_lstat);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { readFileSync } from 'node:fs';
|
import { readFileSync } from 'node:fs';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import axe from 'axe-core';
|
import axe from 'axe-core';
|
||||||
const { version: axeVersion } = axe;
|
const { version: axeVersion } = axe;
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.axe');
|
const log = getLogger('sitespeedio.plugin.axe');
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
export default class AxePlugin extends SitespeedioPlugin {
|
export default class AxePlugin extends SitespeedioPlugin {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ import get from 'lodash.get';
|
||||||
import coach from 'coach-core';
|
import coach from 'coach-core';
|
||||||
import { BrowsertimeEngine, browserScripts } from 'browsertime';
|
import { BrowsertimeEngine, browserScripts } from 'browsertime';
|
||||||
const { getDomAdvice } = coach;
|
const { getDomAdvice } = coach;
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('plugin.browsertime');
|
const log = getLogger('plugin.browsertime');
|
||||||
|
|
||||||
const defaultBrowsertimeOptions = {
|
const defaultBrowsertimeOptions = {
|
||||||
statistics: true
|
statistics: true
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ import { readdir as _readdir } from 'node:fs';
|
||||||
import { promisify } from 'node:util';
|
import { promisify } from 'node:util';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
const readdir = promisify(_readdir);
|
const readdir = promisify(_readdir);
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.browsertime');
|
const log = getLogger('sitespeedio.plugin.browsertime');
|
||||||
|
|
||||||
function findFrame(videoFrames, time) {
|
function findFrame(videoFrames, time) {
|
||||||
let frame = videoFrames[0];
|
let frame = videoFrames[0];
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ import { parse } from 'node:url';
|
||||||
|
|
||||||
import { default as _merge } from 'lodash.merge';
|
import { default as _merge } from 'lodash.merge';
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('plugin.browsertime');
|
const log = getLogger('plugin.browsertime');
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import isEmpty from 'lodash.isempty';
|
import isEmpty from 'lodash.isempty';
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
*/
|
*/
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
import { noop, size } from '../../support/helpers/index.js';
|
import { noop, size } from '../../support/helpers/index.js';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.budget');
|
const log = getLogger('sitespeedio.plugin.budget');
|
||||||
|
|
||||||
function getItem(url, type, metric, value, limit, limitType) {
|
function getItem(url, type, metric, value, limit, limitType) {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
import { verify as deprecatedVerify } from './deprecatedVerify.js';
|
import { verify as deprecatedVerify } from './deprecatedVerify.js';
|
||||||
import { verify } from './verify.js';
|
import { verify } from './verify.js';
|
||||||
|
|
@ -6,7 +6,7 @@ import { writeTap } from './tap.js';
|
||||||
import { writeJunit } from './junit.js';
|
import { writeJunit } from './junit.js';
|
||||||
import { writeJson } from './json.js';
|
import { writeJson } from './json.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.budget');
|
const log = getLogger('sitespeedio.plugin.budget');
|
||||||
|
|
||||||
export default class BudgetPlugin extends SitespeedioPlugin {
|
export default class BudgetPlugin extends SitespeedioPlugin {
|
||||||
constructor(options, context, queue) {
|
constructor(options, context, queue) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { writeFileSync } from 'node:fs';
|
import { writeFileSync } from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.budget');
|
const log = getLogger('sitespeedio.plugin.budget');
|
||||||
|
|
||||||
export function writeJson(results, dir) {
|
export function writeJson(results, dir) {
|
||||||
const file = path.join(dir, 'budgetResult.json');
|
const file = path.join(dir, 'budgetResult.json');
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import { parse } from 'node:url';
|
||||||
|
|
||||||
import jrp from 'junit-report-builder';
|
import jrp from 'junit-report-builder';
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.budget');
|
const log = getLogger('sitespeedio.plugin.budget');
|
||||||
|
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ import path from 'node:path';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { EOL } from 'node:os';
|
import { EOL } from 'node:os';
|
||||||
import tap from 'tape';
|
import tap from 'tape';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.budget');
|
const log = getLogger('sitespeedio.plugin.budget');
|
||||||
|
|
||||||
export function writeTap(results, dir) {
|
export function writeTap(results, dir) {
|
||||||
const file = path.join(dir, 'budget.tap');
|
const file = path.join(dir, 'budget.tap');
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
*/
|
*/
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.budget');
|
const log = getLogger('sitespeedio.plugin.budget');
|
||||||
import friendlyNames from '../../support/friendlynames.js';
|
import friendlyNames from '../../support/friendlynames.js';
|
||||||
import { time } from '../../support/helpers/time.js';
|
import { time } from '../../support/helpers/time.js';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
import { CoachAggregator } from './aggregator.js';
|
import { CoachAggregator } from './aggregator.js';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('plugin.coach');
|
const log = getLogger('plugin.coach');
|
||||||
|
|
||||||
const DEFAULT_METRICS_RUN = [];
|
const DEFAULT_METRICS_RUN = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ import path from 'node:path';
|
||||||
|
|
||||||
import { execa } from 'execa';
|
import { execa } from 'execa';
|
||||||
import { Stats } from 'fast-stats';
|
import { Stats } from 'fast-stats';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { decimals } from '../../support/helpers/index.js';
|
import { decimals } from '../../support/helpers/index.js';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.compare');
|
const log = getLogger('sitespeedio.plugin.compare');
|
||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { readFileSync } from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
@ -19,7 +19,7 @@ import { getBaseline, saveBaseline } from './baseline.js';
|
||||||
|
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.compare');
|
const log = getLogger('sitespeedio.plugin.compare');
|
||||||
const defaultConfig = {};
|
const defaultConfig = {};
|
||||||
|
|
||||||
function urlToId(url, options) {
|
function urlToId(url, options) {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.crawler');
|
const log = getLogger('sitespeedio.plugin.crawler');
|
||||||
import Crawler from 'simplecrawler';
|
import Crawler from 'simplecrawler';
|
||||||
import { throwIfMissing } from '../../support/util.js';
|
import { throwIfMissing } from '../../support/util.js';
|
||||||
import { toArray } from '../../support/util.js';
|
import { toArray } from '../../support/util.js';
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
||||||
|
|
@ -11,7 +11,7 @@ import { throwIfMissing } from '../../support/util.js';
|
||||||
import { repackage } from './repackage.js';
|
import { repackage } from './repackage.js';
|
||||||
import { send } from './send.js';
|
import { send } from './send.js';
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
const log = intel.getLogger('plugin.crux');
|
const log = getLogger('plugin.crux');
|
||||||
|
|
||||||
const defaultConfig = {};
|
const defaultConfig = {};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { request as _request } from 'node:https';
|
import { request as _request } from 'node:https';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('plugin.crux');
|
const log = getLogger('plugin.crux');
|
||||||
|
|
||||||
export async function send(url, key, formFactor, shouldWeTestTheURL) {
|
export async function send(url, key, formFactor, shouldWeTestTheURL) {
|
||||||
let data = shouldWeTestTheURL ? { url } : { origin: url };
|
let data = shouldWeTestTheURL ? { url } : { origin: url };
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
import { parse } from 'node:url';
|
import { parse } from 'node:url';
|
||||||
|
|
||||||
import { Stats } from 'fast-stats';
|
import { Stats } from 'fast-stats';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import isEmpty from 'lodash.isempty';
|
import isEmpty from 'lodash.isempty';
|
||||||
import reduce from 'lodash.reduce';
|
import reduce from 'lodash.reduce';
|
||||||
|
|
||||||
import { summarizeStats } from '../../support/statsHelpers.js';
|
import { summarizeStats } from '../../support/statsHelpers.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.domains');
|
const log = getLogger('sitespeedio.plugin.domains');
|
||||||
|
|
||||||
const timingNames = [
|
const timingNames = [
|
||||||
'blocked',
|
'blocked',
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
||||||
// Documentation of @google-cloud/storage: https://cloud.google.com/nodejs/docs/reference/storage/2.3.x/Bucket#upload
|
// Documentation of @google-cloud/storage: https://cloud.google.com/nodejs/docs/reference/storage/2.3.x/Bucket#upload
|
||||||
import { Storage } from '@google-cloud/storage';
|
import { Storage } from '@google-cloud/storage';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { throwIfMissing } from '../../support/util.js';
|
import { throwIfMissing } from '../../support/util.js';
|
||||||
import { recursiveReaddir } from '../../support/fileUtil.js';
|
import { recursiveReaddir } from '../../support/fileUtil.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.gcs');
|
const log = getLogger('sitespeedio.plugin.gcs');
|
||||||
|
|
||||||
async function uploadLatestFiles(dir, gcsOptions, prefix) {
|
async function uploadLatestFiles(dir, gcsOptions, prefix) {
|
||||||
const config = {
|
const config = {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import http from 'node:http';
|
||||||
import https from 'node:https';
|
import https from 'node:https';
|
||||||
import { createRequire } from 'node:module';
|
import { createRequire } from 'node:module';
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
|
|
||||||
import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
|
import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
|
||||||
import {
|
import {
|
||||||
|
|
@ -13,7 +13,7 @@ import { toArray } from '../../support/util.js';
|
||||||
|
|
||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
const version = require('../../../package.json').version;
|
const version = require('../../../package.json').version;
|
||||||
const log = intel.getLogger('sitespeedio.plugin.grafana');
|
const log = getLogger('sitespeedio.plugin.grafana');
|
||||||
|
|
||||||
export function send(
|
export function send(
|
||||||
url,
|
url,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import isEmpty from 'lodash.isempty';
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
||||||
import { send } from './send-annotation.js';
|
import { send } from './send-annotation.js';
|
||||||
|
|
@ -13,7 +13,7 @@ import { toArray } from '../../support/util.js';
|
||||||
import { GraphiteSender } from './graphite-sender.js';
|
import { GraphiteSender } from './graphite-sender.js';
|
||||||
import { StatsDSender } from './statsd-sender.js';
|
import { StatsDSender } from './statsd-sender.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.graphite');
|
const log = getLogger('sitespeedio.plugin.graphite');
|
||||||
|
|
||||||
export default class GraphitePlugin extends SitespeedioPlugin {
|
export default class GraphitePlugin extends SitespeedioPlugin {
|
||||||
constructor(options, context, queue) {
|
constructor(options, context, queue) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import http from 'node:http';
|
import http from 'node:http';
|
||||||
import https from 'node:https';
|
import https from 'node:https';
|
||||||
import { createRequire } from 'node:module';
|
import { createRequire } from 'node:module';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
|
|
||||||
import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
|
import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
|
||||||
import {
|
import {
|
||||||
|
|
@ -13,7 +13,7 @@ import { toArray } from '../../support/util.js';
|
||||||
|
|
||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
const version = require('../../../package.json').version;
|
const version = require('../../../package.json').version;
|
||||||
const log = intel.getLogger('sitespeedio.plugin.graphite');
|
const log = getLogger('sitespeedio.plugin.graphite');
|
||||||
|
|
||||||
export function send(
|
export function send(
|
||||||
url,
|
url,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.graphite');
|
const log = getLogger('sitespeedio.plugin.graphite');
|
||||||
|
|
||||||
export class Sender {
|
export class Sender {
|
||||||
constructor(host, port, bulkSize) {
|
constructor(host, port, bulkSize) {
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,14 @@ import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import getos from 'getos';
|
import getos from 'getos';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { markdown } from 'markdown';
|
import { markdown } from 'markdown';
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
import isEmpty from 'lodash.isempty';
|
import isEmpty from 'lodash.isempty';
|
||||||
|
|
||||||
const getOS = promisify(getos);
|
const getOS = promisify(getos);
|
||||||
const log = intel.getLogger('sitespeedio.plugin.html');
|
const log = getLogger('sitespeedio.plugin.html');
|
||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
const { dependencies, version } = require('../../../package.json');
|
const { dependencies, version } = require('../../../package.json');
|
||||||
import { renderTemplate } from './renderer.js';
|
import { renderTemplate } from './renderer.js';
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ import path from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { compileFile, compile } from 'pug';
|
import { compileFile, compile } from 'pug';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.html');
|
const log = getLogger('sitespeedio.plugin.html');
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
const basePath = path.resolve(__dirname, 'templates');
|
const basePath = path.resolve(__dirname, 'templates');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.html');
|
const log = getLogger('sitespeedio.plugin.html');
|
||||||
import { toArray } from '../../../support/util.js';
|
import { toArray } from '../../../support/util.js';
|
||||||
import friendlyNames from '../../../support/friendlynames.js';
|
import friendlyNames from '../../../support/friendlynames.js';
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import isEmpty from 'lodash.isempty';
|
import isEmpty from 'lodash.isempty';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
@ -10,7 +10,7 @@ import { sendV2 } from './send-annotationV2.js';
|
||||||
import { InfluxDBDataGenerator as DataGenerator } from './data-generator.js';
|
import { InfluxDBDataGenerator as DataGenerator } from './data-generator.js';
|
||||||
import { throwIfMissing } from '../../support/util.js';
|
import { throwIfMissing } from '../../support/util.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.influxdb');
|
const log = getLogger('sitespeedio.plugin.influxdb');
|
||||||
export default class InfluxDBPlugin extends SitespeedioPlugin {
|
export default class InfluxDBPlugin extends SitespeedioPlugin {
|
||||||
constructor(options, context, queue) {
|
constructor(options, context, queue) {
|
||||||
super({ name: 'influxdb', options, context, queue });
|
super({ name: 'influxdb', options, context, queue });
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import http from 'node:http';
|
||||||
import https from 'node:https';
|
import https from 'node:https';
|
||||||
import { stringify } from 'node:querystring';
|
import { stringify } from 'node:querystring';
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
|
import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
|
||||||
|
|
@ -11,7 +11,7 @@ import {
|
||||||
getTagsAsString
|
getTagsAsString
|
||||||
} from '../../support/annotationsHelper.js';
|
} from '../../support/annotationsHelper.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.influxdb');
|
const log = getLogger('sitespeedio.plugin.influxdb');
|
||||||
|
|
||||||
export function sendV1(
|
export function sendV1(
|
||||||
url,
|
url,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import http from 'node:http';
|
import http from 'node:http';
|
||||||
import https from 'node:https';
|
import https from 'node:https';
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
|
import { getConnectivity, getURLAndGroup } from '../../support/tsdbUtil.js';
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
getTagsAsString
|
getTagsAsString
|
||||||
} from '../../support/annotationsHelper.js';
|
} from '../../support/annotationsHelper.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.influxdb');
|
const log = getLogger('sitespeedio.plugin.influxdb');
|
||||||
|
|
||||||
export function sendV2(
|
export function sendV2(
|
||||||
url,
|
url,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import get from 'lodash.get';
|
import get from 'lodash.get';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
||||||
import send from './send.js';
|
import send from './send.js';
|
||||||
import { throwIfMissing } from '../../support/util.js';
|
import { throwIfMissing } from '../../support/util.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.matrix');
|
const log = getLogger('sitespeedio.plugin.matrix');
|
||||||
|
|
||||||
function getBrowserData(data) {
|
function getBrowserData(data) {
|
||||||
return data && data.browser
|
return data && data.browser
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { request as _request } from 'node:https';
|
import { request as _request } from 'node:https';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio.plugin.matrix');
|
const log = getLogger('sitespeedio.plugin.matrix');
|
||||||
|
|
||||||
function send(
|
function send(
|
||||||
host,
|
host,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
/* eslint no-console:0 */
|
/* eslint no-console:0 */
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import isEmpty from 'lodash.isempty';
|
import isEmpty from 'lodash.isempty';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.messagelogger');
|
const log = getLogger('sitespeedio.plugin.messagelogger');
|
||||||
|
|
||||||
function shortenData(key, value) {
|
function shortenData(key, value) {
|
||||||
if (key === 'data' && !isEmpty(value)) {
|
if (key === 'data' && !isEmpty(value)) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { parse } from 'node:url';
|
import { parse } from 'node:url';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import coach from 'coach-core';
|
import coach from 'coach-core';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { short } from '../../support/helpers/index.js';
|
||||||
|
|
||||||
const { getPageXray } = coach;
|
const { getPageXray } = coach;
|
||||||
const pagexray = getPageXray();
|
const pagexray = getPageXray();
|
||||||
const log = intel.getLogger('plugin.pagexray');
|
const log = getLogger('plugin.pagexray');
|
||||||
|
|
||||||
const DEFAULT_PAGEXRAY_PAGESUMMARY_METRICS = [
|
const DEFAULT_PAGEXRAY_PAGESUMMARY_METRICS = [
|
||||||
'contentTypes',
|
'contentTypes',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.remove');
|
const log = getLogger('sitespeedio.plugin.remove');
|
||||||
|
|
||||||
export default class RemovePlugin extends SitespeedioPlugin {
|
export default class RemovePlugin extends SitespeedioPlugin {
|
||||||
constructor(options, context, queue) {
|
constructor(options, context, queue) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import path from 'node:path';
|
||||||
import { promises as fsPromises } from 'node:fs';
|
import { promises as fsPromises } from 'node:fs';
|
||||||
|
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
|
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
|
||||||
|
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
|
|
@ -10,7 +10,7 @@ import { throwIfMissing } from '../../support/util.js';
|
||||||
import { recursiveReaddir } from '../../support/fileUtil.js';
|
import { recursiveReaddir } from '../../support/fileUtil.js';
|
||||||
import { getContentType } from './contentType.js';
|
import { getContentType } from './contentType.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.s3');
|
const log = getLogger('sitespeedio.plugin.s3');
|
||||||
|
|
||||||
async function uploadFile(file, s3Client, s3Options, prefix, baseDir) {
|
async function uploadFile(file, s3Client, s3Options, prefix, baseDir) {
|
||||||
const stream = await fsPromises.readFile(file);
|
const stream = await fsPromises.readFile(file);
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ import fs from 'node:fs';
|
||||||
|
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
import { Client } from 'node-scp';
|
import { Client } from 'node-scp';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { throwIfMissing } from '../../support/util.js';
|
import { throwIfMissing } from '../../support/util.js';
|
||||||
import { recursiveReaddir } from '../../support/fileUtil.js';
|
import { recursiveReaddir } from '../../support/fileUtil.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.scp');
|
const log = getLogger('sitespeedio.plugin.scp');
|
||||||
|
|
||||||
async function getClient(scpOptions) {
|
async function getClient(scpOptions) {
|
||||||
const options = {
|
const options = {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { IncomingWebhook } from '@slack/webhook';
|
import { IncomingWebhook } from '@slack/webhook';
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
import set from 'lodash.set';
|
import set from 'lodash.set';
|
||||||
|
|
@ -9,7 +9,7 @@ import { getAttachements } from './attachements.js';
|
||||||
import { getSummary } from './summary.js';
|
import { getSummary } from './summary.js';
|
||||||
import { throwIfMissing } from '../../support/util.js';
|
import { throwIfMissing } from '../../support/util.js';
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio.plugin.slack');
|
const log = getLogger('sitespeedio.plugin.slack');
|
||||||
|
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
userName: 'Sitespeed.io',
|
userName: 'Sitespeed.io',
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import fs from 'node:fs';
|
||||||
import zlib from 'node:zlib';
|
import zlib from 'node:zlib';
|
||||||
import { promisify } from 'node:util';
|
import { promisify } from 'node:util';
|
||||||
|
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { co2, hosting } from '@tgwf/co2';
|
import { co2, hosting } from '@tgwf/co2';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
import { Aggregator } from './aggregator.js';
|
import { Aggregator } from './aggregator.js';
|
||||||
|
|
@ -27,7 +27,7 @@ const packageJson = JSON.parse(
|
||||||
const co2Version = packageJson.dependencies['@tgwf/co2'];
|
const co2Version = packageJson.dependencies['@tgwf/co2'];
|
||||||
|
|
||||||
const gunzip = promisify(zlib.gunzip);
|
const gunzip = promisify(zlib.gunzip);
|
||||||
const log = intel.getLogger('sitespeedio.plugin.sustainable');
|
const log = getLogger('sitespeedio.plugin.sustainable');
|
||||||
|
|
||||||
const DEFAULT_METRICS_PAGE_SUMMARY = [
|
const DEFAULT_METRICS_PAGE_SUMMARY = [
|
||||||
'co2PerPageView',
|
'co2PerPageView',
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import fs from 'node:fs/promises';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import utc from 'dayjs/plugin/utc.js';
|
import utc from 'dayjs/plugin/utc.js';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import pullAll from 'lodash.pullall';
|
import pullAll from 'lodash.pullall';
|
||||||
import union from 'lodash.union';
|
import union from 'lodash.union';
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ const packageJson = JSON.parse(
|
||||||
await fs.readFile(path.resolve(path.join(__dirname, '..', 'package.json')))
|
await fs.readFile(path.resolve(path.join(__dirname, '..', 'package.json')))
|
||||||
);
|
);
|
||||||
|
|
||||||
const log = intel.getLogger('sitespeedio');
|
const log = getLogger('sitespeedio');
|
||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
|
|
||||||
const budgetResult = {
|
const budgetResult = {
|
||||||
|
|
@ -61,9 +61,6 @@ export async function run(options) {
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
|
|
||||||
// Setup logging
|
|
||||||
const logDir = await storageManager.createDirectory('logs');
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
options.browsertime &&
|
options.browsertime &&
|
||||||
options.browsertime.tcpdump &&
|
options.browsertime.tcpdump &&
|
||||||
|
|
@ -74,7 +71,7 @@ export async function run(options) {
|
||||||
'SSLKEYLOGFILE.txt'
|
'SSLKEYLOGFILE.txt'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
configure(options, logDir);
|
configure(options);
|
||||||
|
|
||||||
// Tell the world what we are using
|
// Tell the world what we are using
|
||||||
log.info(
|
log.info(
|
||||||
|
|
@ -85,9 +82,8 @@ export async function run(options) {
|
||||||
packageJson.dependencies.browsertime,
|
packageJson.dependencies.browsertime,
|
||||||
packageJson.dependencies['coach-core']
|
packageJson.dependencies['coach-core']
|
||||||
);
|
);
|
||||||
if (log.isEnabledFor(log.DEBUG)) {
|
|
||||||
log.debug('Running with options: %:2j', options);
|
log.debug('Running with options: %:2j', options);
|
||||||
}
|
|
||||||
|
|
||||||
let pluginNames = await parsePluginNames(options);
|
let pluginNames = await parsePluginNames(options);
|
||||||
|
|
||||||
|
|
@ -122,12 +118,11 @@ export async function run(options) {
|
||||||
budget: budgetResult,
|
budget: budgetResult,
|
||||||
name: url,
|
name: url,
|
||||||
log,
|
log,
|
||||||
intel,
|
getLogger,
|
||||||
messageMaker,
|
messageMaker,
|
||||||
statsHelpers,
|
statsHelpers,
|
||||||
filterRegistry
|
filterRegistry
|
||||||
};
|
};
|
||||||
|
|
||||||
const queueHandler = new QueueHandler(options);
|
const queueHandler = new QueueHandler(options);
|
||||||
const runningPlugins = await loadPlugins(
|
const runningPlugins = await loadPlugins(
|
||||||
pluginNames,
|
pluginNames,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { parse } from 'node:url';
|
import { parse } from 'node:url';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
const log = intel.getLogger('sitespeedio');
|
const log = getLogger('sitespeedio');
|
||||||
|
|
||||||
function joinNonEmpty(strings, delimeter) {
|
function joinNonEmpty(strings, delimeter) {
|
||||||
return strings.filter(Boolean).join(delimeter);
|
return strings.filter(Boolean).join(delimeter);
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
"@aws-sdk/client-s3": "3.717.0",
|
"@aws-sdk/client-s3": "3.717.0",
|
||||||
"@google-cloud/storage": "7.14.0",
|
"@google-cloud/storage": "7.14.0",
|
||||||
"@influxdata/influxdb-client": "1.33.2",
|
"@influxdata/influxdb-client": "1.33.2",
|
||||||
"@sitespeed.io/plugin": "0.0.6",
|
"@sitespeed.io/log": "0.2.2",
|
||||||
|
"@sitespeed.io/plugin": "1.0.0",
|
||||||
"@slack/webhook": "7.0.4",
|
"@slack/webhook": "7.0.4",
|
||||||
"@tgwf/co2": "0.16.4",
|
"@tgwf/co2": "0.16.4",
|
||||||
"axe-core": "4.10.2",
|
"axe-core": "4.10.2",
|
||||||
|
|
@ -27,7 +28,6 @@
|
||||||
"getos": "3.2.1",
|
"getos": "3.2.1",
|
||||||
"import-global": "1.1.1",
|
"import-global": "1.1.1",
|
||||||
"influx": "5.9.3",
|
"influx": "5.9.3",
|
||||||
"intel": "1.2.0",
|
|
||||||
"jstransformer-markdown-it": "3.0.0",
|
"jstransformer-markdown-it": "3.0.0",
|
||||||
"junit-report-builder": "3.2.1",
|
"junit-report-builder": "3.2.1",
|
||||||
"lodash.clonedeep": "4.5.0",
|
"lodash.clonedeep": "4.5.0",
|
||||||
|
|
@ -2239,10 +2239,20 @@
|
||||||
"node": ">=14.18"
|
"node": ">=14.18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@sitespeed.io/log": {
|
||||||
|
"version": "0.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sitespeed.io/log/-/log-0.2.2.tgz",
|
||||||
|
"integrity": "sha512-Acvu61hHtbGz07b4TXuUVtRvO5YnNNcoreUFdiGlQkK4jE9ADRjCgrsw3ogQWuC0140ymuCVE/CZAOSQ+alA6g==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@sitespeed.io/plugin": {
|
"node_modules/@sitespeed.io/plugin": {
|
||||||
"version": "0.0.6",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sitespeed.io/plugin/-/plugin-0.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/@sitespeed.io/plugin/-/plugin-1.0.0.tgz",
|
||||||
"integrity": "sha512-LlH46uCTpW+M86JYdUzH5hD9yDj5dVMEi83MTBG/PfnxLAkWmOKqp9mh0zr1wfuyvAuOWxjwmqFKvivd1lRKLg=="
|
"integrity": "sha512-IvwXe17ZlF2UK2Asl8KkfhrNnmDS/3aL/mZg1xPhNbLiGhvYu4Uh7bsbz3YkV8cnOxGK7HdR5khbjm/BjZ0wQg==",
|
||||||
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@sitespeed.io/throttle": {
|
"node_modules/@sitespeed.io/throttle": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,12 @@
|
||||||
},
|
},
|
||||||
"exports": "./lib/sitespeed.js",
|
"exports": "./lib/sitespeed.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aws-sdk/client-s3": "3.717.0",
|
||||||
"@google-cloud/storage": "7.14.0",
|
"@google-cloud/storage": "7.14.0",
|
||||||
"@influxdata/influxdb-client": "1.33.2",
|
"@influxdata/influxdb-client": "1.33.2",
|
||||||
|
"@sitespeed.io/log": "0.2.2",
|
||||||
|
"@sitespeed.io/plugin": "1.0.0",
|
||||||
"@tgwf/co2": "0.16.4",
|
"@tgwf/co2": "0.16.4",
|
||||||
"@aws-sdk/client-s3": "3.717.0",
|
|
||||||
"@slack/webhook": "7.0.4",
|
"@slack/webhook": "7.0.4",
|
||||||
"axe-core": "4.10.2",
|
"axe-core": "4.10.2",
|
||||||
"browsertime": "23.5.0",
|
"browsertime": "23.5.0",
|
||||||
|
|
@ -97,7 +99,6 @@
|
||||||
"getos": "3.2.1",
|
"getos": "3.2.1",
|
||||||
"import-global": "1.1.1",
|
"import-global": "1.1.1",
|
||||||
"influx": "5.9.3",
|
"influx": "5.9.3",
|
||||||
"intel": "1.2.0",
|
|
||||||
"jstransformer-markdown-it": "3.0.0",
|
"jstransformer-markdown-it": "3.0.0",
|
||||||
"junit-report-builder": "3.2.1",
|
"junit-report-builder": "3.2.1",
|
||||||
"lodash.clonedeep": "4.5.0",
|
"lodash.clonedeep": "4.5.0",
|
||||||
|
|
@ -116,7 +117,6 @@
|
||||||
"p-limit": "6.1.0",
|
"p-limit": "6.1.0",
|
||||||
"pug": "3.0.3",
|
"pug": "3.0.3",
|
||||||
"simplecrawler": "1.1.9",
|
"simplecrawler": "1.1.9",
|
||||||
"@sitespeed.io/plugin": "0.0.6",
|
|
||||||
"tape": "5.8.1",
|
"tape": "5.8.1",
|
||||||
"yargs": "17.7.2"
|
"yargs": "17.7.2"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import {
|
||||||
pluginDefaults,
|
pluginDefaults,
|
||||||
registerPluginOptions
|
registerPluginOptions
|
||||||
} from '../lib/cli/util.js';
|
} from '../lib/cli/util.js';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
import { SitespeedioPlugin } from '@sitespeed.io/plugin';
|
||||||
import { messageMaker } from '../lib/support/messageMaker.js';
|
import { messageMaker } from '../lib/support/messageMaker.js';
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ test(`registerPluginOptions should not setup options with invalid values`, t =>
|
||||||
super({ name: 'test', options, context, queue });
|
super({ name: 'test', options, context, queue });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const plugin = new TestPlugin({}, { messageMaker, intel });
|
const plugin = new TestPlugin({}, { messageMaker, getLogger });
|
||||||
|
|
||||||
const codeUnderTest = () => registerPluginOptions(mockYargs(), plugin);
|
const codeUnderTest = () => registerPluginOptions(mockYargs(), plugin);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
import { default as GraphitePlugin } from '../lib/plugins/graphite/index.js';
|
import { default as GraphitePlugin } from '../lib/plugins/graphite/index.js';
|
||||||
|
|
||||||
import { GraphiteDataGenerator as DataGenerator } from '../lib/plugins/graphite/data-generator.js';
|
import { GraphiteDataGenerator as DataGenerator } from '../lib/plugins/graphite/data-generator.js';
|
||||||
|
|
@ -92,7 +92,7 @@ test(`Use graphite interface by default`, async t => {
|
||||||
const { messageMaker } = await import('../lib/support/messageMaker.js');
|
const { messageMaker } = await import('../lib/support/messageMaker.js');
|
||||||
const filterRegistry = await import('../lib/support/filterRegistry.js');
|
const filterRegistry = await import('../lib/support/filterRegistry.js');
|
||||||
const statsHelpers = await import('../lib/support/statsHelpers.js');
|
const statsHelpers = await import('../lib/support/statsHelpers.js');
|
||||||
const context = { messageMaker, filterRegistry, intel, statsHelpers };
|
const context = { messageMaker, filterRegistry, getLogger, statsHelpers };
|
||||||
const plugin = new GraphitePlugin(options, context);
|
const plugin = new GraphitePlugin(options, context);
|
||||||
plugin.open(context, options);
|
plugin.open(context, options);
|
||||||
t.is(plugin.sender.facility, 'Graphite');
|
t.is(plugin.sender.facility, 'Graphite');
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import path from 'node:path';
|
||||||
import { readFileSync } from 'node:fs';
|
import { readFileSync } from 'node:fs';
|
||||||
|
|
||||||
import test from 'ava';
|
import test from 'ava';
|
||||||
import intel from 'intel';
|
import { getLogger } from '@sitespeed.io/log';
|
||||||
|
|
||||||
import { resultUrls } from '../lib/core/resultsStorage/resultUrls.js';
|
import { resultUrls } from '../lib/core/resultsStorage/resultUrls.js';
|
||||||
import { messageMaker } from '../lib/support/messageMaker.js';
|
import { messageMaker } from '../lib/support/messageMaker.js';
|
||||||
|
|
@ -23,7 +23,7 @@ const defaultContextFactory = (context = {}) => {
|
||||||
{
|
{
|
||||||
messageMaker,
|
messageMaker,
|
||||||
filterRegistry,
|
filterRegistry,
|
||||||
intel,
|
getLogger,
|
||||||
statsHelpers,
|
statsHelpers,
|
||||||
resultUrls: resultUrls('', {})
|
resultUrls: resultUrls('', {})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue