Upstream merge; resolve conflicts

This commit is contained in:
Zev Spitz
2018-05-13 17:52:23 +02:00
40 changed files with 25097 additions and 3523 deletions
+17 -35
View File
@@ -1,41 +1,23 @@
import cosmiconfig = require("cosmiconfig");
import cosmiconfig, { CosmiconfigResult } from "cosmiconfig";
import * as path from "path";
const asyncExplorer = cosmiconfig("yourModuleName", {
packageProp: "yourModuleName",
rc: ".yourModuleNamerc",
js: "yourModuleName.config.js",
rcStrictJson: false,
rcExtensions: false,
stopDir: "someDir",
cache: true,
sync: false,
transform: ({ config, filePath }) => ({ config, filePath }),
format: "js"
const explorer = cosmiconfig("yourModuleName", {
searchPlaces: [],
loaders: {},
packageProp: "yourModuleName",
stopDir: "someDir",
cache: true,
transform: (result: CosmiconfigResult) => result,
ignoreEmptySearchPlaces: false,
});
Promise.all([
asyncExplorer.load(),
asyncExplorer.load("start/search/here"),
asyncExplorer.load(null, "load/this/file.json")
explorer.search(path.join(__dirname)),
explorer.searchSync(path.join(__dirname)),
explorer.load(path.join(__dirname, "sample-config.json")),
explorer.loadSync(path.join(__dirname, "sample-config.json")),
]).then(result => result);
asyncExplorer.load().then(({ config, filePath }) => ({ config, filePath }));
asyncExplorer.clearFileCache();
asyncExplorer.clearDirectoryCache();
asyncExplorer.clearCaches();
const syncExplorer = cosmiconfig("yourModuleName", {
packageProp: "yourModuleName",
rc: ".yourModuleNamerc",
js: "yourModuleName.config.js",
rcStrictJson: false,
rcExtensions: false,
stopDir: "someDir",
cache: true,
sync: true,
transform: ({ config, filePath }) => ({ config, filePath }),
format: "js"
});
const { config, filePath } = syncExplorer.load();
explorer.clearLoadCache();
explorer.clearSearchCache();
explorer.clearCaches();
+41 -46
View File
@@ -1,63 +1,58 @@
// Type definitions for cosmiconfig 4.0
// Type definitions for cosmiconfig 5.0
// Project: https://github.com/davidtheclark/cosmiconfig
// Definitions by: ozum <https://github.com/ozum>
// szeck87 <https://github.com/szeck87>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
interface Result {
config: object;
filePath: string;
/// <reference types="node" />
export interface Config {
[key: string]: any;
}
interface Options {
packageProp?: string | false;
rc?: string | false;
js?: string | false;
rcStrictJson?: boolean;
rcExtensions?: boolean;
stopDir?: string;
cache?: boolean;
transform?: (result: Result) => Promise<Result> | Result;
configPath?: string;
format?: "json" | "yaml" | "js";
export type CosmiconfigResult = {
config: Config;
filePath: string;
isEmpty?: boolean;
} | null;
export interface LoaderResult {
config: Config | null;
filepath: string;
}
// Default is false and makes load() method async
interface AsyncOptions extends Options {
sync?: false;
export type SyncLoader = (filepath: string, content: string) => Config | null;
export type AsyncLoader = (filepath: string, content: string) => Config | null | Promise<object | null>;
export interface LoaderEntry {
sync?: SyncLoader;
async?: AsyncLoader;
}
// Makes load() method sync
interface SyncOptions extends Options {
sync: true;
export interface Loaders {
[key: string]: LoaderEntry;
}
interface Explorer {
clearFileCache(): void;
clearDirectoryCache(): void;
clearCaches(): void;
export interface Explorer {
search(searchFrom: string): Promise<null | CosmiconfigResult>;
searchSync(searchFrom: string): null | CosmiconfigResult;
load(loadPath: string): Promise<CosmiconfigResult>;
loadSync(loadPath: string): CosmiconfigResult;
clearLoadCache(): void;
clearSearchCache(): void;
clearCaches(): void;
}
interface AsyncExplorer extends Explorer {
// You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added.
load(searchPath?: string): Promise<Result>;
load(searchPath: null | undefined, configPath?: string): Promise<Result>;
// These are the user options with defaults applied.
export interface ExplorerOptions {
stopDir?: string;
cache?: boolean;
transform?: (result: CosmiconfigResult) => Promise<CosmiconfigResult> | CosmiconfigResult;
packageProp?: string;
loaders?: Loaders;
searchPlaces?: string[];
ignoreEmptySearchPlaces?: boolean;
}
interface SyncExplorer extends Explorer {
// You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added.
load(searchPath?: string): Result;
load(searchPath: null | undefined, configPath?: string): Result;
}
declare function cosmiconfig(
moduleName: string,
options: SyncOptions
): SyncExplorer;
declare function cosmiconfig(
moduleName: string,
options?: AsyncOptions
): AsyncExplorer;
export = cosmiconfig;
export default function cosmiconfig(moduleName: string, options: ExplorerOptions): Explorer;
+41
View File
@@ -0,0 +1,41 @@
import cosmiconfig = require("cosmiconfig");
const asyncExplorer = cosmiconfig("yourModuleName", {
packageProp: "yourModuleName",
rc: ".yourModuleNamerc",
js: "yourModuleName.config.js",
rcStrictJson: false,
rcExtensions: false,
stopDir: "someDir",
cache: true,
sync: false,
transform: ({ config, filePath }) => ({ config, filePath }),
format: "js"
});
Promise.all([
asyncExplorer.load(),
asyncExplorer.load("start/search/here"),
asyncExplorer.load(null, "load/this/file.json")
]).then(result => result);
asyncExplorer.load().then(({ config, filePath }) => ({ config, filePath }));
asyncExplorer.clearFileCache();
asyncExplorer.clearDirectoryCache();
asyncExplorer.clearCaches();
const syncExplorer = cosmiconfig("yourModuleName", {
packageProp: "yourModuleName",
rc: ".yourModuleNamerc",
js: "yourModuleName.config.js",
rcStrictJson: false,
rcExtensions: false,
stopDir: "someDir",
cache: true,
sync: true,
transform: ({ config, filePath }) => ({ config, filePath }),
format: "js"
});
const { config, filePath } = syncExplorer.load();
+63
View File
@@ -0,0 +1,63 @@
// Type definitions for cosmiconfig 4.0
// Project: https://github.com/davidtheclark/cosmiconfig
// Definitions by: ozum <https://github.com/ozum>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
interface Result {
config: object;
filePath: string;
}
interface Options {
packageProp?: string | false;
rc?: string | false;
js?: string | false;
rcStrictJson?: boolean;
rcExtensions?: boolean;
stopDir?: string;
cache?: boolean;
transform?: (result: Result) => Promise<Result> | Result;
configPath?: string;
format?: "json" | "yaml" | "js";
}
// Default is false and makes load() method async
interface AsyncOptions extends Options {
sync?: false;
}
// Makes load() method sync
interface SyncOptions extends Options {
sync: true;
}
interface Explorer {
clearFileCache(): void;
clearDirectoryCache(): void;
clearCaches(): void;
}
interface AsyncExplorer extends Explorer {
// You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added.
load(searchPath?: string): Promise<Result>;
load(searchPath: null | undefined, configPath?: string): Promise<Result>;
}
interface SyncExplorer extends Explorer {
// You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added.
load(searchPath?: string): Result;
load(searchPath: null | undefined, configPath?: string): Result;
}
declare function cosmiconfig(
moduleName: string,
options: SyncOptions
): SyncExplorer;
declare function cosmiconfig(
moduleName: string,
options?: AsyncOptions
): AsyncExplorer;
export = cosmiconfig;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": ["../../"],
"paths": {
"cosmiconfig": [ "cosmiconfig/v4" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "cosmiconfig-tests.ts"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+10 -9
View File
@@ -112,19 +112,20 @@ export declare class SheetsRegistry {
remove(sheet: StyleSheet): void;
toString(options?: ToCssOptions): string;
}
export type CreateStyleSheetOptions<Name extends string = any> = Partial<{
media: string;
meta: string;
link: boolean;
element: HTMLStyleElement;
index: number;
generateClassName: GenerateClassName<Name>;
classNamePrefix: string;
}>;
declare class JSS {
constructor(options?: Partial<JSSOptions>);
createStyleSheet<Name extends string>(
styles: Partial<Styles<Name>>,
options?: Partial<{
media: string;
meta: string;
link: boolean;
element: HTMLStyleElement;
index: number;
generateClassName: GenerateClassName<Name>;
classNamePrefix: string;
}>,
options?: CreateStyleSheetOptions<Name>,
): StyleSheet<Name>;
removeStyleSheet(sheet: StyleSheet): this;
setup(options?: Partial<JSSOptions>): this;
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for lazy-value 1.0
// Project: https://github.com/sindresorhus/lazy-value
// Definitions by: Ika <https://github.com/ikatyang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Create a [lazily evaluated](https://en.wikipedia.org/wiki/Lazy_evaluation) value.
*
* Useful when a value is expensive to generate, so you want to delay the computation until the value is needed.
* For example, improving startup performance by deferring nonessential operations.
*
* @param fn Expected to return a value.
*/
declare function lazyValue<T extends () => any>(fn: T): T;
export = lazyValue;
+8
View File
@@ -0,0 +1,8 @@
import lazyValue = require("lazy-value");
declare function expensiveComputation(): string;
declare function doSomething(x: string): void;
const val = lazyValue(expensiveComputation);
doSomething(val());
@@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es5"
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
@@ -16,6 +16,6 @@
},
"files": [
"index.d.ts",
"activex-iwshruntimelibrary-tests.ts"
"lazy-value-tests.ts"
]
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1 -1
View File
@@ -42,7 +42,7 @@ export declare class Peripheral extends events.EventEmitter {
advertisement: Advertisement;
rssi: number;
services: Service[];
state: string;
state: 'error' | 'connecting' | 'connected' | 'disconnecting' | 'disconnected';
connect(callback?: (error: string) => void): void;
disconnect(callback?: () => void): void;
+15
View File
@@ -56,6 +56,21 @@ interface WeakMapConstructor { }
interface SetConstructor { }
interface WeakSetConstructor { }
// Forward-declare needed types from lib.es2015.d.ts (in case users are using `--lib es5`)
interface Iterable<T> { }
interface Iterator<T> {
next(value?: any): IteratorResult<T>;
}
interface IteratorResult<T> { }
interface AsyncIterableIterator<T> {}
interface SymbolConstructor {
readonly iterator: symbol;
readonly asyncIterator: symbol;
}
declare var Symbol: SymbolConstructor;
/************************************************
* *
* GLOBAL *
+1 -1
View File
@@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es5"
],
"noImplicitAny": true,
"noImplicitThis": true,
+23056 -3239
View File
File diff suppressed because it is too large Load Diff
+55 -4
View File
@@ -37,7 +37,7 @@ function test_excel() {
["Female", 14]
];
var chart = sheet.charts.add(Excel.ChartType._3DColumn, range, "auto");
var chart = sheet.charts.add(Excel.ChartType._3DColumn, range, "Auto");
chart.format.fill.setSolidColor("F8F8FF");
@@ -46,7 +46,7 @@ function test_excel() {
chart.title.format.font.size = 18;
chart.title.format.font.color = "568568";
chart.legend.position = "right";
chart.legend.position = "Right";
chart.legend.format.font.name = "Algerian";
chart.legend.format.font.size = 13;
@@ -165,9 +165,9 @@ function test_word() {
myContentControl.tag = 'Customer-Address';
myContentControl.title = 'Enter Customer Address Here:';
myContentControl.style = 'Heading 2';
myContentControl.insertText('One Microsoft Way, Redmond, WA 98052', 'replace');
myContentControl.insertText('One Microsoft Way, Redmond, WA 98052', 'Replace');
myContentControl.cannotEdit = true;
myContentControl.appearance = 'tags';
myContentControl.appearance = 'Tags';
// Queue a command to load the id property for the content control you created.
context.load(myContentControl, 'id');
@@ -265,3 +265,54 @@ function test_shared() {
}
);
}
async function test_visio() {
const url = "someurl";
try {
const session = new OfficeExtension.EmbeddedSession(url, { id: "embed-iframe", container: document.getElementById("iframeHost") });
await session.init();
await Visio.run(session, async context => {
const eventResult = context.document.onPageLoadComplete.add(async args => {
console.log(Date.now() + ": Page Load Complete Event: " + JSON.stringify(args));
});
await context.sync();
console.log("Success");
});
} catch (error) {
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
}
}
function test_OfficePromise() {
let p1: Promise<any> = Excel.run(async () => { return 10 });
let p2: Promise<any> = new OfficeExtension.Promise(resolve => setTimeout(resolve, 1000));
let p3: Promise<any> = new Office.Promise(resolve => setTimeout(resolve, 1000));
let p4: OfficeExtension.IPromise<any> = new OfficeExtension.Promise(resolve => setTimeout(resolve, 1000));
}
async function test_interfaces() {
await Excel.run(async context => {
let range = context.workbook.getSelectedRange();
range.set({
values: [["Hi"]],
format: {
fill: {
color: "red"
}
}
});
let rangeSettables: Excel.Interfaces.RangeUpdateData = {
values: [["Hi"]],
format: {
fill: {
color: "red"
}
}
};
range.set(rangeSettables);
});
}
+9 -4
View File
@@ -9,7 +9,8 @@ export type Doc = doc.builders.Doc;
// https://github.com/prettier/prettier/blob/master/src/common/fast-path.js
export interface FastPath {
getName(): string | null;
stack: any[];
getName(): null | number | string;
getValue(): any;
getNode(count?: number): any;
getParentNode(count?: number): any;
@@ -131,12 +132,12 @@ export interface Printer {
options: ParserOptions,
print: (path: FastPath) => Doc,
): Doc;
embed(
embed?: (
path: FastPath,
print: (path: FastPath) => Doc,
textToDoc: (text: string, options: Options) => Doc,
options: ParserOptions,
): Doc | null;
) => Doc | null;
insertPragma?: (text: string) => string;
/**
* @returns `null` if you want to remove this node
@@ -405,7 +406,11 @@ export namespace doc {
function printDocToDebug(doc: Doc): string;
}
namespace printer {
function printDocToString(doc: Doc, options: Options): string;
function printDocToString(doc: Doc, options: Options): {
formatted: string;
cursorNodeStart?: number;
cursorNodeText?: string;
};
interface Options {
/**
* Specify the line length that the printer will wrap on.
+838
View File
@@ -0,0 +1,838 @@
// Type definitions for proton-native 0.55
// Project: https://github.com/kusti8/proton-native
// Definitions by: Nguyen Xuan Khanh <https://github.com/khanhas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from 'react';
export interface AppProps {
/**
* Called when the quit menu item is called, right before the entire app quits.
*/
onShouldQuit?: () => void;
}
/**
* The app is the container for the entire program and holds Windows and Menus.
*/
export class App extends React.Component<AppProps> { }
export interface AreaBaseProps {
/**
* The fill color for the component.
*/
fill?: string;
/**
* The opacity of the fill (between 0 and 1). Gets multiplied with the fill colors alpha value.
*/
fillOpacity?: number;
/**
* The stroke (line) color for the component.
*/
stroke?: string;
strokeLinecap?: 'flat' | 'round' | 'bevel';
strokeLinejoin?: 'miter' | 'round' | 'bevel';
/**
* How far to extend the stroke at a sharp corner when using `strokeLinejoin='miter'`
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit
* for a more detailed explanation.
*/
strokeMiterlimit?: number;
/**
* The opacity of the stroke (between 0 and 1). Gets multiplied with the stroke colors alpha value.
*/
strokeOpacity?: number;
strokeWidth?: number;
/**
* List of transformations to apply to the component (are quite similar to SVG transformations). Example for multiple transformations: `transform="translate(100, 100) rotate(90)"`.
*
* All x and y coordinates specified in a transformation are relative _to the component itself_, meaning that `translate(-50%, 0)` will translate the component by 50% of it's own width to left.
*/
transform?: string;
}
export interface AreaRectangleProps extends AreaBaseProps {
/**
* The height of the rectangle.
*/
height: number | string;
/**
* The width of the rectangle.
*/
width: number | string;
/**
* The x coordinate of the rectangles top left corner.
*/
x: number | string;
/**
* The y coordinate of the rectangles top left corner.
*/
y: number | string;
}
/**
* A rectangle to be displayed in an Area component.
*/
export class AreaRectangle extends React.Component<AreaRectangleProps> { }
export interface AreaLineProps extends AreaBaseProps {
/**
* The x coordinate of the line's start point.
*/
x1: number | string;
/**
* The x coordinate of the line's end point.
*/
x2: number | string;
/**
* The y coordinate of the line's start point.
*/
y1: number | string;
/**
* The y coordinate of the line's end point.
*/
y2: number | string;
}
export class AreaLine extends React.Component<AreaLineProps> { }
export interface AreaCircleProps extends AreaBaseProps {
/**
* The circle's radius. Percentage values use the Area's width.
*/
r: number | string;
/**
* The x coordinate of the center of the cirle.
*/
x: number | string;
/**
* The y coordinate of the center of the cirle.
*/
y: number | string;
}
export class AreaCircle extends React.Component<AreaCircleProps> { }
export interface AreaBezierProps extends AreaBaseProps {
/**
* The x coordinate of the curve's control point at the start.
*/
cx1: number | string;
/**
* The x coordinate of the curve's control point at the end.
*/
cx2: number | string;
/**
* The y coordinate of the curve's control point at the start.
*/
cy1: number | string;
/**
* The y coordinate of the curve's control point at the end.
*/
cy2: number | string;
/**
* The x coordinate of the curve's start point.
*/
x1: number | string;
/**
* The x coordinate of the curve's end point.
*/
x2: number | string;
/**
* The y coordinate of the curve's start point.
*/
y1: number | string;
/**
* The y coordinate of the curve's end point.
*/
y2: number | string;
}
export class AreaBezier extends React.Component<AreaBezierProps> { }
export interface AreaPathProps extends AreaBaseProps {
/**
* A string describing the path (uses SVG's path syntax, explanation @see https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths).
*
* A warning is displayed whan an unimplemented shaped are used (Quadratic Beziers and Arcs).
*/
d: string;
/**
* Sets the methods how to determine wheter to fill a path. Explanation @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule.
*/
fillMode: 'nonzero' | 'evenodd';
}
export class AreaPath extends React.Component<AreaPathProps> { }
export interface MouseEvent {
button: number;
height: number;
width: number;
x: number;
y: number;
}
export interface KeyboardEvent {
extKey: number;
key: string;
modifierKey: number;
modifiers: number;
}
export interface AreaProps extends AreaBaseProps {
/**
* Called when releasing a key. Return `true` to signal that this event got handled (always returning true will disable any menu accelerators).
*/
onKeyDown?: (event: KeyboardEvent) => boolean;
/**
* Called when pressing a key. Return `true` to signal that this event got handled (always returning true will disable any menu accelerators).
*/
onKeyUp?: (event: KeyboardEvent) => boolean;
/**
* Whether the area can be seen.
*/
onMouseDown?: (event: MouseEvent) => void;
/**
* Called when the mouse enters the area.
*/
onMouseEnter?: () => void;
/**
* Called when the mouse leaves the area.
*/
onMouseLeave?: () => void;
/**
* Called when the mouse is moved over the area
*/
onMouseMove?: (event: {
buttons: ReadonlyArray<string>;
height: number;
width: number;
x: number;
y: number;
}) => void;
/**
* **Not working at the moment.**
*
* Called when releasing a mouse button over the area.
*/
onMouseUp?: (event: MouseEvent) => void;
/**
* Whether the area can be seen.
*/
visible?: boolean;
}
/**
* A component onto which area components like rectangles or circles can be drawn.
*
* Some props can be applied to all area components (including Area itself and children)
* @see https://proton-native.js.org/#/area_props.
*/
export class Area extends React.Component<AreaProps> {
/**
* A Bezier curve to be displayed in an Area component.
*/
static Bezier: typeof AreaBezier;
/**
* A circle to be displayed in an Area component.
*/
static Circle: typeof AreaCircle;
/**
* A straigt line to be displayed in an Area component.
*/
static Line: typeof AreaLine;
/**
* A component describing a path to be displayed in an Area component.
*
* To be able to use percentage values in transforms, the props `width` and `height` need to be specified (they have no graphical effect).
*/
static Path: typeof AreaPath;
/**
* A rectangle to be displayed in an Area component.
*/
static Rectangle: typeof AreaRectangle;
}
/**
* Undocumented
*/
export class AreaInternal extends React.Component { }
export interface BoxProps {
/**
* Whether the Box is enabled.
*/
enabled?: boolean;
/**
* Whether there is extra space between the children in the Box.
*/
padded?: boolean;
/**
* Whether the Box arranges its children vertically or horizontally.
*/
vertical?: boolean;
/**
* Whether the Box and its children can be seen.
*/
visible?: boolean;
}
export class Box extends React.Component<BoxProps> { }
export interface ButtonProps {
/**
* Whether the button can be clicked.
*/
enabled?: boolean;
/**
* Called when the button is clicked.
*/
onClick?: () => void;
/**
* Whether the button can be seen.
*/
visible?: boolean;
}
/**
* A container for multiple components that are ordered vertically or horizontally. Similar to React Native's `View`.
*/
export class Button extends React.Component<ButtonProps> { }
export interface CheckboxProps {
/**
* Whether the checkbox can be used.
*/
enabled?: boolean;
/**
* Whether the checkbox is checked or not.
*/
checked?: boolean;
/**
* Called when the checkbox is clicked. The current checkbox state is passed as an argument.
*/
onToggle?: (checked: boolean) => void;
/**
* Whether the checkbox can be seen.
*/
visible?: boolean;
}
export class Checkbox extends React.Component<CheckboxProps> { }
export interface ColorButtonProps {
/**
* The initial color for the ColorButton. Can be passed as standard color seen in CSS (a color name, hex, rgb, rgba, hsl, hsla).
*/
color?: string;
/**
* Called when the color is changed for the ColorButton. The current color is passed as an object of RGBA.
*/
onClick?: (color: {
r: number,
g: number,
b: number,
a: number
}) => void;
}
/**
* A button that allows the user to choose a color.
*/
export class ColorButton extends React.Component<ColorButtonProps> { }
/**
* Undocumented
*/
export class Combobox extends React.Component { }
/**
* Undocumented
*/
export class ComboboxItem extends React.Component { }
/**
* Undocumented
*/
export class EditableCombobox extends React.Component { }
/**
* Undocumented
*/
export class Entry extends React.Component { }
/**
* Undocumented
*/
export class FontButton extends React.Component { }
export interface FormProps {
/**
* Whether the Form is enabled.
*/
enabled?: boolean;
/**
* Whether there is padding between the components
*/
padded?: boolean;
/**
* Whether the Form can be seen.
*/
visible?: boolean;
}
/**
* A container where there is a label on the left and a component on the right.
*
* Each form component has a single prop, `label` which sets the label to its left. It is required.
*/
export class Form extends React.Component<FormProps> { }
export interface GridChildrenProps {
/**
* Whether the component is aligned with the other components in the column/row.
*/
align?: {
h: boolean;
v: boolean;
};
/**
* What column the component resides in.
*/
column?: number;
/**
* Whether the component can expand in the direction.
*/
expand?: {
h: boolean;
v: boolean;
};
/**
* What row the component resides in.
*/
row?: number;
}
export interface GridProps {
/**
* Whether the Grid is enabled.
*/
enabled?: boolean;
/**
* Whether there is padding between the components
*/
padded?: boolean;
/**
* Whether the Grid can be seen.
*/
visible?: boolean;
}
/**
* A grid where components can be placed in rows and columns.
*/
export class Grid extends React.Component<GridProps> { }
export interface GroupProps {
/**
* Whether the Group is enabled.
*/
enabled?: boolean;
/**
* Whether there is a margin inside the group.
*/
margined?: boolean;
/**
* The name of the group.
*/
title?: string;
/**
* Whether the Grid can be seen.
*/
visible?: boolean;
}
/**
* A named group of components.
*/
export class Group extends React.Component<GroupProps> { }
/**
* Undocumented
*/
export class HorizontalBox extends React.Component { }
/**
* Undocumented
*/
export class HorizontalSeparator extends React.Component { }
export interface MenuProps {
/**
* The name of the menu.
*/
label?: string;
}
export interface MenuItemProps {
/**
* How the menu item is displayed.
*
* - `Check` - a checkable option in the menu.
* - `Quit` - a Quit button. This accepts no text.
* - `About` - an About button. This accepts no text.
* - `Preferences` - a Preferences button. This accepts no text.
* - `Separator` - a Separator between menu items. This accepts no text.
* - `Item` - a normal menu button. This is the default.
*/
type?: 'Check' | 'Quit' | 'About' | 'Preferences' | 'Separator' | 'Item';
/**
* If the type is `Check`, then set whether it is checked or not.
*/
checked?: boolean;
/**
* Called when the menu item is clicked. If the type is `Check`, then it passes whether it is checked as an argument.
*/
onClick?: (checked: boolean) => void;
}
export class MenuItem extends React.Component<MenuItemProps> { }
/**
* The top bar on a window that can have multiple options.
*
* The menu must come outside and before the Window for it to take effect. It is made up of Menu.Items. Menus can be embedded inside eachother to make sub-menus.
*/
export class Menu extends React.Component<MenuProps> {
/**
* A single item in a Menu.
*/
static Item: typeof MenuItem;
}
/**
* Undocumented
*/
export class MenuBar extends React.Component { }
/**
* Undocumented
*/
export class MenuBarItem extends React.Component { }
/**
* Undocumented
*/
export class MultilineEntry extends React.Component { }
/**
* Undocumented
*/
export class PasswordEntry extends React.Component { }
export interface PickerProps {
/**
* Whether the user can enter their own custom text in addition to the drop down menu.
*/
editable?: boolean;
/**
* Whether the Picker is enabled.
*/
enabled?: boolean;
/**
* When an *editable* Picker is changed. The current text is passed as an argument.
*/
onChange?: (text: string) => void;
/**
* When a *non-editable* Picker is changed. The current selection is passed as an argument.
*/
onSelect?: (selection: string) => void;
/**
* What element is selected if the picker *is not* editable.
*/
selected?: boolean;
/**
* What text is selected/typed if the picker *is* editable.
*/
text?: boolean;
/**
* Whether the Picker can be seen.
*/
visible?: boolean;
}
/**
* A drop down menu where the user can pick different values.
*/
export class Picker extends React.Component<PickerProps> { }
export interface ProgressBarProps {
/**
* Whether the ProgressBar is enabled.
*/
enabled?: boolean;
/**
* The current value of the ProgressBar (0-100). A value of -1 indicates an indeterminate progressbar.
*/
value?: number;
/**
* Whether the ProgressBar can be seen.
*/
visible?: boolean;
}
/**
* A bar that shows the progress in a certain task, 0-100.
*/
export class ProgressBar extends React.Component<ProgressBarProps> { }
/**
* Undocumented
*/
export class RadioButton extends React.Component { }
export class RadioButtonItem extends React.Component { }
export interface RadioButtonsProps {
/**
* Whether the RadioButtons can be used.
*/
enabled?: boolean;
/**
* Called when a RadioButton is selected. The number selected is passed as an argument.
*/
onSelect?: (selected: boolean) => void;
/**
* What RadioButton is selected, zero-indexed. -1 means nothing is selected.
*/
selected?: number;
/**
* Whether the RadioButtons can be seen.
*/
visible?: boolean;
}
/**
* A choice between multiple options.
*
* Every child must be a RadioButtons.Item, that requires a string child that is the label to display to the right of the RadioButton.
*/
export class RadioButtons extends React.Component<RadioButtonsProps> {
static Item: typeof RadioButtonItem;
}
export interface SeparatorProps {
/**
* Whether the Separator is enabled.
*/
enabled?: boolean;
/**
* Whether the line is vertical or horizontal.
*/
vertical?: boolean;
/**
* Whether the Separator can be seen.
*/
visible?: boolean;
}
/**
* A line to separate two components, commonly used in a Box.
*/
export class Separator extends React.Component<SeparatorProps> { }
export interface SliderProps {
/**
* Whether the Slider is enabled.
*/
enabled?: boolean;
/**
* Called when the value of the slider is changed. The current value is passed as an argument.
*/
onChange?: (value: number) => void;
/**
* The current value of the Slider (0-100).
*/
value?: number;
/**
* Whether the Slider can be seen.
*/
visible?: boolean;
}
/**
* A bar that can be dragged by the user from 0-100.
*/
export class Slider extends React.Component<SliderProps> { }
export interface SpinBoxProps {
/**
* Whether the Spinbox is enabled.
*/
enabled?: boolean;
/**
* When the Spinbox value is changed. The current value is passed as a parameter.
*/
onChange?: (value: number) => void;
/**
* What the value of the Spinbox is set to.
*/
value?: number;
/**
* Whether the Spinbox can be seen.
*/
visible?: boolean;
}
/**
* A location for the user to choose a number.
*/
export class SpinBox extends React.Component<SpinBoxProps> { }
export interface TabProps {
/**
* Whether the Tab is enabled.
*/
enabled?: boolean;
/**
* Whether the Tab can be seen.
*/
visible?: boolean;
}
/**
* A component with different named tabs containing other components.
*
* Each child is required to have a label prop that is displayed at the top and names the tab.
*/
export class Tab extends React.Component<TabProps> { }
/**
* Displays some text.
*/
export class Text extends React.Component { }
export interface TextInputProps {
/**
* Whether the TextInput can be used.
*/
enabled?: boolean;
/**
* Whether multiple lines can be inputted into the TextInput.
*/
multiline?: boolean;
/**
* Called when the TextInput text is changed. The new text is passed as an argument.
*/
onChange?: (text: string) => void;
/**
* Whether the TextInput can be written to by the user.
*/
readOnly?: boolean;
/**
* Whether characters are hidden in the TextInput. Commonly used for passwords.
*/
secure?: boolean;
/**
* Whether the TextInput can be seen.
*/
visible?: boolean;
}
/**
* A place for the user to type in a string.
*/
export class TextInput extends React.Component<TextInputProps> { }
/**
* Undocumented
*/
export class VerticalBox extends React.Component { }
/**
* Undocumented
*/
export class VerticalSeparator extends React.Component { }
export interface WindowProps {
/**
* Whether the window will have a border on the inside.
*/
borderless?: boolean;
/**
* Whether the window is closed. If set to closed, then the window will be closed.
*/
closed?: boolean;
/**
* Whether the window will be fullscreen on start.
*/
fullscreen?: boolean;
/**
* Whether the window is the last window. If set to `true`, then the program will quit once the window is closed.
*/
lastWindow?: boolean;
/**
* Whether all children will have a margin around them and the outer edge of the window.
*/
margined?: boolean;
/**
* Whether a menubar will be shown on the top of the window.
*/
menuBar?: boolean;
/**
* Called when the window is closed.
*/
onClose?: () => void;
/**
* Called when the window size is changed by the user. The new size is passed as an argument, in an object.
*/
onContentSizeChange?: (size: {
h: number,
y: number
}) => void;
/**
* How big the window is when the application is first started.
*/
size?: {
h: number,
w: number
};
/**
* The title of the window. Will be shown at the top left ribbon.
*/
title?: string;
}
/**
* The window is the basis where all other components reside.
*/
export class Window extends React.Component<WindowProps> { }
export function render(element: JSX.Element): React.ReactNode;
/**
* A method to display an alert, or a dialog to save or open a file.
* @param type What type the dialog is. The current types are:
* - Message - a simple message
* - Error - an error message
* - Open - open a file
* - Save - save a file
* @param options Options for the title and description if it is a Message or Error.
* Required one of title and description (if it is Message or Error)
*/
export function Dialog(
type: 'Message' | 'Error' | 'Open' | 'Save',
options?: {
title: string,
description?: string
}
| {
title?: string,
description: string
}
): void;
+72
View File
@@ -0,0 +1,72 @@
import * as React from "react";
import {
render,
App,
Area,
Group,
Menu,
RadioButtons,
Window,
} from "proton-native";
class ExampleApp extends React.Component {
render() {
return (
<App>
<Window title="Example" size={{ w: 500, h: 500 }} />
</App>
);
}
}
class MenuTest extends React.Component {
render() {
return (
<App>
<Window title="Example" size={{ w: 500, h: 500 }}>
<App>
<Menu label="HI">
<Menu.Item>Hi</Menu.Item>
</Menu>
<Window title="Example" size={{w: 500, h: 500}} />
</App>
</Window>
</App>
);
}
}
class RadioTest extends React.Component {
render() {
return (
<App>
<Window title="Example" size={{w: 500, h: 500}}>
<RadioButtons enabled={true}>
<RadioButtons.Item>Option 1</RadioButtons.Item>
<RadioButtons.Item>Option 2</RadioButtons.Item>
</RadioButtons>
</Window>
</App>
);
}
}
class RectangleTest extends React.Component {
render() {
return (
<App>
<Window title="Example" size={{ w: 500, h: 500 }}>
<Area>
<Area.Rectangle
x="10"
y="10"
width="100"
height="200"
fill="blue"
/>
</Area>
</Window>
</App>
);
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"test/index.tsx"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+83
View File
@@ -0,0 +1,83 @@
// Type definitions for react-native-htmlview 0.12
// Project: https://github.com/jsdf/react-native-htmlview
// Definitions by: Ifiok Jr. <https://github.com/ifiokjr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import { Component, ComponentType, ReactNode } from 'react';
import { StyleProp, TextProperties, TextStyle, ViewStyle, ImageStyle } from 'react-native';
export interface HTMLViewNode {
data?: string;
type?: string;
name?: string;
attribs: { [key: string]: string };
}
export interface HTMLViewProps {
/**
* a string of HTML content to render
*/
value: string;
stylesheet?: {
[key: string]: StyleProp<ViewStyle | TextStyle | ImageStyle>;
};
onLinkPress?(url: string): void;
onLinkLongPress?(url: string): void;
/**
*
* A custom function to render HTML nodes however you see fit. If the function returns undefined (not null), the
* default renderer will be used for that node. The function takes the following arguments:
*
* - defaultRenderer the default rendering implementation, so you can use the normal rendering logic for some subtree. defaultRenderer takes the following arguments:
* - node the node to render with the default rendering logic
* - parent the parent of node of node
*
* @param node the html node as parsed by htmlparser2
* @param index position of the node in parent node's children
* @param siblings parent node's children (including current node)
* @param parent parent node
* @param defaultRenderer the default rendering implementation, so you can use the normal rendering logic for some subtree:
*/
renderNode?(
node: HTMLViewNode,
index: number,
siblings: HTMLViewNode,
parent: HTMLViewNode,
defaultRenderer: (node: HTMLViewNode, parent: HTMLViewNode) => ReactNode,
): ReactNode;
/**
* Text which is rendered before every li inside a ul
*/
bullet?: string;
/**
* Text which appears after every p element
*/
paragraphBreak?: string;
/**
* Text which appears after text elements which create a new line (br, headings)
*/
lineBreak?: string;
/**
* When explicitly false, effectively sets paragraphBreak and lineBreak to null
*/
addLineBreaks?: boolean;
/*
* TODO Add futher customisization props
* https://github.com/jsdf/react-native-htmlview#customizing-things-even-further
*/
TextComponent?: ComponentType;
textComponentProps?: TextProperties;
}
export default class HTMLView extends Component<HTMLViewProps> {}
@@ -0,0 +1,40 @@
import * as React from 'react';
import { Text, StyleSheet } from 'react-native';
import HTMLView from 'react-native-htmlview';
const styles = StyleSheet.create({
strong: {},
a: {},
p: {},
h1: {},
h2: {},
h3: {},
h4: {},
h5: {},
h6: {},
});
const defaultTextProps = {
style: {
fontSize: 14,
},
};
class Simple extends React.Component {
onPressLink = () => {
// Do someting
}
render() {
return (
<HTMLView
TextComponent={Text}
textComponentProps={defaultTextProps}
value="<br><b>This is html</b><div><p>Yo P</p></p>"
addLineBreaks={false}
stylesheet={styles}
onLinkPress={this.onPressLink}
/>
);
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-native-htmlview-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+211
View File
@@ -0,0 +1,211 @@
// Type definitions for react-native-indicators 0.13
// Project: https://github.com/n4kz/react-native-indicators#readme
// Definitions by: Ifiok Jr. <https://github.com/ifiokjr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import { Component } from 'react';
import { Animated, EasingFunction } from 'react-native';
export interface BaseIndicatorProps {
/**
* Animation easing function
* @default Easing.linear
*/
animationEasing?: EasingFunction;
/**
* Animation duration in ms
* @default1200
*/
animationDuration?: number;
}
export interface UIActivityIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Component count
* @default 12
*/
count?: number;
/**
* Base component size
* @default 40
*/
size?: number;
}
export class UIActivityIndicator extends Component<
UIActivityIndicatorProps
> {}
export interface BallIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Component count
* @default 8
*/
count?: number;
/**
* Base component size
* @default 40
*/
size?: number;
}
export class BallIndicator extends Component<BallIndicatorProps> {}
export interface BarIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Component count
* @default 3
*/
count?: number;
/**
* Base component size
* @default 40
*/
size?: number;
}
export class BarIndicator extends Component<BarIndicatorProps> {}
export interface DotIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Component count
* @default 4
*/
count?: number;
/**
* Base component size
* @default 16
*/
size?: number;
}
export class DotIndicator extends Component<DotIndicatorProps> {}
export interface MaterialIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Base component size
* @default 40
*/
size?: number;
}
export class MaterialIndicator extends Component<MaterialIndicatorProps> {}
export interface PulseIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Base component size
* @default 40
*/
size?: number;
}
export class PulseIndicator extends Component<PulseIndicatorProps> {}
export interface PacmanIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Base component size
* @default 48
*/
size?: number;
}
export class PacmanIndicator extends Component<PacmanIndicatorProps> {}
export interface SkypeIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Component count
* @default 5
*/
count?: number;
/**
* Base component size
* @default 40
*/
size?: number;
/**
* Minimum component scale
* @default 0.2
*/
minScale?: number;
/**
* Maximum component scale
* @default 1.0
*/
maxScale?: number;
}
export class SkypeIndicator extends Component<SkypeIndicatorProps> {}
export interface WaveIndicatorProps extends BaseIndicatorProps {
/**
* Component color
* @default 'rgb(0, 0, 0)'
*/
color?: string;
/**
* Component count
* @default 4
*/
count?: number;
/**
* Base component size
* @default 40
*/
size?: number;
/**
* Minimum component scale
* @default 0.54
*/
waveFactor?: number;
/**
* Maximum component scale
* @default 'fill'
*/
waveMode?: 'fill' | 'outline';
}
export class WaveIndicator extends Component<WaveIndicatorProps> {}
@@ -0,0 +1,14 @@
import * as React from 'react';
import {
DotIndicator,
} from 'react-native-indicators';
class Example extends React.Component {
render() {
return (
<React.Fragment>
<DotIndicator color='white' />
</React.Fragment>
);
}
}
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-native-indicators-tests.tsx"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+8
View File
@@ -48,6 +48,14 @@ export interface AvatarProps extends BaseProps<AvatarClass> {
type AvatarClass = React.StatelessComponent<AvatarProps>
export declare const Avatar: AvatarClass;
export interface ImageProps extends BaseProps<ImageClass> {
size?: number;
src?: string;
alt?: string;
}
type ImageClass = React.StatelessComponent<ImageProps>
export declare const Image: ImageClass;
export interface BadgeProps extends BaseProps<BadgeClass> {
theme?: "primary" | "secondary" | "default" | "info" | "success" | "warning" | "error";
rounded?: boolean | "top" | "right" | "bottom" | "left";
+1 -1
View File
@@ -1,6 +1,6 @@
import * as Snoowrap from '../..';
export default class RedditContent<T> {
export default class RedditContent<T> extends Promise<T> {
created_utc: number;
created: number;
id: string;
+2 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for snoowrap 1.14
// Type definitions for snoowrap 1.15
// Project: https://github.com/not-an-aardvark/snoowrap
// Definitions by: Vito Samson <https://github.com/vitosamson>
// TheAppleFreak <https://github.com/TheAppleFreak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+4
View File
@@ -50,3 +50,7 @@ export function wiki(subreddit: string, page: string): WikiPage {
export function getNewComments(subreddit: string): Listing<Comment> {
return r.getNewComments(subreddit);
}
export function thenable(): Promise<string> {
return r.getMe().then(me => me.name);
}
+80 -74
View File
@@ -1,109 +1,115 @@
// Type definitions for unzipper 0.8
// Project: https://github.com/ZJONSSON/node-unzipper#readme
// Definitions by: s73obrien <https://github.com/s73obrien>
// Nate <https://github.com/natemara>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
import { Readable, Stream, PassThrough, Duplex } from "stream";
import { ClientRequest, RequestOptions } from "http";
export interface PullStream extends Duplex {
stream(eof: number | string, includeEof: boolean): PassThrough;
pull(eof: number | string, includeEof: boolean): Promise<Buffer>;
stream(eof: number | string, includeEof: boolean): PassThrough;
pull(eof: number | string, includeEof: boolean): Promise<Buffer>;
}
export interface Entry extends PassThrough {
autodrain(): Promise<void>;
buffer: Promise<Buffer>;
path: string;
autodrain(): Promise<void>;
buffer(): Promise<Buffer>;
path: string;
props: {
path: string;
};
props: {
path: string;
};
type: string;
vars: {
signature?: number;
versionsNeededToExtract: number;
flags: number;
compressionMethod: number;
lastModifiedTime: number;
crc32: number;
compressedSize: number;
fileNameLength: number;
extraFieldLength: number;
};
type: string;
vars: {
signature?: number;
versionsNeededToExtract: number;
flags: number;
compressionMethod: number;
lastModifiedTime: number;
crc32: number;
compressedSize: number;
fileNameLength: number;
extraFieldLength: number;
};
extra: {
signature: number;
partsize: number;
uncompressedSize: number;
compressedSize: number;
offset: number;
disknum: number;
};
extra: {
signature: number;
partsize: number;
uncompressedSize: number;
compressedSize: number;
offset: number;
disknum: number;
};
}
export function unzip(
source: {
stream: Readable;
size: Promise<number>
},
offset: number,
_password: string): Entry;
source: {
stream: Readable;
size: Promise<number>;
},
offset: number,
_password: string
): Entry;
export namespace Open {
function file(filename: string): CentralDirectory;
function url(request: ClientRequest, opt: string | RequestOptions): CentralDirectory;
function s3(client: any, params: any): CentralDirectory;
function file(filename: string): CentralDirectory;
function url(
request: ClientRequest,
opt: string | RequestOptions
): CentralDirectory;
function s3(client: any, params: any): CentralDirectory;
}
export function BufferStream(entry: Entry): Promise<Buffer>;
export interface CentralDirectory {
signature: number;
diskNumber: number;
diskStart: number;
numberOfRecordsOnDisk: number;
numberOfRecords: number;
sizeOfCentralDirectory: number;
offsetToStartOfCentralDirectory: number;
commentLength: number;
files: [
{
signature: number;
versionMadeBy: number;
versionsNeededToExtract: number;
flags: number;
compressionMethod: number;
lastModifiedTime: number;
lastModifiedDate: number;
crc32: number;
compressedSize: number;
uncompressedSize: number;
fileNameLength: number;
extraFieldLength: number;
fileCommentLength: number;
diskNumber: number;
internalFileAttributes: number;
externalFileAttributes: number;
offsetToLocalFileHeader: number;
path: string;
comment: string;
stream: Entry;
buffer: Promise<Buffer>;
}
];
signature: number;
diskNumber: number;
diskStart: number;
numberOfRecordsOnDisk: number;
numberOfRecords: number;
sizeOfCentralDirectory: number;
offsetToStartOfCentralDirectory: number;
commentLength: number;
files: [
{
signature: number;
versionMadeBy: number;
versionsNeededToExtract: number;
flags: number;
compressionMethod: number;
lastModifiedTime: number;
lastModifiedDate: number;
crc32: number;
compressedSize: number;
uncompressedSize: number;
fileNameLength: number;
extraFieldLength: number;
fileCommentLength: number;
diskNumber: number;
internalFileAttributes: number;
externalFileAttributes: number;
offsetToLocalFileHeader: number;
path: string;
comment: string;
stream: Entry;
buffer: Promise<Buffer>;
}
];
}
export class ParseOptions {
verbose?: boolean;
path?: string;
// more options?
verbose?: boolean;
path?: string;
// more options?
}
export type ParseStream = PullStream & {
promise: Promise<void>
promise(): Promise<void>;
};
export function Parse(opts?: ParseOptions): ParseStream;
+38 -39
View File
@@ -1,44 +1,43 @@
import {
Parse,
Open,
Entry,
CentralDirectory
} from 'unzipper';
import { Parse, Open, Entry, CentralDirectory } from "unzipper";
import { createReadStream } from 'fs';
import { createReadStream } from "fs";
import { get } from 'http';
import { get } from "http";
createReadStream(
'http://example.org/path/to/archive.zip'
).pipe(
Parse()
).on('entry', (entry: Entry) => {
entry.buffer.then((b1: Buffer) => {});
const s1: string = entry.path;
const s2: string = entry.type;
const o1: {
signature?: number;
versionsNeededToExtract: number;
flags: number;
compressionMethod: number;
lastModifiedTime: number;
crc32: number;
compressedSize: number;
fileNameLength: number;
extraFieldLength: number;
} = entry.vars;
createReadStream("http://example.org/path/to/archive.zip")
.pipe(Parse())
.on("entry", (entry: Entry) => {
entry.buffer().then((b1: Buffer) => {});
const s1: string = entry.path;
const s2: string = entry.type;
const o1: {
signature?: number;
versionsNeededToExtract: number;
flags: number;
compressionMethod: number;
lastModifiedTime: number;
crc32: number;
compressedSize: number;
fileNameLength: number;
extraFieldLength: number;
} =
entry.vars;
const o2: {
signature: number;
partsize: number;
uncompressedSize: number;
compressedSize: number;
offset: number;
disknum: number;
} = entry.extra;
});
const o2: {
signature: number;
partsize: number;
uncompressedSize: number;
compressedSize: number;
offset: number;
disknum: number;
} =
entry.extra;
})
.promise()
.then(() => {
console.log("Finished reading stream");
});
const dir1: CentralDirectory = Open.file('Z:\\path\\to\\archive.zip');
const dir2: CentralDirectory = Open.url(get('url/to/archive.zip'), {});
const dir3: CentralDirectory = Open.s3('any', 'any');
const dir1: CentralDirectory = Open.file("Z:\\path\\to\\archive.zip");
const dir2: CentralDirectory = Open.url(get("url/to/archive.zip"), {});
const dir3: CentralDirectory = Open.s3("any", "any");
+50 -64
View File
@@ -253,7 +253,7 @@ declare namespace webpack {
* Defaults to `["browser", "module", "main"]` or `["module", "main"]`,
* depending on the value of the `target` `Configuration` value.
*/
mainFields?: string[];
mainFields?: string[] | string[][];
/**
* A list of fields in a package description object to try to parse
@@ -264,7 +264,7 @@ declare namespace webpack {
*
* @see alias
*/
aliasFields?: string[];
aliasFields?: string[] | string[][];
/**
* A list of file names to search for when requiring directories that
@@ -368,15 +368,16 @@ declare namespace webpack {
system?: boolean;
}
type RuleSetCondition = string
| {
[k: string]: any;
}
type RuleSetCondition =
| RegExp
| string
| ((path: string) => boolean)
| RuleSetConditions
| {
/**
* Logical AND
*/
and?: RuleSetConditions;
and?: RuleSetCondition[];
/**
* Exclude all modules matching any of these conditions
*/
@@ -388,17 +389,19 @@ declare namespace webpack {
/**
* Logical NOT
*/
not?: RuleSetConditions;
not?: RuleSetCondition[];
/**
* Logical OR
*/
or?: RuleSetConditions;
or?: RuleSetCondition[];
/**
* Exclude all modules matching any of these conditions
*/
test?: RuleSetCondition;
};
type RuleSetConditions = RuleSetCondition[];
// A hack around circular type referencing
interface RuleSetConditions extends Array<RuleSetCondition> {}
interface RuleSetRule {
/**
@@ -408,25 +411,19 @@ declare namespace webpack {
/**
* Shortcut for resource.exclude
*/
exclude?: RuleSetCondition & {
[k: string]: any;
};
exclude?: RuleSetCondition;
/**
* Shortcut for resource.include
*/
include?: RuleSetCondition & {
[k: string]: any;
};
include?: RuleSetCondition;
/**
* Match the issuer of the module (The module pointing to this module)
*/
issuer?: RuleSetCondition & {
[k: string]: any;
};
issuer?: RuleSetCondition;
/**
* Shortcut for use.loader
*/
loader?: RuleSetLoader | RuleSetUse;
loader?: RuleSetUse;
/**
* Shortcut for use.loader
*/
@@ -434,7 +431,7 @@ declare namespace webpack {
/**
* Only execute the first matching rule in this array
*/
oneOf?: RuleSetRules;
oneOf?: RuleSetRule[];
/**
* Shortcut for use.options
*/
@@ -442,9 +439,7 @@ declare namespace webpack {
/**
* Options for parsing
*/
parser?: {
[k: string]: any;
};
parser?: { [k: string]: any };
/**
* Options for the resolver
*/
@@ -464,9 +459,7 @@ declare namespace webpack {
/**
* Match the resource path of the module
*/
resource?: RuleSetCondition & {
[k: string]: any;
};
resource?: RuleSetCondition;
/**
* Match the resource query of the module
*/
@@ -478,56 +471,49 @@ declare namespace webpack {
/**
* Match and execute these rules when this rule is matched
*/
rules?: RuleSetRules;
rules?: RuleSetRule[];
/**
* Shortcut for resource.test
*/
test?: RuleSetCondition & {
[k: string]: any;
};
test?: RuleSetCondition;
/**
* Modifiers applied to the module when rule is matched
*/
use?: RuleSetUse;
}
type RuleSetLoader = string;
type RuleSetUse =
| RuleSetUseItem
| {
[k: string]: any;
}
| RuleSetUseItem[];
| RuleSetUseItem[]
| ((data: any) => RuleSetUseItem | RuleSetUseItem[]);
interface RuleSetLoader {
/**
* Loader name
*/
loader?: string;
/**
* Loader options
*/
options?: RuleSetQuery;
/**
* Unique loader identifier
*/
ident?: string;
/**
* Loader query
*/
query?: RuleSetQuery;
}
type RuleSetUseItem =
| string
| RuleSetLoader
| {
[k: string]: any;
}
| {
/**
* Loader name
*/
loader?: RuleSetLoader;
/**
* Loader options
*/
options?: RuleSetQuery;
/**
* Unique loader identifier
*/
ident?: string;
/**
* Loader query
*/
query?: RuleSetQuery;
};
| ((data: any) => string | RuleSetLoader);
type RuleSetQuery =
| {
[k: string]: any;
}
| string;
type CommonArrayOfStringOrStringArrayValues = Array<(string | string[])>;
type CommonArrayOfStringValues = string[];
type RuleSetRules = RuleSetRule[];
| string
| { [k: string]: any };
/**
* @deprecated Use RuleSetCondition instead
+34
View File
@@ -698,3 +698,37 @@ configuration = {
]
}
};
configuration = {
module: {
rules: [
{
test: /\.ts$/,
include: '/foo/bar',
exclude: path => path.startsWith('/foo'),
resourceQuery: ['foo', 'bar'],
resolve: {
mainFields: ['foo'],
aliasFields: [['bar']],
},
loader: 'foo-loader',
loaders: [
'foo-loader',
{
loader: 'bar-loader',
query: 'baz'
}
],
use: () => ([
'foo-loader',
{
loader: 'bar-loader',
query: {
baz: 'qux'
}
},
])
}
]
}
};
+2 -2
View File
@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="activex-iwshruntimelibrary" />
/// <reference types="activex-interop" />
/** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */
interface WshArguments {
@@ -62,7 +62,7 @@ declare var WScript: {
* Can be accessed only while using CScript.exe.
*/
StdOut: IWshRuntimeLibrary.TextStreamWriter;
Arguments: WshArguments;
Arguments: IWshRuntimeLibrary.WshArguments;
/**
* The full path of the currently running script.
+155
View File
@@ -0,0 +1,155 @@
// Type definitions for Windows Script Host 5.8
// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx
// Definitions by: Zev Spitz <https://github.com/zspitz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="activex-iwshruntimelibrary" />
/** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */
interface WshArguments {
Count(): number;
Item(index: number): string;
Length: number;
Named: WshNamed;
/**
* When you run the **ShowUsage** method, a help screen (referred to as the usage) appears and displays details about the script's command line options.
* This information comes from the runtime section of the `*.WSF` file. Everything written between the `<runtime>` and `</runtime>` tags is pieced together
* to produce what is called a "usage statement." The usage statement tells the user how to use the script.
*/
ShowUsage(): void;
Unnamed: WshUnnamed;
(index: number): string;
}
/**
* Provides access to the named command-line arguments
*
* Note that enumerating over this object returns the **names** of the arguments, not the values
*/
interface WshNamed {
Count(): number;
Exists(Key: string): boolean;
Item(name: string): string;
Length: number;
(name: string): string;
}
/** Provides access to the unnamed command-line arguments */
interface WshUnnamed {
Count(): number;
Item(index: number): string;
Length: number;
(index: number): string;
}
declare var WScript: {
/**
* Outputs text to either a message box (under WScript.exe) or the command console window followed by
* a newline (under CScript.exe).
*/
Echo(s?: any): void;
/**
* Exposes the write-only error output stream for the current script.
* Can be accessed only while using CScript.exe.
*/
StdErr: IWshRuntimeLibrary.TextStreamWriter;
/**
* Exposes the write-only output stream for the current script.
* Can be accessed only while using CScript.exe.
*/
StdOut: IWshRuntimeLibrary.TextStreamWriter;
Arguments: WshArguments;
/**
* The full path of the currently running script.
*/
ScriptFullName: string;
/**
* Forces the script to stop immediately, with an optional exit code.
*/
Quit(exitCode?: number): number;
/**
* The Windows Script Host build version number.
*/
BuildVersion: number;
/**
* Fully qualified path of the host executable.
*/
FullName: string;
/**
* Gets/sets the script mode - interactive(true) or batch(false).
*/
Interactive: boolean;
/**
* The name of the host executable (WScript.exe or CScript.exe).
*/
Name: string;
/**
* Path of the directory containing the host executable.
*/
Path: string;
/**
* The filename of the currently running script.
*/
ScriptName: string;
/**
* Exposes the read-only input stream for the current script.
* Can be accessed only while using CScript.exe.
*/
StdIn: IWshRuntimeLibrary.TextStreamReader;
/**
* Windows Script Host version
*/
Version: string;
/**
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
*/
ConnectObject(objEventSource: any, strPrefix: string): void;
/**
* Creates a COM object.
* @param strProgiID
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
*/
CreateObject<K extends keyof ActiveXObjectNameMap = any>(strProgID: K, strPrefix?: string): ActiveXObjectNameMap[K];
/**
* Disconnects a COM object from its event sources.
*/
DisconnectObject(obj: any): void;
/**
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
* @param strPathname Fully qualified path to the file containing the object persisted to disk.
* For objects in memory, pass a zero-length string.
* @param strProgID
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
*/
GetObject<K extends keyof ActiveXObjectNameMap>(strPathname: string, strProgID: K, strPrefix?: string): ActiveXObjectNameMap[K];
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
/**
* Suspends script execution for a specified length of time, then continues execution.
* @param intTime Interval (in milliseconds) to suspend script execution.
*/
Sleep(intTime: number): void;
};
/**
* WSH is an alias for WScript under Windows Script Host
*/
declare var WSH: typeof WScript;
@@ -0,0 +1,30 @@
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
const results: T[] = [];
const enumerator = new Enumerator<T>(col);
enumerator.moveFirst();
while (!enumerator.atEnd()) {
results.push(enumerator.item());
enumerator.moveNext();
}
return results;
};
// Show all of the arguments.
WScript.Echo(`${WScript.Arguments.Length} arguments`);
for (const arg of collectionToArray(WScript.Arguments)) {
WScript.Echo(` ${arg}`);
}
// Show the unnamed arguments.
WScript.Echo(`${WScript.Arguments.Unnamed.Length} unnamed arguments`);
for (const unnamed of collectionToArray(WScript.Arguments.Unnamed)) {
WScript.Echo(` ${unnamed}`);
}
// Show the named arguments.
WScript.Echo(`${WScript.Arguments.Named.Length} named arguments`);
for (const key of collectionToArray(WScript.Arguments.Named)) {
WScript.Echo(` ${key}=${WScript.Arguments.Named(key)}`);
}