mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-26 01:18:21 +01:00
used libantosdk for pompiling
This commit is contained in:
parent
b4fb5473e4
commit
5d41281706
6
Makefile
6
Makefile
@ -71,9 +71,9 @@ ts:
|
||||
tsc -p tsconfig.json
|
||||
cat `find dist/core/ -name "*.d.ts"` > d.ts/antos.d.ts
|
||||
rm `find dist/ -name "*.d.ts"`
|
||||
cat d.ts/*.d.ts > /tmp/corelib.d.ts
|
||||
-rm src/packages/CodePad/libs/corelib.d.ts.zip
|
||||
zip -j src/packages/CodePad/libs/corelib.d.ts.zip /tmp/corelib.d.ts
|
||||
cat d.ts/core.d.ts d.ts/jquery.d.ts d.ts/antos.d.ts > /tmp/corelib.d.ts
|
||||
#-rm src/packages/CodePad/libs/corelib.d.ts.zip
|
||||
#zip -j src/packages/CodePad/libs/corelib.d.ts.zip /tmp/corelib.d.ts
|
||||
|
||||
standalone_tags: ts
|
||||
@echo "$(BLUE)Bundling standalone tags files$(NC)"
|
||||
|
492
d.ts/jquery.d.ts
vendored
492
d.ts/jquery.d.ts
vendored
@ -1,95 +1,3 @@
|
||||
// Type definitions for sizzle 2.3
|
||||
// Project: https://sizzlejs.com
|
||||
// Definitions by: Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export as namespace Sizzle;
|
||||
|
||||
declare const Sizzle: SizzleStatic;
|
||||
export = Sizzle;
|
||||
|
||||
interface SizzleStatic {
|
||||
selectors: Sizzle.Selectors;
|
||||
<TArrayLike extends ArrayLike<Element>>(selector: string, context: Element | Document | DocumentFragment, results: TArrayLike): TArrayLike;
|
||||
(selector: string, context?: Element | Document | DocumentFragment): Element[];
|
||||
// tslint:disable-next-line:ban-types
|
||||
compile(selector: string): Function;
|
||||
matchSelector(element: Element, selector: string): boolean;
|
||||
matches(selector: string, elements: Element[]): Element[];
|
||||
}
|
||||
|
||||
declare namespace Sizzle {
|
||||
interface Selectors {
|
||||
cacheLength: number;
|
||||
match: Selectors.Matches;
|
||||
find: Selectors.FindFunctions;
|
||||
preFilter: Selectors.PreFilterFunctions;
|
||||
filter: Selectors.FilterFunctions;
|
||||
attrHandle: Selectors.AttrHandleFunctions;
|
||||
pseudos: Selectors.PseudoFunctions;
|
||||
setFilters: Selectors.SetFilterFunctions;
|
||||
createPseudo(fn: Selectors.CreatePseudoFunction): Selectors.PseudoFunction;
|
||||
}
|
||||
|
||||
namespace Selectors {
|
||||
interface Matches {
|
||||
[name: string]: RegExp;
|
||||
}
|
||||
|
||||
interface FindFunction {
|
||||
(match: RegExpMatchArray, context: Element | Document, isXML: boolean): Element[] | void;
|
||||
}
|
||||
|
||||
interface FindFunctions {
|
||||
[name: string]: FindFunction;
|
||||
}
|
||||
|
||||
interface PreFilterFunction {
|
||||
(match: RegExpMatchArray): string[];
|
||||
}
|
||||
|
||||
interface PreFilterFunctions {
|
||||
[name: string]: PreFilterFunction;
|
||||
}
|
||||
|
||||
interface FilterFunction {
|
||||
(element: string, ...matches: string[]): boolean;
|
||||
}
|
||||
|
||||
interface FilterFunctions {
|
||||
[name: string]: FilterFunction;
|
||||
}
|
||||
|
||||
interface AttrHandleFunction {
|
||||
(elem: any, casePreservedName: string, isXML: boolean): string;
|
||||
}
|
||||
|
||||
interface AttrHandleFunctions {
|
||||
[name: string]: AttrHandleFunction;
|
||||
}
|
||||
|
||||
interface PseudoFunction {
|
||||
(elem: Element): boolean;
|
||||
}
|
||||
|
||||
interface PseudoFunctions {
|
||||
[name: string]: PseudoFunction;
|
||||
}
|
||||
|
||||
interface SetFilterFunction {
|
||||
(elements: Element[], argument: number, not: boolean): Element[];
|
||||
}
|
||||
|
||||
interface SetFilterFunctions {
|
||||
[name: string]: SetFilterFunction;
|
||||
}
|
||||
|
||||
interface CreatePseudoFunction {
|
||||
(...args: any[]): PseudoFunction;
|
||||
}
|
||||
}
|
||||
}
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
@ -26633,206 +26541,6 @@ $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
|
||||
*/
|
||||
when(...deferreds: any[]): JQuery.Promise<any, any, never>;
|
||||
}
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryCallback extends JQuery.Callbacks { }
|
||||
interface JQueryDeferred<T> extends JQuery.Deferred<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryEventConstructor extends JQuery.EventStatic { }
|
||||
interface JQueryDeferred<T> extends JQuery.Deferred<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryAjaxSettings extends JQuery.AjaxSettings { }
|
||||
interface JQueryAnimationOptions extends JQuery.EffectsOptions<Element> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryCoordinates extends JQuery.Coordinates { }
|
||||
interface JQueryGenericPromise<T> extends JQuery.Thenable<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryXHR extends JQuery.jqXHR { }
|
||||
interface JQueryPromise<T> extends JQuery.Promise<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQuerySerializeArrayElement extends JQuery.NameValuePair { }
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`.
|
||||
*/
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQuerySupport extends JQuery.PlainObject { }
|
||||
|
||||
// Legacy types that are not represented in the current type definitions are marked deprecated.
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Deferred.Callback }\` or \`{@link JQuery.Deferred.CallbackBase }\`.
|
||||
*/
|
||||
interface JQueryPromiseCallback<T> {
|
||||
(value?: T, ...args: any[]): void;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQueryStatic.param JQueryStatic['param']}\`.
|
||||
*/
|
||||
interface JQueryParam {
|
||||
/**
|
||||
* Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
|
||||
* @param obj An array or object to serialize.
|
||||
* @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization.
|
||||
*/
|
||||
(obj: any, traditional?: boolean): string;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface BaseJQueryEventObject extends Event {
|
||||
/**
|
||||
* The current DOM element within the event bubbling phase.
|
||||
* @see \`{@link https://api.jquery.com/event.currentTarget/ }\`
|
||||
*/
|
||||
currentTarget: Element;
|
||||
/**
|
||||
* An optional object of data passed to an event method when the current executing handler is bound.
|
||||
* @see \`{@link https://api.jquery.com/event.data/ }\`
|
||||
*/
|
||||
data: any;
|
||||
/**
|
||||
* The element where the currently-called jQuery event handler was attached.
|
||||
* @see \`{@link https://api.jquery.com/event.delegateTarget/ }\`
|
||||
*/
|
||||
delegateTarget: Element;
|
||||
/**
|
||||
* Returns whether event.preventDefault() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\`
|
||||
*/
|
||||
isDefaultPrevented(): boolean;
|
||||
/**
|
||||
* Returns whether event.stopImmediatePropagation() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\`
|
||||
*/
|
||||
isImmediatePropagationStopped(): boolean;
|
||||
/**
|
||||
* Returns whether event.stopPropagation() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\`
|
||||
*/
|
||||
isPropagationStopped(): boolean;
|
||||
/**
|
||||
* The namespace specified when the event was triggered.
|
||||
* @see \`{@link https://api.jquery.com/event.namespace/ }\`
|
||||
*/
|
||||
namespace: string;
|
||||
/**
|
||||
* The browser's original Event object.
|
||||
* @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
|
||||
*/
|
||||
originalEvent: Event;
|
||||
/**
|
||||
* If this method is called, the default action of the event will not be triggered.
|
||||
* @see \`{@link https://api.jquery.com/event.preventDefault/ }\`
|
||||
*/
|
||||
preventDefault(): any;
|
||||
/**
|
||||
* The other DOM element involved in the event, if any.
|
||||
* @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
|
||||
*/
|
||||
relatedTarget: Element;
|
||||
/**
|
||||
* The last value returned by an event handler that was triggered by this event, unless the value was undefined.
|
||||
* @see \`{@link https://api.jquery.com/event.result/ }\`
|
||||
*/
|
||||
result: any;
|
||||
/**
|
||||
* Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
|
||||
* @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\`
|
||||
*/
|
||||
stopImmediatePropagation(): void;
|
||||
/**
|
||||
* Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
|
||||
* @see \`{@link https://api.jquery.com/event.stopPropagation/ }\`
|
||||
*/
|
||||
stopPropagation(): void;
|
||||
/**
|
||||
* The DOM element that initiated the event.
|
||||
* @see \`{@link https://api.jquery.com/event.target/ }\`
|
||||
*/
|
||||
target: Element;
|
||||
/**
|
||||
* The mouse position relative to the left edge of the document.
|
||||
* @see \`{@link https://api.jquery.com/event.pageX/ }\`
|
||||
*/
|
||||
pageX: number;
|
||||
/**
|
||||
* The mouse position relative to the top edge of the document.
|
||||
* @see \`{@link https://api.jquery.com/event.pageY/ }\`
|
||||
*/
|
||||
pageY: number;
|
||||
/**
|
||||
* For key or mouse events, this property indicates the specific key or button that was pressed.
|
||||
* @see \`{@link https://api.jquery.com/event.which/ }\`
|
||||
*/
|
||||
which: number;
|
||||
/**
|
||||
* Indicates whether the META key was pressed when the event fired.
|
||||
* @see \`{@link https://api.jquery.com/event.metaKey/ }\`
|
||||
*/
|
||||
metaKey: boolean;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryInputEventObject extends BaseJQueryEventObject {
|
||||
altKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
metaKey: boolean;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryMouseEventObject extends JQueryInputEventObject {
|
||||
button: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryKeyEventObject extends JQueryInputEventObject {
|
||||
/** @deprecated */
|
||||
char: string;
|
||||
/** @deprecated */
|
||||
charCode: number;
|
||||
key: string;
|
||||
/** @deprecated */
|
||||
keyCode: number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { }
|
||||
/**
|
||||
* @deprecated Deprecated.
|
||||
*/
|
||||
interface JQueryPromiseOperator<T, U> {
|
||||
(callback1: JQuery.TypeOrArray<JQueryPromiseCallback<T>>,
|
||||
...callbacksN: Array<JQuery.TypeOrArray<JQueryPromiseCallback<any>>>): JQueryPromise<U>;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`.
|
||||
*/
|
||||
interface JQueryEasingFunction {
|
||||
(percent: number): number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`.
|
||||
*/
|
||||
interface JQueryEasingFunctions {
|
||||
[name: string]: JQueryEasingFunction;
|
||||
linear: JQueryEasingFunction;
|
||||
swing: JQueryEasingFunction;
|
||||
}
|
||||
// tslint:disable:jsdoc-format
|
||||
// tslint:disable:max-line-length
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
@ -33481,3 +33189,203 @@ interface SymbolConstructor {
|
||||
declare var Symbol: SymbolConstructor;
|
||||
|
||||
// #endregion
|
||||
// tslint:disable:no-irregular-whitespace
|
||||
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryCallback extends JQuery.Callbacks { }
|
||||
interface JQueryDeferred<T> extends JQuery.Deferred<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryEventConstructor extends JQuery.EventStatic { }
|
||||
interface JQueryDeferred<T> extends JQuery.Deferred<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryAjaxSettings extends JQuery.AjaxSettings { }
|
||||
interface JQueryAnimationOptions extends JQuery.EffectsOptions<Element> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryCoordinates extends JQuery.Coordinates { }
|
||||
interface JQueryGenericPromise<T> extends JQuery.Thenable<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQueryXHR extends JQuery.jqXHR { }
|
||||
interface JQueryPromise<T> extends JQuery.Promise<T> { }
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQuerySerializeArrayElement extends JQuery.NameValuePair { }
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since 1.9. See \`{@link https://api.jquery.com/jQuery.support/ }\`.
|
||||
*/
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface JQuerySupport extends JQuery.PlainObject { }
|
||||
|
||||
// Legacy types that are not represented in the current type definitions are marked deprecated.
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Deferred.Callback }\` or \`{@link JQuery.Deferred.CallbackBase }\`.
|
||||
*/
|
||||
interface JQueryPromiseCallback<T> {
|
||||
(value?: T, ...args: any[]): void;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQueryStatic.param JQueryStatic['param']}\`.
|
||||
*/
|
||||
interface JQueryParam {
|
||||
/**
|
||||
* Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
|
||||
* @param obj An array or object to serialize.
|
||||
* @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization.
|
||||
*/
|
||||
(obj: any, traditional?: boolean): string;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface BaseJQueryEventObject extends Event {
|
||||
/**
|
||||
* The current DOM element within the event bubbling phase.
|
||||
* @see \`{@link https://api.jquery.com/event.currentTarget/ }\`
|
||||
*/
|
||||
currentTarget: Element;
|
||||
/**
|
||||
* An optional object of data passed to an event method when the current executing handler is bound.
|
||||
* @see \`{@link https://api.jquery.com/event.data/ }\`
|
||||
*/
|
||||
data: any;
|
||||
/**
|
||||
* The element where the currently-called jQuery event handler was attached.
|
||||
* @see \`{@link https://api.jquery.com/event.delegateTarget/ }\`
|
||||
*/
|
||||
delegateTarget: Element;
|
||||
/**
|
||||
* Returns whether event.preventDefault() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\`
|
||||
*/
|
||||
isDefaultPrevented(): boolean;
|
||||
/**
|
||||
* Returns whether event.stopImmediatePropagation() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\`
|
||||
*/
|
||||
isImmediatePropagationStopped(): boolean;
|
||||
/**
|
||||
* Returns whether event.stopPropagation() was ever called on this event object.
|
||||
* @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\`
|
||||
*/
|
||||
isPropagationStopped(): boolean;
|
||||
/**
|
||||
* The namespace specified when the event was triggered.
|
||||
* @see \`{@link https://api.jquery.com/event.namespace/ }\`
|
||||
*/
|
||||
namespace: string;
|
||||
/**
|
||||
* The browser's original Event object.
|
||||
* @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
|
||||
*/
|
||||
originalEvent: Event;
|
||||
/**
|
||||
* If this method is called, the default action of the event will not be triggered.
|
||||
* @see \`{@link https://api.jquery.com/event.preventDefault/ }\`
|
||||
*/
|
||||
preventDefault(): any;
|
||||
/**
|
||||
* The other DOM element involved in the event, if any.
|
||||
* @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
|
||||
*/
|
||||
relatedTarget: Element;
|
||||
/**
|
||||
* The last value returned by an event handler that was triggered by this event, unless the value was undefined.
|
||||
* @see \`{@link https://api.jquery.com/event.result/ }\`
|
||||
*/
|
||||
result: any;
|
||||
/**
|
||||
* Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
|
||||
* @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\`
|
||||
*/
|
||||
stopImmediatePropagation(): void;
|
||||
/**
|
||||
* Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
|
||||
* @see \`{@link https://api.jquery.com/event.stopPropagation/ }\`
|
||||
*/
|
||||
stopPropagation(): void;
|
||||
/**
|
||||
* The DOM element that initiated the event.
|
||||
* @see \`{@link https://api.jquery.com/event.target/ }\`
|
||||
*/
|
||||
target: Element;
|
||||
/**
|
||||
* The mouse position relative to the left edge of the document.
|
||||
* @see \`{@link https://api.jquery.com/event.pageX/ }\`
|
||||
*/
|
||||
pageX: number;
|
||||
/**
|
||||
* The mouse position relative to the top edge of the document.
|
||||
* @see \`{@link https://api.jquery.com/event.pageY/ }\`
|
||||
*/
|
||||
pageY: number;
|
||||
/**
|
||||
* For key or mouse events, this property indicates the specific key or button that was pressed.
|
||||
* @see \`{@link https://api.jquery.com/event.which/ }\`
|
||||
*/
|
||||
which: number;
|
||||
/**
|
||||
* Indicates whether the META key was pressed when the event fired.
|
||||
* @see \`{@link https://api.jquery.com/event.metaKey/ }\`
|
||||
*/
|
||||
metaKey: boolean;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryInputEventObject extends BaseJQueryEventObject {
|
||||
altKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
metaKey: boolean;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryMouseEventObject extends JQueryInputEventObject {
|
||||
button: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryKeyEventObject extends JQueryInputEventObject {
|
||||
/** @deprecated */
|
||||
char: string;
|
||||
/** @deprecated */
|
||||
charCode: number;
|
||||
key: string;
|
||||
/** @deprecated */
|
||||
keyCode: number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Use \`{@link JQuery.Event }\`.
|
||||
*/
|
||||
interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { }
|
||||
/**
|
||||
* @deprecated Deprecated.
|
||||
*/
|
||||
interface JQueryPromiseOperator<T, U> {
|
||||
(callback1: JQuery.TypeOrArray<JQueryPromiseCallback<T>>,
|
||||
...callbacksN: Array<JQuery.TypeOrArray<JQueryPromiseCallback<any>>>): JQueryPromise<U>;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`.
|
||||
*/
|
||||
interface JQueryEasingFunction {
|
||||
(percent: number): number;
|
||||
}
|
||||
/**
|
||||
* @deprecated Deprecated. Internal. See \`{@link https://github.com/jquery/api.jquery.com/issues/912 }\`.
|
||||
*/
|
||||
interface JQueryEasingFunctions {
|
||||
[name: string]: JQueryEasingFunction;
|
||||
linear: JQueryEasingFunction;
|
||||
swing: JQueryEasingFunction;
|
||||
}
|
||||
|
@ -14,16 +14,7 @@ namespace OS {
|
||||
*/
|
||||
class AntOSDK extends App.BaseExtension {
|
||||
|
||||
|
||||
/**
|
||||
* Core library for the transpiler stored here
|
||||
*
|
||||
* @static
|
||||
* @type {GenericObject<any>}
|
||||
* @memberof AntOSDK
|
||||
*/
|
||||
static corelib: GenericObject<any>;
|
||||
|
||||
private sdk: any;
|
||||
/**
|
||||
*Creates an instance of AntOSDK.
|
||||
* @param {application.CodePad} app
|
||||
@ -120,6 +111,17 @@ namespace OS {
|
||||
.catch((e) => this.logger().error(__("Unable to read meta-data: {0}", e.stack)));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @protected
|
||||
* @returns {string[]}
|
||||
* @memberof BaseExtension
|
||||
*/
|
||||
protected dependencies(): string[] {
|
||||
return ["pkg://libantosdk/main.js"];
|
||||
}
|
||||
|
||||
// private functions
|
||||
/**
|
||||
* Create project template
|
||||
@ -173,193 +175,6 @@ namespace OS {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check coffeescript file validity
|
||||
*
|
||||
* @private
|
||||
* @param {string[]} list
|
||||
* @returns {Promise<void>}
|
||||
* @memberof AntOSDK
|
||||
*/
|
||||
private verify_coffee(list: string[]): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (list.length === 0) {
|
||||
return resolve();
|
||||
}
|
||||
const file = list.splice(0, 1)[0].asFileHandle();
|
||||
this.logger().info(__("Verifying: {0}", file.path));
|
||||
return file
|
||||
.read()
|
||||
.then((data) => {
|
||||
try {
|
||||
CoffeeScript.nodes(data);
|
||||
return this.verify_coffee(list)
|
||||
.then(() => resolve())
|
||||
.catch((e) => reject(__e(e)));
|
||||
} catch (ex) {
|
||||
return reject(__e(ex));
|
||||
}
|
||||
})
|
||||
.catch((e) => reject(__e(e)));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* load typescript core lib
|
||||
*
|
||||
* @private
|
||||
* @param {string} path
|
||||
* @return {*} {Promise<any>}
|
||||
* @memberof AntOSDK
|
||||
*/
|
||||
private load_corelib(path: string): Promise<any> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (AntOSDK.corelib["ts"]) {
|
||||
return resolve(AntOSDK.corelib["ts"]);
|
||||
}
|
||||
try {
|
||||
const code = await API.VFS.readFileFromZip(`${path}.zip`, "text");
|
||||
AntOSDK.corelib["ts"] = ts.createSourceFile(path, code, ts.ScriptTarget.Latest);
|
||||
return resolve(AntOSDK.corelib["ts"]);
|
||||
} catch (e) {
|
||||
return reject(__e(e));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile typescript to javascript
|
||||
*
|
||||
* @private
|
||||
* @param {string[]} files
|
||||
* @return {*} {Promise<string>}
|
||||
* @memberof AntOSDK
|
||||
*/
|
||||
private compile_ts(files: string[]): Promise<string> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (files.length == 0) {
|
||||
return resolve(undefined);
|
||||
}
|
||||
const core_lib = "os://packages/CodePad/libs/corelib.d.ts";
|
||||
try {
|
||||
await this.load_corelib(core_lib);
|
||||
const arr = await API.VFS.read_files(files);
|
||||
const libs: string[] = files.map((e) => e)
|
||||
libs.unshift(core_lib);
|
||||
const src_files: GenericObject<any> = {};
|
||||
src_files[core_lib] = AntOSDK.corelib["ts"];
|
||||
for (const i in arr) {
|
||||
src_files[files[i]] = ts.createSourceFile(files[i], arr[i], ts.ScriptTarget.Latest);
|
||||
}
|
||||
let js_code = "";
|
||||
const host = {
|
||||
fileExists: (path: string) => {
|
||||
return src_files[path] != undefined;
|
||||
},
|
||||
directoryExists: (path: string) => {
|
||||
return true;
|
||||
},
|
||||
getCurrentDirectory: () => "/",
|
||||
getDirectories: () => [],
|
||||
getCanonicalFileName: (path: string) => path,
|
||||
getNewLine: () => "\n",
|
||||
getDefaultLibFileName: () => "",
|
||||
getSourceFile: (path: string) => src_files[path],
|
||||
readFile: (path: string) => undefined,
|
||||
useCaseSensitiveFileNames: () => true,
|
||||
writeFile: (path: string, data: string) => js_code = `${js_code}\n${data}`,
|
||||
};
|
||||
const program = ts.createProgram(libs, {
|
||||
"target": "es6",
|
||||
"skipLibCheck": true,
|
||||
}, host);
|
||||
const result = program.emit();
|
||||
const diagnostics = result.diagnostics.concat((ts.getPreEmitDiagnostics(program)));
|
||||
if (diagnostics.length > 0) {
|
||||
diagnostics.forEach(diagnostic => {
|
||||
if (diagnostic.file) {
|
||||
let { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start!);
|
||||
let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
||||
this.logger().error(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
} else {
|
||||
this.logger().error(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
||||
}
|
||||
});
|
||||
return reject(API.throwe(__("Typescript compile error")));
|
||||
}
|
||||
for (const file of files) {
|
||||
this.logger().info(__("Compiled: {0}", file));
|
||||
}
|
||||
resolve(js_code);
|
||||
} catch (e) {
|
||||
return reject(__e(e));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private compile(meta: GenericObject<any>): Promise<any> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const libs = [
|
||||
`${this.basedir()}/libs/terser.min.js`,
|
||||
];
|
||||
if (!meta.coffees)
|
||||
meta.coffees = [];
|
||||
if (meta.coffees.length > 0) {
|
||||
libs.push(`${this.basedir()}/libs/coffeescript.js`);
|
||||
}
|
||||
if (!meta.ts)
|
||||
meta.ts = [];
|
||||
if (meta.ts && meta.ts.length > 0) {
|
||||
libs.push("os://scripts/jszip.min.js");
|
||||
libs.push(`${this.basedir()}/libs/typescript.min.js`)
|
||||
}
|
||||
try {
|
||||
await this.import(libs);
|
||||
const coffee_list = meta.coffees.map(
|
||||
(v: string) => `${meta.root.trimBy("/")}/${v}`
|
||||
);
|
||||
const ts_list = meta.ts.map(
|
||||
(v: string) => `${meta.root.trimBy("/")}/${v}`
|
||||
);
|
||||
const results = await Promise.all([
|
||||
this.compile_ts(ts_list),
|
||||
this.compile_coffee(coffee_list)
|
||||
]);
|
||||
|
||||
resolve(results.join("\n"));
|
||||
} catch (e_2) {
|
||||
return reject(__e(e_2));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile coffeescript to javascript
|
||||
*
|
||||
* @private
|
||||
* @param {GenericObject<any>} meta
|
||||
* @returns {Promise<string>}
|
||||
* @memberof AntOSDK
|
||||
*/
|
||||
private compile_coffee(list: string[]): Promise<string> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (list.length == 0) {
|
||||
return resolve("");
|
||||
}
|
||||
try {
|
||||
await this.verify_coffee(list.map((x: string) => x));
|
||||
const code = await API.VFS.cat(list, "");
|
||||
const jsrc = CoffeeScript.compile(code);
|
||||
for (const file of list) {
|
||||
this.logger().info(__("Compiled: {0}", file));
|
||||
}
|
||||
return resolve(jsrc);
|
||||
} catch (e_1) {
|
||||
return reject(__e(e_1));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the project
|
||||
*
|
||||
@ -372,39 +187,87 @@ namespace OS {
|
||||
private build(meta: GenericObject<any>, debug: boolean): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const options = {
|
||||
root: meta.root,
|
||||
targets: {}
|
||||
}
|
||||
if(!this.sdk)
|
||||
{
|
||||
this.sdk = new (OS.API as any).AntOSDKBuilder(this.logger(), "");
|
||||
}
|
||||
this.logger().info(__("Building the package", meta.name));
|
||||
await API.VFS.mkdirAll([`${meta.root}/build`,]);
|
||||
await API.VFS.mkdirAll([`${meta.root}/build/debug`, `${meta.root}/build/release`]);
|
||||
const src = await this.compile(meta);
|
||||
let code = await API.VFS.cat(meta.javascripts.map(v => `${meta.root}/${v}`), src);
|
||||
if (!debug) {
|
||||
const options = {
|
||||
toplevel: false,
|
||||
compress: {
|
||||
passes: 3,
|
||||
},
|
||||
mangle: true,
|
||||
output: {
|
||||
//beautify: true,
|
||||
},
|
||||
};
|
||||
const result = Terser.minify(code, options);
|
||||
if (result.error) {
|
||||
this.logger().error(
|
||||
__(
|
||||
"Unable to minify code: {0}",
|
||||
result.error
|
||||
)
|
||||
);
|
||||
} else {
|
||||
code = result.code;
|
||||
}
|
||||
if(!meta.coffees)
|
||||
meta.coffees = [];
|
||||
if(!meta.ts)
|
||||
meta.ts = [];
|
||||
options.targets["coffee"] = {
|
||||
"require": ["coffee"],
|
||||
"jobs":[
|
||||
{
|
||||
"name": "coffee-compile",
|
||||
"data": {
|
||||
"src": meta.coffees,
|
||||
"dest": "build/debug/coffee-main.js"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
options.targets["ts"] = {
|
||||
"require": ["ts"],
|
||||
"jobs":[
|
||||
{
|
||||
"name": "ts-import",
|
||||
"data": [
|
||||
"sdk://core/ts/core.d.ts",
|
||||
"sdk://core/ts/jquery.d.ts",
|
||||
"sdk://core/ts/antos.d.ts"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ts-compile",
|
||||
"data": {
|
||||
"src": meta.ts,
|
||||
"dest": "build/debug/ts-main.js"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
options.targets["cat"] = {
|
||||
"jobs":[
|
||||
{
|
||||
"name": "vfs-cat",
|
||||
"data": {
|
||||
"src": [
|
||||
"build/debug/ts-main.js", "build/debug/coffee-main.js"
|
||||
].concat(meta.javascripts.map(v => `${meta.root}/${v}`)),
|
||||
"dest": "build/debug/main.js"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "vfs-rm",
|
||||
"data": ["build/debug/ts-main.js", "build/debug/coffee-main.js"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
options.targets["uglify"] = {
|
||||
"require": ["terser"],
|
||||
"jobs":[
|
||||
{
|
||||
"name": "terser-uglify",
|
||||
"data": ["build/debug/main.js"]
|
||||
}
|
||||
]
|
||||
}
|
||||
console.log(options);
|
||||
await this.sdk.batch(["coffee", "ts", "cat"], options);
|
||||
if (!debug) {
|
||||
await this.sdk.batch(["uglify"], options);
|
||||
}
|
||||
if (code != "")
|
||||
await `${meta.root}/build/debug/main.js`
|
||||
.asFileHandle()
|
||||
.setCache(code)
|
||||
.write("text/plain");
|
||||
const txt = await API.VFS.cat(meta.css.map(v => `${meta.root}/${v}`), "");
|
||||
if (txt != "")
|
||||
await `${meta.root}/build/debug/main.css`
|
||||
@ -452,6 +315,5 @@ namespace OS {
|
||||
});
|
||||
}
|
||||
}
|
||||
AntOSDK.corelib = {};
|
||||
App.extensions.AntOSDK = AntOSDK;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
2
src/packages/CodePad/libs/terser.min.js
vendored
2
src/packages/CodePad/libs/terser.min.js
vendored
File diff suppressed because one or more lines are too long
15
src/packages/CodePad/libs/typescript.min.js
vendored
15
src/packages/CodePad/libs/typescript.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1381,7 +1381,8 @@ namespace OS {
|
||||
"os://scripts/ace/ace.js",
|
||||
"os://scripts/ace/ext-language_tools.js",
|
||||
"os://scripts/ace/ext-modelist.js",
|
||||
"os://scripts/ace/ext-themelist.js"
|
||||
"os://scripts/ace/ext-themelist.js",
|
||||
"pkg://libantosdk/main.js"
|
||||
];
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user