Skip to content
Permalink
Browse files

New: Add `utils` package

  • Loading branch information...
sarvaje authored and molant committed Mar 25, 2019
1 parent 61e764d commit f8cbcef8379fa2b97c990fbfae6a74b13a4a6c8f
Showing 442 changed files with 4,484 additions and 1,535 deletions.
@@ -22,3 +22,4 @@ npm-shrinkwrap.json
package-lock.json
packages/*/yarn.lock
yarn-error.log
!packages/utils/tests/fixtures/packages/node_modules
@@ -7,6 +7,7 @@
"timeout": "1m"
},
"dependencies": {
"@hint/utils": "^1.0.0",
"@hint/utils-debugging-protocol-common": "^3.0.1",
"chrome-launcher": "^0.10.4",
"is-ci": "^2.0.0"
@@ -5,12 +5,13 @@
import * as chromeLauncher from 'chrome-launcher';
import * as isCI from 'is-ci';

import { debug as d, fs, misc } from '@hint/utils';

import { Launcher } from '@hint/utils-debugging-protocol-common/dist/src/launcher';
import { BrowserInfo, LauncherOptions } from 'hint/dist/src/lib/types';
import { debug as d } from 'hint/dist/src/lib/utils/debug';
import delay from 'hint/dist/src/lib/utils/misc/delay';
import readFileAsync from 'hint/dist/src/lib/utils/fs/read-file-async';
import writeFileAsync from 'hint/dist/src/lib/utils/fs/write-file-async';

const { readFileAsync, writeFileAsync } = fs;
const { delay } = misc;

const debug: debug.IDebugger = d(__filename);

@@ -14,7 +14,7 @@ import { Connector } from '@hint/utils-debugging-protocol-common/dist/src/debugg
import { ILauncher } from 'hint/dist/src/lib/types';
import { CDPLauncher } from './chrome-launcher';

import { Engine } from 'hint/dist/src/lib/engine';
import { Engine } from 'hint';

export default class ChromeConnector extends Connector {
public constructor(server: Engine, config?: object) {
@@ -9,9 +9,12 @@ import anyTest, { TestInterface, ExecutionContext } from 'ava';

import { Server, ServerConfiguration } from '@hint/utils-create-server';
import { Events, IConnector, IConnectorConstructor } from 'hint/dist/src/lib/types';
import generateHTMLPage from 'hint/dist/src/lib/utils/misc/generate-html-page';
import ChromeConnector from '../src/connector';
import { Engine } from 'hint';
import { test as testUtils } from '@hint/utils';

import ChromeConnector from '../src/connector';

const { generateHTMLPage } = testUtils;

const name: string = 'chrome';

@@ -3,12 +3,14 @@ import { URL } from 'url';
import test from 'ava';

import { Server } from '@hint/utils-create-server';
import generateHTMLPage from 'hint/dist/src/lib/utils/misc/generate-html-page';
import { test as testUtils } from '@hint/utils';
import { IConnector, Events } from 'hint/dist/src/lib/types';
import { Engine } from 'hint';

import ChromeConnector from '../src/connector';

const { generateHTMLPage } = testUtils;

const name: string = 'chrome';

const scripts = [
@@ -14,6 +14,7 @@
],
"references": [
{ "path": "../hint" },
{ "path": "../utils" },
{ "path": "../utils-create-server" },
{ "path": "../utils-debugging-protocol-common" }
]
@@ -1,5 +1,6 @@
{
"dependencies": {
"@hint/utils": "^1.0.0",
"@hint/utils-debugging-protocol-common": "^3.0.1",
"edge-diagnostics-adapter": "^0.6.0",
"node-windows": "^0.1.14"
@@ -14,13 +14,12 @@ import * as os from 'os';
import * as path from 'path';
import { promisify } from 'util';

import { debug as d } from 'hint/dist/src/lib/utils/debug';
import delay from 'hint/dist/src/lib/utils/misc/delay';
import { debug as d, logger, misc } from '@hint/utils';
import { Launcher } from '@hint/utils-debugging-protocol-common/dist/src/launcher';
import * as logging from 'hint/dist/src/lib/utils/logging';
import { BrowserInfo, LauncherOptions } from 'hint/dist/src/lib/types';
import * as nodeWindows from 'node-windows';

const { delay } = misc;
const diagnosticsPath = require.resolve('edge-diagnostics-adapter');
const elevate = promisify(nodeWindows.elevate);

@@ -139,7 +138,7 @@ export class EdgeLauncher extends Launcher {
if (!osInfo.isWin || osInfo.version < 10) {
const message = 'Edge diagnostics adapter needs windows 10';

logging.error(message);
logger.error(message);
throw new Error(message);
}

@@ -14,6 +14,7 @@
],
"references": [
{ "path": "../hint" },
{ "path": "../utils" },
{ "path": "../utils-debugging-protocol-common" }
]
}
@@ -7,6 +7,7 @@
"timeout": "1m"
},
"dependencies": {
"@hint/utils": "^1.0.0",
"@hint/utils-connector-tools": "^3.0.0",
"jsdom": "^14.0.0",
"mutationobserver-shim": "^0.3.3",
@@ -5,11 +5,12 @@
import { URL } from 'url';
import * as vm from 'vm';
import * as path from 'path';
import { DOMWindow } from 'jsdom';

import * as jsdomutils from 'jsdom/lib/jsdom/living/generated/utils';
import { fs } from '@hint/utils';

import readFile from 'hint/dist/src/lib/utils/fs/read-file';
import { DOMWindow } from 'jsdom';
const { readFile } = fs;

export const beforeParse = (finalHref: string) => {
return (window: DOMWindow) => {
@@ -31,18 +31,16 @@ import { fork, ChildProcess } from 'child_process';

import { JSDOM, ResourceLoader, VirtualConsole } from 'jsdom';

import { debug as d } from 'hint/dist/src/lib/utils/debug';
import { debug as d, HttpHeaders, network } from '@hint/utils';
import { getContentTypeData, getType } from 'hint/dist/src/lib/utils/content-type';
import {
HttpHeaders,
HTMLDocument,
IConnector,
HTMLElement,
Event, FetchEnd, FetchError,
NetworkData
} from 'hint/dist/src/lib/types';
import { Engine } from 'hint/dist/src/lib/engine';
import isHTMLDocument from 'hint/dist/src/lib/utils/network/is-html-document';
import createHTMLDocument from 'hint/dist/src/lib/utils/dom/create-html-document';
import traverse from 'hint/dist/src/lib/utils/dom/traverse';

@@ -58,6 +56,7 @@ import { beforeParse } from './before-parse';
* ------------------------------------------------------------------------------
*/

const { isHTMLDocument } = network;
const debug: debug.IDebugger = d(__filename);

const defaultOptions = { waitFor: 1000 };
@@ -3,7 +3,7 @@ import * as vm from 'vm';
import { JSDOM, VirtualConsole } from 'jsdom';
import * as jsdomutils from 'jsdom/lib/jsdom/living/generated/utils';

import { debug as d } from 'hint/dist/src/lib/utils/debug';
import { debug as d } from '@hint/utils';

import { beforeParse } from './before-parse';

@@ -1,6 +1,6 @@
import { URL } from 'url';

import { debug as d } from 'hint/dist/src/lib/utils/debug';
import { debug as d } from '@hint/utils';
import { ResourceLoader } from 'jsdom';

import JSDOMConnector from './connector';
@@ -9,11 +9,13 @@ import anyTest, { TestInterface, ExecutionContext } from 'ava';

import { ServerConfiguration, Server } from '@hint/utils-create-server';
import { IConnector, IConnectorConstructor, Events } from 'hint/dist/src/lib/types';
import generateHTMLPage from 'hint/dist/src/lib/utils/misc/generate-html-page';
import { test as testUtils } from '@hint/utils';
import { Engine } from 'hint';

import JSDOMConnector from '../src/connector';

const { generateHTMLPage } = testUtils;

const name: string = 'jsdom';

type CollectContext = {
@@ -3,12 +3,13 @@ import { URL } from 'url';
import test from 'ava';

import { Server } from '@hint/utils-create-server';
import generateHTMLPage from 'hint/dist/src/lib/utils/misc/generate-html-page';
import { test as testUtils } from '@hint/utils';
import { IConnector, Events } from 'hint/dist/src/lib/types';
import { Engine } from 'hint';

import JSDOMConnector from '../src/connector';

const { generateHTMLPage } = testUtils;
const name: string = 'jsdom';

const scripts = [
@@ -15,6 +15,7 @@
"references": [
{ "path": "../hint" },
{ "path": "../parser-html" },
{ "path": "../utils" },
{ "path": "../utils-connector-tools" },
{ "path": "../utils-create-server" }
]
@@ -7,6 +7,7 @@
"timeout": "1m"
},
"dependencies": {
"@hint/utils": "^1.0.0",
"chokidar": "^2.1.5",
"globby": "^9.2.0",
"jsdom": "^14.0.0"
@@ -15,6 +16,7 @@
"devDependencies": {
"@hint/parser-html": "^2.0.2",
"@types/chokidar": "^2.1.3",
"@types/jsdom": "^12.2.3",
"@types/mock-require": "^2.0.0",
"@types/node": "11.12.0",
"@types/proxyquire": "^1.3.28",
@@ -20,15 +20,13 @@ const readFileAsBuffer = promisify(readFile);
import * as chokidar from 'chokidar';
import globby from 'globby';

import { getAsUri } from 'hint/dist/src/lib/utils/network/as-uri';
import asPathString from 'hint/dist/src/lib/utils/network/as-path-string';
import { fs, logger, network } from '@hint/utils';

import { getContentTypeData, isTextMediaType, getType } from 'hint/dist/src/lib/utils/content-type';
import traverse from 'hint/dist/src/lib/utils/dom/traverse';

import isFile from 'hint/dist/src/lib/utils/fs/is-file';
import cwd from 'hint/dist/src/lib/utils/fs/cwd';
import readFileAsync from 'hint/dist/src/lib/utils/fs/read-file-async';
import * as logger from 'hint/dist/src/lib/utils/logging';
const { cwd, isFile, readFileAsync } = fs;
const { asPathString, getAsUri } = network;

import {
CanEvaluateScript,
Oops, something went wrong.

0 comments on commit f8cbcef

Please sign in to comment.
You can’t perform that action at this time.