Skip to content

Commit c2ff8c1

Browse files
authored
refactor(core): zero circulars + esm ready (NativeScript#10770)
1 parent 1e54baf commit c2ff8c1

File tree

306 files changed

+9134
-9887
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+9134
-9887
lines changed

.github/workflows/apps_automated_android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ jobs:
6767
- name: Run tests on Android Emulator
6868
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0
6969
with:
70-
api-level: 34
70+
api-level: 35
7171
arch: x86_64
7272
script: npx nx test apps-automated -c=android

apps/automated/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
!webpack.config.js
2+
hooks

apps/automated/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core"
1212
},
1313
"devDependencies": {
14-
"@nativescript/android": "~8.9.0",
15-
"@nativescript/ios": "~8.9.0",
14+
"@nativescript/android": "alpha",
15+
"@nativescript/ios": "alpha",
1616
"@nativescript/visionos": "~8.9.0",
1717
"@nativescript/webpack": "file:../../dist/packages/webpack5",
1818
"circular-dependency-plugin": "^5.2.2",

apps/automated/project.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"forDevice": false,
3434
"prepare": false
3535
},
36-
"configurations": {},
3736
"dependsOn": ["^build"]
3837
},
3938
"prepare": {

apps/automated/src/xml-parser-tests/xml-with-namespaces.xml renamed to apps/automated/src/assets/xml-with-namespaces.xml

File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"eventType":"StartElement","position":{"line":2,"column":1},"elementName":"DocumentElement","attributes":{"param":"value"}}{"eventType":"StartElement","position":{"line":3,"column":3},"elementName":"First.Element","attributes":{"some.attr":"some.value"}}{"eventType":"Text","position":{"line":3,"column":41},"data":"\n ¶ Some Text ®\n "}{"eventType":"EndElement","position":{"line":5,"column":3},"elementName":"First.Element"}{"eventType":"StartElement","position":{"line":7,"column":3},"elementName":"SecondElement","attributes":{"param2":"something"}}{"eventType":"Text","position":{"line":7,"column":37},"data":"\n Pre-Text "}{"eventType":"StartElement","position":{"line":8,"column":14},"elementName":"Inline"}{"eventType":"Text","position":{"line":8,"column":22},"data":"Inlined text"}{"eventType":"EndElement","position":{"line":8,"column":34},"elementName":"Inline"}{"eventType":"Text","position":{"line":8,"column":43},"data":" Post-text.\n "}{"eventType":"EndElement","position":{"line":9,"column":3},"elementName":"SecondElement"}{"eventType":"StartElement","position":{"line":10,"column":3},"elementName":"entities"}{"eventType":"Text","position":{"line":10,"column":13},"data":"Xml tags begin with \"<\" and end with \">\" Ampersand is & and apostrophe is '"}{"eventType":"EndElement","position":{"line":10,"column":123},"elementName":"entities"}{"eventType":"StartElement","position":{"line":11,"column":3},"elementName":"script"}{"eventType":"CDATA","position":{"line":12,"column":5},"data":"\nfunction sum(a,b)\n{\n return a+b;\n}\n"}{"eventType":"EndElement","position":{"line":18,"column":3},"elementName":"script"}{"eventType":"Comment","position":{"line":19,"column":3},"data":"\n Hello,\n I am a multi-line XML comment.\n"}{"eventType":"EndElement","position":{"line":23,"column":1},"elementName":"DocumentElement"}
1+
{"eventType":"StartElement","position":{"line":2,"column":1},"elementName":"DocumentElement","attributes":{"param":"value"}}{"eventType":"StartElement","position":{"line":3,"column":3},"elementName":"First.Element","attributes":{"some.attr":"some.value"}}{"eventType":"Text","position":{"line":3,"column":41},"data":"\n ¶ Some Text ®\n "}{"eventType":"EndElement","position":{"line":5,"column":3},"elementName":"First.Element"}{"eventType":"StartElement","position":{"line":7,"column":3},"elementName":"SecondElement","attributes":{"param2":"something"}}{"eventType":"Text","position":{"line":7,"column":37},"data":"\n Pre-Text "}{"eventType":"StartElement","position":{"line":8,"column":14},"elementName":"Inline"}{"eventType":"Text","position":{"line":8,"column":22},"data":"Inlined text"}{"eventType":"EndElement","position":{"line":8,"column":34},"elementName":"Inline"}{"eventType":"Text","position":{"line":8,"column":43},"data":" Post-text.\n "}{"eventType":"EndElement","position":{"line":9,"column":3},"elementName":"SecondElement"}{"eventType":"StartElement","position":{"line":10,"column":3},"elementName":"entities"}{"eventType":"Text","position":{"line":10,"column":13},"data":"Xml tags begin with \"<\" and end with \">\" Ampersand is & and apostrophe is '"}{"eventType":"EndElement","position":{"line":10,"column":123},"elementName":"entities"}{"eventType":"StartElement","position":{"line":11,"column":3},"elementName":"script"}{"eventType":"CDATA","position":{"line":12,"column":5},"data":"\nfunction sum(a,b)\n{\n return a+b;\n}\n"}{"eventType":"EndElement","position":{"line":18,"column":3},"elementName":"script"}{"eventType":"Comment","position":{"line":19,"column":3},"data":"\n Hello,\n I am a multi-line XML comment.\n"}{"eventType":"EndElement","position":{"line":23,"column":1},"elementName":"DocumentElement"}

apps/automated/src/xml-parser-tests/xml.xml renamed to apps/automated/src/assets/xml.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ function sum(a,b)
2020
Hello,
2121
I am a multi-line XML comment.
2222
-->
23-
</DocumentElement>
23+
</DocumentElement>

apps/automated/src/debugger/dom-node-tests.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import { assert, assertEqual } from '../tk-unit';
2-
import { DOMNode } from '@nativescript/core/debugger/dom-node';
2+
import { DOMNode } from '@nativescript/core/debugger/dom-types';
33
import { attachDOMInspectorCommandCallbacks, attachCSSInspectorCommandCallbacks, attachDOMInspectorEventCallbacks } from '@nativescript/core/debugger/devtools-elements';
44
import { InspectorCommands, InspectorEvents } from '@nativescript/core/debugger/devtools-elements';
5-
import { unsetValue } from '@nativescript/core/ui/core/properties';
6-
import { Button } from '@nativescript/core/ui/button';
7-
import { Slider } from '@nativescript/core/ui/slider';
8-
import { Label } from '@nativescript/core/ui/label';
5+
import { unsetValue, Button, Slider, Label, TextView, StackLayout, isAndroid } from '@nativescript/core';
96
import { textProperty } from '@nativescript/core/ui/text-base';
10-
import { TextView } from '@nativescript/core/ui/text-view';
11-
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
12-
import { isAndroid } from '@nativescript/core/platform';
137

148
let originalInspectorGlobal: InspectorCommands & InspectorEvents;
159

apps/automated/src/file-system/file-system-tests.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ export var testFileRead = function () {
186186
// << file-system-example-text
187187
};
188188

189-
export var testFileReadWriteBinary = function () {
189+
export function testFileReadWriteBinary() {
190190
// >> file-system-read-binary
191-
var fileName = 'logo.png';
192-
var error;
191+
const fileName = 'logo.png';
192+
let error;
193+
const appFolder = fs.knownFolders.currentApp().path;
194+
const sourceFile = fs.File.fromPath(appFolder + '/assets/' + fileName);
195+
const destinationFile = fs.knownFolders.documents().getFile(fileName);
193196

194-
var sourceFile = fs.File.fromPath(__dirname + '/assets/' + fileName);
195-
var destinationFile = fs.knownFolders.documents().getFile(fileName);
196-
197-
var source = sourceFile.readSync((e) => {
197+
const source = sourceFile.readSync((e) => {
198198
error = e;
199199
});
200200

@@ -203,7 +203,7 @@ export var testFileReadWriteBinary = function () {
203203
});
204204

205205
// >> (hide)
206-
var destination = destinationFile.readSync((e) => {
206+
const destination = destinationFile.readSync((e) => {
207207
error = e;
208208
});
209209
TKUnit.assertNull(error);
@@ -216,14 +216,14 @@ export var testFileReadWriteBinary = function () {
216216
destinationFile.removeSync();
217217
// << (hide)
218218
// << file-system-read-binary
219-
};
219+
}
220220

221-
export var testFileReadWriteBinaryAsync = function () {
221+
export function testFileReadWriteBinaryAsync() {
222222
// >> file-system-read-binary-async
223-
var fileName = 'logo.png';
224-
225-
var sourceFile = fs.File.fromPath(__dirname + '/assets/' + fileName);
226-
var destinationFile = fs.knownFolders.documents().getFile(fileName);
223+
const fileName = 'logo.png';
224+
const appFolder = fs.knownFolders.currentApp().path;
225+
const sourceFile = fs.File.fromPath(appFolder + '/assets/' + fileName);
226+
const destinationFile = fs.knownFolders.documents().getFile(fileName);
227227

228228
// Read the file
229229
sourceFile.read().then(
@@ -263,7 +263,7 @@ export var testFileReadWriteBinaryAsync = function () {
263263
},
264264
);
265265
// << file-system-read-binary-async
266-
};
266+
}
267267

268268
export var testGetKnownFolders = function () {
269269
// >> file-system-known-folders
@@ -425,11 +425,11 @@ export var testFileNameExtension = function () {
425425
var file = documents.getFile('Test.txt');
426426
// Getting the file name "Test.txt".
427427
var fileName = file.name;
428-
// Getting the file extension ".txt".
428+
// Getting the file extension "txt".
429429
var fileExtension = file.extension;
430430
// >> (hide)
431431
TKUnit.assert(fileName === 'Test.txt', 'Wrong file name.');
432-
TKUnit.assert(fileExtension === '.txt', 'Wrong extension.');
432+
TKUnit.assert(fileExtension === 'txt', 'Wrong extension.');
433433
file.remove();
434434
// << (hide)
435435
// << file-system-extension
@@ -633,7 +633,7 @@ export function test_FSEntity_Properties() {
633633
var documents = fs.knownFolders.documents();
634634
var file = documents.getFile('Test_File.txt');
635635

636-
TKUnit.assert(file.extension === '.txt', 'FileEntity.extension not working.');
636+
TKUnit.assert(file.extension === 'txt', 'FileEntity.extension not working.');
637637
TKUnit.assert(file.isLocked === false, 'FileEntity.isLocked not working.');
638638
TKUnit.assert(file.lastModified instanceof Date, 'FileEntity.lastModified not working.');
639639
TKUnit.assert(file.size === 0, 'FileEntity.size not working.');
@@ -746,7 +746,7 @@ export function testAndroidCreate() {
746746

747747
export function test_FileAppend(done) {
748748
const content = 'Hello World';
749-
const hello_world = global.isIOS ? NSString.stringWithString(content).dataUsingEncoding(NSUTF8StringEncoding) : new java.lang.String(content).getBytes('UTF-8');
749+
const hello_world = __APPLE__ ? NSString.stringWithString(content).dataUsingEncoding(NSUTF8StringEncoding) : new java.lang.String(content).getBytes('UTF-8');
750750
const file = fs.File.fromPath(fs.path.join(fs.knownFolders.temp().path, `${Date.now()}-app.txt`));
751751
file
752752
.appendText('Hello')

apps/automated/src/navigation/custom-transition.ios.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { PageTransition, SharedTransition, SharedTransitionAnimationType, SharedTransitionHelper, Transition, Utils } from '@nativescript/core';
2-
import { CORE_ANIMATION_DEFAULTS } from '@nativescript/core/utils';
32

43
export class CustomTransition extends Transition {
54
constructor(duration: number, curve: any) {
@@ -32,7 +31,7 @@ export class CustomTransition extends Transition {
3231
},
3332
(finished) => {
3433
transitionContext.completeTransition(finished);
35-
}
34+
},
3635
);
3736
}
3837
}
@@ -90,7 +89,7 @@ class PageTransitionController extends NSObject implements UIViewControllerAnima
9089
}
9190
}
9291
}
93-
return CORE_ANIMATION_DEFAULTS.duration;
92+
return Utils.CORE_ANIMATION_DEFAULTS.duration;
9493
}
9594

9695
animateTransition(transitionContext: UIViewControllerContextTransitioning): void {

0 commit comments

Comments
 (0)