Skip to content

Commit

Permalink
Fixed re-exports in ckeditor5-dev-web-crawler.
Browse files Browse the repository at this point in the history
  • Loading branch information
pomek committed Sep 20, 2024
1 parent 09868f4 commit 57ae04c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 37 deletions.
30 changes: 9 additions & 21 deletions packages/ckeditor5-dev-web-crawler/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

import { cpus } from 'os';

const DEFAULT_CONCURRENCY = cpus().length / 2;
export const DEFAULT_CONCURRENCY = cpus().length / 2;

const DEFAULT_TIMEOUT = 15 * 1000;
export const DEFAULT_TIMEOUT = 15 * 1000;

const DEFAULT_RESPONSIVENESS_CHECK_TIMEOUT = 1000;
export const DEFAULT_RESPONSIVENESS_CHECK_TIMEOUT = 1000;

const DEFAULT_REMAINING_ATTEMPTS = 3;
export const DEFAULT_REMAINING_ATTEMPTS = 3;

const ERROR_TYPES = {
export const ERROR_TYPES = {
PAGE_CRASH: {
event: 'error',
description: 'Page crash'
Expand Down Expand Up @@ -45,7 +45,7 @@ const ERROR_TYPES = {
}
};

const PATTERN_TYPE_TO_ERROR_TYPE_MAP = {
export const PATTERN_TYPE_TO_ERROR_TYPE_MAP = {
'page-crash': ERROR_TYPES.PAGE_CRASH,
'uncaught-exception': ERROR_TYPES.UNCAUGHT_EXCEPTION,
'request-failure': ERROR_TYPES.REQUEST_FAILURE,
Expand All @@ -54,20 +54,8 @@ const PATTERN_TYPE_TO_ERROR_TYPE_MAP = {
'navigation-error': ERROR_TYPES.NAVIGATION_ERROR
};

const IGNORE_ALL_ERRORS_WILDCARD = '*';
export const IGNORE_ALL_ERRORS_WILDCARD = '*';

const META_TAG_NAME = 'x-cke-crawler-ignore-patterns';
export const META_TAG_NAME = 'x-cke-crawler-ignore-patterns';

const DATA_ATTRIBUTE_NAME = 'data-cke-crawler-skip';

export default {
DEFAULT_CONCURRENCY,
DEFAULT_TIMEOUT,
DEFAULT_RESPONSIVENESS_CHECK_TIMEOUT,
DEFAULT_REMAINING_ATTEMPTS,
ERROR_TYPES,
PATTERN_TYPE_TO_ERROR_TYPE_MAP,
IGNORE_ALL_ERRORS_WILDCARD,
META_TAG_NAME,
DATA_ATTRIBUTE_NAME
};
export const DATA_ATTRIBUTE_NAME = 'data-cke-crawler-skip';
9 changes: 2 additions & 7 deletions packages/ckeditor5-dev-web-crawler/lib/spinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ora from 'ora';
* @param {Object} options
* @param {Boolean} [options.noSpinner=false] Whether to display the spinner with progress or a message with current progress.
*/
function createSpinner( { noSpinner } ) {
export function createSpinner( { noSpinner } ) {
return ora( {
spinner: {
frames: [ '⣾', '⣷', '⣯', '⣟', '⡿', '⢿', '⣻', '⣽' ]
Expand All @@ -34,7 +34,7 @@ function createSpinner( { noSpinner } ) {
* @param {Boolean} [options.verbose] Whether to display raw log instead of modifying the spinner instance.
* @returns {Function} Progress handler.
*/
function getProgressHandler( spinner, { verbose } ) {
export function getProgressHandler( spinner, { verbose } ) {
let current = 0;

return ( { total } ) => {
Expand All @@ -50,8 +50,3 @@ function getProgressHandler( spinner, { verbose } ) {
}
};
}

export default {
createSpinner,
getProgressHandler
};
12 changes: 3 additions & 9 deletions packages/ckeditor5-dev-web-crawler/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @param {String} url Page URL.
* @returns {String} Base URL from page URL.
*/
function getBaseUrl( url ) {
export function getBaseUrl( url ) {
const { origin, pathname } = new URL( url );

return `${ origin }${ pathname }`;
Expand All @@ -26,7 +26,7 @@ function getBaseUrl( url ) {
* @param {String} url The URL to validate.
* @returns {Boolean}
*/
function isUrlValid( url ) {
export function isUrlValid( url ) {
try {
return [ 'http:', 'https:' ].includes( new URL( url ).protocol );
} catch ( error ) {
Expand All @@ -40,12 +40,6 @@ function isUrlValid( url ) {
* @param {*} data The value to transform to an array.
* @returns {Array.<*>} An array created from data.
*/
function toArray( data ) {
export function toArray( data ) {
return Array.isArray( data ) ? data : [ data ];
}

export default {
getBaseUrl,
isUrlValid,
toArray
};

0 comments on commit 57ae04c

Please sign in to comment.