refactor: improved core barrel exports and Application class (#10286)

BREAKING CHANGES:

`Application.orientation` is no longer a function.

Migration: Remove `()` from the `Application.orientation()` call:
```diff
import { Application } from "@nativescript/core";

-console.log(Application.orientation());
+console.log(Application.orientation);
```


`Application.systemAppearance` is no longer a function.

Migration: Remove `()` from the `Application.systemAppearance()` call:
```diff
import { Application } from "@nativescript/core";

-console.log(Application.systemAppearance());
+console.log(Application.systemAppearance);
```
This commit is contained in:
Igor Randjelovic
2023-05-17 21:02:06 +02:00
committed by Nathan Walker
parent 963d0243de
commit f64355ba7a
67 changed files with 3536 additions and 3678 deletions

View File

@@ -14,6 +14,7 @@
"@nativescript/android": "~8.5.0",
"@nativescript/ios": "~8.5.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"circular-dependency-plugin": "^5.2.2",
"typescript": "~4.9.5"
},
"gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",

View File

@@ -1,5 +1,4 @@
import * as app from '@nativescript/core/application';
import { isAndroid, isIOS, Device, Application, platformNames } from '@nativescript/core';
import { isAndroid, isIOS, Device, Application, platformNames } from '@nativescript/core';
import * as TKUnit from '../tk-unit';
@@ -11,9 +10,9 @@ if (isAndroid) {
export function testInitialized() {
if (Device.os === platformNames.android) {
TKUnit.assert(app.android, 'Application module not properly intialized');
TKUnit.assert(Application.android, 'Application module not properly intialized');
} else if (Device.os === platformNames.ios) {
TKUnit.assert(app.ios, 'Application module not properly intialized');
TKUnit.assert(Application.ios, 'Application module not properly intialized');
}
}
@@ -23,5 +22,5 @@ export function testDisplayedEvent() {
}
export function testOrientation() {
TKUnit.assert(Application.orientation(), 'Orientation not initialized.');
TKUnit.assert(Application.orientation, 'Orientation not initialized.');
}

View File

@@ -40,7 +40,11 @@ export function testAndroidApplicationInitialized() {
TKUnit.assert(Application.android, 'Android application not initialized.');
TKUnit.assert(Application.android.context, 'Android context not initialized.');
TKUnit.assert(Application.android.foregroundActivity, 'Android foregroundActivity not initialized.');
TKUnit.assert(Application.android.foregroundActivity.isNativeScriptActivity, 'Android foregroundActivity.isNativeScriptActivity is false.');
TKUnit.assert(
// @ts-expect-error
Application.android.foregroundActivity.isNativeScriptActivity,
'Android foregroundActivity.isNativeScriptActivity is false.'
);
TKUnit.assert(Application.android.startActivity, 'Android startActivity not initialized.');
TKUnit.assert(Application.android.nativeApp, 'Android nativeApp not initialized.');
TKUnit.assert(Application.android.orientation, 'Android orientation not initialized.');

View File

@@ -4,8 +4,7 @@ import * as fs from '@nativescript/core/file-system';
// << file-system-require
import * as TKUnit from '../tk-unit';
import * as appModule from '@nativescript/core/application';
import { isIOS, Device, platformNames, isAndroid } from '@nativescript/core';
import { Application, isIOS, Device, platformNames, isAndroid } from '@nativescript/core';
export var testPathNormalize = function () {
// >> file-system-normalize
@@ -600,7 +599,7 @@ export var testFolderClear = function () {
// misc
export var testKnownFolderRename = function () {
// You can rename known folders in android - so skip this test.
if (!appModule.android) {
if (!Application.android) {
var folder = fs.knownFolders.documents();
folder.rename('Something').then(
function (result) {

View File

@@ -1,11 +1,8 @@
import { ImageSource } from '@nativescript/core/image-source';
import * as imageAssetModule from '@nativescript/core/image-asset';
import * as fs from '@nativescript/core/file-system';
import * as app from '@nativescript/core/application';
import * as TKUnit from '../tk-unit';
import { Font } from '@nativescript/core/ui/styling/font';
import { Color } from '@nativescript/core/color';
import * as utils from '@nativescript/core/utils';
import { Application, Font, Color, Utils } from '@nativescript/core';
const imagePath = '~/assets/logo.png';
const splashscreenPath = '~/assets/splashscreen.png';
@@ -23,7 +20,7 @@ export function testFromResource() {
export function testDrawableSetNativeSource() {
if (global.isAndroid) {
const context = utils.ad.getApplicationContext() as android.content.Context;
const context = Utils.android.getApplicationContext() as android.content.Context;
const rDrawable = `${context.getPackageName()}.R$drawable`;
const rClazz = java.lang.Class.forName(`${rDrawable}`);
const iconId = rClazz.getDeclaredField('icon').get(null) as java.lang.Integer;
@@ -253,9 +250,9 @@ export function testFromAssetWithBiggerScaling(done) {
export function testNativeFields() {
const img = ImageSource.fromFileSync(imagePath);
if (app.android) {
if (Application.android) {
TKUnit.assert(img.android != null, 'Image.android not updated.');
} else if (app.ios) {
} else if (Application.ios) {
TKUnit.assert(img.ios != null, 'Image.ios not updated.');
}
}
@@ -315,9 +312,9 @@ export function testLoadFromBase64Encode_JPEG() {
export function testLoadFromBase64Encode_PNG() {
let img: ImageSource;
if (app.android) {
if (Application.android) {
img = ImageSource.fromBase64Sync(fullAndroidPng);
} else if (app.ios) {
} else if (Application.ios) {
img = ImageSource.fromBase64Sync(fullIosPng);
}

View File

@@ -1,12 +1,7 @@
import * as helper from '../ui-helper';
import * as TKUnit from '../tk-unit';
import * as app from '@nativescript/core/application';
import * as frame from '@nativescript/core/ui/frame';
import { Color } from '@nativescript/core/color';
import { Builder } from '@nativescript/core/ui/builder';
import { Page } from '@nativescript/core/ui/page';
import { Frame } from '@nativescript/core/ui/frame';
import { Application, Frame, Page, Builder, Color } from '@nativescript/core';
const LIVESYNC_FOLDER = 'livesync/';
@@ -45,7 +40,7 @@ export function setUp() {
}
export function tearDown() {
app.setCssFileName(appCssFileName);
Application.setCssFileName(appCssFileName);
}
export function test_onLiveSync_ModuleContext_AppStyle_AppNewCss() {
@@ -143,7 +138,7 @@ function _test_onLiveSync_ModuleContext_AppStyle(appStyleFileName: string, lives
const buttonPage = <Page>Builder.createViewFromEntry({ moduleName: buttonPageModuleName });
helper.navigateWithHistory(() => buttonPage);
app.setCssFileName(appStyleFileName);
Application.setCssFileName(appStyleFileName);
const pageBeforeLiveSync = helper.getCurrentPage();
livesync({ type: 'style', path: livesyncStyleFileName });

View File

@@ -5,12 +5,12 @@ if (typeof NSDate !== 'undefined') {
start = java.lang.System.currentTimeMillis();
}
import { Application, ApplicationEventData, UnhandledErrorEventData, DiscardedErrorEventData, AndroidActivityBundleEventData, AndroidActivityEventData, AndroidApplication, AndroidActivityNewIntentEventData, AndroidActivityResultEventData, AndroidActivityBackPressedEventData } from '@nativescript/core';
import { AndroidActivityBackPressedEventData, AndroidActivityBundleEventData, AndroidActivityEventData, AndroidActivityNewIntentEventData, AndroidActivityResultEventData, Application, ApplicationEventData, DiscardedErrorEventData, LaunchEventData, UnhandledErrorEventData } from '@nativescript/core';
if (Application.ios) {
// Observe application notifications.
Application.ios.addNotificationObserver(UIApplicationDidFinishLaunchingNotification, (notification: NSNotification) => {
console.log('UIApplicationDidFinishLaunchingNotification: ' + notification);
console.log('UIApplicationDidFinishLaunchingNotification:', notification);
});
}
@@ -19,118 +19,118 @@ Application.on(Application.displayedEvent, function (args: ApplicationEventData)
global.isDisplayedEventFired = true;
if (args.android) {
// For Android applications, args.android is an Android activity class.
console.log('Displayed Activity: ' + args.android);
// For Android applications, args.activity is an Android activity class.
console.log('Displayed Activity:', (args as AndroidActivityEventData).activity);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log('Displayed UIApplication: ' + args.ios);
console.log('Displayed UIApplication:', args.ios);
}
});
Application.on(Application.launchEvent, function (args: ApplicationEventData) {
Application.on(Application.launchEvent, function (args: LaunchEventData) {
if (args.android) {
// For Android applications, args.android is an android.content.Intent class.
console.log('Launched Android application with the following intent: ' + args.android + '.');
console.log('Launched Android application with the following intent:', args.android);
} else if (args.ios !== undefined) {
// For iOS applications, args.ios is NSDictionary (launchOptions).
console.log('Launched iOS application with options: ' + args.ios);
console.log('Launched iOS application with options:', args.ios);
}
});
Application.on(Application.suspendEvent, function (args: ApplicationEventData) {
if (args.android) {
// For Android applications, args.android is an Android activity class.
console.log('Suspend Activity: ' + args.android);
console.log('Suspend Activity:', args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log('Suspend UIApplication: ' + args.ios);
console.log('Suspend UIApplication:', args.ios);
}
});
Application.on(Application.resumeEvent, function (args: ApplicationEventData) {
if (args.android) {
// For Android applications, args.android is an Android activity class.
console.log('Resume Activity: ' + args.android);
console.log('Resume Activity:', args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log('Resume UIApplication: ' + args.ios);
console.log('Resume UIApplication:', args.ios);
}
});
Application.on(Application.exitEvent, function (args: ApplicationEventData) {
if (args.android) {
// For Android applications, args.android is an Android activity class.
console.log('Exit Activity: ' + args.android);
console.log('Exit Activity:', args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log('Exit UIApplication: ' + args.ios);
console.log('Exit UIApplication:', args.ios);
}
});
Application.on(Application.lowMemoryEvent, function (args: ApplicationEventData) {
if (args.android) {
// For Android applications, args.android is an Android activity class.
console.log('Low Memory: ' + args.android);
console.log('Low Memory:', args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
console.log('Low Memory: ' + args.ios);
console.log('Low Memory:', args.ios);
}
});
// Error events.
Application.on(Application.uncaughtErrorEvent, function (args: UnhandledErrorEventData) {
console.log('NativeScriptError: ' + args.error);
console.log((<any>args.error).nativeException || (<any>args.error).nativeError);
console.log((<any>args.error).stackTrace || (<any>args.error).stack);
console.log('NativeScriptError:', args.error);
console.log((<any>args.error).nativeException ?? (<any>args.error).nativeError);
console.log((<any>args.error).stackTrace ?? (<any>args.error).stack);
});
Application.on(Application.discardedErrorEvent, function (args: DiscardedErrorEventData) {
console.log('[Discarded] NativeScriptError: ' + args.error);
console.log((<any>args.error).nativeException || (<any>args.error).nativeError);
console.log((<any>args.error).stackTrace || (<any>args.error).stack);
console.log('[Discarded] NativeScriptError:', args.error);
console.log((<any>args.error).nativeException ?? (<any>args.error).nativeError);
console.log((<any>args.error).stackTrace ?? (<any>args.error).stack);
});
// Android activity events.
if (Application.android) {
Application.android.on(AndroidApplication.activityCreatedEvent, function (args: AndroidActivityBundleEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity + ', Bundle: ' + args.bundle);
Application.android.on(Application.android.activityCreatedEvent, function (args: AndroidActivityBundleEventData) {
console.log('Event: ' + args.eventName + ', Activity:', args.activity, ', Bundle:', args.bundle);
});
Application.android.on(AndroidApplication.activityDestroyedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity);
Application.android.on(Application.android.activityDestroyedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity: ', args.activity);
});
Application.android.on(AndroidApplication.activityStartedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity);
Application.android.on(Application.android.activityStartedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity:', args.activity);
});
Application.android.on(AndroidApplication.activityPausedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity);
Application.android.on(Application.android.activityPausedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity:', args.activity);
});
Application.android.on(AndroidApplication.activityResumedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity);
Application.android.on(Application.android.activityResumedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity:', args.activity);
});
Application.android.on(AndroidApplication.activityStoppedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity);
Application.android.on(Application.android.activityStoppedEvent, function (args: AndroidActivityEventData) {
console.log('Event: ' + args.eventName + ', Activity:', args.activity);
});
Application.android.on(AndroidApplication.saveActivityStateEvent, function (args: AndroidActivityBundleEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity + ', Bundle: ' + args.bundle);
Application.android.on(Application.android.saveActivityStateEvent, function (args: AndroidActivityBundleEventData) {
console.log('Event: ' + args.eventName + ', Activity:', args.activity, ', Bundle:', args.bundle);
});
Application.android.on(AndroidApplication.activityResultEvent, function (args: AndroidActivityResultEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity + ', requestCode: ' + args.requestCode + ', resultCode: ' + args.resultCode + ', Intent: ' + args.intent);
Application.android.on(Application.android.activityResultEvent, function (args: AndroidActivityResultEventData) {
console.log('Event:', args.eventName, ', Activity:', args.activity, ', requestCode: ', args.requestCode, ', resultCode: ', args.resultCode, ', Intent: ', args.intent);
});
Application.android.on(AndroidApplication.activityBackPressedEvent, function (args: AndroidActivityBackPressedEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity);
Application.android.on(Application.android.activityBackPressedEvent, function (args: AndroidActivityBackPressedEventData) {
console.log('Event:', args.eventName, ', Activity:', args.activity);
// Set args.cancel = true to cancel back navigation and do something custom.
});
Application.android.on(AndroidApplication.activityNewIntentEvent, function (args: AndroidActivityNewIntentEventData) {
console.log('Event: ' + args.eventName + ', Activity: ' + args.activity + ', Intent: ' + args.intent);
Application.android.on(Application.android.activityNewIntentEvent, function (args: AndroidActivityNewIntentEventData) {
console.log('Event: ', args.eventName, ', Activity:', args.activity, ', Intent:', args.intent);
});
}

View File

@@ -1,8 +1,5 @@
import * as gridModule from '@nativescript/core/ui/layouts/grid-layout';
import * as pages from '@nativescript/core/ui/page';
import * as buttons from '@nativescript/core/ui/button';
import * as app from '@nativescript/core/application';
import * as platform from '@nativescript/core/platform';
import { Application, Page, Button, GridLayout } from '@nativescript/core';
function printDeviceInfoAndroid() {
console.log('android.os.Build.DEVICE = ' + android.os.Build.DEVICE); //android.os.Build.DEVICE = hammerhead
@@ -10,7 +7,9 @@ function printDeviceInfoAndroid() {
console.log('android.os.Build.VERSION.SDK_INT = ' + android.os.Build.VERSION.SDK_INT); //android.os.Build.VERSION.SDK_INT = 19
console.log('android.os.Build.VERSION.CODENAME = ' + android.os.Build.VERSION.CODENAME); //android.os.Build.VERSION.CODENAME = REL
console.log('android.os.Build.VERSION.RELEASE = ' + android.os.Build.VERSION.RELEASE); //android.os.Build.VERSION.RELEASE = 4.4.4
var metrics: android.util.DisplayMetrics = app.android.context.getResources().getDisplayMetrics();
var metrics: android.util.DisplayMetrics = Application.android.context
.getResources()
.getDisplayMetrics();
console.log('metrics.density = ' + metrics.density); //metrics.density = 3
console.log('metrics.scaledDensity = ' + metrics.scaledDensity); //metrics.scaledDensity = 3
console.log('metrics.densityDpi = ' + metrics.densityDpi); //metrics.densityDpi = 480
@@ -19,11 +18,16 @@ function printDeviceInfoAndroid() {
console.log('metrics.widthPixels = ' + metrics.widthPixels); //metrics.widthPixels = 1080
console.log('metrics.heightPixels = ' + metrics.heightPixels); //metrics.heightPixels = 1776
var config = app.android.context.getResources().getConfiguration();
var config = Application.android.context.getResources().getConfiguration();
console.log('config.screenWidthDp = ' + config.screenWidthDp);
console.log('config.screenHeightDp = ' + config.screenHeightDp);
console.log('config.smallestScreenWidthDp = ' + config.smallestScreenWidthDp);
console.log('config.orientation = ' + (config.orientation === android.content.res.Configuration.ORIENTATION_PORTRAIT ? 'portrait' : 'ladscape'));
console.log(
'config.orientation = ' +
(config.orientation === android.content.res.Configuration.ORIENTATION_PORTRAIT
? 'portrait'
: 'ladscape')
);
}
function printDeviceInfoIOS() {
@@ -37,7 +41,12 @@ function printDeviceInfoIOS() {
console.log('device.batteryLevel = ' + device.batteryLevel); //device.batteryLevel = -1
var screen = UIScreen.mainScreen;
console.log('screen = ' + screen);
console.log('screen.nativeBounds = ' + screen.nativeBounds.size.width + ', ' + screen.nativeBounds.size.height); //screen.nativeBounds = 640, 1136
console.log(
'screen.nativeBounds = ' +
screen.nativeBounds.size.width +
', ' +
screen.nativeBounds.size.height
); //screen.nativeBounds = 640, 1136
console.log('screen.scale = ' + screen.scale); //screen.scale = 2
console.log('screen.nativeScale = ' + screen.nativeScale); //screen.nativeScale = 2
}
@@ -49,15 +58,23 @@ function printTNSInfo() {
console.log('platform.Device.sdkVersion = ' + platform.Device.sdkVersion);
console.log('platform.Device.deviceType = ' + platform.Device.deviceType);
console.log('platform.Screen.mainScreen.widthDIPs = ' + platform.Screen.mainScreen.widthDIPs);
console.log('platform.Screen.mainScreen.heightDIPs = ' + platform.Screen.mainScreen.heightDIPs);
console.log(
'platform.Screen.mainScreen.widthDIPs = ' + platform.Screen.mainScreen.widthDIPs
);
console.log(
'platform.Screen.mainScreen.heightDIPs = ' + platform.Screen.mainScreen.heightDIPs
);
console.log('platform.Screen.mainScreen.scale = ' + platform.Screen.mainScreen.scale);
console.log('platform.Screen.mainScreen.widthPixels = ' + platform.Screen.mainScreen.widthPixels);
console.log('platform.Screen.mainScreen.heightPixels = ' + platform.Screen.mainScreen.heightPixels);
console.log(
'platform.Screen.mainScreen.widthPixels = ' + platform.Screen.mainScreen.widthPixels
);
console.log(
'platform.Screen.mainScreen.heightPixels = ' + platform.Screen.mainScreen.heightPixels
);
}
function print() {
if (app.android) {
if (Application.android) {
printDeviceInfoAndroid();
} else {
printDeviceInfoIOS();
@@ -67,10 +84,10 @@ function print() {
//print();
export function createPage() {
var page = new pages.Page();
var grid = new gridModule.GridLayout();
var page = new Page();
var grid = new GridLayout();
var btn = new buttons.Button();
var btn = new Button();
btn.text = 'print';
btn.on('tap', (d) => {
print();

View File

@@ -5,14 +5,7 @@ import * as TKUnit from '../../../tk-unit';
import * as types from '@nativescript/core/utils/types';
import * as helper from '../../../ui-helper';
import * as bindingBuilder from '@nativescript/core/ui/builder/binding-builder';
import * as appModule from '@nativescript/core/application';
import { Trace } from '@nativescript/core';
import { View } from '@nativescript/core/ui/core/view';
import { Button } from '@nativescript/core/ui/button';
import { Page } from '@nativescript/core/ui/page';
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
import { Label } from '@nativescript/core/ui/label';
import { TextField } from '@nativescript/core/ui/text-field';
import { Application, View, Button, Page, StackLayout, Label, TextField, Trace } from '@nativescript/core';
declare var WeakRef: any;
// <snippet module="ui/core/bindable" title="bindable">
// For information and examples how to use bindings please refer to special [**Data binding**](../../../../bindings.md) topic.
@@ -583,7 +576,11 @@ export function test_BindingToParentView_ShouldNotLeaveGarbageInViewModel() {
testStack.bindingContext = stackViewModel;
let testLabel = <Label>testStack.getChildAt(0);
testLabel.bind({ sourceProperty: '$parent.testProperty', targetProperty: 'text', expression: '$parent.testProperty' });
testLabel.bind({
sourceProperty: '$parent.testProperty',
targetProperty: 'text',
expression: '$parent.testProperty',
});
TKUnit.assertEqual(testLabel.text, expectedValue);
TKUnit.assertTrue(stackViewModel['$parent'] === undefined, "stackViewModel['$parent'] should be removed from parent binding context.");
@@ -610,7 +607,11 @@ export function test_BindingToParentsView_ShouldNotLeaveGarbageInViewModel() {
testStack.bindingContext = stackViewModel;
let testLabel = <Label>testStack.getChildAt(0);
testLabel.bind({ sourceProperty: "$parents['StackLayout'].testProperty", targetProperty: 'text', expression: "$parents['StackLayout'].testProperty" });
testLabel.bind({
sourceProperty: "$parents['StackLayout'].testProperty",
targetProperty: 'text',
expression: "$parents['StackLayout'].testProperty",
});
TKUnit.assertEqual(testLabel.text, expectedValue);
TKUnit.assertTrue(stackViewModel['$parent'] === undefined, "stackViewModel['$parent'] should be removed from parent binding context.");
@@ -632,11 +633,15 @@ export function test_BindingToDictionaryAtAppLevel() {
pageViewModel.set('testProperty', testPropertyName);
const dict = {};
dict[testPropertyName] = expectedValue;
appModule.getResources()['dict'] = dict;
Application.getResources()['dict'] = dict;
const testFunc = function (views: Array<View>) {
const testLabel = <Label>views[0];
testLabel.bind({ sourceProperty: 'testProperty', targetProperty: 'text', expression: 'dict[testProperty]' });
testLabel.bind({
sourceProperty: 'testProperty',
targetProperty: 'text',
expression: 'dict[testProperty]',
});
const page = <Page>views[1];
page.bindingContext = pageViewModel;
@@ -658,7 +663,7 @@ export function test_BindingConverterCalledEvenWithNullValue() {
const testPropertyValue = null;
const expectedValue = 'collapsed';
pageViewModel.set('testProperty', testPropertyValue);
appModule.getResources()['converter'] = {
Application.getResources()['converter'] = {
toView: function (value) {
if (value) {
return 'visible';
@@ -670,7 +675,11 @@ export function test_BindingConverterCalledEvenWithNullValue() {
const testFunc = function (views: Array<View>) {
const testLabel = <Label>views[0];
testLabel.bind({ sourceProperty: 'testProperty', targetProperty: 'text', expression: 'testProperty | converter()' });
testLabel.bind({
sourceProperty: 'testProperty',
targetProperty: 'text',
expression: 'testProperty | converter()',
});
const page = <Page>views[1];
page.bindingContext = pageViewModel;

View File

@@ -16,7 +16,7 @@ import * as ViewModule from '@nativescript/core/ui/core/view';
import * as helper from '../../ui-helper';
import * as color from '@nativescript/core/color';
import * as backgroundModule from '@nativescript/core/ui/styling/background';
import { android as androidApp } from '@nativescript/core/application';
import { Application } from '@nativescript/core';
const imagePath = '~/assets/logo.png';
export function test_recycling() {
@@ -24,7 +24,7 @@ export function test_recycling() {
}
if (global.isAndroid) {
(<any>backgroundModule).initImageCache(androidApp.startActivity, (<any>backgroundModule).CacheMode.memory); // use memory cache only.
(<any>backgroundModule).initImageCache(Application.android.startActivity, (<any>backgroundModule).CacheMode.memory); // use memory cache only.
}
export const test_Image_Members = function () {

View File

@@ -1,8 +1,7 @@
import * as TKUnit from '../../tk-unit';
import * as helper from '../../ui-helper';
import * as viewModule from '@nativescript/core/ui/core/view';
import { View, Application } from '@nativescript/core';
import * as listPickerTestsNative from './list-picker-tests-native';
import * as application from '@nativescript/core/application';
// >> article-require-listpicker-module
import * as listPickerModule from '@nativescript/core/ui/list-picker';
@@ -31,7 +30,7 @@ export function test_recycling() {
}
export var testWhenlistPickerIsCreatedItemsAreUndefined = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
var expectedValue = undefined;
var actualValue = listPicker.items;
@@ -40,7 +39,7 @@ export var testWhenlistPickerIsCreatedItemsAreUndefined = function () {
};
export var testWhenlistPickerIsCreatedSelectedIndexIsUndefined = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
var expectedValue = -1;
var actualValue = listPicker.selectedIndex;
@@ -49,7 +48,7 @@ export var testWhenlistPickerIsCreatedSelectedIndexIsUndefined = function () {
};
export var testWhenSettingItemsToNonEmptyArrayTheSameAmountOfNativeItemsIsCreated = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
listPicker.items = _createItems(10);
var expectedValue = listPicker.items.length;
@@ -59,7 +58,7 @@ export var testWhenSettingItemsToNonEmptyArrayTheSameAmountOfNativeItemsIsCreate
};
export var testWhenSettingItemsToEmptyArrayZeroNativeItemsAreCreated = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
listPicker.items = [];
var expectedValue = listPicker.items.length;
@@ -69,7 +68,7 @@ export var testWhenSettingItemsToEmptyArrayZeroNativeItemsAreCreated = function
};
export var testSelectedIndexBecomesZeroWhenItemsBoundToNonEmptyArray = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
// >> article-binding-listpickeritems
listPicker.items = [1, 2, 3];
@@ -81,7 +80,7 @@ export var testSelectedIndexBecomesZeroWhenItemsBoundToNonEmptyArray = function
};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToEmptyArray = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
listPicker.items = _createItems(10);
// >> article-selecting-item
@@ -95,7 +94,7 @@ export var testSelectedIndexBecomesUndefinedWhenItemsBoundToEmptyArray = functio
};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToUndefined = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
listPicker.items = _createItems(10);
listPicker.selectedIndex = 9;
@@ -107,7 +106,7 @@ export var testSelectedIndexBecomesUndefinedWhenItemsBoundToUndefined = function
};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToNull = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
listPicker.items = _createItems(10);
listPicker.selectedIndex = 9;
@@ -123,7 +122,7 @@ export var testItemsIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var expectedValue = 10;
listPicker.items = _createItems(expectedValue);
listPicker.selectedIndex = 9;
helper.buildUIAndRunTest(listPicker, function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(listPicker, function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
var actualValue = listPicker.items.length;
TKUnit.assert(actualValue === expectedValue, 'Actual: ' + actualValue + '; Expected: ' + expectedValue);
@@ -135,7 +134,7 @@ export var testSelectedIndexIsResolvedCorrectlyIfSetBeforeViewIsLoaded = functio
listPicker.items = _createItems(10);
var expectedValue = 9;
listPicker.selectedIndex = expectedValue;
helper.buildUIAndRunTest(listPicker, function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(listPicker, function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
var actualValue = listPicker.selectedIndex;
TKUnit.assert(actualValue === expectedValue, 'Actual: ' + actualValue + '; Expected: ' + expectedValue);
@@ -144,7 +143,7 @@ export var testSelectedIndexIsResolvedCorrectlyIfSetBeforeViewIsLoaded = functio
// export var testSettingNegativeSelectedIndexShouldThrow = function () {
// var listPicker = _createListPicker();
// helper.buildUIAndRunTest(listPicker, function (views: Array<viewModule.View>) {
// helper.buildUIAndRunTest(listPicker, function (views: Array<View>) {
// var listPicker = <listPickerModule.ListPicker>views[0];
// listPicker.items = _createItems(10);
@@ -156,7 +155,7 @@ export var testSelectedIndexIsResolvedCorrectlyIfSetBeforeViewIsLoaded = functio
// export var testSettingSelectedIndexLargerThanCountShouldThrow = function () {
// var listPicker = _createListPicker();
// helper.buildUIAndRunTest(listPicker, function (views: Array<viewModule.View>) {
// helper.buildUIAndRunTest(listPicker, function (views: Array<View>) {
// var listPicker = <listPickerModule.ListPicker>views[0];
// listPicker.items = _createItems(10);
// TKUnit.assertThrows(function () {
@@ -180,11 +179,11 @@ export var testWhenSelectingAnItemNativelySelectedIndexIsUpdatedProperly = funct
};
export var test_Android_MaxValueIsOneLessThanItemsCount = function () {
if (!application.android) {
if (!Application.android) {
return;
}
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
listPicker.items = ['One', 'Two', 'Three'];
var expectedValue = listPicker.items.length - 1;
@@ -194,11 +193,11 @@ export var test_Android_MaxValueIsOneLessThanItemsCount = function () {
};
export var test_Android_WhenItemsAreEmptyNativeControlDoesNotShowZero = function () {
if (!application.android) {
if (!Application.android) {
return;
}
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
var expectedValue = ' ';
var actualValue = listPicker.nativeViewProtected.editText.getText().toString();
@@ -207,11 +206,11 @@ export var test_Android_WhenItemsAreEmptyNativeControlDoesNotShowZero = function
};
export var test_Android_WhenBoundToSingleElementArrayEditTextIsUpdatedProperly = function () {
if (!application.android) {
if (!Application.android) {
return;
}
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
listPicker.items = ['One'];
var expectedValue = 'One';
@@ -221,11 +220,11 @@ export var test_Android_WhenBoundToSingleElementArrayEditTextIsUpdatedProperly =
};
export var test_Android_WhenSelectedIndexChangesEditTextIsUpdatedProperly = function () {
if (!application.android) {
if (!Application.android) {
return;
}
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<viewModule.View>) {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array<View>) {
var listPicker = <listPickerModule.ListPicker>views[0];
listPicker.items = ['One', 'Two'];
listPicker.selectedIndex = 1;

View File

@@ -1,10 +1,6 @@
import * as TKUnit from '../../tk-unit';
import * as helper from '../../ui-helper';
import { Page } from '@nativescript/core/ui/page';
import { isAndroid } from '@nativescript/core/platform';
import { Frame, NavigationEntry } from '@nativescript/core/ui/frame';
import { _resetRootView, getRootView } from '@nativescript/core/application';
import { TabView, TabViewItem } from '@nativescript/core/ui/tab-view';
import { Page, isAndroid, Frame, NavigationEntry, Application, TabView, TabViewItem } from '@nativescript/core';
function waitUntilTabViewReady(page: Page, action: Function) {
helper.waitUntilNavigatedTo(page, action);
@@ -57,18 +53,18 @@ function createTestTabRootEntry() {
export function test_reset_frame_to_frame() {
const testFrameRoot1 = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot1.page, () => _resetRootView(testFrameRoot1.entry));
helper.waitUntilNavigatedTo(testFrameRoot1.page, () => Application.resetRootView(testFrameRoot1.entry));
const rootView1 = getRootView();
const rootView1 = Application.getRootView();
const frameStack1 = Frame._stack();
TKUnit.assertEqual(rootView1, testFrameRoot1.root);
TKUnit.assertEqual(frameStack1.length, 1);
const testFrameRoot2 = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot2.page, () => _resetRootView(testFrameRoot2.entry));
helper.waitUntilNavigatedTo(testFrameRoot2.page, () => Application.resetRootView(testFrameRoot2.entry));
const rootView2 = getRootView();
const rootView2 = Application.getRootView();
const frameStack2 = Frame._stack();
TKUnit.assertEqual(rootView2, testFrameRoot2.root);
TKUnit.assertEqual(frameStack2.length, 1);
@@ -77,18 +73,18 @@ export function test_reset_frame_to_frame() {
export function test_reset_frame_to_tab() {
const testFrameRoot = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot.page, () => _resetRootView(testFrameRoot.entry));
helper.waitUntilNavigatedTo(testFrameRoot.page, () => Application.resetRootView(testFrameRoot.entry));
const rootView1 = getRootView();
const rootView1 = Application.getRootView();
const frameStack1 = Frame._stack();
TKUnit.assertEqual(rootView1, testFrameRoot.root);
TKUnit.assertEqual(frameStack1.length, 1);
const testTabRoot = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot.page, () => _resetRootView(testTabRoot.entry));
waitUntilTabViewReady(testTabRoot.page, () => Application.resetRootView(testTabRoot.entry));
const rootView2 = getRootView();
const rootView2 = Application.getRootView();
const frameStack2 = Frame._stack();
TKUnit.assertEqual(rootView2, testTabRoot.root);
TKUnit.assertEqual(frameStack2.length, 2);
@@ -97,18 +93,18 @@ export function test_reset_frame_to_tab() {
export function test_reset_tab_to_frame() {
const testTabRoot = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot.page, () => _resetRootView(testTabRoot.entry));
waitUntilTabViewReady(testTabRoot.page, () => Application.resetRootView(testTabRoot.entry));
const rootView2 = getRootView();
const rootView2 = Application.getRootView();
const frameStack2 = Frame._stack();
TKUnit.assertEqual(rootView2, testTabRoot.root);
TKUnit.assertEqual(frameStack2.length, 2);
const testFrameRoot = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot.page, () => _resetRootView(testFrameRoot.entry));
helper.waitUntilNavigatedTo(testFrameRoot.page, () => Application.resetRootView(testFrameRoot.entry));
const rootView1 = getRootView();
const rootView1 = Application.getRootView();
const frameStack1 = Frame._stack();
TKUnit.assertEqual(rootView1, testFrameRoot.root);
TKUnit.assertEqual(frameStack1.length, 1);
@@ -117,18 +113,18 @@ export function test_reset_tab_to_frame() {
export function test_reset_tab_to_tab() {
const testTabRoot1 = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot1.page, () => _resetRootView(testTabRoot1.entry));
waitUntilTabViewReady(testTabRoot1.page, () => Application.resetRootView(testTabRoot1.entry));
const rootView1 = getRootView();
const rootView1 = Application.getRootView();
const frameStack1 = Frame._stack();
TKUnit.assertEqual(rootView1, testTabRoot1.root);
TKUnit.assertEqual(frameStack1.length, 2);
const testTabRoot2 = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot2.page, () => _resetRootView(testTabRoot2.entry));
waitUntilTabViewReady(testTabRoot2.page, () => Application.resetRootView(testTabRoot2.entry));
const rootView2 = getRootView();
const rootView2 = Application.getRootView();
const frameStack2 = Frame._stack();
TKUnit.assertEqual(rootView2, testTabRoot2.root);
TKUnit.assertEqual(frameStack2.length, 2);
@@ -137,13 +133,13 @@ export function test_reset_tab_to_tab() {
export function test_reset_during_tab_index_change() {
const testTabRoot = createTestTabRootEntry();
waitUntilTabViewReady(testTabRoot.page, () => _resetRootView(testTabRoot.entry));
waitUntilTabViewReady(testTabRoot.page, () => Application.resetRootView(testTabRoot.entry));
testTabRoot.root.selectedIndex = 1;
const testFrameRoot = createTestFrameRootEntry();
helper.waitUntilNavigatedTo(testFrameRoot.page, () => _resetRootView(testFrameRoot.entry));
helper.waitUntilNavigatedTo(testFrameRoot.page, () => Application.resetRootView(testFrameRoot.entry));
TKUnit.assertTrue(true);
}
@@ -152,6 +148,6 @@ export function tearDownModule() {
// reset the root to frame for other tests
const resetFrameRoot = createTestFrameRootEntry();
_resetRootView(resetFrameRoot.entry);
Application.resetRootView(resetFrameRoot.entry);
TKUnit.waitUntilReady(() => resetFrameRoot.page.isLoaded);
}

View File

@@ -1,9 +1,5 @@
import * as TKUnit from '../../tk-unit';
import { isAndroid } from '@nativescript/core/platform';
import { _resetRootView } from '@nativescript/core/application/';
import { Frame, NavigationEntry } from '@nativescript/core/ui/frame';
import { Page } from '@nativescript/core/ui/page';
import { TabView, TabViewItem } from '@nativescript/core/ui/tab-view';
import { Application, Frame, NavigationEntry, Page, TabView, TabViewItem, isAndroid } from '@nativescript/core';
function waitUntilNavigatedToMaxTimeout(pages: Page[], action: Function) {
const maxTimeout = 8;
@@ -80,7 +76,7 @@ export function test_frame_topmost_matches_selectedIndex() {
create: () => tabView,
};
waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([items[0].page], () => Application.resetRootView(entry));
TKUnit.assertEqual(Frame.topmost().id, 'Tab0 Frame0');
waitUntilNavigatedToMaxTimeout([items[1].page], () => (tabView.selectedIndex = 1));
@@ -130,7 +126,7 @@ export function test_offset_zero_should_raise_same_events() {
create: () => tabView,
};
waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([items[0].page], () => Application.resetRootView(entry));
const expectedEventsRaisedAfterTabCreated = [['Tab0 Frame0 loaded', 'Tab0 Frame0 Page0 navigatingTo', 'Tab0 Frame0 Page0 loaded', 'Tab0 Frame0 Page0 navigatedTo'], [], []];
@@ -191,7 +187,7 @@ export function test_android_default_offset_should_preload_1_tab_on_each_side()
create: () => tabView,
};
waitUntilNavigatedToMaxTimeout([items[0].page, items[1].page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([items[0].page, items[1].page], () => Application.resetRootView(entry));
const expectedEventsRaisedAfterTabCreated = [['Tab0 Frame0 loaded', 'Tab0 Frame0 Page0 navigatingTo', 'Tab0 Frame0 Page0 loaded', 'Tab0 Frame0 Page0 navigatedTo'], ['Tab1 Frame1 loaded', 'Tab1 Frame1 Page1 navigatingTo', 'Tab1 Frame1 Page1 loaded', 'Tab1 Frame1 Page1 navigatedTo'], []];
@@ -223,5 +219,5 @@ export function tearDownModule() {
create: () => frame,
};
waitUntilNavigatedToMaxTimeout([page], () => _resetRootView(entry));
waitUntilNavigatedToMaxTimeout([page], () => Application.resetRootView(entry));
}

View File

@@ -1,7 +1,7 @@
import * as TKUnit from '../../tk-unit';
import { View, eachDescendant, getViewById, InheritedProperty, CssProperty, CssAnimationProperty, ShorthandProperty, Property, Style, Frame, Page, Button, Label, Color, StackLayout, AbsoluteLayout, Observable, Utils, BindingOptions, isAndroid, LayoutBase } from '@nativescript/core';
import * as helper from '../../ui-helper';
import * as definition from './view-tests';
import { checkNativeBackgroundColor, checkNativeBackgroundImage } from './view-tests';
export function test_eachDescendant() {
const test = function (views: Array<View>) {
@@ -237,8 +237,14 @@ export function test_InheritableStylePropertiesWhenUsedWithExtendedClass_AreInhe
}
// TestView definition START
const customCssProperty = new CssProperty<Style, string>({ name: 'customCssProperty', cssName: 'custom-css-property' });
const customCssAnimationProperty = new CssAnimationProperty<Style, string>({ name: 'customCssAnimationProperty', cssName: 'custom-css-animation-property' });
const customCssProperty = new CssProperty<Style, string>({
name: 'customCssProperty',
cssName: 'custom-css-property',
});
const customCssAnimationProperty = new CssAnimationProperty<Style, string>({
name: 'customCssAnimationProperty',
cssName: 'custom-css-animation-property',
});
const customViewProperty = new Property<TestView, string>({ name: 'custom' });
const customCssAProperty = new CssProperty<Style, string>({
@@ -380,14 +386,23 @@ customCssAnimationProperty.register(Style);
customViewProperty.register(TestView);
const inheritanceTestDefaultValue = 42;
const inheritanceTestProperty = new InheritedProperty<TestView, number>({ name: 'inheritanceTest', defaultValue: inheritanceTestDefaultValue });
const inheritanceTestProperty = new InheritedProperty<TestView, number>({
name: 'inheritanceTest',
defaultValue: inheritanceTestDefaultValue,
});
inheritanceTestProperty.register(TestView);
const booleanInheritanceTestDefaultValue = true;
const booleanInheritanceTestProperty = new InheritedProperty<TestView, boolean>({ name: 'booleanInheritanceTest', defaultValue: booleanInheritanceTestDefaultValue });
const booleanInheritanceTestProperty = new InheritedProperty<TestView, boolean>({
name: 'booleanInheritanceTest',
defaultValue: booleanInheritanceTestDefaultValue,
});
booleanInheritanceTestProperty.register(TestView);
const dummyProperty = new InheritedProperty<TestView, number>({ name: 'dummy', defaultValue: 0 });
const dummyProperty = new InheritedProperty<TestView, number>({
name: 'dummy',
defaultValue: 0,
});
dummyProperty.register(TestView);
/////// TestView definition END
@@ -941,7 +956,7 @@ export function testBackgroundColor() {
helper.buildUIAndRunTest(_createLabelWithBorder(), function (views: Array<View>) {
const lbl = views[0];
helper.waitUntilLayoutReady(lbl);
TKUnit.assertEqual(definition.checkNativeBackgroundColor(lbl), true, 'BackgroundColor not applied correctly!');
TKUnit.assertEqual(checkNativeBackgroundColor(lbl), true, 'BackgroundColor not applied correctly!');
});
}
@@ -949,16 +964,16 @@ export function testBackgroundBorderColor() {
helper.buildUIAndRunTest(_createLabelWithBorder(), function (views: Array<View>) {
const lbl = views[0];
helper.waitUntilLayoutReady(lbl);
TKUnit.assertEqual(definition.checkNativeBackgroundColor(lbl), true, 'BackgroundColor not applied correctly!');
TKUnit.assertEqual(checkNativeBackgroundColor(lbl), true, 'BackgroundColor not applied correctly!');
});
}
export function testSetAndRemoveBackgroundColor() {
helper.buildUIAndRunTest(_createBackgroundColorView(), function (views: Array<View>) {
const lbl = views[0];
helper.waitUntilLayoutReady(lbl);
TKUnit.assertEqual(definition.checkNativeBackgroundColor(lbl), true, 'BackgroundColor not applied correctly!');
TKUnit.assertEqual(checkNativeBackgroundColor(lbl), true, 'BackgroundColor not applied correctly!');
lbl.backgroundColor = null;
TKUnit.assertEqual(definition.checkNativeBackgroundColor(lbl), true, 'BackgroundColor not applied correctly!');
TKUnit.assertEqual(checkNativeBackgroundColor(lbl), true, 'BackgroundColor not applied correctly!');
});
}
@@ -968,7 +983,7 @@ export function testBackgroundImage() {
helper.buildUIAndRunTest(lbl, function (views: Array<View>) {
const page = <Page>views[1];
page.css = ".myClass { background-image: url('~/assets/logo.png') }";
TKUnit.assertEqual(definition.checkNativeBackgroundImage(lbl), true, 'Style background-image not loaded correctly.');
TKUnit.assertEqual(checkNativeBackgroundImage(lbl), true, 'Style background-image not loaded correctly.');
});
}

View File

@@ -1,5 +1,7 @@
const webpack = require("@nativescript/webpack");
const CircularDependencyPlugin = require('circular-dependency-plugin');
module.exports = (env) => {
webpack.init(env);
@@ -10,9 +12,25 @@ module.exports = (env) => {
Object.assign(args[0], {
__CI__: !!process.env.CI,
})
return args
})
config.plugin('CircularDependencyPlugin').use(CircularDependencyPlugin, [
{
// exclude detection of files based on a RegExp
// exclude: /a\.js|node_modules/,
// include specific files based on a RegExp
// include: /application/,
// add errors to webpack instead of warnings
// failOnError: true,
// allow import cycles that include an asyncronous import,
// e.g. via import(/* webpackMode: "weak" */ './file.js')
// allowAsyncCycles: false,
// set the current working directory for displaying module paths
// cwd: process.cwd(),
}
])
})
return webpack.resolveConfig();