Merge branch 'master' of github.com:NativeScript/NativeScript

# Conflicts:
#	package.json
#	packages/core/tsconfig.lib.json
#	packages/core/ui/frame/index.android.ts
#	packages/core/ui/tabs/index.ios.ts
This commit is contained in:
Martin Guillon
2020-10-28 09:46:54 +01:00
292 changed files with 1704 additions and 1061 deletions

View File

@ -1,42 +0,0 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"ignorePatterns": ["**/*"],
"plugins": ["@typescript-eslint", "@nrwl/nx"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"rules": {
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
]
}
]
},
"overrides": [
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-any": "off"
}
}
]
}

40
.eslintrc.json Normal file
View File

@ -0,0 +1,40 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"ignorePatterns": ["**/*"],
"plugins": ["@typescript-eslint", "@nrwl/nx"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "prettier", "prettier/@typescript-eslint"],
"rules": {
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
],
"@typescript-eslint/explicit-module-boundary-types": "off"
},
"overrides": [
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-any": "off"
}
}
]
}

View File

@ -12,6 +12,7 @@ Provide version numbers for the following components (information can be retriev
- Cross-platform modules: - Cross-platform modules:
- Android Runtime: - Android Runtime:
- iOS Runtime: - iOS Runtime:
- XCode Version:
- Plugin(s): - Plugin(s):
**Describe the bug** **Describe the bug**

View File

@ -23,7 +23,7 @@ jobs:
run: npm version $NPM_VERSION run: npm version $NPM_VERSION
- name: Build @nativescript/core - name: Build @nativescript/core
run: npx nx run core:build.npm run: npx nx run core:build
- name: Publish @nativescript/core - name: Publish @nativescript/core
working-directory: dist/packages working-directory: dist/packages

View File

@ -1,6 +1,6 @@
language: node_js language: node_js
node_js: node_js:
- "node" - 14
script: script:
- npm run setup - npm run setup
- npm start @nativescript.core.test - npm start @nativescript.core.test

8
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,8 @@
{
"recommendations": [
"nrwl.angular-console",
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
]
}

View File

@ -1,3 +1,34 @@
## [7.0.12](https://github.com/NativeScript/NativeScript/compare/7.0.11-core...7.0.12) (2020-10-21)
### Bug Fixes
* **android:** BottomNavigation error on back press (application exit) ([#8970](https://github.com/NativeScript/NativeScript/issues/8970)) ([99bb067](https://github.com/NativeScript/NativeScript/commit/99bb067420871078c40454eec842fad6cbede0f7))
* **core:** ObservableArray tests and a typo ([#8968](https://github.com/NativeScript/NativeScript/issues/8968)) ([5c1b7f6](https://github.com/NativeScript/NativeScript/commit/5c1b7f6d76c19877da1f47a0696dfbbd89b5fd00))
### Features
* **core:** TypeScript 4 + cleanup ([#8967](https://github.com/NativeScript/NativeScript/issues/8967)) ([2243660](https://github.com/NativeScript/NativeScript/commit/2243660080ce6877d68a3f32fd64625f86023f77))
* **webpack:** add svelte support ([#8963](https://github.com/NativeScript/NativeScript/issues/8963)) ([0afea86](https://github.com/NativeScript/NativeScript/commit/0afea8681c62071823804f392ab8d595e61190ff))
## [7.0.10](https://github.com/NativeScript/NativeScript/compare/7.0.10-core...7.0.10) (2020-10-10)
### Bug Fixes
* **ios:** iOS 10 support with adjustment to UILayoutGuide ([#8954](https://github.com/NativeScript/NativeScript/issues/8954)) ([ad25759](https://github.com/NativeScript/NativeScript/commit/ad2575991aa53c1a1806dfd5dc5e368e1674d73c))
### Features
* **webpack:** angular configuration schema validation compliance ([ee05b44](https://github.com/NativeScript/NativeScript/commit/ee05b4466336858bd7e2dcb651deb15ba74fc8c2))
* **webpack:** angular configuration support for environment handling ([#8938](https://github.com/NativeScript/NativeScript/issues/8938)) ([3f7bf67](https://github.com/NativeScript/NativeScript/commit/3f7bf676ff4321d7c490099e3c72687ad68d46a2))
## [7.0.10](https://github.com/NativeScript/NativeScript/compare/7.0.9-core...7.0.10) (2020-10-03) ## [7.0.10](https://github.com/NativeScript/NativeScript/compare/7.0.9-core...7.0.10) (2020-10-03)

View File

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier same "printed page" as the copyright notice for easier
identification within third-party archives. identification within third-party archives.
Copyright (c) 2015-2019 Progress Software Corporation Copyright (c) 2020, nStudio, LLC
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -360,6 +360,85 @@ export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsSta
export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsStartingFromSpecifiedIndexAndRaiseChangeEventWithCorrectArgs = function () { export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsStartingFromSpecifiedIndexAndRaiseChangeEventWithCorrectArgs = function () {
let result: ChangedData<number>; let result: ChangedData<number>;
// >> observable-array-splice-change
const array = new ObservableArray([1, 2, 3, 4]);
array.on(ObservableArray.changeEvent, (args: ChangedData<number>) => {
// Argument (args) is ChangedData<T>.
// args.eventName is "change".
// args.action is "splice".
// args.index is the start index.
// args.removed.length is equal to the number of deleted items.
// args.addedCount is 0.
// >> (hide)
result = args;
// << (hide)
});
array.splice(1, 2);
// << observable-array-splice-change
TKUnit.assert(result.eventName === ObservableArray.changeEvent && result.action === ChangeType.Splice && result.removed.length === 2 && result.index === 1 && result.addedCount === 0, "ObservableArray splice() should raise 'change' event with correct args!");
};
export const test_ObservableArray_spliceShouldAddSpecifiedNumberOfElementsStartingFromSpecifiedIndexAndRaiseChangeEventWithCorrectArgs = function () {
let result: ChangedData<number>;
// >> observable-array-splice-change
const array = new ObservableArray([0]);
array.on(ObservableArray.changeEvent, (args: ChangedData<number>) => {
// Argument (args) is ChangedData<T>.
// args.eventName is "change".
// args.action is "splice".
// args.index is the start index.
// args.removed.length is equal to the number of deleted items.
// args.addedCount is 0.
// >> (hide)
result = args;
// << (hide)
});
// Because their is only one item in the above array the item index should be
// normalized to Index 1.
array.splice(2, 0, 1);
// << observable-array-splice-change
TKUnit.assert(result.eventName === ObservableArray.changeEvent && result.action === ChangeType.Splice && result.removed.length === 0 && result.index === 1 && result.addedCount === 1, "ObservableArray splice() should raise 'change' event with correct args!");
};
export const test_ObservableArray_spliceShouldAddDeleteSpecifiedNumberOfElementsStartingFromSpecifiedIndexAndRaiseChangeEventWithCorrectArgs = function () {
let result: ChangedData<number>;
// >> observable-array-splice-change
const array = new ObservableArray([0]);
array.on(ObservableArray.changeEvent, (args: ChangedData<number>) => {
// Argument (args) is ChangedData<T>.
// args.eventName is "change".
// args.action is "splice".
// args.index is the start index.
// args.removed.length is equal to the number of deleted items.
// args.addedCount is 1.
// >> (hide)
result = args;
// << (hide)
});
// Because we are starting at index 2, their is NOTHING to delete
// So the Starting index should actually be normalized to Index 1
array.splice(2, 2, 1);
// << observable-array-splice-change
TKUnit.assert(result.eventName === ObservableArray.changeEvent && result.action === ChangeType.Splice && result.removed.length === 0 && result.index === 1 && result.addedCount === 1, "ObservableArray splice() should raise 'change' event with correct args!");
};
export const test_ObservableArray_spliceShouldRemoveSpecifiedNumberOfElementsStartingFromSpecifiedIndexAndRaiseChangeEventWithCorrectedArgs = function () {
let result: ChangedData<number>;
// >> observable-array-splice-change // >> observable-array-splice-change
const array = new ObservableArray([1, 2, 3]); const array = new ObservableArray([1, 2, 3]);
@ -526,6 +605,28 @@ export const test_ObservableArray_settingLengthToSomethingPerformsSplice = funct
TKUnit.assertTrue(changeRaised); TKUnit.assertTrue(changeRaised);
}; };
export const test_ObservableArray_settingLengthToSomethingPerformsSpliceAdded = function () {
const array = new ObservableArray([1, 2, 3]);
let changeRaised = false;
array.on('change', (args: ChangedData<number>) => {
changeRaised = true;
TKUnit.assertEqual(args.object, array);
TKUnit.assertEqual(args.eventName, 'change');
TKUnit.assertEqual(args.action, ChangeType.Splice);
// Because the array only has 3 elements, the index it starts the change at is #2
TKUnit.assertEqual(args.index, 3);
TKUnit.assertEqual(args.addedCount, 2);
TKUnit.arrayAssert(args.removed, []);
});
array.length = 5;
TKUnit.assertEqual(array.length, 5);
TKUnit.assertTrue(changeRaised);
};
const array = new ObservableArray(); const array = new ObservableArray();
// We do not have indexer! // We do not have indexer!

View File

@ -1,6 +1,6 @@
import * as TKUnit from '../../tk-unit'; import * as TKUnit from '../../tk-unit';
import * as helper from '../../ui-helper'; import * as helper from '../../ui-helper';
import { Application, Label, Page, StackLayout, WrapLayout, LayoutBase, View, GestureTypes, Repeater, ObservableArray } from '@nativescript/core'; import { Application, Label, Page, StackLayout, WrapLayout, LayoutBase, View, KeyedTemplate, GestureTypes, Repeater, ObservableArray } from '@nativescript/core';
var FEW_ITEMS = [0, 1, 2]; var FEW_ITEMS = [0, 1, 2];
var MANY_ITEMS = []; var MANY_ITEMS = [];
@ -8,6 +8,18 @@ for (var i = 0; i < 100; i++) {
MANY_ITEMS[i] = i; MANY_ITEMS[i] = i;
} }
const ITEM_TEMPLATES_STRING = `
<template key="red">
<Label text='red' style.backgroundColor='red' minHeight='100' maxHeight='100'/>
</template>
<template key='green'>
<Label text='green' style.backgroundColor='green' minHeight='100' maxHeight='100'/>
</template>
<template key='blue'>
<Label text='blue' style.backgroundColor='blue' minHeight='100' maxHeight='100'/>
</template>
`;
export function test_recycling() { export function test_recycling() {
const setters = new Map<string, StackLayout>(); const setters = new Map<string, StackLayout>();
setters.set('itemsLayout', new StackLayout()); setters.set('itemsLayout', new StackLayout());
@ -309,6 +321,117 @@ export function test_ItemTemplateFactoryFunction() {
helper.buildUIAndRunTest(repeater, testAction); helper.buildUIAndRunTest(repeater, testAction);
} }
// Multiple item templates tests
export function test_ItemTemplateSelector_WhenWrongTemplateKeyIsSpecified_TheDefaultTemplateIsUsed() {
var repeater = new Repeater();
function testAction(views: Array<View>) {
repeater.itemTemplate = "<Label text='default' minHeight='100' maxHeight='100'/>";
repeater.itemTemplates = ITEM_TEMPLATES_STRING;
repeater.itemTemplateSelector = "age == 20 ? 'wrong' : 'green'";
repeater.items = [{ age: 20 }, { age: 25 }];
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
const firstElement = getChildAt(repeater, 0);
TKUnit.assertEqual((<Label>firstElement).text, 'default', 'first element text');
}
helper.buildUIAndRunTest(repeater, testAction);
}
export function test_ItemTemplateSelector_IsCorrectlyParsedFromString() {
var repeater = new Repeater();
function testAction(views: Array<View>) {
repeater.itemTemplates = ITEM_TEMPLATES_STRING;
repeater.itemTemplateSelector = "age < 25 ? 'red' : 'green'";
repeater.items = [{ age: 20 }, { age: 25 }];
let itemTemplateSelectorFunction = <any>repeater.itemTemplateSelector;
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
let templateKey0 = itemTemplateSelectorFunction(repeater.items[0], 0, repeater.items);
TKUnit.assertEqual(templateKey0, 'red', 'itemTemplateSelector result for first item');
let templateKey1 = itemTemplateSelectorFunction(repeater.items[1], 1, repeater.items);
TKUnit.assertEqual(templateKey1, 'green', 'itemTemplateSelector result for second item');
}
helper.buildUIAndRunTest(repeater, testAction);
}
export function test_ItemTemplateSelector_IsCorrectlyUsedAsAFunction() {
var repeater = new Repeater();
function testAction(views: Array<View>) {
repeater.itemTemplates = ITEM_TEMPLATES_STRING;
repeater.itemTemplateSelector = function (item, index: number, items) {
return item.age < 25 ? 'red' : 'green';
};
repeater.items = [{ age: 20 }, { age: 25 }];
let itemTemplateSelectorFunction = <any>repeater.itemTemplateSelector;
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
let templateKey0 = itemTemplateSelectorFunction(repeater.items[0], 0, repeater.items);
TKUnit.assertEqual(templateKey0, 'red', 'itemTemplateSelector result for first item');
let templateKey1 = itemTemplateSelectorFunction(repeater.items[1], 1, repeater.items);
TKUnit.assertEqual(templateKey1, 'green', 'itemTemplateSelector result for second item');
}
helper.buildUIAndRunTest(repeater, testAction);
}
export function test_ItemTemplateSelector_ItemTemplatesAreCorrectlyParsedFromString() {
var repeater = new Repeater();
function testAction(views: Array<View>) {
repeater.itemTemplates = ITEM_TEMPLATES_STRING;
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
let itemTemplatesArray = <any>repeater.itemTemplates;
TKUnit.assertEqual(itemTemplatesArray.length, 3, 'itemTemplates array length');
let template0 = <KeyedTemplate>itemTemplatesArray[0];
TKUnit.assertEqual(template0.key, 'red', 'template0.key');
TKUnit.assertEqual((<Label>template0.createView()).text, 'red', 'template0 created view text');
let template1 = <KeyedTemplate>itemTemplatesArray[1];
TKUnit.assertEqual(template1.key, 'green', 'template1.key');
TKUnit.assertEqual((<Label>template1.createView()).text, 'green', 'template1 created view text');
let template2 = <KeyedTemplate>itemTemplatesArray[2];
TKUnit.assertEqual(template2.key, 'blue', 'template2.key');
TKUnit.assertEqual((<Label>template2.createView()).text, 'blue', 'template2 created view text');
}
helper.buildUIAndRunTest(repeater, testAction);
}
export function test_ItemTemplateSelector_CorrectTemplateIsUsed() {
var repeater = new Repeater();
function testAction(views: Array<View>) {
repeater.itemTemplates = ITEM_TEMPLATES_STRING;
repeater.itemTemplateSelector = "age == 25 ? 'green' : 'red'";
repeater.items = [{ age: 20 }, { age: 25 }];
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
const firstElement = getChildAt(repeater, 0);
const secondElement = getChildAt(repeater, 1);
TKUnit.assertEqual((<Label>firstElement).text, 'red', 'first element text');
TKUnit.assertEqual((<Label>secondElement).text, 'green', 'second element text');
}
helper.buildUIAndRunTest(repeater, testAction);
}
export function test_BindingRepeaterToASimpleArrayWithExpression() { export function test_BindingRepeaterToASimpleArrayWithExpression() {
var repeater = new Repeater(); var repeater = new Repeater();

View File

@ -16,6 +16,16 @@ Other modules which will be used in the code samples in this article:
{%raw%}<Repeater items="{{ myItems }}" />{%endraw%} {%raw%}<Repeater items="{{ myItems }}" />{%endraw%}
</Page> </Page>
``` ```
### Define the Repeater itemsLayout property. Default is StackLayout with orientation="vertical".
``` XML
<Page>
{%raw%}<Repeater items="{{ myItems }}">
<Repeater.itemsLayout>
<StackLayout orientation="horizontal" />
</Repeater.itemsLayout>
</Repeater>{%endraw%}
</Page>
```
### Define the Repeater itemTemplate property. ### Define the Repeater itemTemplate property.
``` XML ``` XML
<Page> <Page>
@ -26,13 +36,52 @@ Other modules which will be used in the code samples in this article:
</Repeater>{%endraw%} </Repeater>{%endraw%}
</Page> </Page>
``` ```
### Define the Repeater itemsLayout property. Default is StackLayout with orientation="vertical". ### Define multiple item templates and an item template selector in XML.
The itemTemplateSelector can be an expression specified directly in XML. The context of the expression is the data item for each row.
``` XML ``` XML
<Page> <Page>
{%raw%}<Repeater items="{{ myItems }}"> {%raw%}<Repeater items="{{ myItems }}" itemTemplateSelector="age > 18 ? 'green' : 'red'">
<Repeater.itemsLayout> <Repeater.itemTemplates>
<StackLayout orientation="horizontal" /> <template key="green">
</Repeater.itemsLayout> <Label text="{{ age }}" style.backgroundColor="green" />
</template>
<template key="red">
<Label text="{{ age }}" style.backgroundColor="red" />
</template>
</Repeater.itemTemplates>
</Repeater>{%endraw%}
</Page>
```
### Specifying the item template selector as a function in the code-behind file
In case your item template selector involves complicated logic which cannot be expressed with an expression, you can create an item template selector function in the code behind of the page in which the RepeaterRepeater resides. The function receives the respective data item, the row index and the entire Repeater items collection as parameters. It has to return the the key of the template to be used based on the supplied information.
``` XML
<Page>
{%raw%}<Repeater items="{{ myItems }}" itemTemplateSelector="selectItemTemplate">
<Repeater.itemTemplates>
<template key="green">
<Label text="{{ age }}" style.backgroundColor="green" />
</template>
<template key="red">
<Label text="{{ age }}" style.backgroundColor="red" />
</template>
</Repeater.itemTemplates>
</Repeater>{%endraw%}
</Page>
```
{%snippet article-item-template-selector-function%}
### Alternating row colors
You can use the special value '$index' in the item template selector expression which represents the row index.
``` XML
<Page>
{%raw%}<Repeater items="{{ myItems }}" itemTemplateSelector="$index % 2 === 0 ? 'even' : 'odd'">
<Repeater.itemTemplates>
<template key="even">
<Label text="{{ age }}" style.backgroundColor="white" />
</template>
<template key="odd">
<Label text="{{ age }}" style.backgroundColor="gray" />
</template>
</Repeater.itemTemplates>
</Repeater>{%endraw%} </Repeater>{%endraw%}
</Page> </Page>
``` ```

View File

@ -36,6 +36,7 @@ export function pageLoaded(args: EventData) {
examples.set('text-view', 'text-view/main-page'); examples.set('text-view', 'text-view/main-page');
examples.set('webview', 'web-view/main-page'); examples.set('webview', 'web-view/main-page');
examples.set('progress-bar', 'progress-bar/main-page'); examples.set('progress-bar', 'progress-bar/main-page');
examples.set('repeater', 'repeater/main-page');
examples.set('date-picker', 'date-picker/date-picker-page'); examples.set('date-picker', 'date-picker/date-picker-page');
examples.set('nested-frames', 'nested-frames/main-page'); examples.set('nested-frames', 'nested-frames/main-page');
examples.set('screen-qualifiers', 'screen-qualifiers/main-page'); examples.set('screen-qualifiers', 'screen-qualifiers/main-page');

View File

@ -0,0 +1,17 @@
import { EventData } from '@nativescript/core/data/observable';
import { SubMainPageViewModel } from '../sub-main-page-view-model';
import { WrapLayout } from '@nativescript/core/ui/layouts/wrap-layout';
import { Page } from '@nativescript/core/ui/page';
export function pageLoaded(args: EventData) {
const page = <Page>args.object;
const wrapLayout = <WrapLayout>page.getViewById('wrapLayoutWithExamples');
page.bindingContext = new SubMainPageViewModel(wrapLayout, loadExamples());
}
export function loadExamples() {
const examples = new Map<string, string>();
examples.set('multi-templates', 'repeater/multi-templates-page');
return examples;
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Page loaded="pageLoaded">
<ScrollView orientation="vertical" row="1">
<WrapLayout id="wrapLayoutWithExamples"/>
</ScrollView>
</Page>

View File

@ -0,0 +1,13 @@
import { EventData } from '@nativescript/core/data/observable';
import { ObservableArray } from '@nativescript/core/data/observable-array';
import { Page } from '@nativescript/core/ui/page';
import { MultiTemplatesViewModel } from './multi-templates-view-model';
export function pageLoaded(args: EventData) {
const page = <Page>args.object;
page.bindingContext = new MultiTemplatesViewModel();
}
export function getOddEvenTemplate(item: number, index: number, items: ObservableArray<number>): string {
return index % 2 === 0 ? 'even' : '';
}

View File

@ -0,0 +1,18 @@
<Page loaded="pageLoaded">
<ScrollView>
<Repeater items="{{ items }}" itemTemplateSelector="getOddEvenTemplate">
<Repeater.itemTemplate>
<StackLayout backgroundColor="blue" height="40">
<Label text="{{ $value }}" class="p-r-10" color="#fff" fontSize="16" />
</StackLayout>
</Repeater.itemTemplate>
<Repeater.itemTemplates>
<template key="even">
<StackLayout backgroundColor="green" height="40">
<Label text="{{ $value }}" class="p-r-10" color="#fff" fontSize="16" />
</StackLayout>
</template>
</Repeater.itemTemplates>
</Repeater>
</ScrollView>
</Page>

View File

@ -0,0 +1,15 @@
import { Observable } from '@nativescript/core/data/observable';
import { ObservableArray } from '@nativescript/core/data/observable-array';
export class MultiTemplatesViewModel extends Observable {
private _items: ObservableArray<number>;
get items(): ObservableArray<number> {
this._items = new ObservableArray<number>();
for (let i = 0; i < 20; i++) {
this._items.push(i);
}
return this._items;
}
}

View File

@ -1,9 +1,3 @@
module.exports = { module.exports = {
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'], projects: ['<rootDir>/packages/core'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest'
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html']
}; };

11
jest.preset.js Normal file
View File

@ -0,0 +1,11 @@
const nxPreset = require('@nrwl/jest/preset');
module.exports = {
...nxPreset,
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest',
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html'],
};

View File

@ -1,32 +1,109 @@
{ {
"migrations": [ "migrations": [
{ {
"version": "10.0.0-beta.0", "version": "10.1.0-beta.0",
"description": "Add default branch to nx.json", "description": "Migrate .eslintrc files to use tsconfig with a wildcard",
"factory": "./src/migrations/update-10-0-0/update-10-0-0", "factory": "./src/migrations/update-10-1-0/migrate-eslintrc-tsconfig-wildcard",
"package": "@nrwl/workspace", "package": "@nrwl/workspace",
"name": "add-default-branch-to-nx-json" "name": "migrate-eslintrc-tsconfig-wildcard"
}, },
{ {
"version": "10.0.0-beta.0", "version": "10.3.0-beta.0",
"description": "Migrate tsconfigs to solution style tsconfigs", "description": "Add @nrwl/cli as dependency",
"factory": "./src/migrations/update-10-0-0/solution-tsconfigs", "factory": "./src/migrations/update-10-3-0/add-cli-dependency",
"package": "@nrwl/workspace", "package": "@nrwl/workspace",
"name": "solution-tsconfigs" "name": "add-cli-dependency"
}, },
{ {
"version": "10.0.1-beta.0", "version": "10.3.0-beta.0",
"description": "Migrate .eslintrc files to reference new tsconfig", "description": "Update typescript to v4",
"factory": "./src/migrations/update-10-0-1/migrate-eslintrc", "factory": "./src/migrations/update-10-3-0/update-typescript",
"package": "@nrwl/workspace", "package": "@nrwl/workspace",
"name": "migrate-eslintrc-tsconfig" "name": "update-10-3-0"
}, },
{ {
"version": "10.0.0-beta.2", "version": "10.3.0-beta.1",
"description": "update jest configs to include setup env files", "description": "Adds .vscode/extensions.json to a workspace",
"factory": "./src/migrations/update-10-0-0/update-jest-configs", "factory": "./src/migrations/update-10-3-0/add-vscode-extensions",
"package": "@nrwl/workspace",
"name": "add-vscode-extensions"
},
{
"version": "10.3.0-beta.0",
"description": "Adds `buildableProjectDepsInPackageJsonType` for web and angular package builders",
"factory": "./src/migrations/update-10-3-0/add-buildable-project-deps-in-package-json-type",
"package": "@nrwl/workspace",
"name": "add-buildable-project-deps-in-package-json-type"
},
{
"version": "10.1.0-beta.4",
"description": "Update jest to v26",
"factory": "./src/migrations/update-10-1-0/update-10-1-0",
"package": "@nrwl/jest", "package": "@nrwl/jest",
"name": "update-10.0.0" "name": "update-10.1.0"
},
{
"version": "10.2.0",
"description": "Remove deprecated jest builder options",
"factory": "./src/migrations/update-10-2-0/update-10-2-0",
"package": "@nrwl/jest",
"name": "update-10.2.0"
},
{
"version": "10.3.0-beta.1",
"description": "Adds all jest projects into the root jest config",
"factory": "./src/migrations/update-10-3-0/update-projects-property",
"package": "@nrwl/jest",
"name": "update-projects-property"
},
{
"version": "10.3.0-beta.1",
"description": "Update ts-jest to v26.4",
"factory": "./src/migrations/update-10-3-0/update-ts-jest",
"package": "@nrwl/jest",
"name": "update-ts-jest"
},
{
"version": "10.3.0-beta.1",
"description": "Adds a jest extension to the recommended extensions for vscode",
"factory": "./src/migrations/update-10-3-0/add-jest-extension",
"package": "@nrwl/jest",
"name": "add-jest-extension"
},
{
"version": "10.3.0-beta.1",
"description": "Update @typescript-eslint to v4.3",
"factory": "./src/migrations/update-10-3-0/update-10-3-0",
"package": "@nrwl/linter",
"name": "update-10.3.0"
},
{
"version": "10.3.0-beta.0",
"description": "Migrate to the new ESLint builder and ESLint config style",
"factory": "./src/migrations/update-10-3-0/update-eslint-builder-and-config",
"package": "@nrwl/linter",
"name": "update-eslint-builder-and-config"
},
{
"version": "10.3.0-beta.2",
"description": "Add explicit .json file extension to .eslintrc files, not using an extension is deprecated",
"factory": "./src/migrations/update-10-3-0/add-json-ext-to-eslintrc",
"package": "@nrwl/linter",
"name": "add-json-ext-to-eslintrc"
},
{
"version": "10.3.0-beta.3",
"description": "Update implicitDependencies within nx.json to include root .eslintrc.json",
"factory": "./src/migrations/update-10-3-0/add-root-eslintrc-json-to-workspace-implicit-deps",
"package": "@nrwl/linter",
"name": "add-root-eslintrc-json-to-workspace-implicit-deps"
},
{
"version": "10.1.0-beta.1",
"description": "Removes rootDir from node libs' tsconfig",
"factory": "./src/migrations/update-10-1-0/remove-root-dir",
"package": "@nrwl/node",
"name": "remove-root-dir"
} }
] ]
} }

View File

@ -12,7 +12,8 @@
}, },
"tsconfig.json": "*", "tsconfig.json": "*",
"tslint.json": "*", "tslint.json": "*",
"nx.json": "*" "nx.json": "*",
".eslintrc.json": "*"
}, },
"projects": { "projects": {
"apps-automated": { "apps-automated": {
@ -27,9 +28,6 @@
"core": { "core": {
"tags": [] "tags": []
}, },
"core-compat": {
"tags": []
},
"types": { "types": {
"tags": [] "tags": []
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "nativescript", "name": "nativescript",
"version": "7.0.10", "version": "7.0.12",
"license": "MIT", "license": "MIT",
"config": { "config": {
"npm_alias": "npm" "npm_alias": "npm"
@ -46,30 +46,31 @@
}, },
"devDependencies": { "devDependencies": {
"@nativescript/hook": "^2.0.0", "@nativescript/hook": "^2.0.0",
"@nrwl/eslint-plugin-nx": "~10.0.7", "@nrwl/cli": "~10.3.1",
"@nrwl/jest": "~10.0.7", "@nrwl/eslint-plugin-nx": "~10.3.0",
"@nrwl/node": "~10.0.7", "@nrwl/jest": "~10.3.0",
"@nrwl/workspace": "~10.0.7", "@nrwl/node": "~10.3.0",
"@nstudio/focus": "~10.0.0", "@nrwl/workspace": "~10.3.0",
"@nstudio/focus": "~10.3.0",
"@nstudio/nps-i": "~1.1.0", "@nstudio/nps-i": "~1.1.0",
"@types/chai": "^4.2.11", "@types/chai": "^4.2.11",
"@types/jest": "~26.0.4", "@types/jest": "~26.0.8",
"@types/mocha": "^7.0.2", "@types/mocha": "^7.0.2",
"@types/node": "~14.0.22", "@types/node": "~14.0.22",
"@typescript-eslint/eslint-plugin": "~3.6.0", "@typescript-eslint/eslint-plugin": "~4.3.0",
"@typescript-eslint/parser": "~3.6.0", "@typescript-eslint/parser": "~4.3.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"conventional-changelog-cli": "^2.0.34", "conventional-changelog-cli": "^2.0.34",
"copyfiles": "^2.3.0", "copyfiles": "^2.4.0",
"cpy-cli": "^3.1.1", "cpy-cli": "^3.1.1",
"css": "^3.0.0", "css": "^3.0.0",
"css-tree": "^1.0.0-alpha.39", "css-tree": "^1.0.0-alpha.39",
"dotenv": "~8.2.0", "dotenv": "~8.2.0",
"eslint": "~7.4.0", "eslint": "~7.10.0",
"eslint-config-prettier": "~6.11.0", "eslint-config-prettier": "~6.11.0",
"gonzales": "^1.0.7", "gonzales": "^1.0.7",
"husky": "^4.2.5", "husky": "^4.2.5",
"jest": "~26.1.0", "jest": "~26.2.2",
"lint-staged": "^10.2.11", "lint-staged": "^10.2.11",
"mocha": "^8.0.1", "mocha": "^8.0.1",
"mocha-typescript": "^1.1.17", "mocha-typescript": "^1.1.17",
@ -84,12 +85,12 @@
"rimraf": "3.0.2", "rimraf": "3.0.2",
"shady-css-parser": "^0.1.0", "shady-css-parser": "^0.1.0",
"terser-webpack-plugin": "~3.0.6", "terser-webpack-plugin": "~3.0.6",
"ts-jest": "~26.1.1", "ts-jest": "26.4.0",
"ts-node": "~8.10.2", "ts-node": "~8.10.2",
"ts-patch": "^1.2.5", "ts-patch": "^1.2.5",
"tslib": "~2.0.1", "tslib": "~2.0.1",
"tslint": "~6.1.3", "tslint": "~6.1.3",
"typescript": "~3.9.7", "typescript": "~4.0.3",
"webpack": "~4.44.1", "webpack": "~4.44.1",
"webpack-cli": "~3.3.12" "webpack-cli": "~3.3.12"
}, },

View File

@ -1,4 +0,0 @@
*.tgz
**/*.ts
!**/*.d.ts
npm-debug.log

View File

@ -1,3 +0,0 @@
**NOTE**: Do not use this package directly.
The `tns-core-modules` package exists only for compatibility with older versions of NativeScript. It's recommended to use `@nativescript/core` now.

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
import '@nativescript/core/bundle-entry-points';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
require("@nativescript/core/bundle-entry-points");

View File

@ -1,2 +0,0 @@
// Execute the bundle-entry-points from core. Nothing is exported.
import '@nativescript/core/bundle-entry-points';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,7 +0,0 @@
// The "inspector_modules" module is not public, but is refered in legacy versons of webpack.config
// So add the re-export manually
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("@nativescript/core/inspector_modules"));

View File

@ -1,25 +0,0 @@
{
"name": "tns-core-modules",
"main": "index",
"types": "index.d.ts",
"description": "Compatibility with old style tns-core-modules imports for NativeScript.",
"version": "7.0.0-rc.33",
"homepage": "https://nativescript.org",
"repository": {
"type": "git",
"url": "https://github.com/NativeScript/NativeScript"
},
"license": "Apache-2.0",
"scripts": {
"setup": "npm i"
},
"devDependencies": {
"@nativescript/core": "rc"
},
"nativescript": {
"platforms": {
"ios": "5.0.0",
"android": "5.0.0"
}
}
}

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1 +0,0 @@
// Not needed. Only added for back-compatibility as some apps refer to this file.

View File

@ -1 +0,0 @@
export * from './trace';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./trace"), exports);

View File

@ -1 +0,0 @@
export * from './trace';

View File

@ -1,21 +0,0 @@
import { Trace } from '@nativescript/core';
export declare const enable: typeof Trace.enable;
export declare const error: typeof Trace.error;
export declare const getErrorHandler: typeof Trace.getErrorHandler;
export declare const isCategorySet: typeof Trace.isCategorySet;
export declare const isEnabled: typeof Trace.isEnabled;
export declare const notifyEvent: typeof Trace.notifyEvent;
export declare const setCategories: typeof Trace.setCategories;
export declare const setErrorHandler: typeof Trace.setErrorHandler;
export declare const write: typeof Trace.write;
export declare const removeWriter: typeof Trace.removeWriter;
export declare const messageType: typeof Trace.messageType;
export declare const removeEventListener: typeof Trace.removeEventListener;
export declare const addCategories: typeof Trace.addCategories;
export declare const addEventListener: typeof Trace.addEventListener;
export declare const DefaultErrorHandler: typeof Trace.DefaultErrorHandler;
export declare const ConsoleWriter: typeof Trace.ConsoleWriter;
export declare const addWriter: typeof Trace.addWriter;
export declare const categories: typeof Trace.categories;
export declare const clearWriters: typeof Trace.clearWriters;
export declare const disable: typeof Trace.disable;

View File

@ -1,23 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.disable = exports.clearWriters = exports.categories = exports.addWriter = exports.ConsoleWriter = exports.DefaultErrorHandler = exports.addEventListener = exports.addCategories = exports.removeEventListener = exports.messageType = exports.removeWriter = exports.write = exports.setErrorHandler = exports.setCategories = exports.notifyEvent = exports.isEnabled = exports.isCategorySet = exports.getErrorHandler = exports.error = exports.enable = void 0;
var core_1 = require("@nativescript/core");
exports.enable = core_1.Trace.enable;
exports.error = core_1.Trace.error;
exports.getErrorHandler = core_1.Trace.getErrorHandler;
exports.isCategorySet = core_1.Trace.isCategorySet;
exports.isEnabled = core_1.Trace.isEnabled;
exports.notifyEvent = core_1.Trace.notifyEvent;
exports.setCategories = core_1.Trace.setCategories;
exports.setErrorHandler = core_1.Trace.setErrorHandler;
exports.write = core_1.Trace.write;
exports.removeWriter = core_1.Trace.removeWriter;
exports.messageType = core_1.Trace.messageType;
exports.removeEventListener = core_1.Trace.removeEventListener;
exports.addCategories = core_1.Trace.addCategories;
exports.addEventListener = core_1.Trace.addEventListener;
exports.DefaultErrorHandler = core_1.Trace.DefaultErrorHandler;
exports.ConsoleWriter = core_1.Trace.ConsoleWriter;
exports.addWriter = core_1.Trace.addWriter;
exports.categories = core_1.Trace.categories;
exports.clearWriters = core_1.Trace.clearWriters;
exports.disable = core_1.Trace.disable;

View File

@ -1,22 +0,0 @@
import { Trace } from '@nativescript/core';
export const enable = Trace.enable;
export const error = Trace.error;
export const getErrorHandler = Trace.getErrorHandler;
export const isCategorySet = Trace.isCategorySet;
export const isEnabled = Trace.isEnabled;
export const notifyEvent = Trace.notifyEvent;
export const setCategories = Trace.setCategories;
export const setErrorHandler = Trace.setErrorHandler;
export const write = Trace.write;
export const removeWriter = Trace.removeWriter;
export const messageType = Trace.messageType;
export const removeEventListener = Trace.removeEventListener;
export const addCategories = Trace.addCategories;
export const addEventListener = Trace.addEventListener;
export const DefaultErrorHandler = Trace.DefaultErrorHandler;
export const ConsoleWriter = Trace.ConsoleWriter;
export const addWriter = Trace.addWriter;
export const categories = Trace.categories;
export const clearWriters = Trace.clearWriters;
export const disable = Trace.disable;

View File

@ -1,30 +0,0 @@
{
"compilerOptions": {
"noEmitOnError": true,
"noEmitHelpers": true,
"target": "es5",
"module": "commonjs",
"declaration": true,
"noImplicitAny": false,
"noImplicitUseStrict": true,
"removeComments": true,
"experimentalDecorators": true,
"diagnostics": true,
"sourceMap": false,
"types" : [
"node"
],
"lib": [
"es6", "dom"
],
"baseUrl": "."
},
"include": [
"**/*.ts"
],
"exclude": [
"node_modules",
"dist",
"__tests__"
]
}

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

View File

@ -1,2 +0,0 @@
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@nativescript/core"), exports);

View File

@ -1 +0,0 @@
export * from '@nativescript/core';

Some files were not shown because too many files have changed in this diff Show More