Import Debian changes 27.5.1~ds+~cs69.51.22-ok1

node-jest (27.5.1~ds+~cs69.51.22-ok1) yangtze; urgency=medium

  * Build for openKylin.
This commit is contained in:
openKylinBot 2022-04-25 22:03:04 +08:00 committed by Lu zhiping
parent c0606860b8
commit a66fe7393b
132 changed files with 5728 additions and 0 deletions

53
debian/README.Debian vendored Normal file
View File

@ -0,0 +1,53 @@
# USING JEST IN DEBIAN PACKAGING
# Changes added to jest package in default configuration:
* jest package excludes <rootdir>.pc/ directory to avoid problems when
upstream tests are patched (default value of --modulePathIgnorePatterns)
* jest package includes Debian nodejs directories
(default values of --modulePaths)
# Usage notes:
* when upstream installed snapshots in its test files, it may generate
false-positive autopkgtest regressions (test succeeds but output changed).
To avoid this, use the "-u" option: this updates snapshots and so avoid
these kind of errors
* always use the "--ci" option when jest is used in Debian packaging and/or
autopkgtest. It prevents snapshot from being written
* when your package contains component, it is recommended to set a path
to jest to avoid launching component test that may be incompatible
(component tests can be launched using
debian/nodejs/<component>/test). Example:
$ jest test/
* pkg-js-autopkgtest
* jest needs often babel configuration file. Since version 0.9.48,
pkg-js-autopkgtest automatically installs .babelrc and babel.config.json
in test directory (and installed package.json. If your package uses
another file, set a debian/tests/pkg-js/files (see below)
* jest tests often need sources files. Use debian/tests/pkg-js/files in
this case.
* debian/tests/pkg-js/files example (remember that when this file exists,
only the mentioned files and package files are installed in test
directory):
babel.config.json
src/
test/
# Switching from ava to jest:
ava is not packaged. You can easily replace it by jest using jest-codemods.
Simply launch this and follow instructions:
$ npx jest-codemods
Note that you will probably need a .babelrc or babel.config.json. Example:
{
"presets": [ "@babel/preset-env" ],
"plugins": [ "@babel/plugin-transform-runtime" ]
}

26
debian/bcoe-rollup-config.js vendored Normal file
View File

@ -0,0 +1,26 @@
import babel from '@rollup/plugin-babel';
import ts from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import multiInput from 'rollup-plugin-multi-input';
export default {
input: ['../bcoe-v8-coverage/src/lib/*.ts'],
output: {
dir: '../bcoe-v8-coverage/dist/lib',
format: 'cjs',
},
plugins: [
multiInput(),
babel({ babelHelpers: 'bundled' }),
ts({
//declaration: true,
skipLibCheck: true,
exclude:["node_modules","debian","test","gulpfile.ts"],
allowSyntheticDefaultImports: true,
downlevelIteration: true,
//declarationDir:'../bcoe-v8-coverage/dist/lib',
//dir:'../bcoe-v8-coverage/dist/lib',
}),
commonjs(),
]
};

View File

@ -0,0 +1 @@
{"name":"@tsconfig/node10","repository":{"type":"git","url":"https://github.com/tsconfig/bases.git","directory":"bases"},"license":"MIT","description":"A base TSConfig for working with Node 10.","version":"1.0.8"}

View File

@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 10",
"compilerOptions": {
"lib": ["es2018"],
"module": "commonjs",
"target": "es2018",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@ -0,0 +1,60 @@
// Type definitions for node-notifier 8.0
// Project: https://github.com/mikaelbr/node-notifier
// Definitions by: Qubo <https://github.com/tkQubo>
// Lorenzo Rapetti <https://github.com/loryman>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import NotificationCenter = require('./notifiers/notificationcenter');
import NotifySend = require('./notifiers/notifysend');
import WindowsToaster = require('./notifiers/toaster');
import WindowsBalloon = require('./notifiers/balloon');
import Growl = require('./notifiers/growl');
declare namespace nodeNotifier {
interface NodeNotifier extends NodeJS.EventEmitter {
notify(notification?: NotificationCenter.Notification, callback?: NotificationCallback): NotificationCenter;
notify(notification?: WindowsToaster.Notification, callback?: NotificationCallback): WindowsToaster;
notify(notification?: WindowsBalloon.Notification, callback?: NotificationCallback): WindowsBalloon;
notify(notification?: NotifySend.Notification, callback?: NotificationCallback): NotifySend;
notify(notification?: Growl.Notification, callback?: NotificationCallback): Growl;
notify(notification?: Notification | string, callback?: NotificationCallback): NodeNotifier;
NotificationCenter: typeof NotificationCenter;
NotifySend: typeof NotifySend;
WindowsToaster: typeof WindowsToaster;
WindowsBalloon: typeof WindowsBalloon;
Growl: typeof Growl;
}
interface Notification {
title?: string;
message?: string;
/** Absolute path (not balloons) */
icon?: string;
/** Wait with callback until user action is taken on notification */
wait?: boolean;
}
interface NotificationMetadata {
activationType?: string;
activationAt?: string;
deliveredAt?: string;
activationValue?: string;
activationValueIndex?: string;
}
interface NotificationCallback {
(err: Error | null, response: string, metadata?: NotificationMetadata): void;
}
interface Option {
withFallback?: boolean;
customPath?: string;
}
}
declare var nodeNotifier: nodeNotifier.NodeNotifier;
export = nodeNotifier;

View File

@ -0,0 +1,22 @@
import notifier = require('../');
declare class WindowsBalloon {
constructor(option?: notifier.Option);
notify(notification?: WindowsBalloon.Notification, callback?: notifier.NotificationCallback): WindowsBalloon;
}
declare namespace WindowsBalloon {
interface Notification {
title?: string;
message?: string;
sound?: boolean;
/** How long to show balloons in ms */
time?: number;
/** Wait with callback until user action is taken on notification */
wait?: boolean;
/** The notification type */
type?: 'info' | 'warn' | 'error';
}
}
export = WindowsBalloon;

View File

@ -0,0 +1,25 @@
import notifier = require('../');
declare class Growl {
constructor(option?: Growl.Option);
notify(notification?: Growl.Notification, callback?: notifier.NotificationCallback): Growl;
}
declare namespace Growl {
interface Option {
name?: string;
host?: string;
port?: number;
}
interface Notification extends notifier.Notification {
/** whether or not to sticky the notification (defaults to false) */
sticky?: boolean;
/** type of notification to use (defaults to the first registered type) */
label?: string;
/** the priority of the notification from lowest (-2) to highest (2) */
priority?: number;
}
}
export = Growl;

View File

@ -0,0 +1,45 @@
import notifier = require('../');
declare class NotificationCenter {
constructor(option?: notifier.Option);
notify(
notification?: NotificationCenter.Notification,
callback?: notifier.NotificationCallback,
): NotificationCenter;
}
declare namespace NotificationCenter {
interface Notification extends notifier.Notification {
/**
* Case Sensitive string for location of sound file, or use one of macOS' native sounds.
*/
sound?: boolean | string;
subtitle?: string;
/** Attach image? (Absolute path) */
contentImage?: string;
/** URL to open on click */
open?: string;
/**
* The amount of seconds before the notification closes.
* Takes precedence over wait if both are defined.
* As of Version 6.0 there is a default `timeout` set of 10 to ensure that the application closes properly.
* In order to remove the `timeout` and have an instantly closing notification (does not support actions),
* set `timeout` to `false`.
* If you are using action it is recommended to set `timeout` to a high value to ensure the user has time to respond.
*/
timeout?: number | false;
/** Label for cancel button */
closeLabel?: string;
/** Action label or list of labels in case of dropdown. */
actions?: string | string[];
/** Label to be used if there are multiple actions */
dropdownLabel?: string;
/**
* If notification should take input.
* Value passed as third argument in callback and event emitter.
*/
reply?: boolean;
}
}
export = NotificationCenter;

View File

@ -0,0 +1,26 @@
import notifier = require('../');
declare class NotifySend {
constructor(option?: notifier.Option);
notify(notification?: NotifySend.Notification, callback?: notifier.NotificationCallback): NotifySend;
}
declare namespace NotifySend {
interface Notification {
title?: string;
message?: string;
icon?: string;
/** Shorthand for timeout 5 seconds if true. Timeout option overrides wait */
wait?: boolean;
/** Specifies the urgency level (low, normal, critical). */
urgency?: string;
/** Specifies the timeout in seconds at which to expire the notification. Defaults to 10 seconds */
timeout?: number | false;
/** Specifies the notification category */
category?: string;
/** Specifies basic extra data to pass. Valid types are int, double, string and byte. */
hint?: string;
}
}
export = NotifySend;

View File

@ -0,0 +1,28 @@
import notifier = require('../');
declare class WindowsToaster {
constructor(option?: notifier.Option);
notify(notification?: WindowsToaster.Notification, callback?: notifier.NotificationCallback): WindowsToaster;
}
declare namespace WindowsToaster {
interface Notification extends notifier.Notification {
/**
* Defined by http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx
*/
sound?: boolean | string;
/** ID to use for closing notification. */
id?: number;
/** App.ID and app Name. Defaults to no value, causing SnoreToast text to be visible. */
appID?: string;
/** Refer to previously created notification to close. */
remove?: number;
/**
* Creates a shortcut <path> in the start menu which point to the
* executable <application>, appID used for the notifications.
*/
install?: string;
}
}
export = WindowsToaster;

View File

@ -0,0 +1,36 @@
{
"name": "@types/node-notifier",
"version": "8.0.0",
"description": "TypeScript definitions for node-notifier",
"license": "MIT",
"contributors": [
{
"name": "Qubo",
"url": "https://github.com/tkQubo",
"githubUsername": "tkQubo"
},
{
"name": "Lorenzo Rapetti",
"url": "https://github.com/loryman",
"githubUsername": "loryman"
},
{
"name": "Piotr Błażejewicz",
"url": "https://github.com/peterblazejewicz",
"githubUsername": "peterblazejewicz"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/node-notifier"
},
"scripts": {},
"dependencies": {
"@types/node": "*"
},
"typesPublisherContentHash": "aa65cc532fac490753cb2725a7810244aa208c936b075a4e2b19a6eeee1f81d3",
"typeScriptVersion": "3.2"
}

View File

@ -0,0 +1,153 @@
import { Doc } from './';
// https://github.com/prettier/prettier/blob/master/src/doc/index.js
export namespace builders {
type Doc =
| string
| Align
| BreakParent
| Concat
| Fill
| Group
| IfBreak
| Indent
| Line
| LineSuffix
| LineSuffixBoundary
| Trim
| Cursor;
interface Align {
type: 'align';
contents: Doc;
n: number | string | { type: 'root' };
}
interface BreakParent {
type: 'break-parent';
}
interface Concat {
type: 'concat';
parts: Doc[];
}
interface Fill {
type: 'fill';
parts: Doc[];
}
interface Group {
type: 'group';
contents: Doc;
break: boolean;
expandedStates: Doc[];
}
interface IfBreak {
type: 'if-break';
breakContents: Doc;
flatContents: Doc;
}
interface Indent {
type: 'indent';
contents: Doc;
}
interface Line {
type: 'line';
soft?: boolean;
hard?: boolean;
literal?: boolean;
}
interface LineSuffix {
type: 'line-suffix';
contents: Doc;
}
interface LineSuffixBoundary {
type: 'line-suffix-boundary';
}
interface Trim {
type: 'trim';
}
interface Cursor {
type: 'cursor';
placeholder: symbol;
}
function addAlignmentToDoc(doc: Doc, size: number, tabWidth: number): Doc;
function align(n: Align['n'], contents: Doc): Align;
const breakParent: BreakParent;
function concat(contents: Doc[]): Concat;
function conditionalGroup(states: Doc[], opts?: { shouldBreak: boolean }): Group;
function dedent(contents: Doc): Align;
function dedentToRoot(contents: Doc): Align;
function fill(parts: Doc[]): Fill;
function group(contents: Doc, opts?: { shouldBreak: boolean }): Group;
const hardline: Concat;
function ifBreak(breakContents: Doc, flatContents: Doc): IfBreak;
function indent(contents: Doc): Indent;
function join(separator: Doc, parts: Doc[]): Concat;
const line: Line;
function lineSuffix(contents: Doc): LineSuffix;
const lineSuffixBoundary: LineSuffixBoundary;
const literalline: Concat;
function markAsRoot(contents: Doc): Align;
const softline: Line;
const trim: Trim;
const cursor: Cursor;
}
export namespace debug {
function printDocToDebug(doc: Doc): string;
}
export namespace printer {
function printDocToString(
doc: Doc,
options: Options,
): {
formatted: string;
cursorNodeStart?: number;
cursorNodeText?: string;
};
interface Options {
/**
* Specify the line length that the printer will wrap on.
* @default 80
*/
printWidth: number;
/**
* Specify the number of spaces per indentation-level.
* @default 2
*/
tabWidth: number;
/**
* Indent lines with tabs instead of spaces
* @default false
*/
useTabs: boolean;
}
}
export namespace utils {
function isEmpty(doc: Doc): boolean;
function isLineNext(doc: Doc): boolean;
function willBreak(doc: Doc): boolean;
function traverseDoc(
doc: Doc,
onEnter?: (doc: Doc) => void | boolean,
onExit?: (doc: Doc) => void,
shouldTraverseConditionalGroups?: boolean,
): void;
function mapDoc<T>(doc: Doc, callback: (doc: Doc) => T): T;
function propagateBreaks(doc: Doc): void;
function removeLines(doc: Doc): Doc;
function stripTrailingHardline(doc: Doc): Doc;
}

View File

@ -0,0 +1,621 @@
// Type definitions for prettier 2.1
// Project: https://github.com/prettier/prettier, https://prettier.io
// Definitions by: Ika <https://github.com/ikatyang>,
// Ifiok Jr. <https://github.com/ifiokjr>,
// Florian Keller <https://github.com/ffflorian>,
// Sosuke Suzuki <https://github.com/sosukesuzuki>,
// Christopher Quadflieg <https://github.com/Shinigami92>
// Kevin Deisz <https://github.com/kddeisz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// This utility is here to handle the case where you have an explicit union
// between string literals and the generic string type. It would normally
// resolve out to just the string type, but this generic LiteralUnion maintains
// the intellisense of the original union.
//
// It comes from this issue: microsoft/TypeScript#29729:
// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-700527227
export type LiteralUnion<T extends U, U = string> = T | (Pick<U, never> & { _?: never });
export type AST = any;
export type Doc = doc.builders.Doc;
// https://github.com/prettier/prettier/blob/master/src/common/fast-path.js
export interface FastPath<T = any> {
stack: T[];
getName(): null | PropertyKey;
getValue(): T;
getNode(count?: number): null | T;
getParentNode(count?: number): null | T;
call<U>(callback: (path: this) => U, ...names: PropertyKey[]): U;
each(callback: (path: this) => void, ...names: PropertyKey[]): void;
map<U>(callback: (path: this, index: number) => U, ...names: PropertyKey[]): U[];
}
export type BuiltInParser = (text: string, options?: any) => AST;
export type BuiltInParserName =
| 'babel'
| 'babel-flow'
| 'babel-ts'
| 'flow'
| 'typescript'
| 'css'
| 'less'
| 'scss'
| 'json'
| 'json5'
| 'json-stringify'
| 'graphql'
| 'markdown'
| 'vue'
| 'html'
| 'angular'
| 'mdx'
| 'yaml'
| 'lwc';
export type BuiltInParsers = Record<BuiltInParserName, BuiltInParser>;
export type CustomParser = (text: string, parsers: BuiltInParsers, options: Options) => AST;
export interface Options extends Partial<RequiredOptions> {}
export interface RequiredOptions extends doc.printer.Options {
/**
* Print semicolons at the ends of statements.
* @default true
*/
semi: boolean;
/**
* Use single quotes instead of double quotes.
* @default false
*/
singleQuote: boolean;
/**
* Use single quotes in JSX.
* @default false
*/
jsxSingleQuote: boolean;
/**
* Print trailing commas wherever possible.
* @default 'es5'
*/
trailingComma: 'none' | 'es5' | 'all';
/**
* Print spaces between brackets in object literals.
* @default true
*/
bracketSpacing: boolean;
/**
* Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
* @default false
*/
jsxBracketSameLine: boolean;
/**
* Format only a segment of a file.
* @default 0
*/
rangeStart: number;
/**
* Format only a segment of a file.
* @default Infinity
*/
rangeEnd: number;
/**
* Specify which parser to use.
*/
parser: LiteralUnion<BuiltInParserName> | CustomParser;
/**
* Specify the input filepath. This will be used to do parser inference.
*/
filepath: string;
/**
* Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
* This is very useful when gradually transitioning large, unformatted codebases to prettier.
* @default false
*/
requirePragma: boolean;
/**
* Prettier can insert a special @format marker at the top of files specifying that
* the file has been formatted with prettier. This works well when used in tandem with
* the --require-pragma option. If there is already a docblock at the top of
* the file then this option will add a newline to it with the @format marker.
* @default false
*/
insertPragma: boolean;
/**
* By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
* In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
* @default 'preserve'
*/
proseWrap: 'always' | 'never' | 'preserve';
/**
* Include parentheses around a sole arrow function parameter.
* @default 'always'
*/
arrowParens: 'avoid' | 'always';
/**
* The plugin API is in a beta state.
*/
plugins: Array<string | Plugin>;
/**
* How to handle whitespaces in HTML.
* @default 'css'
*/
htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
/**
* Which end of line characters to apply.
* @default 'lf'
*/
endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
/**
* Change when properties in objects are quoted.
* @default 'as-needed'
*/
quoteProps: 'as-needed' | 'consistent' | 'preserve';
/**
* Whether or not to indent the code inside <script> and <style> tags in Vue files.
* @default false
*/
vueIndentScriptAndStyle: boolean;
/**
* Control whether Prettier formats quoted code embedded in the file.
* @default 'auto'
*/
embeddedLanguageFormatting: 'auto' | 'off';
}
export interface ParserOptions<T = any> extends RequiredOptions {
locStart: (node: T) => number;
locEnd: (node: T) => number;
originalText: string;
}
export interface Plugin<T = any> {
languages?: SupportLanguage[];
parsers?: { [parserName: string]: Parser<T> };
printers?: { [astFormat: string]: Printer<T> };
options?: SupportOptions;
defaultOptions?: Partial<RequiredOptions>;
}
export interface Parser<T = any> {
parse: (text: string, parsers: { [parserName: string]: Parser }, options: ParserOptions<T>) => T;
astFormat: string;
hasPragma?: (text: string) => boolean;
locStart: (node: T) => number;
locEnd: (node: T) => number;
preprocess?: (text: string, options: ParserOptions<T>) => string;
}
export interface Printer<T = any> {
print(path: FastPath<T>, options: ParserOptions<T>, print: (path: FastPath<T>) => Doc): Doc;
embed?: (
path: FastPath<T>,
print: (path: FastPath<T>) => Doc,
textToDoc: (text: string, options: Options) => Doc,
options: ParserOptions<T>,
) => Doc | null;
insertPragma?: (text: string) => string;
/**
* @returns `null` if you want to remove this node
* @returns `void` if you want to use modified newNode
* @returns anything if you want to replace the node with it
*/
massageAstNode?: (node: any, newNode: any, parent: any) => any;
hasPrettierIgnore?: (path: FastPath<T>) => boolean;
canAttachComment?: (node: T) => boolean;
willPrintOwnComments?: (path: FastPath<T>) => boolean;
printComments?: (path: FastPath<T>, print: (path: FastPath<T>) => Doc, options: ParserOptions<T>, needsSemi: boolean) => Doc;
handleComments?: {
ownLine?: (commentNode: any, text: string, options: ParserOptions<T>, ast: T, isLastComment: boolean) => boolean;
endOfLine?: (
commentNode: any,
text: string,
options: ParserOptions<T>,
ast: T,
isLastComment: boolean,
) => boolean;
remaining?: (
commentNode: any,
text: string,
options: ParserOptions<T>,
ast: T,
isLastComment: boolean,
) => boolean;
};
}
export interface CursorOptions extends Options {
/**
* Specify where the cursor is.
*/
cursorOffset: number;
rangeStart?: never;
rangeEnd?: never;
}
export interface CursorResult {
formatted: string;
cursorOffset: number;
}
/**
* `format` is used to format text using Prettier. [Options](https://github.com/prettier/prettier#options) may be provided to override the defaults.
*/
export function format(source: string, options?: Options): string;
/**
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
*/
export function check(source: string, options?: Options): boolean;
/**
* `formatWithCursor` both formats the code, and translates a cursor position from unformatted code to formatted code.
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted.
*
* The `cursorOffset` option should be provided, to specify where the cursor is. This option cannot be used with `rangeStart` and `rangeEnd`.
*/
export function formatWithCursor(source: string, options: CursorOptions): CursorResult;
export interface ResolveConfigOptions {
/**
* If set to `false`, all caching will be bypassed.
*/
useCache?: boolean;
/**
* Pass directly the path of the config file if you don't wish to search for it.
*/
config?: string;
/**
* If set to `true` and an `.editorconfig` file is in your project,
* Prettier will parse it and convert its properties to the corresponding prettier configuration.
* This configuration will be overridden by `.prettierrc`, etc. Currently,
* the following EditorConfig properties are supported:
* - indent_style
* - indent_size/tab_width
* - max_line_length
*/
editorconfig?: boolean;
}
/**
* `resolveConfig` can be used to resolve configuration for a given source file,
* passing its path as the first argument. The config search will start at the
* file path and continue to search up the directory.
* (You can use `process.cwd()` to start searching from the current directory).
*
* A promise is returned which will resolve to:
*
* - An options object, providing a [config file](https://github.com/prettier/prettier#configuration-file) was found.
* - `null`, if no file was found.
*
* The promise will be rejected if there was an error parsing the configuration file.
*/
export function resolveConfig(filePath: string, options?: ResolveConfigOptions): Promise<null | Options>;
export namespace resolveConfig {
function sync(filePath: string, options?: ResolveConfigOptions): null | Options;
}
/**
* `resolveConfigFile` can be used to find the path of the Prettier configuration file,
* that will be used when resolving the config (i.e. when calling `resolveConfig`).
*
* A promise is returned which will resolve to:
*
* - The path of the configuration file.
* - `null`, if no file was found.
*
* The promise will be rejected if there was an error parsing the configuration file.
*/
export function resolveConfigFile(filePath?: string): Promise<null | string>;
export namespace resolveConfigFile {
function sync(filePath?: string): null | string;
}
/**
* As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. This function will clear the cache.
* Generally this is only needed for editor integrations that know that the file system has changed since the last format took place.
*/
export function clearConfigCache(): void;
export interface SupportLanguage {
name: string;
since?: string;
parsers: BuiltInParserName[] | string[];
group?: string;
tmScope?: string;
aceMode?: string;
codemirrorMode?: string;
codemirrorMimeType?: string;
aliases?: string[];
extensions?: string[];
filenames?: string[];
linguistLanguageId?: number;
vscodeLanguageIds?: string[];
}
export interface SupportOptionRange {
start: number;
end: number;
step: number;
}
export type SupportOptionType = 'int' | 'boolean' | 'choice' | 'path';
export interface BaseSupportOption<Type extends SupportOptionType> {
readonly name?: string;
since: string;
category: string;
/**
* The type of the option.
*
* When passing a type other than the ones listed below, the option is
* treated as taking any string as argument, and `--option <${type}>` will
* be displayed in --help.
*/
type: Type;
/**
* Indicate that the option is deprecated.
*
* Use a string to add an extra message to --help for the option,
* for example to suggest a replacement option.
*/
deprecated?: true | string;
/**
* Description to be displayed in --help. If omitted, the option won't be
* shown at all in --help.
*/
description?: string;
}
export interface IntSupportOption extends BaseSupportOption<'int'> {
default: number;
array?: false;
range?: SupportOptionRange;
}
export interface IntArraySupportOption extends BaseSupportOption<'int'> {
default: Array<{ value: number[] }>;
array: true;
}
export interface BooleanSupportOption extends BaseSupportOption<'boolean'> {
default: boolean;
array?: false;
description: string;
oppositeDescription?: boolean;
}
export interface BooleanArraySupportOption extends BaseSupportOption<'boolean'> {
default: Array<{ value: boolean[] }>;
array: true;
}
export interface ChoiceSupportOption<Value = any> extends BaseSupportOption<'choice'> {
default: Value | Array<{ since: string; value: Value }>;
description: string;
choices: Array<{
since?: string;
value: Value;
description: string;
}>;
}
export interface PathSupportOption extends BaseSupportOption<'path'> {
default: string;
array?: false;
}
export interface PathArraySupportOption extends BaseSupportOption<'path'> {
default: Array<{ value: string[] }>;
array: true;
}
export type SupportOption =
| IntSupportOption
| IntArraySupportOption
| BooleanSupportOption
| BooleanArraySupportOption
| ChoiceSupportOption
| PathSupportOption
| PathArraySupportOption;
export interface SupportOptions extends Record<string, SupportOption> {}
export interface SupportInfo {
languages: SupportLanguage[];
options: SupportOption[];
}
export interface FileInfoOptions {
ignorePath?: string;
withNodeModules?: boolean;
plugins?: string[];
resolveConfig?: boolean;
}
export interface FileInfoResult {
ignored: boolean;
inferredParser: string | null;
}
export function getFileInfo(filePath: string, options?: FileInfoOptions): Promise<FileInfoResult>;
export namespace getFileInfo {
function sync(filePath: string, options?: FileInfoOptions): FileInfoResult;
}
/**
* Returns an object representing the parsers, languages and file types Prettier supports for the current version.
*/
export function getSupportInfo(): SupportInfo;
/**
* `version` field in `package.json`
*/
export const version: string;
// https://github.com/prettier/prettier/blob/master/src/common/util-shared.js
export namespace util {
function isNextLineEmpty(text: string, node: any, locEnd: (node: any) => number): boolean;
function isNextLineEmptyAfterIndex(text: string, index: number): boolean;
function isPreviousLineEmpty(text: string, node: any, locStart: (node: any) => number): boolean;
function getNextNonSpaceNonCommentCharacterIndex(text: string, node: any, options: ParserOptions): number;
function makeString(rawContent: string, enclosingQuote: "'" | '"', unescapeUnnecessaryEscapes: boolean): string;
function addLeadingComment(node: any, commentNode: any): void;
function addDanglingComment(node: any, commentNode: any): void;
function addTrailingComment(node: any, commentNode: any): void;
}
// https://github.com/prettier/prettier/blob/master/src/doc/index.js
export namespace doc {
namespace builders {
type Doc =
| string
| Align
| BreakParent
| Concat
| Fill
| Group
| IfBreak
| Indent
| Line
| LineSuffix
| LineSuffixBoundary
| Trim
| Cursor;
interface Align {
type: 'align';
contents: Doc;
n: number | string | { type: 'root' };
}
interface BreakParent {
type: 'break-parent';
}
interface Concat {
type: 'concat';
parts: Doc[];
}
interface Fill {
type: 'fill';
parts: Doc[];
}
interface Group {
type: 'group';
contents: Doc;
break: boolean;
expandedStates: Doc[];
}
interface IfBreak {
type: 'if-break';
breakContents: Doc;
flatContents: Doc;
}
interface Indent {
type: 'indent';
contents: Doc;
}
interface Line {
type: 'line';
soft?: boolean;
hard?: boolean;
literal?: boolean;
}
interface LineSuffix {
type: 'line-suffix';
contents: Doc;
}
interface LineSuffixBoundary {
type: 'line-suffix-boundary';
}
interface Trim {
type: 'trim';
}
interface Cursor {
type: 'cursor';
placeholder: symbol;
}
function addAlignmentToDoc(doc: Doc, size: number, tabWidth: number): Doc;
function align(n: Align['n'], contents: Doc): Align;
const breakParent: BreakParent;
function concat(contents: Doc[]): Concat;
function conditionalGroup(states: Doc[], opts?: { shouldBreak: boolean }): Group;
function dedent(contents: Doc): Align;
function dedentToRoot(contents: Doc): Align;
function fill(parts: Doc[]): Fill;
function group(contents: Doc, opts?: { shouldBreak: boolean }): Group;
const hardline: Concat;
function ifBreak(breakContents: Doc, flatContents: Doc): IfBreak;
function indent(contents: Doc): Indent;
function join(separator: Doc, parts: Doc[]): Concat;
const line: Line;
function lineSuffix(contents: Doc): LineSuffix;
const lineSuffixBoundary: LineSuffixBoundary;
const literalline: Concat;
function markAsRoot(contents: Doc): Align;
const softline: Line;
const trim: Trim;
const cursor: Cursor;
}
namespace debug {
function printDocToDebug(doc: Doc): string;
}
namespace printer {
function printDocToString(
doc: Doc,
options: Options,
): {
formatted: string;
cursorNodeStart?: number;
cursorNodeText?: string;
};
interface Options {
/**
* Specify the line length that the printer will wrap on.
* @default 80
*/
printWidth: number;
/**
* Specify the number of spaces per indentation-level.
* @default 2
*/
tabWidth: number;
/**
* Indent lines with tabs instead of spaces
* @default false
*/
useTabs: boolean;
parentParser?: string;
embeddedInHtml: boolean;
}
}
namespace utils {
function isEmpty(doc: Doc): boolean;
function isLineNext(doc: Doc): boolean;
function willBreak(doc: Doc): boolean;
function traverseDoc(
doc: Doc,
onEnter?: (doc: Doc) => void | boolean,
onExit?: (doc: Doc) => void,
shouldTraverseConditionalGroups?: boolean,
): void;
function mapDoc<T>(doc: Doc, callback: (doc: Doc) => T): T;
function propagateBreaks(doc: Doc): void;
function removeLines(doc: Doc): Doc;
function stripTrailingHardline(doc: Doc): Doc;
}
}

View File

@ -0,0 +1,49 @@
{
"name": "@types/prettier",
"version": "2.1.6",
"description": "TypeScript definitions for prettier",
"license": "MIT",
"contributors": [
{
"name": "Ika",
"url": "https://github.com/ikatyang",
"githubUsername": "ikatyang"
},
{
"name": "Ifiok Jr.",
"url": "https://github.com/ifiokjr",
"githubUsername": "ifiokjr"
},
{
"name": "Florian Keller",
"url": "https://github.com/ffflorian",
"githubUsername": "ffflorian"
},
{
"name": "Sosuke Suzuki",
"url": "https://github.com/sosukesuzuki",
"githubUsername": "sosukesuzuki"
},
{
"name": "Christopher Quadflieg",
"url": "https://github.com/Shinigami92",
"githubUsername": "Shinigami92"
},
{
"name": "Kevin Deisz",
"url": "https://github.com/kddeisz",
"githubUsername": "kddeisz"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/prettier"
},
"scripts": {},
"dependencies": {},
"typesPublisherContentHash": "ef4aeeeb305d3bc4dbe7aa951248a1ea6f56f3d6ea1d6c2b3d38decaaabb8389",
"typeScriptVersion": "3.3"
}

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,4 @@
import { Parser } from './';
declare const parser: { parsers: { [parserName: string]: Parser } };
export = parser;

View File

@ -0,0 +1,27 @@
import { CursorOptions, CursorResult, Options, Plugin } from './';
/**
* formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code.
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted
*
* The cursorOffset option should be provided, to specify where the cursor is. This option cannot be used with rangeStart and rangeEnd.
*
* ```js
* prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });
* ```
* `-> { formatted: '1;\n', cursorOffset: 1 }`
*/
export function formatWithCursor(source: string, options: CursorOptions): CursorResult;
/**
* `format` is used to format text using Prettier. [Options](https://github.com/prettier/prettier#options) may be provided to override the defaults.
*/
export function format(source: string, options?: Options): string;
/**
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
*/
export function check(source: string, options?: Options): boolean;
export as namespace prettier;

View File

@ -0,0 +1,72 @@
// Type definitions for weak-napi 2.0
// Project: https://github.com/node-ffi-napi/weak-napi
// Definitions by: Hieu Lam <https://github.com/lamhieu-vk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/// <reference types="node" />
declare class WeakRef<T> {}
/**
* Makes weak references to JavaScript Objects
* @param object can be a regular Object, an Array, a Function, a RegExp, or any of the primitive types or constructor function created with new
* @param callback a callback function to be invoked before the object is garbage collected
*/
declare function weak<T extends object>(object: T, callback?: () => void): WeakRef<T>;
declare namespace weak {
// export alias
const create: typeof weak;
/**
* Returns the actual reference to the Object that this weak reference was created with. If this is called with a dead reference, undefined is returned.
* @param ref weak reference object
*/
function get<T>(ref: WeakRef<T>): T | undefined;
/**
* Checks to see if ref is a dead reference. Returns true if the original Object has already been GC'd, false otherwise
* @param ref weak reference object
*/
function isDead(ref: WeakRef<any>): ref is WeakRef<undefined>;
/**
* Checks to see if ref is "near death". This will be true exactly during the weak reference callback function, and false any other time.
* @param ref weak reference object
*/
function isNearDeath(ref: WeakRef<any>): false;
/**
* Checks to see if obj is "weak reference" instance. Returns true if the passed in object is a "weak reference", false otherwise.
* @param obj object to check
*/
function isWeakRef(obj: any): obj is WeakRef<any>;
/**
* Adds callback to the Array of callback functions that will be invoked before the Object gets garbage collected. The callbacks get executed in the order that they are added.
* @param ref weak reference object
* @param callback function to be called
*/
function addCallback(ref: WeakRef<any>, callback: () => void): NodeJS.EventEmitter;
/**
* Removes callback from the Array of callback functions that will be invoked before the Object gets garbage collected.
* @param ref weak reference object
* @param callback function to be called
*/
function removeCallback(ref: WeakRef<any>, callback: () => void): NodeJS.EventEmitter;
/**
* Empties the Array of callback functions that will be invoked before the Object gets garbage collected.
* @param ref weak reference object
*/
function removeCallbacks(ref: WeakRef<any>): NodeJS.EventEmitter;
/**
* Returns an Array that ref iterates through to invoke the GC callbacks. This utilizes node's EventEmitter#listeners() function and therefore returns a copy in node 0.10 and newer.
* @param ref weak reference object
*/
function callbacks(ref: WeakRef<any>): Array<(() => void)>;
}
export = weak;

View File

@ -0,0 +1,26 @@
{
"name": "@types/weak-napi",
"version": "2.0.0",
"description": "TypeScript definitions for weak-napi",
"license": "MIT",
"contributors": [
{
"name": "Hieu Lam",
"url": "https://github.com/lamhieu-vk",
"githubUsername": "lamhieu-vk"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/weak-napi"
},
"scripts": {},
"dependencies": {
"@types/node": "*"
},
"typesPublisherContentHash": "6e648bfba891df08873733285250889407a77233f3dcb8992cb4df1be6bfc692",
"typeScriptVersion": "3.0"
}

View File

@ -0,0 +1,8 @@
import { PluginObj } from '@babel/core';
import { TemplateBuilder } from '@babel/template';
import { TSExportAssignment } from '@babel/types';
declare const _default: ({ template }: {
template: TemplateBuilder<TSExportAssignment>;
}) => PluginObj<{}>;
export = _default;
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;;;;AAElD,kBAiBE"}

View File

@ -0,0 +1,15 @@
"use strict";
module.exports = ({ template }) => {
const moduleExportsDeclaration = template(`
module.exports = ASSIGNMENT;
`);
return {
name: 'replace-ts-export-assignment',
visitor: {
TSExportAssignment(path) {
path.replaceWith(moduleExportsDeclaration({ ASSIGNMENT: path.node.expression }));
}
}
};
};
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAIA,iBAAS,CACP,EAAE,QAAQ,EAAqD,EACpD,EAAE;IACb,MAAM,wBAAwB,GAAG,QAAQ,CAAC;;GAEzC,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE;YACP,kBAAkB,CAAC,IAAkC;gBACnD,IAAI,CAAC,WAAW,CACd,wBAAwB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAC/D,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}

View File

@ -0,0 +1,83 @@
{
"name": "babel-plugin-replace-ts-export-assignment",
"version": "0.0.2",
"description": "Allows export assignment syntax to be used when compiling TypeScript with babel",
"keywords": [
"Babel",
"TypeScript"
],
"homepage": "https://github.com/G-Rath/babel-plugin-replace-ts-export-assignment#readme",
"bugs": {
"url": "https://github.com/G-Rath/babel-plugin-replace-ts-export-assignment/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/G-Rath/babel-plugin-replace-ts-export-assignment.git"
},
"license": "ISC",
"author": "Gareth Jones",
"files": [
"lib"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib",
"test": "test"
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"check": "tsc -p tsconfig.build.json --noEmit",
"lint": "npm run lint:all --silent",
"lint:all": "eslint \"**/*.{t,j}s\"",
"lint:staged": "lint-staged",
"test": "jest",
"version": "cd scripts && ts-node npm-version.ts"
},
"jest": {
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json",
"jsx",
"node"
],
"moduleNameMapper": {
"^@src/(.*)$": "<rootDir>/src/$1",
"^@test/(.*)$": "<rootDir>/test/$1"
},
"resetMocks": true,
"restoreMocks": true,
"setupFilesAfterEnv": [
"./test/setupExpectEachTestHasAssertions.ts"
],
"testRunner": "jest-circus/runner",
"transform": {
"\\.tsx?": "ts-jest"
}
},
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/template": "^7.4.4",
"@babel/types": "^7.5.5",
"@babel/preset-typescript": "^7.3.3",
"@types/dedent": "^0.7.0",
"@types/jest": "^24.0.17",
"@types/node": "^12.7.1",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"dedent": "^0.7.0",
"eslint": "^6.1.0",
"eslint-plugin-jest": "^22.15.0",
"husky": "^3.0.3",
"jest": "^24.8.0",
"jest-circus": "^24.8.0",
"jest-junit": "^7.0.0",
"lint-staged": "^9.2.1",
"ts-jest": "^24.0.2",
"ts-node": "^8.3.0",
"typescript": "^3.5.3"
}
}

View File

@ -0,0 +1,40 @@
const handledByTransformTypescript = path =>
path.node.declare || path.node.id.type === 'StringLiteral';
const visitor = {
TSModuleDeclaration: {
enter(modulePath) {
if (!handledByTransformTypescript(modulePath)) {
// Make sure there are only allowed node types inside
modulePath.get('body').traverse({
enter(path) {
if (!path.isModuleDeclaration()) {
throw path.buildCodeFrameError(
'Namespaces must only contain type and interface declarations'
);
}
},
blacklist: [
'TSModuleDeclaration', // nested ones will get their own visitor passes
'TSTypeAliasDeclaration',
'TSInterfaceDeclaration',
],
});
}
},
exit(modulePath) {
if (!handledByTransformTypescript(modulePath)) {
modulePath.remove();
}
},
},
};
module.exports = ({ types: t }) => ({
visitor: {
// Gotta run before plugin-transform-typescript
Program(path) {
path.traverse(visitor);
},
},
});

View File

@ -0,0 +1,19 @@
{
"name": "babel-plugin-typescript-strip-namespaces",
"version": "1.1.1",
"description": "A Babel plugin to strip away TypeScript namespaces that declare only types",
"main": "index.js",
"repository": "https://github.com/jeysal/babel-plugin-typescript-strip-namespaces",
"author": "Tim Seckinger <seckinger.tim@gmail.com>",
"license": "MIT",
"peerDependencies": {
"@babel/core": "^7.0.0"
},
"devDependencies": {
"@babel/core": "^7.3.0",
"@babel/plugin-syntax-typescript": "^7.3.0",
"@babel/plugin-transform-typescript": "^7.3.0",
"jest": "^24.1.0",
"prettier": "^1.16.4"
}
}

View File

@ -0,0 +1,256 @@
import objectInspect from "object-inspect";
import { Incident as Interface, StaticIncident as StaticInterface } from "./types";
/**
* Default message formatter.
*
* This uses `object-inspect` to print the `data` object.
*
* @param data Data object associated with the error.
* @return String representation of the data object.
*/
export function format(data: any): string {
return objectInspect(data, {depth: 30});
}
/**
* Define a hidden property.
*
* @param obj
* @param propertyName
* @param value
*/
function defineHiddenProperty(obj: object, propertyName: string, value: any) {
Object.defineProperty(obj, propertyName, {
value,
configurable: true,
enumerable: false,
writable: true,
});
}
/**
* Define a normal property.
*
* @param obj
* @param propertyName
* @param value
*/
function defineSimpleProperty(obj: object, propertyName: string, value: any) {
Object.defineProperty(obj, propertyName, {
value,
configurable: true,
enumerable: true,
writable: true,
});
}
/**
* A symbol used internally to prevent the capture of the call stack.
*/
const noStackSymbol: object = {};
// Incident factory, allows a fine control over the getter / setters
// and will eventually allow to have TypeError, SyntaxError, etc. as super classes.
function createIncident(_super: Function): StaticInterface {
Object.setPrototypeOf(Incident, _super);
function __(this: typeof __): void {
this.constructor = Incident;
}
__.prototype = _super.prototype;
Incident.prototype = new (__ as any)();
// tslint:disable-next-line:max-line-length
interface PrivateIncident<D extends object, N extends string = string, C extends (Error | undefined) = (Error | undefined)> extends Interface<D, N, C> {
/**
* `(data: D) => string`: A lazy formatter, called once when needed. Its result replaces `_message`
* `string`: The resolved error message.
*/
_message: string | ((data: D) => string);
/**
* `undefined`: The stack is not resolved yet, clean the stack when resolving
* `null`: The stack is not resolved yet, do not clean the stack when resolving
* `string`: The stack is resolved stack
*/
_stack?: string | null;
/**
* An error containing an untouched stack
*/
_stackContainer?: {stack?: string};
}
function Incident<D extends object, N extends string, C extends (Error | undefined) = (Error | undefined)>(
this: PrivateIncident<D, N, C>,
// tslint:disable-next-line:trailing-comma
...args: any[]
): Interface<D, N, C> | void {
if (!(this instanceof Incident)) {
switch (args.length) {
case 0:
return new (Incident as any)(noStackSymbol);
case 1:
if (args[0] instanceof Error) {
const err: Error & PrivateIncident<D, N, C> = args[0] as any;
let converted: PrivateIncident<D, N, C>;
const name: string = err.name;
const message: string | ((data: D) => string) = typeof err._message === "function"
? err._message
: err.message;
if (err.cause instanceof Error) {
if (typeof err.data === "object") {
converted = new (Incident as any)(noStackSymbol, err.cause, name, err.data, message);
} else {
converted = new (Incident as any)(noStackSymbol, err.cause, name, message);
}
} else {
if (typeof err.data === "object") {
converted = new (Incident as any)(noStackSymbol, name, err.data, message);
} else {
converted = new (Incident as any)(noStackSymbol, name, message);
}
}
if (err._stackContainer !== undefined) {
converted._stackContainer = (args[0] as any)._stackContainer;
} else if (err._stack === undefined) {
converted._stackContainer = args[0];
converted._stack = null; // Use the stack as-is
} else {
converted._stack = err._stack;
}
return converted;
}
return new (Incident as any)(noStackSymbol, args[0]);
case 2:
return new (Incident as any)(noStackSymbol, args[0], args[1]);
case 3:
return new (Incident as any)(noStackSymbol, args[0], args[1], args[2]);
default:
return new (Incident as any)(noStackSymbol, args[0], args[1], args[2], args[3]);
}
}
let noStack: boolean = false;
let name: N;
let data: D | undefined = undefined;
let cause: C | undefined = undefined;
let message: string | ((data: D) => string);
const argCount: number = args.length;
let argIndex: number = 0;
if (argCount > 0 && args[0] === noStackSymbol) {
noStack = true;
argIndex++;
}
if (argIndex < argCount && args[argIndex] instanceof Error) {
cause = args[argIndex++];
}
if (typeof args[argIndex] !== "string") {
throw new TypeError("Missing required `name` argument to `Incident`.");
}
name = args[argIndex++];
if (argIndex < argCount && typeof args[argIndex] === "object") {
data = args[argIndex++];
}
if (argIndex < argCount && (typeof args[argCount - 1] === "string" || typeof args[argCount - 1] === "function")) {
message = args[argIndex];
} else {
if (data !== undefined) {
message = format;
} else {
message = "";
}
}
if (data === undefined) {
data = {} as D;
}
_super.call(this, typeof message === "function" ? "<non-evaluated lazy message>" : message);
this.name = name;
defineHiddenProperty(this, "_message", message);
this.data = data;
if (cause !== undefined) {
this.cause = cause;
}
defineHiddenProperty(this, "_stack", undefined);
defineHiddenProperty(this, "_stackContainer", noStack ? undefined : new Error());
}
Incident.prototype.toString = Error.prototype.toString;
function getMessage(this: PrivateIncident<object>): string {
if (typeof this._message === "function") {
this._message = this._message(this.data);
}
defineSimpleProperty(this, "message", this._message);
return this._message;
}
function setMessage<D extends object>(this: PrivateIncident<D>, message: string | ((data: D) => string)): void {
this._message = message;
}
function getStack(this: PrivateIncident<object>): string {
if (this._stack === undefined || this._stack === null) {
if (this._stackContainer !== undefined && this._stackContainer.stack !== undefined) {
// This removes the firs lines corresponding to: "Error\n at new Incident [...]"
if (this._stack === null) {
// `null` indicates that the stack has to be used without any transformation
// This usually occurs when the stack container is an error that was converted
this._stack = this._stackContainer.stack;
} else {
const stack: string = this._stackContainer.stack.replace(/^[^\n]+\n[^\n]+\n/, "");
this._stack = this.message === "" ?
`${this.name}\n${stack}` :
`${this.name}: ${this.message}\n${stack}`;
}
} else {
this._stack = this.message === "" ? this.name : `${this.name}: ${this.message}`;
}
if (this.cause !== undefined && this.cause.stack !== undefined) {
this._stack = `${this._stack}\n caused by ${this.cause.stack}`;
}
}
Object.defineProperty(this, "stack", {
configurable: true,
value: this._stack,
writable: true,
});
return this._stack;
}
function setStack(this: PrivateIncident<object>, stack: string): void {
this._stackContainer = undefined;
this._stack = stack;
}
Object.defineProperty(Incident.prototype, "message", {
get: getMessage,
set: setMessage,
enumerable: true,
configurable: true,
});
Object.defineProperty(Incident.prototype, "stack", {
get: getStack,
set: setStack,
enumerable: true,
configurable: true,
});
return Incident as any;
}
// tslint:disable-next-line:variable-name
export const Incident: StaticInterface = createIncident(Error);
// tslint:disable-next-line:max-line-length
export interface Incident<D extends object, N extends string = string, C extends (Error | undefined) = (Error | undefined)>
extends Interface<D, N, C> {
}

View File

@ -0,0 +1,8 @@
import { format, Incident } from "./incident";
export { format, Incident } from "./incident";
export { StaticIncident } from "./types";
const DEFAULT: any = {format, Incident};
export { DEFAULT as default };

View File

@ -0,0 +1,39 @@
// tslint:disable:max-line-length
export interface Plain<D extends object, N extends string = string, C extends (Error | undefined) = (Error | undefined)> {
message: string;
name: N;
data: D;
cause: C;
stack: string;
}
// tslint:disable:max-line-length
export interface Incident<D extends object, N extends string = string, C extends (Error | undefined) = (Error | undefined)>
extends Error, Plain<D, N, C> {
name: N;
stack: string;
toString(): string;
}
// tslint:disable:comment-format max-line-length typedef-whitespace space-within-parens
export interface StaticIncident {
new< N extends string, C extends Error>(cause: C, name: N, message?: string | ((data: object) => string)): Incident<object, N, C >;
new< N extends string >( name: N, message?: string | ((data: object) => string)): Incident<object, N, undefined>;
new<D extends object, N extends string, C extends Error>(cause: C, name: N, data: D, message?: string | ((data: D ) => string)): Incident<D, N, C >;
new<D extends object, N extends string >( name: N, data: D, message?: string | ((data: D ) => string)): Incident<D, N, undefined>;
< N extends string, C extends Error>(cause: C, name: N, message?: string | ((data: object) => string)): Incident<object, N, C >;
< N extends string >( name: N, message?: string | ((data: object) => string)): Incident<object, N, undefined>;
<D extends object, N extends string, C extends Error>(cause: C, name: N, data: D, message?: string | ((data: D ) => string)): Incident<D, N, C >;
<D extends object, N extends string >( name: N, data: D, message?: string | ((data: D ) => string)): Incident<D, N, undefined>;
<D extends object, N extends string, C extends Error | undefined>(error: Error & {name: N; data: D; cause: C}): Incident<D, N, C >;
<D extends object, N extends string >(error: Error & {name: N; data: D }): Incident<D, N, undefined>;
<D extends object, C extends Error | undefined>(error: Error & { data: D; cause: C}): Incident<D, string, C >;
< N extends string, C extends Error | undefined>(error: Error & {name: N; cause: C}): Incident<object, N, C >;
<D extends object >(error: Error & { data: D }): Incident<D, string, undefined>;
< N extends string >(error: Error & {name: N }): Incident<object, N, undefined>;
< C extends Error | undefined>(error: Error & { cause: C}): Incident<object, string, C >;
(error: Error ): Incident<object, string, undefined>;
}
// tslint:enable

View File

@ -0,0 +1,13 @@
import { Incident as Interface, StaticIncident as StaticInterface } from "./types";
/**
* Default message formatter.
*
* This uses `object-inspect` to print the `data` object.
*
* @param data Data object associated with the error.
* @return String representation of the data object.
*/
export declare function format(data: any): string;
export declare const Incident: StaticInterface;
export interface Incident<D extends object, N extends string = string, C extends (Error | undefined) = (Error | undefined)> extends Interface<D, N, C> {
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
export { format, Incident } from "./incident";
export { StaticIncident } from "./types";
declare const DEFAULT: any;
export { DEFAULT as default };

10
debian/build_modules/incident/index.js vendored Normal file
View File

@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const incident_1 = require("./incident");
var incident_2 = require("./incident");
exports.format = incident_2.format;
exports.Incident = incident_2.Incident;
const DEFAULT = { format: incident_1.format, Incident: incident_1.Incident };
exports.default = DEFAULT;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIl9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBOEM7QUFFOUMsdUNBQThDO0FBQXJDLDRCQUFBLE1BQU0sQ0FBQTtBQUFFLDhCQUFBLFFBQVEsQ0FBQTtBQUd6QixNQUFNLE9BQU8sR0FBUSxFQUFDLE1BQU0sRUFBTixpQkFBTSxFQUFFLFFBQVEsRUFBUixtQkFBUSxFQUFDLENBQUM7QUFFcEIsMEJBQU8iLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBmb3JtYXQsIEluY2lkZW50IH0gZnJvbSBcIi4vaW5jaWRlbnRcIjtcblxuZXhwb3J0IHsgZm9ybWF0LCBJbmNpZGVudCB9IGZyb20gXCIuL2luY2lkZW50XCI7XG5leHBvcnQgeyBTdGF0aWNJbmNpZGVudCB9IGZyb20gXCIuL3R5cGVzXCI7XG5cbmNvbnN0IERFRkFVTFQ6IGFueSA9IHtmb3JtYXQsIEluY2lkZW50fTtcblxuZXhwb3J0IHsgREVGQVVMVCBhcyBkZWZhdWx0IH07XG4iXSwic291cmNlUm9vdCI6IiJ9

View File

@ -0,0 +1,6 @@
import { format, Incident } from "./incident";
export { format, Incident } from "./incident";
const DEFAULT = { format, Incident };
export { DEFAULT as default };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIl9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFFOUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFHOUMsTUFBTSxPQUFPLEdBQVEsRUFBQyxNQUFNLEVBQUUsUUFBUSxFQUFDLENBQUM7QUFFeEMsT0FBTyxFQUFFLE9BQU8sSUFBSSxPQUFPLEVBQUUsQ0FBQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGZvcm1hdCwgSW5jaWRlbnQgfSBmcm9tIFwiLi9pbmNpZGVudFwiO1xuXG5leHBvcnQgeyBmb3JtYXQsIEluY2lkZW50IH0gZnJvbSBcIi4vaW5jaWRlbnRcIjtcbmV4cG9ydCB7IFN0YXRpY0luY2lkZW50IH0gZnJvbSBcIi4vdHlwZXNcIjtcblxuY29uc3QgREVGQVVMVDogYW55ID0ge2Zvcm1hdCwgSW5jaWRlbnR9O1xuXG5leHBvcnQgeyBERUZBVUxUIGFzIGRlZmF1bHQgfTtcbiJdLCJzb3VyY2VSb290IjoiIn0=

View File

@ -0,0 +1,48 @@
{
"name": "incident",
"version": "3.2.1",
"description": "Errors with superpowers",
"private": false,
"main": "index",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/demurgos/incident"
},
"keywords": [
"error"
],
"pre-commit": {
"run": [
"lint"
]
},
"author": "Charles Samborski <demurgos@demurgos.net> (https://demurgos.net)",
"license": "MIT",
"dependencies": {
"@types/object-inspect": "^1.4.0",
"object-inspect": "^1.6.0"
},
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/gulp": "^4.0.6",
"@types/minimist": "^1.2.0",
"@types/mocha": "^5.2.6",
"chai": "^4.2.0",
"codecov": "^3.4.0",
"gulp": "^4.0.2",
"gulp-cli": "^2.2.0",
"minimist": "^1.2.0",
"pre-commit": "^1.2.2",
"ts-node": "^8.1.0",
"turbo-gulp": "^0.20.1",
"typescript": "^3.4.5"
},
"c88": {
"match": [
"build/test/lib/*.{js,mjs}",
"build/test/lib/**/*.{js,mjs}"
]
},
"gitHead": "44dff3abfc8612760fd2dc4434d4085f9f07e5e9"
}

View File

@ -0,0 +1,49 @@
export interface Plain<D extends object, N extends string = string, C extends (Error | undefined) = (Error | undefined)> {
message: string;
name: N;
data: D;
cause: C;
stack: string;
}
export interface Incident<D extends object, N extends string = string, C extends (Error | undefined) = (Error | undefined)> extends Error, Plain<D, N, C> {
name: N;
stack: string;
toString(): string;
}
export interface StaticIncident {
new <N extends string, C extends Error>(cause: C, name: N, message?: string | ((data: object) => string)): Incident<object, N, C>;
new <N extends string>(name: N, message?: string | ((data: object) => string)): Incident<object, N, undefined>;
new <D extends object, N extends string, C extends Error>(cause: C, name: N, data: D, message?: string | ((data: D) => string)): Incident<D, N, C>;
new <D extends object, N extends string>(name: N, data: D, message?: string | ((data: D) => string)): Incident<D, N, undefined>;
<N extends string, C extends Error>(cause: C, name: N, message?: string | ((data: object) => string)): Incident<object, N, C>;
<N extends string>(name: N, message?: string | ((data: object) => string)): Incident<object, N, undefined>;
<D extends object, N extends string, C extends Error>(cause: C, name: N, data: D, message?: string | ((data: D) => string)): Incident<D, N, C>;
<D extends object, N extends string>(name: N, data: D, message?: string | ((data: D) => string)): Incident<D, N, undefined>;
<D extends object, N extends string, C extends Error | undefined>(error: Error & {
name: N;
data: D;
cause: C;
}): Incident<D, N, C>;
<D extends object, N extends string>(error: Error & {
name: N;
data: D;
}): Incident<D, N, undefined>;
<D extends object, C extends Error | undefined>(error: Error & {
data: D;
cause: C;
}): Incident<D, string, C>;
<N extends string, C extends Error | undefined>(error: Error & {
name: N;
cause: C;
}): Incident<object, N, C>;
<D extends object>(error: Error & {
data: D;
}): Incident<D, string, undefined>;
<N extends string>(error: Error & {
name: N;
}): Incident<object, N, undefined>;
<C extends Error | undefined>(error: Error & {
cause: C;
}): Incident<object, string, C>;
(error: Error): Incident<object, string, undefined>;
}

View File

@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:enable
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIl9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFzQ0EsZ0JBQWdCIiwiZmlsZSI6InR5cGVzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gdHNsaW50OmRpc2FibGU6bWF4LWxpbmUtbGVuZ3RoXG5leHBvcnQgaW50ZXJmYWNlIFBsYWluPEQgZXh0ZW5kcyBvYmplY3QsIE4gZXh0ZW5kcyBzdHJpbmcgPSBzdHJpbmcsIEMgZXh0ZW5kcyAoRXJyb3IgfCB1bmRlZmluZWQpID0gKEVycm9yIHwgdW5kZWZpbmVkKT4ge1xuICBtZXNzYWdlOiBzdHJpbmc7XG4gIG5hbWU6IE47XG4gIGRhdGE6IEQ7XG4gIGNhdXNlOiBDO1xuICBzdGFjazogc3RyaW5nO1xufVxuXG4vLyB0c2xpbnQ6ZGlzYWJsZTptYXgtbGluZS1sZW5ndGhcbmV4cG9ydCBpbnRlcmZhY2UgSW5jaWRlbnQ8RCBleHRlbmRzIG9iamVjdCwgTiBleHRlbmRzIHN0cmluZyA9IHN0cmluZywgQyBleHRlbmRzIChFcnJvciB8IHVuZGVmaW5lZCkgPSAoRXJyb3IgfCB1bmRlZmluZWQpPlxuICBleHRlbmRzIEVycm9yLCBQbGFpbjxELCBOLCBDPiB7XG4gIG5hbWU6IE47XG4gIHN0YWNrOiBzdHJpbmc7XG5cbiAgdG9TdHJpbmcoKTogc3RyaW5nO1xufVxuXG4vLyB0c2xpbnQ6ZGlzYWJsZTpjb21tZW50LWZvcm1hdCBtYXgtbGluZS1sZW5ndGggdHlwZWRlZi13aGl0ZXNwYWNlIHNwYWNlLXdpdGhpbi1wYXJlbnNcbmV4cG9ydCBpbnRlcmZhY2UgU3RhdGljSW5jaWRlbnQge1xuICBuZXc8ICAgICAgICAgICAgICAgICAgTiBleHRlbmRzIHN0cmluZywgQyBleHRlbmRzIEVycm9yPihjYXVzZTogQywgbmFtZTogTiwgICAgICAgICAgbWVzc2FnZT86IHN0cmluZyB8ICgoZGF0YTogb2JqZWN0KSA9PiBzdHJpbmcpKTogSW5jaWRlbnQ8b2JqZWN0LCBOLCBDICAgICAgICA+O1xuICBuZXc8ICAgICAgICAgICAgICAgICAgTiBleHRlbmRzIHN0cmluZyAgICAgICAgICAgICAgICAgPiggICAgICAgICAgbmFtZTogTiwgICAgICAgICAgbWVzc2FnZT86IHN0cmluZyB8ICgoZGF0YTogb2JqZWN0KSA9PiBzdHJpbmcpKTogSW5jaWRlbnQ8b2JqZWN0LCBOLCB1bmRlZmluZWQ+O1xuICBuZXc8RCBleHRlbmRzIG9iamVjdCwgTiBleHRlbmRzIHN0cmluZywgQyBleHRlbmRzIEVycm9yPihjYXVzZTogQywgbmFtZTogTiwgZGF0YTogRCwgbWVzc2FnZT86IHN0cmluZyB8ICgoZGF0YTogRCAgICAgKSA9PiBzdHJpbmcpKTogSW5jaWRlbnQ8RCwgICAgICBOLCBDICAgICAgICA+O1xuICBuZXc8RCBleHRlbmRzIG9iamVjdCwgTiBleHRlbmRzIHN0cmluZyAgICAgICAgICAgICAgICAgPiggICAgICAgICAgbmFtZTogTiwgZGF0YTogRCwgbWVzc2FnZT86IHN0cmluZyB8ICgoZGF0YTogRCAgICAgKSA9PiBzdHJpbmcpKTogSW5jaWRlbnQ8RCwgICAgICBOLCB1bmRlZmluZWQ+O1xuICAgICA8ICAgICAgICAgICAgICAgICAgTiBleHRlbmRzIHN0cmluZywgQyBleHRlbmRzIEVycm9yPihjYXVzZTogQywgbmFtZTogTiwgICAgICAgICAgbWVzc2FnZT86IHN0cmluZyB8ICgoZGF0YTogb2JqZWN0KSA9PiBzdHJpbmcpKTogSW5jaWRlbnQ8b2JqZWN0LCBOLCBDICAgICAgICA+O1xuICAgICA8ICAgICAgICAgICAgICAgICAgTiBleHRlbmRzIHN0cmluZyAgICAgICAgICAgICAgICAgPiggICAgICAgICAgbmFtZTogTiwgICAgICAgICAgbWVzc2FnZT86IHN0cmluZyB8ICgoZGF0YTogb2JqZWN0KSA9PiBzdHJpbmcpKTogSW5jaWRlbnQ8b2JqZWN0LCBOLCB1bmRlZmluZWQ+O1xuICAgICA8RCBleHRlbmRzIG9iamVjdCwgTiBleHRlbmRzIHN0cmluZywgQyBleHRlbmRzIEVycm9yPihjYXVzZTogQywgbmFtZTogTiwgZGF0YTogRCwgbWVzc2FnZT86IHN0cmluZyB8ICgoZGF0YTogRCAgICAgKSA9PiBzdHJpbmcpKTogSW5jaWRlbnQ8RCwgICAgICBOLCBDICAgICAgICA+O1xuICAgICA8RCBleHRlbmRzIG9iamVjdCwgTiBleHRlbmRzIHN0cmluZyAgICAgICAgICAgICAgICAgPiggICAgICAgICAgbmFtZTogTiwgZGF0YTogRCwgbWVzc2FnZT86IHN0cmluZyB8ICgoZGF0YTogRCAgICAgKSA9PiBzdHJpbmcpKTogSW5jaWRlbnQ8RCwgICAgICBOLCB1bmRlZmluZWQ+O1xuXG4gIDxEIGV4dGVuZHMgb2JqZWN0LCBOIGV4dGVuZHMgc3RyaW5nLCBDIGV4dGVuZHMgRXJyb3IgfCB1bmRlZmluZWQ+KGVycm9yOiBFcnJvciAmIHtuYW1lOiBOOyBkYXRhOiBEOyBjYXVzZTogQ30pOiBJbmNpZGVudDxELCAgICAgIE4sICAgICAgQyAgICAgICAgPjtcbiAgPEQgZXh0ZW5kcyBvYmplY3QsIE4gZXh0ZW5kcyBzdHJpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgID4oZXJyb3I6IEVycm9yICYge25hbWU6IE47IGRhdGE6IEQgICAgICAgICAgfSk6IEluY2lkZW50PEQsICAgICAgTiwgICAgICB1bmRlZmluZWQ+O1xuICA8RCBleHRlbmRzIG9iamVjdCwgICAgICAgICAgICAgICAgICAgQyBleHRlbmRzIEVycm9yIHwgdW5kZWZpbmVkPihlcnJvcjogRXJyb3IgJiB7ICAgICAgICAgZGF0YTogRDsgY2F1c2U6IEN9KTogSW5jaWRlbnQ8RCwgICAgICBzdHJpbmcsIEMgICAgICAgID47XG4gIDwgICAgICAgICAgICAgICAgICBOIGV4dGVuZHMgc3RyaW5nLCBDIGV4dGVuZHMgRXJyb3IgfCB1bmRlZmluZWQ+KGVycm9yOiBFcnJvciAmIHtuYW1lOiBOOyAgICAgICAgICBjYXVzZTogQ30pOiBJbmNpZGVudDxvYmplY3QsIE4sICAgICAgQyAgICAgICAgPjtcbiAgPEQgZXh0ZW5kcyBvYmplY3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID4oZXJyb3I6IEVycm9yICYgeyAgICAgICAgIGRhdGE6IEQgICAgICAgICAgfSk6IEluY2lkZW50PEQsICAgICAgc3RyaW5nLCB1bmRlZmluZWQ+O1xuICA8ICAgICAgICAgICAgICAgICAgTiBleHRlbmRzIHN0cmluZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPihlcnJvcjogRXJyb3IgJiB7bmFtZTogTiAgICAgICAgICAgICAgICAgICB9KTogSW5jaWRlbnQ8b2JqZWN0LCBOLCAgICAgIHVuZGVmaW5lZD47XG4gIDwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDIGV4dGVuZHMgRXJyb3IgfCB1bmRlZmluZWQ+KGVycm9yOiBFcnJvciAmIHsgICAgICAgICAgICAgICAgICBjYXVzZTogQ30pOiBJbmNpZGVudDxvYmplY3QsIHN0cmluZywgQyAgICAgICAgPjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZXJyb3I6IEVycm9yICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICk6IEluY2lkZW50PG9iamVjdCwgc3RyaW5nLCB1bmRlZmluZWQ+O1xufVxuLy8gdHNsaW50OmVuYWJsZVxuIl0sInNvdXJjZVJvb3QiOiIifQ==

View File

@ -0,0 +1,3 @@
// tslint:enable
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIl9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBc0NBLGdCQUFnQiIsImZpbGUiOiJ0eXBlcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIHRzbGludDpkaXNhYmxlOm1heC1saW5lLWxlbmd0aFxuZXhwb3J0IGludGVyZmFjZSBQbGFpbjxEIGV4dGVuZHMgb2JqZWN0LCBOIGV4dGVuZHMgc3RyaW5nID0gc3RyaW5nLCBDIGV4dGVuZHMgKEVycm9yIHwgdW5kZWZpbmVkKSA9IChFcnJvciB8IHVuZGVmaW5lZCk+IHtcbiAgbWVzc2FnZTogc3RyaW5nO1xuICBuYW1lOiBOO1xuICBkYXRhOiBEO1xuICBjYXVzZTogQztcbiAgc3RhY2s6IHN0cmluZztcbn1cblxuLy8gdHNsaW50OmRpc2FibGU6bWF4LWxpbmUtbGVuZ3RoXG5leHBvcnQgaW50ZXJmYWNlIEluY2lkZW50PEQgZXh0ZW5kcyBvYmplY3QsIE4gZXh0ZW5kcyBzdHJpbmcgPSBzdHJpbmcsIEMgZXh0ZW5kcyAoRXJyb3IgfCB1bmRlZmluZWQpID0gKEVycm9yIHwgdW5kZWZpbmVkKT5cbiAgZXh0ZW5kcyBFcnJvciwgUGxhaW48RCwgTiwgQz4ge1xuICBuYW1lOiBOO1xuICBzdGFjazogc3RyaW5nO1xuXG4gIHRvU3RyaW5nKCk6IHN0cmluZztcbn1cblxuLy8gdHNsaW50OmRpc2FibGU6Y29tbWVudC1mb3JtYXQgbWF4LWxpbmUtbGVuZ3RoIHR5cGVkZWYtd2hpdGVzcGFjZSBzcGFjZS13aXRoaW4tcGFyZW5zXG5leHBvcnQgaW50ZXJmYWNlIFN0YXRpY0luY2lkZW50IHtcbiAgbmV3PCAgICAgICAgICAgICAgICAgIE4gZXh0ZW5kcyBzdHJpbmcsIEMgZXh0ZW5kcyBFcnJvcj4oY2F1c2U6IEMsIG5hbWU6IE4sICAgICAgICAgIG1lc3NhZ2U/OiBzdHJpbmcgfCAoKGRhdGE6IG9iamVjdCkgPT4gc3RyaW5nKSk6IEluY2lkZW50PG9iamVjdCwgTiwgQyAgICAgICAgPjtcbiAgbmV3PCAgICAgICAgICAgICAgICAgIE4gZXh0ZW5kcyBzdHJpbmcgICAgICAgICAgICAgICAgID4oICAgICAgICAgIG5hbWU6IE4sICAgICAgICAgIG1lc3NhZ2U/OiBzdHJpbmcgfCAoKGRhdGE6IG9iamVjdCkgPT4gc3RyaW5nKSk6IEluY2lkZW50PG9iamVjdCwgTiwgdW5kZWZpbmVkPjtcbiAgbmV3PEQgZXh0ZW5kcyBvYmplY3QsIE4gZXh0ZW5kcyBzdHJpbmcsIEMgZXh0ZW5kcyBFcnJvcj4oY2F1c2U6IEMsIG5hbWU6IE4sIGRhdGE6IEQsIG1lc3NhZ2U/OiBzdHJpbmcgfCAoKGRhdGE6IEQgICAgICkgPT4gc3RyaW5nKSk6IEluY2lkZW50PEQsICAgICAgTiwgQyAgICAgICAgPjtcbiAgbmV3PEQgZXh0ZW5kcyBvYmplY3QsIE4gZXh0ZW5kcyBzdHJpbmcgICAgICAgICAgICAgICAgID4oICAgICAgICAgIG5hbWU6IE4sIGRhdGE6IEQsIG1lc3NhZ2U/OiBzdHJpbmcgfCAoKGRhdGE6IEQgICAgICkgPT4gc3RyaW5nKSk6IEluY2lkZW50PEQsICAgICAgTiwgdW5kZWZpbmVkPjtcbiAgICAgPCAgICAgICAgICAgICAgICAgIE4gZXh0ZW5kcyBzdHJpbmcsIEMgZXh0ZW5kcyBFcnJvcj4oY2F1c2U6IEMsIG5hbWU6IE4sICAgICAgICAgIG1lc3NhZ2U/OiBzdHJpbmcgfCAoKGRhdGE6IG9iamVjdCkgPT4gc3RyaW5nKSk6IEluY2lkZW50PG9iamVjdCwgTiwgQyAgICAgICAgPjtcbiAgICAgPCAgICAgICAgICAgICAgICAgIE4gZXh0ZW5kcyBzdHJpbmcgICAgICAgICAgICAgICAgID4oICAgICAgICAgIG5hbWU6IE4sICAgICAgICAgIG1lc3NhZ2U/OiBzdHJpbmcgfCAoKGRhdGE6IG9iamVjdCkgPT4gc3RyaW5nKSk6IEluY2lkZW50PG9iamVjdCwgTiwgdW5kZWZpbmVkPjtcbiAgICAgPEQgZXh0ZW5kcyBvYmplY3QsIE4gZXh0ZW5kcyBzdHJpbmcsIEMgZXh0ZW5kcyBFcnJvcj4oY2F1c2U6IEMsIG5hbWU6IE4sIGRhdGE6IEQsIG1lc3NhZ2U/OiBzdHJpbmcgfCAoKGRhdGE6IEQgICAgICkgPT4gc3RyaW5nKSk6IEluY2lkZW50PEQsICAgICAgTiwgQyAgICAgICAgPjtcbiAgICAgPEQgZXh0ZW5kcyBvYmplY3QsIE4gZXh0ZW5kcyBzdHJpbmcgICAgICAgICAgICAgICAgID4oICAgICAgICAgIG5hbWU6IE4sIGRhdGE6IEQsIG1lc3NhZ2U/OiBzdHJpbmcgfCAoKGRhdGE6IEQgICAgICkgPT4gc3RyaW5nKSk6IEluY2lkZW50PEQsICAgICAgTiwgdW5kZWZpbmVkPjtcblxuICA8RCBleHRlbmRzIG9iamVjdCwgTiBleHRlbmRzIHN0cmluZywgQyBleHRlbmRzIEVycm9yIHwgdW5kZWZpbmVkPihlcnJvcjogRXJyb3IgJiB7bmFtZTogTjsgZGF0YTogRDsgY2F1c2U6IEN9KTogSW5jaWRlbnQ8RCwgICAgICBOLCAgICAgIEMgICAgICAgID47XG4gIDxEIGV4dGVuZHMgb2JqZWN0LCBOIGV4dGVuZHMgc3RyaW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICA+KGVycm9yOiBFcnJvciAmIHtuYW1lOiBOOyBkYXRhOiBEICAgICAgICAgIH0pOiBJbmNpZGVudDxELCAgICAgIE4sICAgICAgdW5kZWZpbmVkPjtcbiAgPEQgZXh0ZW5kcyBvYmplY3QsICAgICAgICAgICAgICAgICAgIEMgZXh0ZW5kcyBFcnJvciB8IHVuZGVmaW5lZD4oZXJyb3I6IEVycm9yICYgeyAgICAgICAgIGRhdGE6IEQ7IGNhdXNlOiBDfSk6IEluY2lkZW50PEQsICAgICAgc3RyaW5nLCBDICAgICAgICA+O1xuICA8ICAgICAgICAgICAgICAgICAgTiBleHRlbmRzIHN0cmluZywgQyBleHRlbmRzIEVycm9yIHwgdW5kZWZpbmVkPihlcnJvcjogRXJyb3IgJiB7bmFtZTogTjsgICAgICAgICAgY2F1c2U6IEN9KTogSW5jaWRlbnQ8b2JqZWN0LCBOLCAgICAgIEMgICAgICAgID47XG4gIDxEIGV4dGVuZHMgb2JqZWN0ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA+KGVycm9yOiBFcnJvciAmIHsgICAgICAgICBkYXRhOiBEICAgICAgICAgIH0pOiBJbmNpZGVudDxELCAgICAgIHN0cmluZywgdW5kZWZpbmVkPjtcbiAgPCAgICAgICAgICAgICAgICAgIE4gZXh0ZW5kcyBzdHJpbmcgICAgICAgICAgICAgICAgICAgICAgICAgICAgID4oZXJyb3I6IEVycm9yICYge25hbWU6IE4gICAgICAgICAgICAgICAgICAgfSk6IEluY2lkZW50PG9iamVjdCwgTiwgICAgICB1bmRlZmluZWQ+O1xuICA8ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQyBleHRlbmRzIEVycm9yIHwgdW5kZWZpbmVkPihlcnJvcjogRXJyb3IgJiB7ICAgICAgICAgICAgICAgICAgY2F1c2U6IEN9KTogSW5jaWRlbnQ8b2JqZWN0LCBzdHJpbmcsIEMgICAgICAgID47XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGVycm9yOiBFcnJvciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICApOiBJbmNpZGVudDxvYmplY3QsIHN0cmluZywgdW5kZWZpbmVkPjtcbn1cbi8vIHRzbGludDplbmFibGVcbiJdLCJzb3VyY2VSb290IjoiIn0=

5
debian/build_modules/matched/index.js vendored Normal file
View File

@ -0,0 +1,5 @@
'use strict';
module.exports = require('./lib/async');
module.exports.sync = require('./lib/sync');
module.exports.promise = require('./lib/promise');

View File

@ -0,0 +1,19 @@
'use strict';
const glob = require('./promise');
module.exports = (patterns, options, callback) => {
if (typeof options === 'function') {
callback = options;
options = void 0;
}
const promise = glob(patterns, options);
if (typeof callback === 'function') {
promise.then(files => callback(null, files)).catch(callback);
return;
}
return promise;
};

View File

@ -0,0 +1,62 @@
'use strict';
const path = require('path');
const utils = require('./utils');
const { Glob } = require('glob');
const glob = (pattern, options) => {
const onMatch = utils.onMatch(pattern, options);
return new Promise((resolve, reject) => {
const globber = new Glob(pattern, options, (err, files) => {
globber.off('match', onMatch);
if (err) {
reject(err);
} else {
resolve(files);
}
});
globber.on('match', onMatch);
});
};
module.exports = async (patterns, options) => {
const { expand, getPaths, sift, setIgnores } = utils;
patterns = [].concat(patterns || []);
const opts = { cwd: '.', nosort: true, ...options };
opts.cwd = path.resolve(expand(opts.cwd));
const sifted = sift(patterns, opts);
if (sifted === null) {
return Promise.reject(new Error('invalid glob pattern: ' + patterns));
}
if (sifted.globs === 0) {
return Promise.resolve(getPaths(patterns, opts));
}
const { excludes, includes } = sifted;
const config = include => setIgnores(opts, excludes, include.index);
const pending = [];
const files = [];
const onFiles = options => {
return dirents => {
files.push(...dirents);
if (options.onFiles) {
return options.onFiles(dirents, options);
}
};
};
for (const include of includes) {
const opt = config(include);
pending.push(glob(include.pattern, opt).then(onFiles(opt)));
}
return Promise.all(pending).then(() => files);
};

View File

@ -0,0 +1,44 @@
'use strict';
const path = require('path');
const glob = require('glob');
const utils = require('./utils');
module.exports = (patterns, options) => {
const { expand, getPaths, sift, setIgnores } = utils;
patterns = [].concat(patterns || []);
// shallow clone options
const opts = { cwd: '.', nosort: true, ...options };
opts.cwd = path.resolve(expand(opts.cwd));
const sifted = sift(patterns, opts);
if (sifted === null) {
throw new Error('invalid glob pattern: ' + patterns);
}
if (sifted.globs === 0) {
return getPaths(patterns, opts);
}
const { excludes, includes } = sifted;
const config = include => setIgnores(opts, excludes, include.index);
const files = [];
for (const include of includes) {
const dirOpts = config(include);
// simulate onMatch, for parity with async
const dirents = glob.sync(include.pattern, dirOpts);
const onMatch = utils.onMatch(include.pattern, options);
dirents.forEach(dirent => {
files.push(dirent);
onMatch(dirent);
});
if (dirOpts.onFiles) {
dirOpts.onFiles(dirents, dirOpts);
}
}
return files;
};

View File

@ -0,0 +1,144 @@
'use strict';
const fs = require('fs');
const os = require('os');
const path = require('path');
const picomatch = require('picomatch');
const union = (...args) => [...new Set([].concat.apply([], args).filter(Boolean))];
/**
* Expand tilde
*/
exports.expand = str => str.replace(/^~/, os.homedir());
/**
* Sift glob patterns into inclusive and exclusive patterns.
*
* @param {String|Array} `patterns`
* @param {Object} opts
* @return {Object}
*/
exports.sift = (patterns, options = {}) => {
const results = { includes: [], excludes: [], globs: 0 };
let index = 0;
for (const pattern of [].concat(patterns || [])) {
if (typeof pattern !== 'string') return null;
const res = picomatch.scan(pattern);
res.pattern = path.posix.join(res.base, res.glob);
res.index = index++;
if (res.isGlob) results.globs++;
if (options.relative) {
res.pattern = exports.toRelative(res.pattern, options);
delete options.cwd;
}
if (res.negated) {
results.excludes.push(res);
} else {
results.includes.push(res);
}
}
return results;
};
/**
* Set the index of ignore patterns based on their position
* in an array of globs.
*
* @param {Object} `options`
* @param {Array} `excludes`
* @param {Number} `inclusiveIndex`
*/
exports.setIgnores = (options, excludes, inclusiveIndex) => {
const opts = Object.assign({}, options);
const negations = [];
for (const exclusive of excludes) {
if (exclusive.index > inclusiveIndex) {
negations.push(exclusive.pattern);
}
}
opts.ignore = union([], opts.ignore, negations);
return opts;
};
/**
* Make a glob pattern relative.
*
* @param {String} `pattern`
* @param {Object} `opts`
* @return {String}
*/
exports.toRelative = (pattern, opts) => {
return path.relative(process.cwd(), path.resolve(exports.expand(opts.cwd), pattern));
};
/**
* Create an event listener for .on('match', ...).
*
* @param {String} pattern
* @param {Object} options
* @return {Function}
*/
exports.onMatch = (pattern, options) => {
return filepath => {
if (options && typeof options.onMatch === 'function') {
options.onMatch({ pattern, options, path: filepath });
}
};
};
/**
* Get paths from non-glob patterns
*
* @param {Array} `paths`
* @param {Object} `opts`
* @return {Array}
*/
exports.getPaths = (paths, options = {}) => {
const resolve = fp => path.resolve(exports.expand(options.cwd), fp);
const result = [];
for (const filepath of paths) {
const onMatch = exports.onMatch(filepath, options);
const absolute = resolve(filepath);
let resolved = filepath;
if (options.absolute) {
resolved = absolute;
}
if (options.realpath) {
try {
resolved = fs.realpathSync(absolute);
} catch (err) {
continue;
}
}
if (!fs.existsSync(absolute)) {
continue;
}
if (options.onMatch) {
onMatch(resolved);
}
result.push(resolved);
}
if (options.onFiles) {
options.onFiles(result, options);
}
return result;
};

View File

@ -0,0 +1,102 @@
{
"name": "matched",
"description": "Adds array support to node-glob, sync and async. Also supports tilde expansion (user home) and resolving to global npm modules.",
"version": "5.0.1",
"homepage": "https://github.com/jonschlinkert/matched",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"Bogdan Chadkin (https://github.com/TrySound)",
"Jon Schlinkert (http://twitter.com/jonschlinkert)"
],
"funding": "https://github.com/sponsors/jonschlinkert",
"repository": "jonschlinkert/matched",
"bugs": {
"url": "https://github.com/jonschlinkert/matched/issues"
},
"license": "MIT",
"files": [
"index.js",
"lib"
],
"main": "index.js",
"engines": {
"node": ">=10"
},
"scripts": {
"report": "nyc report --reporter=html",
"cover": "nyc mocha test/*.js",
"test": "mocha",
"posttest": "eslint *.js test/*.js lib/*.js"
},
"dependencies": {
"glob": "^7.1.6",
"picomatch": "^2.2.1"
},
"devDependencies": {
"eslint": "^6.8.0",
"gulp-format-md": "^2.0.0",
"mocha": "^7.0.0",
"nyc": "^15.0.0",
"rimraf": "^3.0.0"
},
"keywords": [
"array",
"directories",
"exclude",
"exclusions",
"expand",
"files",
"filesystem",
"find",
"fnmatch",
"folders",
"fs",
"glob",
"globbing",
"globby",
"globs",
"globstar",
"lookup",
"match",
"matched",
"matcher",
"matching",
"minimatch",
"multi",
"multimatch",
"multiple",
"negate",
"node",
"node-glob",
"paths",
"pattern",
"patterns",
"star",
"wildcard",
"wildcards"
],
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"findup-sync",
"is-glob",
"micromatch"
]
},
"lint": {
"reflinks": true
},
"reflinks": [
"glob",
"picomatch"
]
}
}

View File

@ -0,0 +1,170 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var fastGlob = _interopRequireWildcard(require("fast-glob"));
var _path = _interopRequireDefault(require("path"));
var _isString = _interopRequireDefault(require("lodash/isString"));
var _partition = _interopRequireDefault(require("lodash/partition"));
var _packageJson = require("../package.json");
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++){
arr2[i] = arr[i];
}
return arr2;
}
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {
};
if (obj != null) {
for(var key in obj){
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
};
if (desc.get || desc.set) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
}
newObj.default = obj;
return newObj;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for(var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true){
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally{
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally{
if (_d) throw _e;
}
}
return _arr;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
function _objectSpread(target) {
for(var i = 1; i < arguments.length; i++){
var source = arguments[i] != null ? arguments[i] : {
};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function(key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
var _Object;
/**
* default multi-input Options
* */ var defaultOptions = {
// `path.sep` is used for windows support
relative: "src".concat(_path.default.sep)
};
// extract the output file name from a file name
var outputFileName = function(filePath) {
return filePath.replace(/\.[^/.]+$/, '').replace(/\\/g, '/');
};
var _default = function(param) {
var options = param === void 0 ? defaultOptions : param;
var globOptions = options.glob, _relative = options.relative, relative = _relative === void 0 ? defaultOptions.relative : _relative, transformOutputPath = options.transformOutputPath;
return {
name: _packageJson.name,
options: function(conf) {
// flat to enable input to be a string or an array
// separate globs inputs string from others to enable input to be a mixed array too
var ref = _slicedToArray((0, _partition).default([
conf.input
].flat(), _isString.default), 2), globs = ref[0], others = ref[1];
var normalizedGlobs = globs.map(function(glob) {
return glob.replace(/\\/g, '/');
});
// get files from the globs strings and return as a Rollup entries Object
var input = (_Object = Object).assign.apply(_Object, [
{
},
Object.fromEntries(fastGlob.sync(normalizedGlobs, globOptions).map(function(name) {
var filePath = _path.default.relative(relative, name);
var isRelative = !filePath.startsWith("..".concat(_path.default.sep));
var relativeFilePath = isRelative ? filePath : _path.default.relative(".".concat(_path.default.sep), name);
if (transformOutputPath) {
return [
outputFileName(transformOutputPath(relativeFilePath, name)),
name
];
}
return [
outputFileName(relativeFilePath),
name
];
})),
].concat(// add no globs input to the result
_toConsumableArray(others)));
// return the new configuration with the glob input and the non string inputs
return _objectSpread({
}, conf, {
input: input
});
}
};
};
exports.default = _default;

View File

@ -0,0 +1,68 @@
{
"name": "rollup-plugin-multi-input",
"version": "1.3.1",
"description": "rollup plugin for bundling modular libraries",
"main": "dist/plugin.js",
"esnext": "src/plugin.js",
"scripts": {
"lint": "eslint src/plugin.js",
"build": "swc src/plugin.js --out-dir dist",
"generate-declaration": "jsdoc -t node_modules/tsd-jsdoc/dist -r ./dist/plugin.js -d ./dist/",
"prepare": "npm run lint && npm run build",
"prepublishOnly": "npm run generate-declaration",
"test": "jest --coverage"
},
"files": [
"src",
"dist"
],
"keywords": [
"rollup-plugin",
"rollup",
"es6",
"glob",
"multi-entry",
"modular",
"libraries"
],
"repository": {
"type": "git",
"url": "https://github.com/alfredosalzillo/rollup-plugin-multi-input.git"
},
"author": "alfredo salzillo <alfredo.salzillo@virgilio.it>",
"license": "MIT",
"bugs": {
"url": "https://github.com/alfredosalzillo/rollup-plugin-multi-input/issues"
},
"homepage": "https://github.com/alfredosalzillo/rollup-plugin-multi-input#readme",
"devDependencies": {
"@babel/runtime": "^7.14.0",
"@rollup/plugin-json": "^4.0.2",
"@swc/cli": "^0.1.40",
"@swc/core": "^1.2.57",
"@swc/jest": "^0.1.2",
"@types/jest": "^26.0.0",
"eslint": "^7.2.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^24.0.0",
"jest": "^26.0.1",
"jsdoc": "^3.6.2",
"rollup": "^2.0.2",
"tsd-jsdoc": "^2.1.3"
},
"dependencies": {
"core-js": "^3.1.3",
"fast-glob": "^3.0.0",
"lodash": "^4.17.11"
},
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true,
"transform": {
"^.+\\.(t|j)sx?$": [
"@swc/jest"
]
}
}
}

View File

@ -0,0 +1,79 @@
import * as fastGlob from 'fast-glob';
import path from 'path';
import isString from 'lodash/isString';
import partition from 'lodash/partition';
import { name as pluginName } from '../package.json';
/**
* default multi-input Options
* */
const defaultOptions = {
// `path.sep` is used for windows support
relative: `src${path.sep}`,
};
// extract the output file name from a file name
const outputFileName = (filePath) => filePath
.replace(/\.[^/.]+$/, '')
.replace(/\\/g, '/');
/**
* Callback for transforming output file path
*
* @callback TransformOutputPathFn
* @param {string} output target file name
* @param {string} input source file name
*/
/**
* multiInput is a rollup plugin to use multiple entry point and preserve the directory
* structure in the dist folder
*
* @param {?Object} options
* @param {?FastGlob?.Options} options.glob - the fast-glob configuration object
* @param {?string?} options.relative - the base path to remove in the dist folder
* @param {?TransformOutputPathFn?} options.transformOutputPath - callback function to
* transform the destination file name before generation
* @return {Plugin} - the rollup plugin config for enable support of multi-entry glob inputs
* */
export default (options = defaultOptions) => {
const {
glob: globOptions,
relative = defaultOptions.relative,
transformOutputPath,
} = options;
return ({
name: pluginName,
options(conf) {
// flat to enable input to be a string or an array
// separate globs inputs string from others to enable input to be a mixed array too
const [globs, others] = partition([conf.input].flat(), isString);
const normalizedGlobs = globs.map((glob) => glob.replace(/\\/g, '/'));
// get files from the globs strings and return as a Rollup entries Object
const input = Object
.assign(
{},
Object.fromEntries(fastGlob
.sync(normalizedGlobs, globOptions)
.map((name) => {
const filePath = path.relative(relative, name);
const isRelative = !filePath.startsWith(`..${path.sep}`);
const relativeFilePath = (isRelative
? filePath
: path.relative(`.${path.sep}`, name));
if (transformOutputPath) {
return [outputFileName(transformOutputPath(relativeFilePath, name)), name];
}
return [outputFileName(relativeFilePath), name];
})),
// add no globs input to the result
...others,
);
// return the new configuration with the glob input and the non string inputs
return {
...conf,
input,
};
},
});
};

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
node-jest (27.5.1~ds+~cs69.51.22-ok1) yangtze; urgency=medium
* Build for openKylin.
-- openKylinBot <openKylinBot@openkylin.com> Mon, 25 Apr 2022 22:03:04 +0800

18
debian/clean vendored Normal file
View File

@ -0,0 +1,18 @@
debian/bcoe-tsconfig.json
debian/debbundle-docs/
bcoe-v8-coverage/dist/
bcoe-v8-coverage/gulpfile.js*
bcoe-v8-coverage/node_modules/
bcoe-v8-coverage/src/lib/node_modules/
bcoe-v8-coverage/src/lib/tsconfig.json
bcoe-v8-coverage/src/lib/*.js
bcoe-v8-coverage/src/lib/*.map
bcoe-v8-coverage/src/tsconfig.json
bcoe-v8-coverage/src/test/*.js*
*.1
node_modules/
packages/*/build/
packages/*/build-es5/
packages/*/tsconfig.tsbuildinfo
resolveexports/dist/
website/backers.json

237
debian/control vendored Normal file
View File

@ -0,0 +1,237 @@
Source: node-jest
Maintainer: Debian Javascript Maintainers <pkg-javascript-devel@lists.alioth.debian.org>
Uploaders: Pirate Praveen <praveen@debian.org>,
Yadd <yadd@debian.org>
Section: javascript
Testsuite: autopkgtest-pkg-nodejs
Priority: optional
Build-Depends: chai
, debhelper-compat (= 13)
, dh-sequence-nodejs (>= 0.9.84~)
, help2man
, jq
, node-async-done
, node-ansi-escapes
, node-ansi-regex
, node-ansi-styles
, node-anymatch (>= 3.1.2)
, node-babel-core (>= 7.8.3)
, node-babel-preset-react (>= 7)
, node-babel-register (>= 7)
, node-babel-traverse (>= 7)
, node-babel7
, node-braces
, node-browserify-lite
, node-browserslist
, node-bundt
, node-camelcase
, node-chalk
, node-chokidar
, node-ci-info
, node-co
, node-color-name
, node-convert-source-map
, node-cosmiconfig
, node-crypto-browserify <!nocheck>
, node-csstype
, node-deepmerge
, node-detect-newline
, node-emittery
, node-execa
, node-exit
, node-fast-json-stable-stringify (>= 2.1)
, node-flow-remove-types <!nocheck>
, node-glob
, node-glob-stream
, node-graceful-fs
, node-is-generator-fn
, node-istanbul
, node-jsdom
, node-json-stable-stringify
, node-leven
, node-make-error
, node-merge-stream
, node-micromatch
, node-minimatch
, node-minimist
, node-mkdirp <!nocheck>
, node-normalize-package-data
, node-parse-json
, node-prompts <!nocheck>
, node-prop-types
, node-react
, node-read-pkg
, node-read-pkg-up
, node-resolve
, node-resolve-cwd <!nocheck>
, node-resolve-from
, node-rimraf
, node-rollup-plugin-babel
, node-rollup-plugin-commonjs
, node-rollup-plugin-json
, node-rollup-plugin-node-resolve
, node-rollup-plugin-typescript
, node-sane <!nocheck>
, node-semver
, node-sinon
, node-slash
, node-source-map
, node-source-map-support
, node-stack-utils
, node-strip-ansi <!nocheck>
, node-strip-bom
, node-strip-json-comments <!nocheck>
, node-supports-color
, node-tough-cookie
, node-types-gulp
, node-types-node
, node-types-mocha
, node-types-vinyl-fs
, node-types-undertaker
, node-types-undertaker-registry
, node-typescript (>= 4.4.4~)
, node-v8-to-istanbul (>= 8~)
, node-vinyl
, node-write-file-atomic
, node-yargs
, node-yargs-parser
, rollup (>= 2~)
, ts-node
, webpack
Standards-Version: 4.6.0
Vcs-Browser: https://salsa.debian.org/js-team/node-jest
Vcs-Git: https://salsa.debian.org/js-team/node-jest.git
Homepage: https://jestjs.io
Rules-Requires-Root: no
Package: jest
Architecture: all
Depends: ${misc:Depends}
, node-ansi-escapes
, node-ansi-regex
, node-ansi-styles
, node-anymatch
, node-babel-code-frame (>= 7)
, node-babel-core (>= 7)
, node-babel-generator
, node-babel-plugin-syntax-typescript
, node-babel-preset-current-node-syntax
, node-babel-traverse (>= 7)
, node-babel-types (>= 7)
, node-camelcase
, node-chalk
, node-ci-info
, node-co
, node-convert-source-map
, node-cosmiconfig
, node-deepmerge
, node-detect-newline
, node-emittery
, node-execa
, node-exit
, node-glob
, node-graceful-fs
, node-is-generator-fn
, node-istanbul
, node-jest-debbundle
, node-jest-worker
, node-jsdom
, node-json-stable-stringify
, node-leven
, node-micromatch
, node-minimist
, node-parse-json
, node-pirates
, node-prompts
, node-react
, node-read-pkg (>= 5.2~)
, node-read-pkg-up
, node-resolve
, node-resolve-from
, node-rimraf
, node-sane
, node-semver
, node-sinon
, node-slash
, node-source-map
, node-source-map-support
, node-stack-utils
, node-strip-ansi
, node-strip-bom
, node-strip-json-comments
, node-types-babel-core
, node-types-babel-traverse
, node-v8-to-istanbul (>= 8~)
, node-which
, node-write-file-atomic
, node-yargs
, nodejs:any
Provides: ${jest:Provides}
Description: Delightful JavaScript Testing
Some features of this testing framework are:
* Easy Setup: Jest is a complete and easy to set up JavaScript testing
solution. In fact, Jest works out of the box for any React project.
* Instant Feedback: Failed tests run first. Fast interactive mode can switch
between running all tests or only test files related to changed files.
* Snapshot Testing: Jest can capture snapshots of React trees or other
serializable values to simplify UI testing.
.
Node.js is an event-based server-side JavaScript engine.
Package: node-jest-worker
Architecture: all
Depends: ${misc:Depends}
, node-merge-stream
, node-supports-color
, node-types-node
Breaks: node-rollup-plugin-terser (<< 7.0.2-0)
Multi-Arch: foreign
Description: Nodejs module for executing heavy tasks under forked processes in parallel
jest-worker provides a `Promise` based interface, minimum overhead and
bound workers.
.
The module works by providing an absolute path of the module to be loaded in
all forked processes. Files relative to a node module are also accepted. All
methods are exposed on the parent process as promises, so they can be
`await`'ed. Child (worker) methods can either be synchronous or asynchronous.
.
The module also implements support for bound workers. Binding a worker means
that, based on certain parameters, the same task will always be executed by
the same worker. The way bound workers work is by using the returned string
of the `computeWorkerKey` method. If the string was used before for a task,
the call will be queued to the related worker that processed the task earlier;
if not, it will be executed by the first available worker, then sticked to the
worker that executed it; so the next time it will be processed by the same
worker. If you have no preference on the worker executing the task, but you
have defined a `computeWorkerKey` method because you want _some_ of the tasks
to be sticked, you can return `null` from it.
Package: node-jest-debbundle
Architecture: all
Multi-Arch: foreign
Depends: ${misc:Depends}
, node-ansi-escapes
, node-babel-plugin-lodash
, node-ci-info
, node-has-flag
, node-pkg-dir
, node-resolve-cwd
, node-strip-ansi
, node-supports-color
Provides: ${jest:depsProvides}
Description: various ittle Node.js modules needed by jest
This package provides:
* astral-regex
* babel-preset-jest
* babel-plugin-jest-hoist
* babel-preset-moxy.
* char-regex
* dedent
* import-local
* is-ci
* p-each-series
* p-reduce
* repl
* string-length
* terminal-link
* throat

197
debian/copyright vendored Normal file
View File

@ -0,0 +1,197 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: jest
Upstream-Contact: https://github.com/facebook/jest/issues
Source: https://github.com/facebook/jest/tags
https://registry.npmjs.org/@types/jest
https://github.com/sindresorhus/import-local/tags
https://github.com/kevva/astral-regex/tags
https://registry.npmjs.org/babel-preset-moxy
https://github.com/litejs/natural-compare-lite/tags
https://github.com/sindresorhus/p-each-series/tags
https://github.com/sindresorhus/p-reduce/tags
https://github.com/sindresorhus/string-length/tags
https://github.com/jamestalmage/supports-hyperlinks/tags
https://github.com/sindresorhus/terminal-link/tags
https://github.com/ForbesLindesay/throat/tags
https://github.com/Richienb/char-regex/tags
https://registry.npmjs.org/natural-compare
https://registry.npmjs.org/jest-pnp-resolver
https://github.com/watson/is-ci/tags
https://registry.npmjs.org/@bcoe/v8-coverage
https://github.com/SimenB/collect-v8-coverage/tags
https://github.com/dmnd/dedent/tags
https://registry.npmjs.org/repl
https://github.com/ikatyang/jest-snapshot-serializer-raw/tags
https://github.com/guybedford/cjs-module-lexer/tags
Files-Excluded: website
.yarn
.vscode
.circleci
Files-Excluded-bcoe-v8-coverage: dist
Files-Excluded-natural-compare-lite: dist
Files-Excluded-cjs-module-lexer: lib/lexer.wasm
Files: *
Copyright: Facebook, Inc. and its affiliates
License: Expat
Files: astral-regex/*
Copyright: Kevin Mårtensson <kevinmartensson@gmail.com>
License: Expat
Files: babel-preset-moxy/*
Copyright: 2017 Made With MOXY Lda <hello@moxy.studio>
License: Expat
Files: bcoe-v8-coverage/*
Copyright: 2015-2017 Charles Samborski
License: Expat
Comment: contributions under ISC
Files: char-regex/*
Copyright: 2019 Richie Bendall
License: Expat
Files: cjs-module-lexer/*
Copyright: 2012-2018 by various contributors
2018-2020 Guy Bedford
License: Expat
Files: collect-v8-coverage/*
Copyright: 2017-2019 Simen Bekkhus
License: Expat
Files: dedent/*
Copyright: 2015 Desmond Brand <dmnd@desmondbrand.com>
License: Expat
Files: import-local/*
p-each-series/*
p-reduce/*
string-length/*
terminal-link/*
Copyright: Sindre Sorhus <sindresorhus@gmail.com>
License: Expat
Files: is-ci/*
Copyright: 2016-2021 Thomas Watson Steen
License: Expat
Files: jest-tobetype/*
Copyright: 2017 Gregory Wild-Smith
License: Expat
Files: jest-pnp-resolver/*
Copyright: 2016 Maël Nison
License: Expat
Files: jest-snapshot-serializer-raw/*
Copyright: Ika <ikatyang@gmail.com> (https://github.com/ikatyang)
License: Expat
Files: natural-compare-lite/*
natural-compare/*
Copyright: 2012-2015 Lauri Rooden <lauri@rooden.ee>
License: Expat
Files: packages/expect/src/jasmineUtils.ts
Copyright: 2008-2016 Pivotal Labs
License: Expat
Files: packages/jest-diff/src/cleanupSemantic.ts
Copyright: 2018 The diff-match-patch Authors
License: Apache-2.0
Files: repl/*
Copyright: 2011 Firejune <to@firejune.com>
License: Expat
Files: supports-hyperlinks/*
Copyright: James Talmage <james@talmage.io>
License: Expat
Files: throat/*
Copyright: 2013 Forbes Lindesay
License: Expat
Files: debian/*
Copyright: 2018 Pirate Praveen <praveen@debian.org>
2019-2022, Yadd <yadd@debian.org>
License: Expat
Files: debian/build_modules/babel-plugin-typescript-strip-namespaces/*
Copyright: 2019 Tim Seckinger and contributors
License: ISC
Files: debian/build_modules/rollup-plugin-multi-input/*
Copyright: 2018 Alfredo Salzillo
License: Expat
Files: debian/build_modules/@tsconfig/*
debian/build_modules/@types/*
types-*/*
typesjest/*
Copyright: Microsoft Corporation
License: Expat
Files: resolveexports/*
Copyright: Luke Edwards <luke.edwards05@gmail.com>
License: Expat
Files: debian/build_modules/incident/*
Copyright: 2015-2017 Charles Samborski
License: Expat
Files: debian/build_modules/matched/*
Copyright: 2014-present Jon Schlinkert
License:Expat
License: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the complete text of the Apache version 2.0 license
can be found in "/usr/share/common-licenses/Apache-2.0".
License: Expat
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
.
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
License: ISC
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

1
debian/examples vendored Normal file
View File

@ -0,0 +1 @@
examples/*

6
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,6 @@
[DEFAULT]
pristine-tar=True
component=['typesjest', 'import-local', 'astral-regex', 'babel-preset-moxy', 'natural-compare-lite', 'p-each-series', 'p-reduce', 'string-length', 'supports-hyperlinks', 'terminal-link', 'throat', 'char-regex', 'natural-compare', 'jest-pnp-resolver', 'is-ci', 'bcoe-v8-coverage', 'collect-v8-coverage', 'dedent', 'repl', 'types-is-ci', 'types-dedent', 'types-natural-compare', 'types-natural-compare', 'jest-tobetype', 'resolveexports', 'jest-snapshot-serializer-raw', 'cjs-module-lexer']
[import-orig]
filter=[ '.gitignore', '.travis.yml', '.git*' ]

9
debian/gitlab-ci.yml vendored Normal file
View File

@ -0,0 +1,9 @@
---
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
variables:
SALSA_CI_DISABLE_CROSSBUILD_ARM64: '1'
SALSA_CI_DISABLE_BUILD_PACKAGE_ANY: '1'
SALSA_CI_DISABLE_BHLC: '1'

2
debian/jest.docs vendored Normal file
View File

@ -0,0 +1,2 @@
README.md
docs/*

1
debian/jest.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/nodejs

5
debian/jest.links vendored Normal file
View File

@ -0,0 +1,5 @@
usr/share/nodejs/jest-repl/bin/jest-repl.js usr/bin/jest-repl
usr/share/nodejs/jest-repl/bin/jest-runtime-cli.js usr/bin/jest-runtime
usr/share/nodejs/jest-repl/bin/jest-runtime-cli.js usr/bin/jest-runtime-cli
usr/share/nodejs/jest/bin/jest.js usr/bin/jest
usr/share/man/man1/jest-runtime-cli.1.gz usr/share/man/man1/jest-runtime.1.gz

5
debian/jest.lintian-overrides vendored Normal file
View File

@ -0,0 +1,5 @@
# Noise
duplicate-files usr/share/doc/jest/examples/async/.babelrc.js usr/share/doc/jest/examples/mongodb/babel.config.js
duplicate-files usr/share/doc/jest/examples/automatic-mocks/.babelrc.js usr/share/doc/jest/examples/getting-started/.babelrc.js usr/share/doc/jest/examples/jquery/.babelrc.js usr/share/doc/jest/examples/manual-mocks/.babelrc.js usr/share/doc/jest/examples/timer/.babelrc.js
duplicate-files usr/share/doc/jest/examples/getting-started/sum.js usr/share/doc/jest/examples/typescript/sum.js
duplicate-files usr/share/doc/jest/examples/react-testing-library/.babelrc.js usr/share/doc/jest/examples/snapshot/.babelrc.js

1
debian/manpages vendored Normal file
View File

@ -0,0 +1 @@
jest*.1

1
debian/node-jest-debbundle.docs vendored Normal file
View File

@ -0,0 +1 @@
debian/debbundle-docs/*

18
debian/node-jest-debbundle.install vendored Normal file
View File

@ -0,0 +1,18 @@
usr/share/nodejs/@types/dedent
usr/share/nodejs/@types/is-ci
usr/share/nodejs/astral-regex
usr/share/nodejs/babel-plugin-jest-hoist
usr/share/nodejs/babel-preset-jest
usr/share/nodejs/babel-preset-moxy
usr/share/nodejs/char-regex
usr/share/nodejs/dedent
usr/share/nodejs/import-local
usr/share/nodejs/is-ci
usr/share/nodejs/p-each-series
usr/share/nodejs/p-reduce
usr/share/nodejs/repl
usr/share/nodejs/resolve.exports
usr/share/nodejs/string-length
usr/share/nodejs/supports-hyperlinks
usr/share/nodejs/terminal-link
usr/share/nodejs/throat

View File

@ -0,0 +1,2 @@
# Minor issue: not in path
missing-dep-for-interpreter node (does not satisfy nodejs:any) [usr/share/nodejs/is-ci/bin.js]

1
debian/node-jest-worker.docs vendored Normal file
View File

@ -0,0 +1 @@
packages/jest-worker/README.md

1
debian/node-jest-worker.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/nodejs/jest-worker

1
debian/nodejs/additional_components vendored Normal file
View File

@ -0,0 +1 @@
packages/*

14
debian/nodejs/bcoe-v8-coverage/build vendored Normal file
View File

@ -0,0 +1,14 @@
rm -rf dist
(
if mkdir node_modules; then
ln -s /usr/share/nodejs/tslib node_modules/
mkdir -p node_modules/@types
ln -s /usr/share/nodejs/@types/mocha node_modules/@types/
ln -s /usr/share/nodejs/@types/node node_modules/@types/
fi
)
rollup -c ../debian/bcoe-rollup-config.js
cp ../debian/nodejs/def-bcoe-v8-coverage/* dist/lib/
rm -rf dist/lib/src
mv dist/lib/lib/*.js dist/lib
rm -fr dist/lib/lib

View File

@ -0,0 +1,12 @@
import { RangeCov } from "./types";
interface ReadonlyRangeTree {
readonly start: number;
readonly end: number;
readonly count: number;
readonly children: ReadonlyRangeTree[];
}
export declare function emitForest(trees: ReadonlyArray<ReadonlyRangeTree>): string;
export declare function emitForestLines(trees: ReadonlyArray<ReadonlyRangeTree>): string[];
export declare function parseFunctionRanges(text: string, offsetMap: Map<number, number>): RangeCov[];
export declare function parseOffsets(text: string): Map<number, number>;
export {};

View File

@ -0,0 +1,29 @@
import { FunctionCov, ProcessCov, RangeCov, ScriptCov } from "./types";
/**
* Creates a deep copy of a process coverage.
*
* @param processCov Process coverage to clone.
* @return Cloned process coverage.
*/
export declare function cloneProcessCov(processCov: Readonly<ProcessCov>): ProcessCov;
/**
* Creates a deep copy of a script coverage.
*
* @param scriptCov Script coverage to clone.
* @return Cloned script coverage.
*/
export declare function cloneScriptCov(scriptCov: Readonly<ScriptCov>): ScriptCov;
/**
* Creates a deep copy of a function coverage.
*
* @param functionCov Function coverage to clone.
* @return Cloned function coverage.
*/
export declare function cloneFunctionCov(functionCov: Readonly<FunctionCov>): FunctionCov;
/**
* Creates a deep copy of a function coverage.
*
* @param rangeCov Range coverage to clone.
* @return Cloned range coverage.
*/
export declare function cloneRangeCov(rangeCov: Readonly<RangeCov>): RangeCov;

View File

@ -0,0 +1,21 @@
import { FunctionCov, RangeCov, ScriptCov } from "./types";
/**
* Compares two script coverages.
*
* The result corresponds to the comparison of their `url` value (alphabetical sort).
*/
export declare function compareScriptCovs(a: Readonly<ScriptCov>, b: Readonly<ScriptCov>): number;
/**
* Compares two function coverages.
*
* The result corresponds to the comparison of the root ranges.
*/
export declare function compareFunctionCovs(a: Readonly<FunctionCov>, b: Readonly<FunctionCov>): number;
/**
* Compares two range coverages.
*
* The ranges are first ordered by ascending `startOffset` and then by
* descending `endOffset`.
* This corresponds to a pre-order tree traversal.
*/
export declare function compareRangeCovs(a: Readonly<RangeCov>, b: Readonly<RangeCov>): number;

View File

@ -0,0 +1,6 @@
export { emitForest, emitForestLines, parseFunctionRanges, parseOffsets } from "./ascii";
export { cloneFunctionCov, cloneProcessCov, cloneScriptCov, cloneRangeCov } from "./clone";
export { compareScriptCovs, compareFunctionCovs, compareRangeCovs } from "./compare";
export { mergeFunctionCovs, mergeProcessCovs, mergeScriptCovs } from "./merge";
export { RangeTree } from "./range-tree";
export { ProcessCov, ScriptCov, FunctionCov, RangeCov } from "./types";

View File

@ -0,0 +1,39 @@
import { FunctionCov, ProcessCov, ScriptCov } from "./types";
/**
* Merges a list of process coverages.
*
* The result is normalized.
* The input values may be mutated, it is not safe to use them after passing
* them to this function.
* The computation is synchronous.
*
* @param processCovs Process coverages to merge.
* @return Merged process coverage.
*/
export declare function mergeProcessCovs(processCovs: ReadonlyArray<ProcessCov>): ProcessCov;
/**
* Merges a list of matching script coverages.
*
* Scripts are matching if they have the same `url`.
* The result is normalized.
* The input values may be mutated, it is not safe to use them after passing
* them to this function.
* The computation is synchronous.
*
* @param scriptCovs Process coverages to merge.
* @return Merged script coverage, or `undefined` if the input list was empty.
*/
export declare function mergeScriptCovs(scriptCovs: ReadonlyArray<ScriptCov>): ScriptCov | undefined;
/**
* Merges a list of matching function coverages.
*
* Functions are matching if their root ranges have the same span.
* The result is normalized.
* The input values may be mutated, it is not safe to use them after passing
* them to this function.
* The computation is synchronous.
*
* @param funcCovs Function coverages to merge.
* @return Merged function coverage, or `undefined` if the input list was empty.
*/
export declare function mergeFunctionCovs(funcCovs: ReadonlyArray<FunctionCov>): FunctionCov | undefined;

View File

@ -0,0 +1,53 @@
import { RangeTree } from "./range-tree";
import { FunctionCov, ProcessCov, ScriptCov } from "./types";
/**
* Normalizes a process coverage.
*
* Sorts the scripts alphabetically by `url`.
* Reassigns script ids: the script at index `0` receives `"0"`, the script at
* index `1` receives `"1"` etc.
* This does not normalize the script coverages.
*
* @param processCov Process coverage to normalize.
*/
export declare function normalizeProcessCov(processCov: ProcessCov): void;
/**
* Normalizes a process coverage deeply.
*
* Normalizes the script coverages deeply, then normalizes the process coverage
* itself.
*
* @param processCov Process coverage to normalize.
*/
export declare function deepNormalizeProcessCov(processCov: ProcessCov): void;
/**
* Normalizes a script coverage.
*
* Sorts the function by root range (pre-order sort).
* This does not normalize the function coverages.
*
* @param scriptCov Script coverage to normalize.
*/
export declare function normalizeScriptCov(scriptCov: ScriptCov): void;
/**
* Normalizes a script coverage deeply.
*
* Normalizes the function coverages deeply, then normalizes the script coverage
* itself.
*
* @param scriptCov Script coverage to normalize.
*/
export declare function deepNormalizeScriptCov(scriptCov: ScriptCov): void;
/**
* Normalizes a function coverage.
*
* Sorts the ranges (pre-order sort).
* TODO: Tree-based normalization of the ranges.
*
* @param funcCov Function coverage to normalize.
*/
export declare function normalizeFunctionCov(funcCov: FunctionCov): void;
/**
* @internal
*/
export declare function normalizeRangeTree(tree: RangeTree): void;

View File

@ -0,0 +1,24 @@
import { RangeCov } from "./types";
export declare class RangeTree {
start: number;
end: number;
delta: number;
children: RangeTree[];
constructor(start: number, end: number, delta: number, children: RangeTree[]);
/**
* @precodition `ranges` are well-formed and pre-order sorted
*/
static fromSortedRanges(ranges: ReadonlyArray<RangeCov>): RangeTree | undefined;
normalize(): void;
/**
* @precondition `tree.start < value && value < tree.end`
* @return RangeTree Right part
*/
split(value: number): RangeTree;
/**
* Get the range coverages corresponding to the tree.
*
* The ranges are pre-order sorted.
*/
toRanges(): RangeCov[];
}

View File

@ -0,0 +1,22 @@
export interface ProcessCov {
result: ScriptCov[];
}
export interface ScriptCov {
scriptId: string;
url: string;
functions: FunctionCov[];
}
export interface FunctionCov {
functionName: string;
ranges: RangeCov[];
isBlockCoverage: boolean;
}
export interface Range {
readonly start: number;
readonly end: number;
}
export interface RangeCov {
startOffset: number;
endOffset: number;
count: number;
}

27
debian/nodejs/extcopies vendored Normal file
View File

@ -0,0 +1,27 @@
ansi-escapes
ansi-styles
@babel/parser
read-pkg
read-pkg-up
source-map-support
ts-node
@types/babel__core
@types/babel__generator
@types/babel__traverse
@types/babel__template
@types/glob
@types/glob-stream
@types/gulp
@types/istanbul-lib-instrument
@types/istanbul-lib-report
@types/istanbul-lib-source-maps
@types/istanbul-reports
@types/jsdom
@types/micromatch
@types/react
@types/react-is
@types/rimraf
@types/undertaker
@types/vinyl-fs
@types/yargs
v8-to-istanbul

65
debian/nodejs/extlinks vendored Normal file
View File

@ -0,0 +1,65 @@
ansi-regex
anymatch
async-done
@babel/core
@babel/generator
@babel/traverse
@babel/types
callsites
camelcase
chalk
chokidar
ci-info
csstype
deepmerge
detect-newline
emittery
escalade
execa
fast-json-stable-stringify
is-generator-fn
leven
make-error
pirates
slash
source-map
strip-ansi
strip-bom
strip-json-comments
tslib
typescript
type-fest
@types/babel__code-frame
@types/babel-types
@types/braces
@types/chai
@types/ci-info
@types/co
@types/color-name
@types/convert-source-map
@types/exit
@types/fb-watchman
@types/graceful-fs
@types/istanbul-lib-coverage
@types/merge-stream
@types/minimatch
@types/minimist
@types/node
@types/normalize-package-data
@types/parse5
@types/parse-json
@types/picomatch
@types/prompts
@types/prop-types
@types/resolve
@types/sane
@types/scheduler
@types/sinonjs__fake-timers
@types/semver
@types/stack-utils
@types/supports-color
@types/tough-cookie
@types/undertaker-registry
@types/vinyl
@types/write-file-atomic
@types/yargs-parser

View File

@ -0,0 +1,3 @@
mv ../node_modules/@types/jsdom ../node_modules/@types/.jsdom
tsc -p ./tsconfig.build.json
mv ../node_modules/@types/.jsdom ../node_modules/@types/jsdom

1
debian/nodejs/main vendored Normal file
View File

@ -0,0 +1 @@
packages/jest

View File

@ -0,0 +1 @@
build

1
debian/nodejs/resolveexports/build vendored Normal file
View File

@ -0,0 +1 @@
bundt

1
debian/nodejs/root_modules vendored Normal file
View File

@ -0,0 +1 @@
*

View File

@ -0,0 +1,57 @@
/**
* Diff Match and Patch
* Copyright 2018 The diff-match-patch Authors.
* https://github.com/google/diff-match-patch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Computes the difference between two texts to create a patch.
* Applies the patch onto another text, allowing for errors.
* @author fraser@google.com (Neil Fraser)
*/
/**
* CHANGES by pedrottimark to diff_match_patch_uncompressed.ts file:
*
* 1. Delete anything not needed to use diff_cleanupSemantic method
* 2. Convert from prototype properties to var declarations
* 3. Convert Diff to class from constructor and prototype
* 4. Add type annotations for arguments and return values
* 5. Add exports
*/
/**
* The data structure representing a diff is an array of tuples:
* [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
* which means: delete 'Hello', add 'Goodbye' and keep ' world.'
*/
declare var DIFF_DELETE: number;
declare var DIFF_INSERT: number;
declare var DIFF_EQUAL: number;
/**
* Class representing one diff tuple.
* Attempts to look like a two-element array (which is what this used to be).
* @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL.
* @param {string} text Text to be deleted, inserted, or retained.
* @constructor
*/
declare class Diff {
0: number;
1: string;
constructor(op: number, text: string);
}
/**
* Reduce the number of edits by eliminating semantically trivial equalities.
* @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
*/
declare var diff_cleanupSemantic: (diffs: Array<Diff>) => void;
export { Diff, DIFF_EQUAL, DIFF_DELETE, DIFF_INSERT, diff_cleanupSemantic as cleanupSemantic, };

View File

@ -0,0 +1,8 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export declare const NO_DIFF_MESSAGE = "Compared values have no visual difference.";
export declare const SIMILAR_MESSAGE: string;

View File

@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Diff } from './cleanupSemantic';
import type { DiffOptions } from './types';
export declare const diffLinesUnified: (aLines: Array<string>, bLines: Array<string>, options?: DiffOptions | undefined) => string;
export declare const diffLinesUnified2: (aLinesDisplay: Array<string>, bLinesDisplay: Array<string>, aLinesCompare: Array<string>, bLinesCompare: Array<string>, options?: DiffOptions | undefined) => string;
export declare const diffLinesRaw: (aLines: Array<string>, bLines: Array<string>) => Array<Diff>;

View File

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Diff } from './cleanupSemantic';
declare const diffStrings: (a: string, b: string) => Array<Diff>;
export default diffStrings;

View File

@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Diff } from './cleanupSemantic';
import type { DiffOptionsColor } from './types';
declare const getAlignedDiffs: (diffs: Array<Diff>, changeColor: DiffOptionsColor) => Array<Diff>;
export default getAlignedDiffs;

View File

@ -0,0 +1,16 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff } from './cleanupSemantic';
import { diffLinesRaw, diffLinesUnified, diffLinesUnified2 } from './diffLines';
import { diffStringsRaw, diffStringsUnified } from './printDiffs';
import type { DiffOptions } from './types';
export type { DiffOptions, DiffOptionsColor } from './types';
export { diffLinesRaw, diffLinesUnified, diffLinesUnified2 };
export { diffStringsRaw, diffStringsUnified };
export { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff };
declare function diff(a: any, b: any, options?: DiffOptions): string | null;
export default diff;

View File

@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Diff } from './cleanupSemantic';
import type { DiffOptionsNormalized } from './types';
export declare const joinAlignedDiffsNoExpand: (diffs: Array<Diff>, options: DiffOptionsNormalized) => string;
export declare const joinAlignedDiffsExpand: (diffs: Array<Diff>, options: DiffOptionsNormalized) => string;

View File

@ -0,0 +1,9 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import type { DiffOptions, DiffOptionsNormalized } from './types';
export declare const noColor: (string: string) => string;
export declare const normalizeDiffOptions: (options?: DiffOptions) => DiffOptionsNormalized;

View File

@ -0,0 +1,22 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Diff } from './cleanupSemantic';
import type { DiffOptions, DiffOptionsNormalized } from './types';
export declare const printDeleteLine: (line: string, isFirstOrLast: boolean, { aColor, aIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder, }: DiffOptionsNormalized) => string;
export declare const printInsertLine: (line: string, isFirstOrLast: boolean, { bColor, bIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder, }: DiffOptionsNormalized) => string;
export declare const printCommonLine: (line: string, isFirstOrLast: boolean, { commonColor, commonIndicator, commonLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder, }: DiffOptionsNormalized) => string;
export declare const hasCommonDiff: (diffs: Array<Diff>, isMultiline: boolean) => boolean;
export declare type ChangeCounts = {
a: number;
b: number;
};
export declare const countChanges: (diffs: Array<Diff>) => ChangeCounts;
export declare const printAnnotation: ({ aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator, includeChangeCounts, omitAnnotationLines, }: DiffOptionsNormalized, changeCounts: ChangeCounts) => string;
export declare const printDiffLines: (diffs: Array<Diff>, options: DiffOptionsNormalized) => string;
export declare const createPatchMark: (aStart: number, aEnd: number, bStart: number, bEnd: number, { patchColor }: DiffOptionsNormalized) => string;
export declare const diffStringsUnified: (a: string, b: string, options?: DiffOptions | undefined) => string;
export declare const diffStringsRaw: (a: string, b: string, cleanup: boolean) => Array<Diff>;

View File

@ -0,0 +1,45 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export declare type DiffOptionsColor = (arg: string) => string;
export declare type DiffOptions = {
aAnnotation?: string;
aColor?: DiffOptionsColor;
aIndicator?: string;
bAnnotation?: string;
bColor?: DiffOptionsColor;
bIndicator?: string;
changeColor?: DiffOptionsColor;
changeLineTrailingSpaceColor?: DiffOptionsColor;
commonColor?: DiffOptionsColor;
commonIndicator?: string;
commonLineTrailingSpaceColor?: DiffOptionsColor;
contextLines?: number;
emptyFirstOrLastLinePlaceholder?: string;
expand?: boolean;
includeChangeCounts?: boolean;
omitAnnotationLines?: boolean;
patchColor?: DiffOptionsColor;
};
export declare type DiffOptionsNormalized = {
aAnnotation: string;
aColor: DiffOptionsColor;
aIndicator: string;
bAnnotation: string;
bColor: DiffOptionsColor;
bIndicator: string;
changeColor: DiffOptionsColor;
changeLineTrailingSpaceColor: DiffOptionsColor;
commonColor: DiffOptionsColor;
commonIndicator: string;
commonLineTrailingSpaceColor: DiffOptionsColor;
contextLines: number;
emptyFirstOrLastLinePlaceholder: string;
expand: boolean;
includeChangeCounts: boolean;
omitAnnotationLines: boolean;
patchColor: DiffOptionsColor;
};

View File

@ -0,0 +1,32 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import type { Config, Printer, Refs } from './types';
/**
* Return entries (for example, of a map)
* with spacing, indentation, and comma
* without surrounding punctuation (for example, braces)
*/
export declare function printIteratorEntries(iterator: Iterator<[unknown, unknown]>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer, separator?: string): string;
/**
* Return values (for example, of a set)
* with spacing, indentation, and comma
* without surrounding punctuation (braces or brackets)
*/
export declare function printIteratorValues(iterator: Iterator<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
/**
* Return items (for example, of an array)
* with spacing, indentation, and comma
* without surrounding punctuation (for example, brackets)
**/
export declare function printListItems(list: ArrayLike<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
/**
* Return properties of an object
* with spacing, indentation, and comma
* without surrounding punctuation (for example, braces)
*/
export declare function printObjectProperties(val: Record<string, unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;

Some files were not shown because too many files have changed in this diff Show More