mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-30 02:01:46 +00:00
Merge remote-tracking branch 'upstream/master' into AlexJ-OutlookOrganization
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@
|
||||
"scripts": {
|
||||
"compile-scripts": "tsc -p scripts",
|
||||
"not-needed": "node scripts/not-needed.js",
|
||||
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 2",
|
||||
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
|
||||
"lint": "dtslint types"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -8,25 +8,22 @@ FB.init({
|
||||
xfbml: true
|
||||
});
|
||||
|
||||
FB.getLoginStatus(function(response: fb.AuthResponse) {
|
||||
FB.getLoginStatus(function(response: fb.StatusResponse) {
|
||||
console.log(response);
|
||||
console.log(response.status);
|
||||
console.log(response.authResponse.accessToken);
|
||||
});
|
||||
|
||||
FB.getLoginStatus(function(response: fb.AuthResponse) {
|
||||
FB.getLoginStatus(function(response: fb.StatusResponse) {
|
||||
console.log(response);
|
||||
console.log(response.status);
|
||||
console.log(response.authResponse.accessToken);
|
||||
}, true);
|
||||
|
||||
FB.getAuthResponse(function(response: fb.AuthResponse) {
|
||||
console.log(response);
|
||||
console.log(response.status);
|
||||
console.log(response.authResponse.accessToken);
|
||||
});
|
||||
const authResponse: fb.AuthResponse = FB.getAuthResponse();
|
||||
console.log(authResponse.accessToken);
|
||||
|
||||
FB.login(function(response: fb.AuthResponse) {
|
||||
FB.login(function(response: fb.StatusResponse) {
|
||||
console.log(response);
|
||||
console.log(response.status);
|
||||
console.log(response.authResponse.accessToken);
|
||||
@@ -34,7 +31,7 @@ FB.login(function(response: fb.AuthResponse) {
|
||||
scope: 'public_profile'
|
||||
});
|
||||
|
||||
FB.logout(function(response: fb.AuthResponse) {
|
||||
FB.logout(function(response: fb.StatusResponse) {
|
||||
console.log(response);
|
||||
console.log(response.status);
|
||||
console.log(response.authResponse.accessToken);
|
||||
|
||||
Vendored
+18
-14
@@ -1,12 +1,14 @@
|
||||
// Type definitions for the Facebook Javascript SDK 2.8
|
||||
// Project: https://developers.facebook.com/docs/javascript
|
||||
// Definitions by: Amrit Kahlon <https://github.com/amritk>
|
||||
// Definitions by: Amrit Kahlon <https://github.com/amritk>
|
||||
// Mahmoud Zohdi <https://github.com/mahmoudzohdi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import fb = facebook;
|
||||
declare var FB: fb.FacebookStatic;
|
||||
declare namespace facebook {
|
||||
|
||||
|
||||
|
||||
interface FacebookStatic {
|
||||
api: any;
|
||||
AppEvents: any;
|
||||
@@ -18,15 +20,17 @@ declare namespace facebook {
|
||||
* The synchronous nature of this method is what sets it apart from the other login methods.
|
||||
*
|
||||
* @param callback function to handle the response.
|
||||
*
|
||||
* This method is similar in nature to FB.getLoginStatus(), but it returns just the authResponse object.
|
||||
*/
|
||||
getAuthResponse(callback: (response: AuthResponse) => void): void;
|
||||
getAuthResponse(): AuthResponse;
|
||||
/**
|
||||
* FB.getLoginStatus() allows you to determine if a user is
|
||||
* logged in to Facebook and has authenticated your app.
|
||||
*
|
||||
* @param callback function to handle the response.
|
||||
*/
|
||||
getLoginStatus(callback: (response: AuthResponse) => void, roundtrip?: boolean ): void;
|
||||
getLoginStatus(callback: (response: StatusResponse) => void, roundtrip?: boolean ): void;
|
||||
/**
|
||||
* The method FB.init() is used to initialize and setup the SDK.
|
||||
*
|
||||
@@ -43,13 +47,13 @@ declare namespace facebook {
|
||||
* @param callback function to handle the response.
|
||||
* @param options optional ILoginOption to add params such as scope.
|
||||
*/
|
||||
login(callback: (response: AuthResponse) => void, options?: LoginOptions): void;
|
||||
login(callback: (response: StatusResponse) => void, options?: LoginOptions): void;
|
||||
/**
|
||||
* The method FB.logout() logs the user out of your site and, in some cases, Facebook.
|
||||
*
|
||||
* @param callback function to handle the response
|
||||
*/
|
||||
logout(callback: (response: AuthResponse) => void): void;
|
||||
logout(callback: (response: StatusResponse) => void): void;
|
||||
|
||||
/**
|
||||
* @see https://developers.facebook.com/docs/sharing/reference/share-dialog
|
||||
@@ -180,16 +184,16 @@ declare namespace facebook {
|
||||
// RESPONSES
|
||||
//
|
||||
////////////////////////
|
||||
|
||||
interface AuthResponse {
|
||||
accessToken: string;
|
||||
expiresIn: number;
|
||||
signedRequest: string;
|
||||
userID: string;
|
||||
}
|
||||
|
||||
interface StatusResponse {
|
||||
status: string;
|
||||
authResponse: {
|
||||
accessToken: string;
|
||||
expiresIn: number;
|
||||
grantedScopes: string;
|
||||
signedRequest: string;
|
||||
userID: string;
|
||||
};
|
||||
authResponse: AuthResponse;
|
||||
}
|
||||
|
||||
interface ShareDialogResponse {
|
||||
|
||||
Vendored
+50
-47
@@ -1,63 +1,66 @@
|
||||
// Type definitions for koa-route 3.2
|
||||
// Project: https://github.com/koajs/route#readme
|
||||
// Definitions by: Mike Cook <https://github.com/migstopheles>
|
||||
// Jaco Greeff <https://github.com/jacogr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Koa from 'koa';
|
||||
import * as pathToRegexp from 'path-to-regexp';
|
||||
|
||||
type RoutePath = string | RegExp | Array<string | RegExp>;
|
||||
declare namespace KoaRoute {
|
||||
type Path = string | RegExp | Array<string | RegExp>;
|
||||
|
||||
type RouteHandler = (this: Koa.Context, ctx: Koa.Context, ...params: any[]) => any;
|
||||
type Handler = (this: Koa.Context, ctx: Koa.Context, ...params: any[]) => any;
|
||||
|
||||
type CreateRoute = (routeFunc: RouteHandler) => Koa.Middleware;
|
||||
type CreateRoute = (routeFunc: Handler) => Koa.Middleware;
|
||||
|
||||
interface RouteMethod {
|
||||
(path: RoutePath): CreateRoute;
|
||||
(path: RoutePath, fn: RouteHandler, opts?: pathToRegexp.ParseOptions & pathToRegexp.RegExpOptions): Koa.Middleware;
|
||||
interface Method {
|
||||
(path: Path): CreateRoute;
|
||||
(path: Path, fn: Handler, opts?: pathToRegexp.ParseOptions & pathToRegexp.RegExpOptions): Koa.Middleware;
|
||||
}
|
||||
|
||||
type CreateMethod = (method: string) => Method;
|
||||
|
||||
interface Routes {
|
||||
all: Method;
|
||||
acl: Method;
|
||||
bind: Method;
|
||||
checkout: Method;
|
||||
connect: Method;
|
||||
copy: Method;
|
||||
delete: Method;
|
||||
del: Method;
|
||||
get: Method;
|
||||
head: Method;
|
||||
link: Method;
|
||||
lock: Method;
|
||||
msearch: Method;
|
||||
merge: Method;
|
||||
mkactivity: Method;
|
||||
mkcalendar: Method;
|
||||
mkcol: Method;
|
||||
move: Method;
|
||||
notify: Method;
|
||||
options: Method;
|
||||
patch: Method;
|
||||
post: Method;
|
||||
propfind: Method;
|
||||
proppatch: Method;
|
||||
purge: Method;
|
||||
put: Method;
|
||||
rebind: Method;
|
||||
report: Method;
|
||||
search: Method;
|
||||
subscribe: Method;
|
||||
trace: Method;
|
||||
unbind: Method;
|
||||
unlink: Method;
|
||||
unlock: Method;
|
||||
unsubscribe: Method;
|
||||
}
|
||||
}
|
||||
|
||||
type CreateRouteMethod = (method: string) => RouteMethod;
|
||||
|
||||
interface KoaRoutes {
|
||||
all: CreateRouteMethod;
|
||||
acl: RouteMethod;
|
||||
bind: RouteMethod;
|
||||
checkout: RouteMethod;
|
||||
connect: RouteMethod;
|
||||
copy: RouteMethod;
|
||||
delete: RouteMethod;
|
||||
del: RouteMethod;
|
||||
get: RouteMethod;
|
||||
head: RouteMethod;
|
||||
link: RouteMethod;
|
||||
lock: RouteMethod;
|
||||
msearch: RouteMethod;
|
||||
merge: RouteMethod;
|
||||
mkactivity: RouteMethod;
|
||||
mkcalendar: RouteMethod;
|
||||
mkcol: RouteMethod;
|
||||
move: RouteMethod;
|
||||
notify: RouteMethod;
|
||||
options: RouteMethod;
|
||||
patch: RouteMethod;
|
||||
post: RouteMethod;
|
||||
propfind: RouteMethod;
|
||||
proppatch: RouteMethod;
|
||||
purge: RouteMethod;
|
||||
put: RouteMethod;
|
||||
rebind: RouteMethod;
|
||||
report: RouteMethod;
|
||||
search: RouteMethod;
|
||||
subscribe: RouteMethod;
|
||||
trace: RouteMethod;
|
||||
unbind: RouteMethod;
|
||||
unlink: RouteMethod;
|
||||
unlock: RouteMethod;
|
||||
unsubscribe: RouteMethod;
|
||||
}
|
||||
|
||||
declare const routes: KoaRoutes;
|
||||
declare const routes: KoaRoute.Routes;
|
||||
|
||||
export = routes;
|
||||
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
import * as express from 'express';
|
||||
import Template from './src/runtime/html/Template';
|
||||
import { IRouterMatcher as ExpressRouterMatcher, NextFunction, PathParams } from 'express-serve-static-core';
|
||||
|
||||
declare function m(): m.Application;
|
||||
|
||||
declare namespace m {
|
||||
interface Response extends express.Response {
|
||||
marko(template: Template, data?: any): void;
|
||||
}
|
||||
|
||||
interface Application extends express.Application {
|
||||
get: ((name: string) => any) & ExpressRouterMatcher<this> & MarkoRouterMatcher;
|
||||
}
|
||||
|
||||
type MarkoRouterMatcher = (path: PathParams, ...handlers: RequestHandler[]) => Application;
|
||||
type RequestHandler = (req: express.Request, res: Response, next?: NextFunction) => any;
|
||||
}
|
||||
|
||||
export = m;
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for marko 4.6
|
||||
// Project: http://markojs.com
|
||||
// Definitions by: Timur Manyanov <https://github.com/darkwebdev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { AsyncStream, Template } from './src/runtime/html';
|
||||
|
||||
export function createOut(globalData: any): AsyncStream;
|
||||
|
||||
export interface TemplateOptions {
|
||||
buffer?: boolean;
|
||||
writeToDisk?: boolean;
|
||||
}
|
||||
|
||||
export function load(templatePath: string, options?: TemplateOptions): Template;
|
||||
export function load(templatePath: string, templateSrc: string, options?: TemplateOptions): Template;
|
||||
@@ -0,0 +1,174 @@
|
||||
import { createServer } from 'http';
|
||||
import { createWriteStream } from 'fs';
|
||||
import express = require('express');
|
||||
import asyncWriter = require('async-writer');
|
||||
|
||||
import markoExpress = require('marko/express');
|
||||
import { load } from 'marko';
|
||||
import { createWriter, AsyncStream, Template, RenderResult } from 'marko/src/runtime/html';
|
||||
import { Component } from 'marko/src/components';
|
||||
import { buildTaglibLookup, taglibFinder } from 'marko/src/compiler';
|
||||
|
||||
// tslint:disable-next-line no-var-requires
|
||||
const template: Template = require('template.marko');
|
||||
|
||||
// Working with document
|
||||
|
||||
(document: Document) => {
|
||||
// $ExpectType RenderResult
|
||||
template
|
||||
.renderSync({ name: 'Marko' })
|
||||
.appendTo(document.body);
|
||||
|
||||
createServer((req, res) => {
|
||||
res.setHeader('content-type', 'text/html');
|
||||
// $ExpectType void
|
||||
template.render({ name: 'Marko' }, res);
|
||||
}).listen(8080);
|
||||
|
||||
template
|
||||
.render({ $global: { flags: ['mobile'] } })
|
||||
.then((result) => {
|
||||
// $ExpectType RenderResult
|
||||
result.appendTo(document.body);
|
||||
});
|
||||
|
||||
template.render({}, (err: Error | null, result: RenderResult) => {
|
||||
// $ExpectType RenderResult
|
||||
result.appendTo(document.body);
|
||||
});
|
||||
};
|
||||
|
||||
// WriteStream tests
|
||||
|
||||
const writeStream = createWriteStream('template.html', { encoding: 'utf8' });
|
||||
|
||||
// $ExpectType void
|
||||
template.render({ name: 'Frank' }, writeStream);
|
||||
|
||||
// $ExpectType WriteStream
|
||||
template.stream({}).pipe(writeStream);
|
||||
|
||||
(req: Request) => {
|
||||
// $ExpectType Readable
|
||||
template.stream({ name: 'Frank' });
|
||||
};
|
||||
|
||||
// rendering tests
|
||||
|
||||
const out = template.createOut();
|
||||
|
||||
// $ExpectType void
|
||||
template.render({}, out);
|
||||
out.on('finish', () => {
|
||||
// $ExpectType string
|
||||
out.getOutput();
|
||||
});
|
||||
out.end();
|
||||
|
||||
// $ExpectType void
|
||||
template.render({ name: 'Frank' }, process.stdout);
|
||||
|
||||
// $ExpectType string
|
||||
template.renderToString({ label: 'Click me!' });
|
||||
|
||||
template.renderToString({}, (err, html) => {
|
||||
// $ExpectType string
|
||||
html;
|
||||
});
|
||||
|
||||
// AsyncStream/AsyncWriter tests
|
||||
|
||||
const writer: AsyncStream = createWriter(process.stdout);
|
||||
|
||||
// $ExpectType void
|
||||
template.render({ name: 'Frank' }, writer);
|
||||
writer.end();
|
||||
|
||||
const asyncWriterInstance = asyncWriter.create(process.stdout);
|
||||
|
||||
// $ExpectType AsyncWriter
|
||||
asyncWriterInstance.write('Hello');
|
||||
|
||||
const asyncOut = asyncWriterInstance.beginAsync();
|
||||
|
||||
setTimeout(() => {
|
||||
asyncOut.write('World');
|
||||
asyncOut.end();
|
||||
}, 100);
|
||||
|
||||
template.render({}, asyncWriterInstance);
|
||||
|
||||
// Component tests
|
||||
|
||||
(component: Component) => {
|
||||
// $ExpectType HTMLElement
|
||||
component.getEl('header');
|
||||
|
||||
// $ExpectType HTMLElement[]
|
||||
component.getEls('colors');
|
||||
|
||||
// $ExpectType Component
|
||||
component.getComponent('myFancyButton');
|
||||
};
|
||||
|
||||
// markoExpress() tests
|
||||
|
||||
const app = express() as markoExpress.Application;
|
||||
|
||||
// $ExpectType Application
|
||||
app.use(markoExpress());
|
||||
|
||||
// $ExpectType Application
|
||||
app.get('/', (req: express.Request, res: markoExpress.Response) => {
|
||||
// $ExpectType void
|
||||
res.marko(template, {
|
||||
name: 'Frank',
|
||||
count: 30,
|
||||
colors: ['red', 'green', 'blue']
|
||||
});
|
||||
});
|
||||
|
||||
// Taglib tests
|
||||
|
||||
const lookup = buildTaglibLookup('some/dir');
|
||||
|
||||
lookup.forEachTag(tag => {
|
||||
// $ExpectType string
|
||||
tag.name;
|
||||
});
|
||||
|
||||
lookup.forEachAttribute('div', attr => {
|
||||
// $ExpectType string | undefined
|
||||
attr.name;
|
||||
});
|
||||
|
||||
// $ExpectType Attribute | undefined
|
||||
lookup.getAttribute('foo', 'cat');
|
||||
|
||||
// $ExpectType void
|
||||
taglibFinder.excludeDir('dir/Path');
|
||||
|
||||
// $ExpectType void
|
||||
taglibFinder.excludePackage('packageName');
|
||||
|
||||
// load() tests
|
||||
|
||||
const isomorphicTemplate = load(require.resolve('./template.marko'));
|
||||
isomorphicTemplate.render({ name: 'Frank' }, process.stdout);
|
||||
|
||||
const serverTemplateFromFile = load('./sample.marko', { writeToDisk: false });
|
||||
serverTemplateFromFile.render({ name: 'Frank' }, process.stdout);
|
||||
|
||||
const serverTemplateFromString = load('sample.marko', '<div>Hello $!{data.name}</div>');
|
||||
serverTemplateFromString.render({ name: 'Frank' }, process.stdout);
|
||||
|
||||
// node-require tests
|
||||
|
||||
import { install, getExtensions } from 'marko/node-require';
|
||||
|
||||
// $ExpectType void
|
||||
install();
|
||||
|
||||
// $ExpectType any
|
||||
getExtensions();
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export function install(options?: any): void;
|
||||
|
||||
export function getExtensions(): any;
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
export default interface Config {
|
||||
checkUpToDate?: boolean;
|
||||
writeToDisk?: boolean;
|
||||
assumeUpToDate?: boolean;
|
||||
preserveWhitespace?: boolean;
|
||||
output?: 'vdom' | 'html';
|
||||
writeVersionComment?: boolean;
|
||||
ignoreUnrecognizedTags?: boolean;
|
||||
escapeAtTags?: boolean;
|
||||
autoKeyEnabled?: boolean;
|
||||
}
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
import Config from './config';
|
||||
import * as taglibLookup from './taglib-lookup';
|
||||
import * as taglibLoader from './taglib-loader';
|
||||
import * as taglibFinder from './taglib-finder';
|
||||
import * as modules from './modules';
|
||||
|
||||
export const isVDOMSupported: true;
|
||||
export const builder: any;
|
||||
export const defaultOptions: Config;
|
||||
export const config: Config;
|
||||
|
||||
export function createBuilder(options: any): any;
|
||||
|
||||
export function compileFile(filename: string, optionsOrCallback?: any, callback?: any): any;
|
||||
|
||||
export function compile(src: any, filename: string, optionsOrCallback: any, callback?: any): any;
|
||||
|
||||
export function compileForBrowser(src: any, filename: string, optionsOrCallback: any, callback?: any): any;
|
||||
|
||||
export function compileFileForBrowser(filename: string, optionsOrCallback?: any, callback?: any): any;
|
||||
|
||||
export function parseRaw(templateSrc: any, filename: string): any;
|
||||
|
||||
export function createInlineCompiler(filename: string, userOptions?: any): any;
|
||||
|
||||
export function checkUpToDate(templateFile: any, templateJsFile: any): boolean;
|
||||
|
||||
export function getLastModified(path: string, optionsOrCallback: any, callback: any): void;
|
||||
|
||||
export function createWalker(options: any): any;
|
||||
|
||||
export function configure(newConfig?: Config): void;
|
||||
|
||||
export function clearCaches(): void;
|
||||
|
||||
export function buildTaglibLookup(dirname: string): taglibLookup.TaglibLookup;
|
||||
|
||||
export function registerTaglib(filePath: string): void;
|
||||
|
||||
export {
|
||||
taglibLookup,
|
||||
taglibLoader,
|
||||
taglibFinder,
|
||||
modules
|
||||
};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
export function require(path: string): any;
|
||||
|
||||
export function resolve(path: string): string;
|
||||
|
||||
export function resolveFrom(from: string, target: string): string | null;
|
||||
|
||||
export function deresolve(targetFilename: string, from: string): string;
|
||||
@@ -0,0 +1,11 @@
|
||||
import Taglib from '../taglib-loader/Taglib';
|
||||
|
||||
export function find(dirname: string, registeredTaglibs: Taglib[]): Taglib[];
|
||||
|
||||
export function excludeDir(dir: string): void;
|
||||
|
||||
export function excludePackage(name: string): void;
|
||||
|
||||
export function reset(): void;
|
||||
|
||||
export function clearCache(): void;
|
||||
@@ -0,0 +1,22 @@
|
||||
export default class Attribute {
|
||||
type: string | null;
|
||||
key: string;
|
||||
filePath: string;
|
||||
ref?: string;
|
||||
name?: string;
|
||||
preserveName?: string;
|
||||
targetProperty: string | null;
|
||||
defaultValue: string;
|
||||
pattern?: any;
|
||||
setFlag: string | null;
|
||||
setContextFlag: string;
|
||||
required: boolean;
|
||||
ignore: boolean;
|
||||
dynamicAttribute: boolean;
|
||||
allowExpressions: boolean;
|
||||
removeDashes: boolean;
|
||||
autocomplete: boolean;
|
||||
html: boolean;
|
||||
deprecated: any;
|
||||
enum: any;
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
import Taglib from './Taglib';
|
||||
import Attribute from './Attribute';
|
||||
import Transformer from './Transformer';
|
||||
|
||||
declare class Tag {
|
||||
name: string;
|
||||
dir: string;
|
||||
taglibId: string | null;
|
||||
taglibPath: string | null;
|
||||
attributes: { [name: string]: Attribute };
|
||||
attributeGroups: string[];
|
||||
transformers: { [path: string]: Transformer };
|
||||
patternAttributes: Attribute[];
|
||||
renderer: any;
|
||||
template: any;
|
||||
codeGeneratorModulePath: string | null;
|
||||
nodeFactoryPath: string | null;
|
||||
nestedVariables: any;
|
||||
importedVariables: any;
|
||||
bodyFunction: any;
|
||||
nestedTags: { [name: string]: Tag } | null;
|
||||
isNestedTag: boolean;
|
||||
isRepeated: boolean | null;
|
||||
parentTagName: string | null;
|
||||
openTagOnly: any;
|
||||
body: any;
|
||||
type: any;
|
||||
targetProperty?: string;
|
||||
|
||||
constructor(filePath?: string);
|
||||
|
||||
addAttribute(attr: Attribute): void;
|
||||
|
||||
addImportedVariable(importedVariable: any): void;
|
||||
|
||||
addNestedTag(nestedTag: Tag): void;
|
||||
|
||||
addNestedVariable(nestedVariable: any): void;
|
||||
|
||||
addTransformer(transformer: Transformer): void;
|
||||
|
||||
forEachAttribute(callback: (attr: Attribute) => void, thisObj?: any): void;
|
||||
|
||||
forEachImportedVariable(callback: (importedVariable: any) => void, thisObj?: any): void;
|
||||
|
||||
forEachNestedTag(callback: (nestedTag: Tag) => void, thisObj?: any): void;
|
||||
|
||||
forEachTransformer(callback: (transformer: Transformer) => void, thisObj?: any): void;
|
||||
|
||||
forEachVariable(callback: (nestedVariable: any) => void, thisObj?: any): void;
|
||||
|
||||
getAttribute(attrName: string): Attribute | undefined;
|
||||
|
||||
getNodeFactory(): any;
|
||||
|
||||
hasAttribute(attrName: string): boolean;
|
||||
|
||||
hasNestedTags(): boolean;
|
||||
|
||||
hasTransformers(): boolean;
|
||||
|
||||
setBodyFunction(name: string, params: any): void;
|
||||
|
||||
setBodyProperty(propertyName: string): void;
|
||||
|
||||
setTaglib(taglib: Taglib): void;
|
||||
}
|
||||
|
||||
export = Tag;
|
||||
@@ -0,0 +1,38 @@
|
||||
import Attribute from './Attribute';
|
||||
import Transformer from './Transformer';
|
||||
import Tag = require('./Tag');
|
||||
|
||||
export default class Taglib {
|
||||
id: string;
|
||||
/** @deprecated */
|
||||
path: string;
|
||||
filePath: string;
|
||||
dirname: string;
|
||||
tags: { [name: string]: Tag };
|
||||
attributes: { [key: string]: Attribute };
|
||||
attributeGroups: { [name: string]: Attribute };
|
||||
patternAttributes: Attribute[];
|
||||
textTransformers: Transformer[];
|
||||
transformers: Transformer[];
|
||||
inputFilesLookup: any;
|
||||
imports: any;
|
||||
importsLookup: any;
|
||||
|
||||
constructor(filePath: string);
|
||||
|
||||
addAttribute(attribute: Attribute): void;
|
||||
|
||||
getAttribute(name: string): Attribute | undefined;
|
||||
|
||||
addTag(tag: Tag): void;
|
||||
|
||||
addTransformer(transformer: Transformer): void;
|
||||
|
||||
addTextTransformer(transformer: Transformer): void;
|
||||
|
||||
addImport(path: string): void;
|
||||
|
||||
forEachTag(callback: (tag: Tag) => void, thisObj?: any): void;
|
||||
|
||||
toJSON(): any;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import Tag = require('./Tag');
|
||||
|
||||
export default class Transformer {
|
||||
id: number;
|
||||
name: string | null;
|
||||
tag: Tag | null;
|
||||
path: string | null;
|
||||
priority: any;
|
||||
properties: any;
|
||||
taglibId: string;
|
||||
|
||||
constructor();
|
||||
getFunc(): any;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import _Taglib from './Taglib';
|
||||
import Tag = require('./Tag');
|
||||
|
||||
export class Taglib extends _Taglib {}
|
||||
|
||||
export function createTaglib(filePath: string): Taglib;
|
||||
|
||||
export function loadTaglibFromProps(taglib: Taglib, taglibProps: any): Taglib;
|
||||
|
||||
export function loadTaglibFromFile(filePath: string): Taglib;
|
||||
|
||||
export function loadTag(tagProps: any, filePath: string): Tag;
|
||||
|
||||
export function clearCache(): void;
|
||||
@@ -0,0 +1,41 @@
|
||||
import Taglib from '../taglib-loader/Taglib';
|
||||
import Tag = require('../taglib-loader/Tag');
|
||||
import Attribute from '../taglib-loader/Attribute';
|
||||
import Transformer from '../taglib-loader/Transformer';
|
||||
|
||||
export interface Element {
|
||||
tagName: string;
|
||||
}
|
||||
|
||||
export default class TaglibLookup {
|
||||
merged: {
|
||||
attributeGroups: any;
|
||||
};
|
||||
taglibsById: { [id: string]: Taglib };
|
||||
|
||||
constructor();
|
||||
|
||||
hasTaglib(taglib: Taglib): boolean;
|
||||
|
||||
addTaglib(taglib: Taglib): void;
|
||||
|
||||
getTagsSorted(): Tag[];
|
||||
|
||||
forEachTag(callback: (tag: Tag) => void | boolean): void;
|
||||
|
||||
forEachAttribute(tagName: string, callback: (attrDef: Attribute, tag: Tag) => void): void;
|
||||
|
||||
getTag(element: string | Element): Tag | undefined;
|
||||
|
||||
getAttribute(element: string | Element, attr: string | { name: string }): Attribute | undefined;
|
||||
|
||||
forEachTemplateTransformer(callback: (trans: Transformer) => any, thisObj?: any): void;
|
||||
|
||||
forEachNodeTransformer(node: any, callback: (trans: Transformer) => any, thisObj?: any): void;
|
||||
|
||||
forEachTagTransformer(element: string | Element, callback: (trans: Transformer) => any, thisObj?: any): void;
|
||||
|
||||
forEachTextTransformer(callback: (trans: Transformer) => any, thisObj?: any): void;
|
||||
|
||||
getInputFiles(): string[];
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import Taglib from '../taglib-loader/Taglib';
|
||||
import _TaglibLookup from './TaglibLookup';
|
||||
|
||||
export class TaglibLookup extends _TaglibLookup {}
|
||||
|
||||
export const registeredTaglibs: Taglib[];
|
||||
|
||||
export function registerTaglib(taglib: Taglib): void;
|
||||
|
||||
export function buildLookup(dirname: string): TaglibLookup;
|
||||
|
||||
export function clearCache(): void;
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import DomElement from '../runtime/DomElement';
|
||||
|
||||
export default interface Component extends EventEmitter, DomElement {
|
||||
/** @deprecated */
|
||||
el: HTMLElement;
|
||||
/** @deprecated */
|
||||
els: HTMLElement[];
|
||||
id: string;
|
||||
input: any;
|
||||
state: any;
|
||||
destroy(): void;
|
||||
elId(key: string, index?: number): string;
|
||||
forceUpdate(): void;
|
||||
getComponent(key: string, index?: number): Component;
|
||||
getComponents(key: string): Component[];
|
||||
getEl(key?: string, index?: number): HTMLElement;
|
||||
getElId(key: string, index?: number): string;
|
||||
getEls(key?: string): HTMLElement[];
|
||||
isDestroyed(): boolean;
|
||||
replaceState(newState: any): void;
|
||||
setState(name: string, value: any): void;
|
||||
setState(name: any): void;
|
||||
setStateDirty(name: string, value?: any): void;
|
||||
shouldUpdate(newState: any, newProps: any): boolean;
|
||||
update(): void;
|
||||
(id: string): this;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import _Component from './Component';
|
||||
|
||||
export function writeInitComponentsCode(fromOut: any, targetOut: any, shouldIncludeAll: any): void;
|
||||
|
||||
export function getRenderedComponents(out: any): any;
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
export interface Component extends _Component {}
|
||||
@@ -0,0 +1,12 @@
|
||||
declare function getComponentFiles(filename: string): getComponentFiles.ComponentFiles | null;
|
||||
|
||||
declare namespace getComponentFiles {
|
||||
interface ComponentFiles {
|
||||
styles: string[];
|
||||
file: string | null;
|
||||
browserFile: string | null;
|
||||
package: string | null;
|
||||
}
|
||||
}
|
||||
|
||||
export = getComponentFiles;
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export default interface Async extends EventEmitter, Promise<any> {
|
||||
sync(): void;
|
||||
isSync(): boolean;
|
||||
write(str?: string): this;
|
||||
w(str?: string): this;
|
||||
beginAsync(options?: any): this;
|
||||
error(e: Error): this;
|
||||
flush(): void;
|
||||
createOut(): this;
|
||||
endElement(): void;
|
||||
onLast(callback: any): this;
|
||||
c(componentDef: any, key: any, customEvents: any): void;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export default interface DomElement {
|
||||
appendTo(referenceEl: string | Node): this;
|
||||
prependTo(referenceEl: string | Node): this;
|
||||
replace(referenceEl: string | Node): this;
|
||||
replaceChildrenOf(referenceEl: string | Node): this;
|
||||
insertBefore(referenceEl: string | Node): this;
|
||||
insertAfter(referenceEl: string | Node): this;
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import Async from '../Async';
|
||||
|
||||
export default interface AsyncStream extends Async {
|
||||
DEFAULT_TIMEOUT: number;
|
||||
INCLUDE_STACK: boolean;
|
||||
|
||||
(global: any, writer?: any, parentOut?: any, shouldBuffer?: boolean): this;
|
||||
enableAsyncStackTrace(): void;
|
||||
text(str: any): void;
|
||||
element(tagName: string, elementAttrs: any, openTagOnly: boolean): void;
|
||||
beginElement(name: string, elementAttrs: any): void;
|
||||
end(data?: any): this;
|
||||
/** @deprecated */
|
||||
getOutput(): string;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import DomElement from '../DomElement';
|
||||
import Component from '../../components/Component';
|
||||
|
||||
export default interface RenderResult extends DomElement {
|
||||
document: Document | false;
|
||||
|
||||
(out: any): this;
|
||||
getComponent(): Component;
|
||||
getComponents(selector?: any): Component[];
|
||||
afterInsert(doc: Document): this;
|
||||
getNode(doc: Document): Node;
|
||||
getOutput(): any;
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as stream from 'stream';
|
||||
import { ServerResponse } from 'http';
|
||||
import AsyncStream from './AsyncStream';
|
||||
import RenderResult from './RenderResult';
|
||||
import AsyncVDOMBuilder from '../vdom/AsyncVDOMBuilder';
|
||||
import { AsyncWriter } from 'async-writer';
|
||||
|
||||
export class Readable extends stream.Readable {
|
||||
_t: any;
|
||||
_d: any;
|
||||
_shouldBuffer: boolean;
|
||||
_rendered: boolean;
|
||||
|
||||
constructor(template: Template, data: any, options: any);
|
||||
|
||||
write(data: any): void;
|
||||
}
|
||||
|
||||
export interface Renderable {
|
||||
createOut: any;
|
||||
|
||||
renderToString(data?: any): string;
|
||||
|
||||
renderToString(data: any, callback: (err: Error | null, result: string) => void): undefined;
|
||||
|
||||
renderSync(data?: any): RenderResult;
|
||||
|
||||
render(data?: any): Promise<RenderResult>;
|
||||
|
||||
render(data: any, out: AsyncStream | AsyncWriter | AsyncVDOMBuilder | stream.Writable |
|
||||
((err: any, result: RenderResult) => void)): void;
|
||||
}
|
||||
|
||||
export default interface Template extends Renderable {
|
||||
path: string;
|
||||
_: any;
|
||||
___shouldBuffer: boolean;
|
||||
meta: any;
|
||||
|
||||
(path: string, renderFunc: any, options: any): Template;
|
||||
|
||||
createOut(globalData?: any, writer?: any, parentOut?: any, buffer?: any): AsyncStream;
|
||||
|
||||
stream(data: any): Readable;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import MarkoAsyncStream from './AsyncStream';
|
||||
import MarkoTemplate from './Template';
|
||||
import MarkoRenderResult from './RenderResult';
|
||||
|
||||
export function createWriter(writer: any): AsyncStream;
|
||||
|
||||
export function enableAsyncStackTrace(): void;
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
export interface Template extends MarkoTemplate {}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
export interface AsyncStream extends MarkoAsyncStream {}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
export interface RenderResult extends MarkoRenderResult {}
|
||||
@@ -0,0 +1,25 @@
|
||||
import Component from '../../components/Component';
|
||||
import Async from '../Async';
|
||||
|
||||
export default interface AsyncVDOMBuilder extends Async {
|
||||
isVDOM: true;
|
||||
data: any;
|
||||
global: any;
|
||||
|
||||
(globalData?: any, parentNode?: any, parentOut?: any): this;
|
||||
bc(component: Component): any;
|
||||
n(node: any, component: Component): this;
|
||||
node(node: any): this;
|
||||
h(html?: string): this;
|
||||
html(html?: string): this;
|
||||
ed(tagName: string, attrs: any, key: string, component: Component, childCount: number, flags?: number, props?: any): any;
|
||||
bed(tagName: string, attrs: any, key: string, component: Component, childCount: number, flags?: number, props?: any): this;
|
||||
ee(): void;
|
||||
comment(comment: any): this;
|
||||
t(text: any): this | string | void;
|
||||
text(text: any): this | string | void;
|
||||
element(tagName: string, attrs: any, key: string, component: Component, childCount: number, flags?: number, props?: any): any;
|
||||
be(tagName: string, attrs: any, key: string, component: Component, childCount: number, flags?: number, props?: any): this;
|
||||
beginElement(tagName: string, attrs: any, key: string, component: Component, childCount: number, flags?: number, props?: any): this;
|
||||
end(): this;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"express.d.ts",
|
||||
"node-require.d.ts",
|
||||
"marko-tests.ts",
|
||||
"src/compiler/index.d.ts",
|
||||
"src/compiler/config.d.ts",
|
||||
"src/compiler/modules.d.ts",
|
||||
"src/compiler/taglib-finder/index.d.ts",
|
||||
"src/compiler/taglib-loader/index.d.ts",
|
||||
"src/compiler/taglib-loader/Attribute.d.ts",
|
||||
"src/compiler/taglib-loader/Tag.d.ts",
|
||||
"src/compiler/taglib-loader/Taglib.d.ts",
|
||||
"src/compiler/taglib-loader/Transformer.d.ts",
|
||||
"src/compiler/taglib-lookup/index.d.ts",
|
||||
"src/compiler/taglib-lookup/TaglibLookup.d.ts",
|
||||
"src/components/index.d.ts",
|
||||
"src/components/Component.d.ts",
|
||||
"src/components/taglib/TransformHelper/getComponentFiles.d.ts",
|
||||
"src/runtime/Async.d.ts",
|
||||
"src/runtime/DomElement.d.ts",
|
||||
"src/runtime/html/index.d.ts",
|
||||
"src/runtime/html/Template.d.ts",
|
||||
"src/runtime/html/RenderResult.d.ts",
|
||||
"src/runtime/html/AsyncStream.d.ts",
|
||||
"src/runtime/vdom/AsyncVDOMBuilder.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+10
-45
@@ -16,6 +16,9 @@ import * as url from "url";
|
||||
import { Response as NodeResponse } from "node-fetch";
|
||||
|
||||
declare namespace next {
|
||||
/** Map object used in query strings. */
|
||||
type QueryStringMapObject = Record<string, string | string[] | undefined>;
|
||||
|
||||
/**
|
||||
* Context object used in methods like `getInitialProps()`
|
||||
* <<https://github.com/zeit/next.js/issues/1651>>
|
||||
@@ -24,15 +27,7 @@ declare namespace next {
|
||||
/** path section of URL */
|
||||
pathname: string;
|
||||
/** query string section of URL parsed as an object */
|
||||
query: {
|
||||
[key: string]:
|
||||
| boolean
|
||||
| boolean[]
|
||||
| number
|
||||
| number[]
|
||||
| string
|
||||
| string[];
|
||||
};
|
||||
query: QueryStringMapObject;
|
||||
/** String of the actual path (including the query) shows in the browser */
|
||||
asPath: string;
|
||||
/** HTTP request object (server only) */
|
||||
@@ -43,6 +38,8 @@ declare namespace next {
|
||||
jsonPageRes?: NodeResponse;
|
||||
/** Error object if any error is encountered during the rendering */
|
||||
err?: Error;
|
||||
/** Whether we're running on the server environment or not. */
|
||||
isServer?: boolean;
|
||||
}
|
||||
|
||||
type NextSFC<TProps = {}> = NextStatelessComponent<TProps>;
|
||||
@@ -101,15 +98,7 @@ declare namespace next {
|
||||
req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
pathname: string,
|
||||
query?: {
|
||||
[key: string]:
|
||||
| boolean
|
||||
| boolean[]
|
||||
| number
|
||||
| number[]
|
||||
| string
|
||||
| string[];
|
||||
},
|
||||
query?: QueryStringMapObject,
|
||||
parsedUrl?: UrlLike
|
||||
): Promise<void>;
|
||||
renderError(
|
||||
@@ -117,15 +106,7 @@ declare namespace next {
|
||||
req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
pathname: string,
|
||||
query?: {
|
||||
[key: string]:
|
||||
| boolean
|
||||
| boolean[]
|
||||
| number
|
||||
| number[]
|
||||
| string
|
||||
| string[];
|
||||
}
|
||||
query?: QueryStringMapObject
|
||||
): Promise<void>;
|
||||
render404(
|
||||
req: http.IncomingMessage,
|
||||
@@ -136,30 +117,14 @@ declare namespace next {
|
||||
req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
pathname: string,
|
||||
query?: {
|
||||
[key: string]:
|
||||
| boolean
|
||||
| boolean[]
|
||||
| number
|
||||
| number[]
|
||||
| string
|
||||
| string[];
|
||||
}
|
||||
query?: QueryStringMapObject
|
||||
): Promise<string>;
|
||||
renderErrorToHTML(
|
||||
err: any,
|
||||
req: http.IncomingMessage,
|
||||
res: http.ServerResponse,
|
||||
pathname: string,
|
||||
query?: {
|
||||
[key: string]:
|
||||
| boolean
|
||||
| boolean[]
|
||||
| number
|
||||
| number[]
|
||||
| string
|
||||
| string[];
|
||||
}
|
||||
query?: QueryStringMapObject
|
||||
): Promise<string>;
|
||||
|
||||
serveStatic(
|
||||
|
||||
Vendored
+5
-1
@@ -685,7 +685,7 @@ declare namespace Office {
|
||||
*
|
||||
* @param startAddress - Accepts the initial HTTPS URL that opens in the dialog.
|
||||
* @param options - Optional. Accepts an {@link Office.DialogOptions} object to define dialog display.
|
||||
* @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. If successful, the AsyncResult.value is a DialogHandler object.
|
||||
* @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. If successful, the AsyncResult.value is a Dialog object.
|
||||
*/
|
||||
displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
@@ -1132,6 +1132,10 @@ declare namespace Office {
|
||||
* - DialogEventReceived. Triggered when the dialog box has been closed or otherwise unloaded.
|
||||
*/
|
||||
addEventHandler(eventType: Office.EventType, handler: Function): void;
|
||||
/**
|
||||
* FOR INTERNAL USE ONLY. DO NOT CALL IN YOUR CODE.
|
||||
*/
|
||||
sendMessage(name: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for polyfill-service 3.25
|
||||
// Project: https://github.com/financial-times/polyfill-service#readme
|
||||
// Definitions by: Arturas Molcanovas <https://github.com/Alorel>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export type PolyfillFlag = 'gated' | 'always';
|
||||
export type Unknown = 'polyfill' | 'ignore';
|
||||
|
||||
export interface Feature {
|
||||
flags?: PolyfillFlag[];
|
||||
}
|
||||
|
||||
export interface Features {
|
||||
[feature: string]: Feature;
|
||||
}
|
||||
|
||||
export interface GetPolyfillsOptions {
|
||||
uaString: string;
|
||||
features?: Features;
|
||||
excludes?: string[];
|
||||
}
|
||||
|
||||
export interface GetPolyfillStringOptions extends GetPolyfillsOptions {
|
||||
minify?: boolean;
|
||||
unknown?: Unknown;
|
||||
}
|
||||
|
||||
export interface PolyfillSpec {
|
||||
aliasOf?: Set<string>;
|
||||
flags: Set<PolyfillFlag>;
|
||||
}
|
||||
|
||||
export interface GetPolyfillsResponse {
|
||||
[name: string]: PolyfillSpec;
|
||||
}
|
||||
|
||||
export function listAllPolyfills(): Promise<ReadonlyArray<string>>;
|
||||
|
||||
export function getPolyfillString(options: GetPolyfillStringOptions): Promise<string>;
|
||||
|
||||
export function getPolyfills(options: GetPolyfillsOptions): Promise<GetPolyfillsResponse>;
|
||||
@@ -0,0 +1,43 @@
|
||||
import * as svc from 'polyfill-service';
|
||||
|
||||
const o: svc.GetPolyfillsOptions = {
|
||||
uaString: ''
|
||||
};
|
||||
|
||||
o.excludes = ['foo'];
|
||||
o.features = {
|
||||
foo: {},
|
||||
bar: {flags: ['gated', 'always']}
|
||||
};
|
||||
|
||||
const o2: svc.GetPolyfillStringOptions = {
|
||||
uaString: ''
|
||||
};
|
||||
|
||||
o2.excludes = ['foo'];
|
||||
o2.features = {
|
||||
foo: {},
|
||||
bar: {flags: ['gated', 'always']}
|
||||
};
|
||||
o2.minify = true;
|
||||
o2.minify = false;
|
||||
o2.unknown = 'polyfill';
|
||||
o2.unknown = 'ignore';
|
||||
|
||||
svc.listAllPolyfills().then(v => {
|
||||
v[0].toLocaleLowerCase();
|
||||
});
|
||||
|
||||
svc.getPolyfillString(o2).then(s => {
|
||||
s.toLocaleUpperCase();
|
||||
});
|
||||
|
||||
svc.getPolyfills(o).then(r => {
|
||||
const p = r.Symbol;
|
||||
p.flags.clear();
|
||||
|
||||
const a = p.aliasOf;
|
||||
if (a) {
|
||||
a.clear();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"polyfill-service-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for twig 1.10
|
||||
// Type definitions for twig 1.12
|
||||
// Project: https://github.com/twigjs/twig.js
|
||||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
|
||||
// Tim Schumacher <https://github.com/enko>
|
||||
@@ -12,11 +12,12 @@ export interface Parameters {
|
||||
macros?: any;
|
||||
base?: any;
|
||||
path?: any;
|
||||
url?: any;
|
||||
href?: any;
|
||||
name?: any;
|
||||
method?: any;
|
||||
options?: any;
|
||||
data?: any;
|
||||
async?: any;
|
||||
}
|
||||
|
||||
export interface Template {
|
||||
|
||||
@@ -14,7 +14,8 @@ const params: twig.Parameters = {
|
||||
method: value,
|
||||
name: value,
|
||||
options: value,
|
||||
url: value
|
||||
href: value,
|
||||
async: value
|
||||
};
|
||||
|
||||
const temp: twig.Template = twig.twig(params);
|
||||
|
||||
Vendored
+8
@@ -1594,6 +1594,14 @@ declare namespace webpack {
|
||||
*/
|
||||
exec(code: string, filename: string): any;
|
||||
|
||||
/**
|
||||
* Resolves the given request to a module, applies all configured loaders and calls
|
||||
* back with the generated source, the sourceMap and the module instance (usually an
|
||||
* instance of NormalModule). Use this function if you need to know the source code
|
||||
* of another module to generate the result.
|
||||
*/
|
||||
loadModule(request: string, callback: (err: Error | null, source: string, sourceMap: RawSourceMap, module: Module) => void): any;
|
||||
|
||||
/**
|
||||
* Resolve a request like a require expression.
|
||||
*/
|
||||
|
||||
@@ -516,6 +516,7 @@ function loader(this: webpack.loader.LoaderContext, source: string | Buffer, sou
|
||||
|
||||
this.addDependency('');
|
||||
|
||||
this.loadModule('path', (err: Error | null, result: string, sourceMap: RawSourceMap, module: webpack.Module) => { });
|
||||
this.resolve('context', 'request', (err: Error, result: string) => { });
|
||||
|
||||
this.emitWarning('warning message');
|
||||
|
||||
Vendored
+5
-2
@@ -2,9 +2,10 @@
|
||||
// Project: https://github.com/Tencent/wepy/tree/1.7.x/packages/wepy-redux
|
||||
// Definitions by: Jiayu Liu <https://github.com/Jimexist>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import wepy from "wepy";
|
||||
import { Store } from "redux";
|
||||
|
||||
export interface MapStateToProps {
|
||||
[propName: string]: ((state: any) => any) | string;
|
||||
@@ -18,4 +19,6 @@ export function connect(
|
||||
mapDispatchToProps: MapDispatchToProps
|
||||
): (<T extends wepy.Component>(original: T) => T);
|
||||
|
||||
export function setStore(store: any): void;
|
||||
export function setStore(store: Store): void;
|
||||
|
||||
export function getStore(): Store;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"redux": "^4.0.0"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,17 @@
|
||||
import wepy from "wepy";
|
||||
import { connect } from "wepy-redux";
|
||||
import { createStore } from "redux";
|
||||
import { connect, getStore, setStore } from "wepy-redux";
|
||||
|
||||
const store = createStore(
|
||||
(counter: number | undefined, action: { type: string; payload: number }) =>
|
||||
counter || 0 + action.payload,
|
||||
0
|
||||
);
|
||||
|
||||
setStore(store);
|
||||
|
||||
const s = getStore();
|
||||
s.dispatch({ type: "a" });
|
||||
|
||||
interface State {
|
||||
counter: {
|
||||
|
||||
Reference in New Issue
Block a user