feat(monorepo): build with esm modules (#8729)

fixes https://github.com/NativeScript/NativeScript/issues/8739
This commit is contained in:
Martin Guillon
2020-07-23 22:58:08 +02:00
committed by Nathan Walker
parent 5658e638d5
commit fc64fc3ed9
373 changed files with 2295 additions and 1453 deletions

View File

@@ -1,5 +1,4 @@
import { knownFolders } from '../file-system';
import { isAndroid } from '../platform';
export let debug = true;
@@ -62,7 +61,7 @@ export class ScopeError extends Error {
formattedMessage = message || inner.message || undefined;
}
super(formattedMessage);
this.stack = isAndroid ? 'Error: ' + this.message + '\n' + inner.stack.substr(inner.stack.indexOf('\n') + 1) : inner.stack;
this.stack = global.isAndroid ? 'Error: ' + this.message + '\n' + inner.stack.substr(inner.stack.indexOf('\n') + 1) : inner.stack;
this.message = formattedMessage;
}
}

View File

@@ -3,7 +3,7 @@ import { Device } from '../platform';
import { FileSystemAccess } from '../file-system/file-system-access';
import { Trace } from '../trace';
export { ad } from './native-helper';
export { ad, iOSNativeHelper } from './native-helper';
export * from './utils-common';
export { Source } from './debug';

View File

@@ -46,3 +46,5 @@ export function openUrl(location: string): boolean {
export function isRealDevice(): boolean {
return iOSNativeHelper.isRealDevice();
}
export const ad = 0;

View File

@@ -2,22 +2,20 @@ import { round, MODE_MASK } from './layout-helper-common';
export * from './layout-helper-common';
let mainScreenScale;
export function makeMeasureSpec(size: number, mode: number): number {
return (Math.round(Math.max(0, size)) & ~MODE_MASK) | (mode & MODE_MASK);
}
export function getDisplayDensity(): number {
return mainScreenScale;
return UIScreen.mainScreen.scale;
}
export function toDevicePixels(value: number): number {
return value * mainScreenScale;
return value * UIScreen.mainScreen.scale;
}
export function toDeviceIndependentPixels(value: number): number {
return value / mainScreenScale;
return value / UIScreen.mainScreen.scale;
}
export function measureNativeView(nativeView: any /* UIView */, width: number, widthMode: number, height: number, heightMode: number): { width: number; height: number } {
@@ -32,5 +30,3 @@ export function measureNativeView(nativeView: any /* UIView */, width: number, w
return nativeSize;
}
mainScreenScale = UIScreen.mainScreen.scale;

View File

@@ -157,3 +157,5 @@ export namespace ad {
return fingerprint != null && (fingerprint.indexOf('vbox') > -1 || fingerprint.indexOf('generic') > -1);
}
}
export const iOSNativeHelper = 0;

View File

@@ -127,7 +127,8 @@ export namespace iOSNativeHelper {
return transform;
}
export class UIDocumentInteractionControllerDelegateImpl extends NSObject implements UIDocumentInteractionControllerDelegate {
@NativeClass
export class UIDocumentInteractionControllerDelegateImpl extends NSObject implements UIDocumentInteractionControllerDelegate {
public static ObjCProtocols = [UIDocumentInteractionControllerDelegate];
public getViewController(): UIViewController {