Add Robot_JoyIt driver

This commit is contained in:
2026-01-17 16:50:07 +01:00
parent e9e50acf5f
commit 0cfb4d5a95
15848 changed files with 570836 additions and 268976 deletions

1
node_modules/jest-watcher/LICENSE generated vendored
View File

@@ -1,6 +1,7 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,35 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class BaseWatchPlugin {
_stdin;
_stdout;
constructor({stdin, stdout}) {
this._stdin = stdin;
this._stdout = stdout;
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
apply(_hooks) {}
getUsageInfo(_globalConfig) {
return null;
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
onKey(_key) {}
run(_globalConfig, _updateConfigAndRun) {
return Promise.resolve();
}
}
var _default = BaseWatchPlugin;
exports.default = _default;

View File

@@ -1,63 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class JestHooks {
_listeners;
_subscriber;
_emitter;
constructor() {
this._listeners = {
onFileChange: [],
onTestRunComplete: [],
shouldRunTestSuite: []
};
this._subscriber = {
onFileChange: fn => {
this._listeners.onFileChange.push(fn);
},
onTestRunComplete: fn => {
this._listeners.onTestRunComplete.push(fn);
},
shouldRunTestSuite: fn => {
this._listeners.shouldRunTestSuite.push(fn);
}
};
this._emitter = {
onFileChange: fs =>
this._listeners.onFileChange.forEach(listener => listener(fs)),
onTestRunComplete: results =>
this._listeners.onTestRunComplete.forEach(listener =>
listener(results)
),
shouldRunTestSuite: async testSuiteInfo => {
const result = await Promise.all(
this._listeners.shouldRunTestSuite.map(listener =>
listener(testSuiteInfo)
)
);
return result.every(Boolean);
}
};
}
isUsed(hook) {
return this._listeners[hook]?.length > 0;
}
getSubscriber() {
return this._subscriber;
}
getEmitter() {
return this._emitter;
}
}
var _default = JestHooks;
exports.default = _default;

View File

@@ -1,74 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _ansiEscapes() {
const data = _interopRequireDefault(require('ansi-escapes'));
_ansiEscapes = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const {CLEAR} = _jestUtil().specialChars;
const usage = entity =>
`\n${_chalk().default.bold('Pattern Mode Usage')}\n` +
` ${_chalk().default.dim('\u203A Press')} Esc ${_chalk().default.dim(
'to exit pattern mode.'
)}\n` +
` ${_chalk().default.dim('\u203A Press')} Enter ` +
`${_chalk().default.dim(`to filter by a ${entity} regex pattern.`)}\n` +
'\n';
const usageRows = usage('').split('\n').length;
class PatternPrompt {
_currentUsageRows;
constructor(_pipe, _prompt, _entityName = '') {
this._pipe = _pipe;
this._prompt = _prompt;
this._entityName = _entityName;
this._currentUsageRows = usageRows;
}
run(onSuccess, onCancel, options) {
this._pipe.write(_ansiEscapes().default.cursorHide);
this._pipe.write(CLEAR);
if (options && options.header) {
this._pipe.write(`${options.header}\n`);
this._currentUsageRows = usageRows + options.header.split('\n').length;
} else {
this._currentUsageRows = usageRows;
}
this._pipe.write(usage(this._entityName));
this._pipe.write(_ansiEscapes().default.cursorShow);
this._prompt.enter(this._onChange.bind(this), onSuccess, onCancel);
}
_onChange(_pattern, _options) {
this._pipe.write(_ansiEscapes().default.eraseLine);
this._pipe.write(_ansiEscapes().default.cursorLeft);
}
}
exports.default = PatternPrompt;

View File

@@ -1,45 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _emittery() {
const data = _interopRequireDefault(require('emittery'));
_emittery = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class TestWatcher extends _emittery().default {
state;
_isWatchMode;
constructor({isWatchMode}) {
super();
this.state = {
interrupted: false
};
this._isWatchMode = isWatchMode;
}
async setState(state) {
Object.assign(this.state, state);
await this.emit('change', this.state);
}
isInterrupted() {
return this.state.interrupted;
}
isWatchMode() {
return this._isWatchMode;
}
}
exports.default = TestWatcher;

View File

@@ -1,27 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.KEYS = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const isWindows = process.platform === 'win32';
const KEYS = {
ARROW_DOWN: '\u001b[B',
ARROW_LEFT: '\u001b[D',
ARROW_RIGHT: '\u001b[C',
ARROW_UP: '\u001b[A',
BACKSPACE: Buffer.from(isWindows ? '08' : '7f', 'hex').toString(),
CONTROL_C: '\u0003',
CONTROL_D: '\u0004',
CONTROL_U: '\u0015',
ENTER: '\r',
ESCAPE: '\u001b'
};
exports.KEYS = KEYS;

169
node_modules/jest-watcher/build/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,169 @@
import Emittery from "emittery";
import { ReadStream, WriteStream } from "tty";
import { Config } from "@jest/types";
import { AggregatedResult } from "@jest/test-result";
//#region src/types.d.ts
type TestSuiteInfo = {
config: Config.ProjectConfig;
duration?: number;
testPath: string;
};
type JestHookExposedFS = {
projects: Array<{
config: Config.ProjectConfig;
testPaths: Array<string>;
}>;
};
type FileChange = (fs: JestHookExposedFS) => void;
type ShouldRunTestSuite = (testSuiteInfo: TestSuiteInfo) => Promise<boolean>;
type TestRunComplete = (results: AggregatedResult) => void;
type JestHookSubscriber = {
onFileChange: (fn: FileChange) => void;
onTestRunComplete: (fn: TestRunComplete) => void;
shouldRunTestSuite: (fn: ShouldRunTestSuite) => void;
};
type JestHookEmitter = {
onFileChange: (fs: JestHookExposedFS) => void;
onTestRunComplete: (results: AggregatedResult) => void;
shouldRunTestSuite: (testSuiteInfo: TestSuiteInfo) => Promise<boolean> | boolean;
};
type UsageData = {
key: string;
prompt: string;
};
type AllowedConfigOptions = Partial<Pick<Config.GlobalConfig, 'bail' | 'changedSince' | 'collectCoverage' | 'collectCoverageFrom' | 'coverageDirectory' | 'coverageReporters' | 'findRelatedTests' | 'nonFlagArgs' | 'notify' | 'notifyMode' | 'onlyFailures' | 'reporters' | 'testNamePattern' | 'updateSnapshot' | 'verbose'> & {
mode: 'watch' | 'watchAll';
testPathPatterns: Array<string>;
}>;
type UpdateConfigCallback = (config?: AllowedConfigOptions) => void;
interface WatchPlugin {
isInternal?: boolean;
apply?: (hooks: JestHookSubscriber) => void;
getUsageInfo?: (globalConfig: Config.GlobalConfig) => UsageData | null;
onKey?: (value: string) => void;
run?: (globalConfig: Config.GlobalConfig, updateConfigAndRun: UpdateConfigCallback) => Promise<void | boolean>;
}
type WatchPluginClass = new (options: {
config: Record<string, unknown>;
stdin: ReadStream;
stdout: WriteStream;
}) => WatchPlugin;
type ScrollOptions = {
offset: number;
max: number;
};
//#endregion
//#region src/BaseWatchPlugin.d.ts
declare abstract class BaseWatchPlugin implements WatchPlugin {
protected _stdin: ReadStream;
protected _stdout: WriteStream;
constructor({
stdin,
stdout
}: {
stdin: ReadStream;
stdout: WriteStream;
});
apply(_hooks: JestHookSubscriber): void;
getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null;
onKey(_key: string): void;
run(_globalConfig: Config.GlobalConfig, _updateConfigAndRun: UpdateConfigCallback): Promise<void | boolean>;
}
//#endregion
//#region src/JestHooks.d.ts
type AvailableHooks = 'onFileChange' | 'onTestRunComplete' | 'shouldRunTestSuite';
declare class JestHooks {
private readonly _listeners;
private readonly _subscriber;
private readonly _emitter;
constructor();
isUsed(hook: AvailableHooks): boolean;
getSubscriber(): Readonly<JestHookSubscriber>;
getEmitter(): Readonly<JestHookEmitter>;
}
//#endregion
//#region src/lib/Prompt.d.ts
declare class Prompt {
private _entering;
private _value;
private _onChange;
private _onSuccess;
private _onCancel;
private _offset;
private _promptLength;
private _selection;
constructor();
private readonly _onResize;
enter(onChange: (pattern: string, options: ScrollOptions) => void, onSuccess: (pattern: string) => void, onCancel: () => void): void;
setPromptLength(length: number): void;
setPromptSelection(selected: string): void;
put(key: string): void;
abort(): void;
isEntering(): boolean;
}
//#endregion
//#region src/PatternPrompt.d.ts
declare abstract class PatternPrompt {
protected _pipe: NodeJS.WritableStream;
protected _prompt: Prompt;
protected _entityName: string;
protected _currentUsageRows: number;
constructor(_pipe: NodeJS.WritableStream, _prompt: Prompt, _entityName?: string);
run(onSuccess: (value: string) => void, onCancel: () => void, options?: {
header: string;
}): void;
protected _onChange(_pattern: string, _options: ScrollOptions): void;
}
//#endregion
//#region src/TestWatcher.d.ts
type State = {
interrupted: boolean;
};
declare class TestWatcher extends Emittery<{
change: State;
}> {
state: State;
private readonly _isWatchMode;
constructor({
isWatchMode
}: {
isWatchMode: boolean;
});
setState(state: State): Promise<void>;
isInterrupted(): boolean;
isWatchMode(): boolean;
}
//#endregion
//#region src/constants.d.ts
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare const KEYS: {
ARROW_DOWN: string;
ARROW_LEFT: string;
ARROW_RIGHT: string;
ARROW_UP: string;
BACKSPACE: string;
CONTROL_C: string;
CONTROL_D: string;
CONTROL_U: string;
ENTER: string;
ESCAPE: string;
};
//#endregion
//#region src/lib/patternModeHelpers.d.ts
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
declare function printPatternCaret(pattern: string, pipe: NodeJS.WritableStream): void;
declare function printRestoredPatternCaret(pattern: string, currentUsageRows: number, pipe: NodeJS.WritableStream): void;
//#endregion
export { AllowedConfigOptions, BaseWatchPlugin, JestHooks as JestHook, JestHookEmitter, JestHookSubscriber, KEYS, PatternPrompt, Prompt, ScrollOptions, TestWatcher, UpdateConfigCallback, UsageData, WatchPlugin, WatchPluginClass, printPatternCaret, printRestoredPatternCaret };

View File

@@ -4,11 +4,11 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import type {AggregatedResult} from '@jest/test-result';
import type {Config} from '@jest/types';
import Emittery = require('emittery');
import {ReadStream, WriteStream} from 'tty';
import Emittery from 'emittery';
import {AggregatedResult} from '@jest/test-result';
import {Config} from '@jest/types';
export declare type AllowedConfigOptions = Partial<
Pick<
@@ -26,11 +26,11 @@ export declare type AllowedConfigOptions = Partial<
| 'onlyFailures'
| 'reporters'
| 'testNamePattern'
| 'testPathPattern'
| 'updateSnapshot'
| 'verbose'
> & {
mode: 'watch' | 'watchAll';
testPathPatterns: Array<string>;
}
>;
@@ -40,15 +40,9 @@ declare type AvailableHooks =
| 'shouldRunTestSuite';
export declare abstract class BaseWatchPlugin implements WatchPlugin {
protected _stdin: NodeJS.ReadStream;
protected _stdout: NodeJS.WriteStream;
constructor({
stdin,
stdout,
}: {
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
});
protected _stdin: ReadStream;
protected _stdout: WriteStream;
constructor({stdin, stdout}: {stdin: ReadStream; stdout: WriteStream});
apply(_hooks: JestHookSubscriber): void;
getUsageInfo(_globalConfig: Config.GlobalConfig): UsageData | null;
onKey(_key: string): void;
@@ -211,12 +205,10 @@ export declare interface WatchPlugin {
) => Promise<void | boolean>;
}
export declare interface WatchPluginClass {
new (options: {
config: Record<string, unknown>;
stdin: NodeJS.ReadStream;
stdout: NodeJS.WriteStream;
}): WatchPlugin;
}
export declare type WatchPluginClass = new (options: {
config: Record<string, unknown>;
stdin: ReadStream;
stdout: WriteStream;
}) => WatchPlugin;
export {};

View File

@@ -1,8 +1,286 @@
'use strict';
/*!
* /**
* * Copyright (c) Meta Platforms, Inc. and affiliates.
* *
* * This source code is licensed under the MIT license found in the
* * LICENSE file in the root directory of this source tree.
* * /
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
Object.defineProperty(exports, '__esModule', {
/***/ "./src/BaseWatchPlugin.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
});
}));
exports["default"] = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class BaseWatchPlugin {
_stdin;
_stdout;
constructor({
stdin,
stdout
}) {
this._stdin = stdin;
this._stdout = stdout;
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
apply(_hooks) {}
getUsageInfo(_globalConfig) {
return null;
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
onKey(_key) {}
run(_globalConfig, _updateConfigAndRun) {
return Promise.resolve();
}
}
var _default = exports["default"] = BaseWatchPlugin;
/***/ }),
/***/ "./src/JestHooks.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class JestHooks {
_listeners;
_subscriber;
_emitter;
constructor() {
this._listeners = {
onFileChange: [],
onTestRunComplete: [],
shouldRunTestSuite: []
};
this._subscriber = {
onFileChange: fn => {
this._listeners.onFileChange.push(fn);
},
onTestRunComplete: fn => {
this._listeners.onTestRunComplete.push(fn);
},
shouldRunTestSuite: fn => {
this._listeners.shouldRunTestSuite.push(fn);
}
};
this._emitter = {
onFileChange: fs => {
for (const listener of this._listeners.onFileChange) listener(fs);
},
onTestRunComplete: results => {
for (const listener of this._listeners.onTestRunComplete) listener(results);
},
shouldRunTestSuite: async testSuiteInfo => {
const result = await Promise.all(this._listeners.shouldRunTestSuite.map(listener => listener(testSuiteInfo)));
return result.every(Boolean);
}
};
}
isUsed(hook) {
return this._listeners[hook]?.length > 0;
}
getSubscriber() {
return this._subscriber;
}
getEmitter() {
return this._emitter;
}
}
var _default = exports["default"] = JestHooks;
/***/ }),
/***/ "./src/PatternPrompt.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
function _ansiEscapes() {
const data = _interopRequireDefault(require("ansi-escapes"));
_ansiEscapes = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require("jest-util");
_jestUtil = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const {
CLEAR
} = _jestUtil().specialChars;
const usage = entity => `\n${_chalk().default.bold('Pattern Mode Usage')}\n` + ` ${_chalk().default.dim('\u203A Press')} Esc ${_chalk().default.dim('to exit pattern mode.')}\n` + ` ${_chalk().default.dim('\u203A Press')} Enter ` + `${_chalk().default.dim(`to filter by a ${entity} regex pattern.`)}\n` + '\n';
const usageRows = usage('').split('\n').length;
class PatternPrompt {
_currentUsageRows;
constructor(_pipe, _prompt, _entityName = '') {
this._pipe = _pipe;
this._prompt = _prompt;
this._entityName = _entityName;
this._currentUsageRows = usageRows;
}
run(onSuccess, onCancel, options) {
this._pipe.write(_ansiEscapes().default.cursorHide);
this._pipe.write(CLEAR);
if (typeof options?.header === 'string' && options.header) {
this._pipe.write(`${options.header}\n`);
this._currentUsageRows = usageRows + options.header.split('\n').length;
} else {
this._currentUsageRows = usageRows;
}
this._pipe.write(usage(this._entityName));
this._pipe.write(_ansiEscapes().default.cursorShow);
this._prompt.enter(this._onChange.bind(this), onSuccess, onCancel);
}
_onChange(_pattern, _options) {
this._pipe.write(_ansiEscapes().default.eraseLine);
this._pipe.write(_ansiEscapes().default.cursorLeft);
}
}
exports["default"] = PatternPrompt;
/***/ }),
/***/ "./src/TestWatcher.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
function _emittery() {
const data = _interopRequireDefault(require("emittery"));
_emittery = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class TestWatcher extends _emittery().default {
state;
_isWatchMode;
constructor({
isWatchMode
}) {
super();
this.state = {
interrupted: false
};
this._isWatchMode = isWatchMode;
}
async setState(state) {
Object.assign(this.state, state);
await this.emit('change', this.state);
}
isInterrupted() {
return this.state.interrupted;
}
isWatchMode() {
return this._isWatchMode;
}
}
exports["default"] = TestWatcher;
/***/ }),
/***/ "./src/constants.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.KEYS = void 0;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const isWindows = process.platform === 'win32';
const KEYS = exports.KEYS = {
ARROW_DOWN: '\u001B[B',
ARROW_LEFT: '\u001B[D',
ARROW_RIGHT: '\u001B[C',
ARROW_UP: '\u001B[A',
BACKSPACE: Buffer.from(isWindows ? '08' : '7f', 'hex').toString(),
CONTROL_C: '\u0003',
CONTROL_D: '\u0004',
CONTROL_U: '\u0015',
ENTER: '\r',
ESCAPE: '\u001B'
};
/***/ }),
/***/ "./src/index.ts":
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var _exportNames = {
BaseWatchPlugin: true,
JestHook: true,
@@ -10,43 +288,43 @@ var _exportNames = {
TestWatcher: true,
Prompt: true
};
Object.defineProperty(exports, 'BaseWatchPlugin', {
Object.defineProperty(exports, "BaseWatchPlugin", ({
enumerable: true,
get: function () {
return _BaseWatchPlugin.default;
}
});
Object.defineProperty(exports, 'JestHook', {
}));
Object.defineProperty(exports, "JestHook", ({
enumerable: true,
get: function () {
return _JestHooks.default;
}
});
Object.defineProperty(exports, 'PatternPrompt', {
}));
Object.defineProperty(exports, "PatternPrompt", ({
enumerable: true,
get: function () {
return _PatternPrompt.default;
}
});
Object.defineProperty(exports, 'Prompt', {
}));
Object.defineProperty(exports, "Prompt", ({
enumerable: true,
get: function () {
return _Prompt.default;
}
});
Object.defineProperty(exports, 'TestWatcher', {
}));
Object.defineProperty(exports, "TestWatcher", ({
enumerable: true,
get: function () {
return _TestWatcher.default;
}
});
var _BaseWatchPlugin = _interopRequireDefault(require('./BaseWatchPlugin'));
var _JestHooks = _interopRequireDefault(require('./JestHooks'));
var _PatternPrompt = _interopRequireDefault(require('./PatternPrompt'));
var _TestWatcher = _interopRequireDefault(require('./TestWatcher'));
var _constants = require('./constants');
}));
var _BaseWatchPlugin = _interopRequireDefault(__webpack_require__("./src/BaseWatchPlugin.ts"));
var _JestHooks = _interopRequireDefault(__webpack_require__("./src/JestHooks.ts"));
var _PatternPrompt = _interopRequireDefault(__webpack_require__("./src/PatternPrompt.ts"));
var _TestWatcher = _interopRequireDefault(__webpack_require__("./src/TestWatcher.ts"));
var _constants = __webpack_require__("./src/constants.ts");
Object.keys(_constants).forEach(function (key) {
if (key === 'default' || key === '__esModule') return;
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _constants[key]) return;
Object.defineProperty(exports, key, {
@@ -56,10 +334,10 @@ Object.keys(_constants).forEach(function (key) {
}
});
});
var _Prompt = _interopRequireDefault(require('./lib/Prompt'));
var _patternModeHelpers = require('./lib/patternModeHelpers');
var _Prompt = _interopRequireDefault(__webpack_require__("./src/lib/Prompt.ts"));
var _patternModeHelpers = __webpack_require__("./src/lib/patternModeHelpers.ts");
Object.keys(_patternModeHelpers).forEach(function (key) {
if (key === 'default' || key === '__esModule') return;
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _patternModeHelpers[key]) return;
Object.defineProperty(exports, key, {
@@ -69,6 +347,210 @@ Object.keys(_patternModeHelpers).forEach(function (key) {
}
});
});
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/***/ }),
/***/ "./src/lib/Prompt.ts":
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _constants = __webpack_require__("./src/constants.ts");
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class Prompt {
_entering;
_value;
_onChange;
_onSuccess;
_onCancel;
_offset;
_promptLength;
_selection;
constructor() {
// Copied from `enter` to satisfy TS
this._entering = true;
this._value = '';
this._selection = null;
this._offset = -1;
this._promptLength = 0;
/* eslint-disable @typescript-eslint/no-empty-function */
this._onChange = () => {};
this._onSuccess = () => {};
this._onCancel = () => {};
/* eslint-enable */
}
_onResize = () => {
this._onChange();
};
enter(onChange, onSuccess, onCancel) {
this._entering = true;
this._value = '';
this._onSuccess = onSuccess;
this._onCancel = onCancel;
this._selection = null;
this._offset = -1;
this._promptLength = 0;
this._onChange = () => onChange(this._value, {
max: 10,
offset: this._offset
});
this._onChange();
process.stdout.on('resize', this._onResize);
}
setPromptLength(length) {
this._promptLength = length;
}
setPromptSelection(selected) {
this._selection = selected;
}
put(key) {
switch (key) {
case _constants.KEYS.ENTER:
this._entering = false;
this._onSuccess(this._selection ?? this._value);
this.abort();
break;
case _constants.KEYS.ESCAPE:
this._entering = false;
this._onCancel(this._value);
this.abort();
break;
case _constants.KEYS.ARROW_DOWN:
this._offset = Math.min(this._offset + 1, this._promptLength - 1);
this._onChange();
break;
case _constants.KEYS.ARROW_UP:
this._offset = Math.max(this._offset - 1, -1);
this._onChange();
break;
case _constants.KEYS.ARROW_LEFT:
case _constants.KEYS.ARROW_RIGHT:
break;
case _constants.KEYS.CONTROL_U:
this._value = '';
this._offset = -1;
this._selection = null;
this._onChange();
break;
default:
this._value = key === _constants.KEYS.BACKSPACE ? this._value.slice(0, -1) : this._value + key;
this._offset = -1;
this._selection = null;
this._onChange();
break;
}
}
abort() {
this._entering = false;
this._value = '';
process.stdout.removeListener('resize', this._onResize);
}
isEntering() {
return this._entering;
}
}
exports["default"] = Prompt;
/***/ }),
/***/ "./src/lib/patternModeHelpers.ts":
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.printPatternCaret = printPatternCaret;
exports.printRestoredPatternCaret = printRestoredPatternCaret;
function _ansiEscapes() {
const data = _interopRequireDefault(require("ansi-escapes"));
_ansiEscapes = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _stringLength() {
const data = _interopRequireDefault(require("string-length"));
_stringLength = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function printPatternCaret(pattern, pipe) {
const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`;
pipe.write(_ansiEscapes().default.eraseDown);
pipe.write(inputText);
pipe.write(_ansiEscapes().default.cursorSavePosition);
}
function printRestoredPatternCaret(pattern, currentUsageRows, pipe) {
const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`;
pipe.write(_ansiEscapes().default.cursorTo((0, _stringLength().default)(inputText), currentUsageRows - 1));
pipe.write(_ansiEscapes().default.cursorRestorePosition);
}
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
/******/ module.exports = __webpack_exports__;
/******/
/******/ })()
;

10
node_modules/jest-watcher/build/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import cjsModule from './index.js';
export const BaseWatchPlugin = cjsModule.BaseWatchPlugin;
export const JestHook = cjsModule.JestHook;
export const PatternPrompt = cjsModule.PatternPrompt;
export const Prompt = cjsModule.Prompt;
export const TestWatcher = cjsModule.TestWatcher;
export const KEYS = cjsModule.KEYS;
export const printPatternCaret = cjsModule.printPatternCaret;
export const printRestoredPatternCaret = cjsModule.printRestoredPatternCaret;

View File

@@ -1,113 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
var _constants = require('../constants');
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class Prompt {
_entering;
_value;
_onChange;
_onSuccess;
_onCancel;
_offset;
_promptLength;
_selection;
constructor() {
// Copied from `enter` to satisfy TS
this._entering = true;
this._value = '';
this._selection = null;
this._offset = -1;
this._promptLength = 0;
/* eslint-disable @typescript-eslint/no-empty-function */
this._onChange = () => {};
this._onSuccess = () => {};
this._onCancel = () => {};
/* eslint-enable */
}
_onResize = () => {
this._onChange();
};
enter(onChange, onSuccess, onCancel) {
this._entering = true;
this._value = '';
this._onSuccess = onSuccess;
this._onCancel = onCancel;
this._selection = null;
this._offset = -1;
this._promptLength = 0;
this._onChange = () =>
onChange(this._value, {
max: 10,
offset: this._offset
});
this._onChange();
process.stdout.on('resize', this._onResize);
}
setPromptLength(length) {
this._promptLength = length;
}
setPromptSelection(selected) {
this._selection = selected;
}
put(key) {
switch (key) {
case _constants.KEYS.ENTER:
this._entering = false;
this._onSuccess(this._selection ?? this._value);
this.abort();
break;
case _constants.KEYS.ESCAPE:
this._entering = false;
this._onCancel(this._value);
this.abort();
break;
case _constants.KEYS.ARROW_DOWN:
this._offset = Math.min(this._offset + 1, this._promptLength - 1);
this._onChange();
break;
case _constants.KEYS.ARROW_UP:
this._offset = Math.max(this._offset - 1, -1);
this._onChange();
break;
case _constants.KEYS.ARROW_LEFT:
case _constants.KEYS.ARROW_RIGHT:
break;
case _constants.KEYS.CONTROL_U:
this._value = '';
this._offset = -1;
this._selection = null;
this._onChange();
break;
default:
this._value =
key === _constants.KEYS.BACKSPACE
? this._value.slice(0, -1)
: this._value + key;
this._offset = -1;
this._selection = null;
this._onChange();
break;
}
}
abort() {
this._entering = false;
this._value = '';
process.stdout.removeListener('resize', this._onResize);
}
isEntering() {
return this._entering;
}
}
exports.default = Prompt;

View File

@@ -1,30 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = colorize;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function colorize(str, start, end) {
return (
_chalk().default.dim(str.slice(0, start)) +
_chalk().default.reset(str.slice(start, end)) +
_chalk().default.dim(str.slice(end))
);
}

View File

@@ -1,67 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = formatTestNameByPattern;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
var _colorize = _interopRequireDefault(require('./colorize'));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const DOTS = '...';
const ENTER = '⏎';
function formatTestNameByPattern(testName, pattern, width) {
const inlineTestName = testName.replace(/(\r\n|\n|\r)/gm, ENTER);
let regexp;
try {
regexp = new RegExp(pattern, 'i');
} catch {
return _chalk().default.dim(inlineTestName);
}
const match = inlineTestName.match(regexp);
if (!match) {
return _chalk().default.dim(inlineTestName);
}
const startPatternIndex = Math.max(match.index ?? 0, 0);
const endPatternIndex = startPatternIndex + match[0].length;
if (inlineTestName.length <= width) {
return (0, _colorize.default)(
inlineTestName,
startPatternIndex,
endPatternIndex
);
}
const slicedTestName = inlineTestName.slice(0, width - DOTS.length);
if (startPatternIndex < slicedTestName.length) {
if (endPatternIndex > slicedTestName.length) {
return (0, _colorize.default)(
slicedTestName + DOTS,
startPatternIndex,
slicedTestName.length + DOTS.length
);
} else {
return (0, _colorize.default)(
slicedTestName + DOTS,
Math.min(startPatternIndex, slicedTestName.length),
endPatternIndex
);
}
}
return `${_chalk().default.dim(slicedTestName)}${_chalk().default.reset(
DOTS
)}`;
}

View File

@@ -1,54 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.printPatternCaret = printPatternCaret;
exports.printRestoredPatternCaret = printRestoredPatternCaret;
function _ansiEscapes() {
const data = _interopRequireDefault(require('ansi-escapes'));
_ansiEscapes = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function () {
return data;
};
return data;
}
function _stringLength() {
const data = _interopRequireDefault(require('string-length'));
_stringLength = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function printPatternCaret(pattern, pipe) {
const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`;
pipe.write(_ansiEscapes().default.eraseDown);
pipe.write(inputText);
pipe.write(_ansiEscapes().default.cursorSavePosition);
}
function printRestoredPatternCaret(pattern, currentUsageRows, pipe) {
const inputText = `${_chalk().default.dim(' pattern \u203A')} ${pattern}`;
pipe.write(
_ansiEscapes().default.cursorTo(
(0, _stringLength().default)(inputText),
currentUsageRows - 1
)
);
pipe.write(_ansiEscapes().default.cursorRestorePosition);
}

View File

@@ -1,31 +0,0 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = scroll;
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function scroll(size, {offset, max}) {
let start = 0;
let index = Math.min(offset, size);
const halfScreen = max / 2;
if (index <= halfScreen) {
start = 0;
} else {
if (size >= max) {
start = Math.min(index - halfScreen - 1, size - max);
}
index = Math.min(index - start, size);
}
return {
end: Math.min(size, start + max),
index,
start
};
}

View File

@@ -1 +0,0 @@
'use strict';

View File

@@ -1,25 +1,27 @@
{
"name": "jest-watcher",
"description": "Delightful JavaScript Testing.",
"version": "29.7.0",
"version": "30.2.0",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@jest/test-result": "^29.7.0",
"@jest/types": "^29.6.3",
"@jest/test-result": "30.2.0",
"@jest/types": "30.2.0",
"@types/node": "*",
"ansi-escapes": "^4.2.1",
"chalk": "^4.0.0",
"ansi-escapes": "^4.3.2",
"chalk": "^4.1.2",
"emittery": "^0.13.1",
"jest-util": "^29.7.0",
"string-length": "^4.0.1"
"jest-util": "30.2.0",
"string-length": "^4.0.2"
},
"repository": {
"type": "git",
@@ -30,12 +32,12 @@
"url": "https://github.com/jestjs/jest/issues"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"homepage": "https://jestjs.io/",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"gitHead": "4e56991693da7cd4c3730dc3579a1dd1403ee630"
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
}