refactor(core): zero circulars + esm ready (#10770)

This commit is contained in:
Nathan Walker
2025-09-18 17:03:23 -07:00
committed by GitHub
parent 1e54baf198
commit c2ff8c1ae7
306 changed files with 9136 additions and 9889 deletions

View File

@ -10,6 +10,7 @@ import { isIOS, Device } from '@nativescript/core/platform';
import lazy from '@nativescript/core/utils/lazy';
const sdkVersion = lazy(() => parseInt(Device.sdkVersion));
const appFolder = fs.knownFolders.currentApp().path;
export var test_XmlParser_IsDefined = function () {
TKUnit.assertNotEqual(xmlModule.XmlParser, undefined, 'Class XmlParser should be defined!');
@ -92,7 +93,7 @@ export var test_XmlParser_OnErrorIsCalledWhenAnErrorOccurs = function () {
},
function (error: Error) {
e = error;
}
},
);
xmlParser.parse('<element></otherElement>');
TKUnit.assert(e !== undefined, 'Expected result: error; Actual result: ' + e + ';');
@ -103,8 +104,8 @@ export var test_XmlParser_IntegrationTest = function () {
return;
}
var actualResult = '';
var xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) {
let actualResult = '';
const xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) {
if (event.eventType === xmlModule.ParserEventType.Text && event.data.trim() === '') {
// Ignore ignorable whitespace.
return;
@ -113,20 +114,20 @@ export var test_XmlParser_IntegrationTest = function () {
actualResult += event.toString();
});
var file = fs.File.fromPath(fs.path.join(__dirname, 'xml.xml'));
var xmlString = file.readTextSync();
let file = fs.File.fromPath(appFolder + '/assets/xml.xml');
let xmlString = file.readTextSync();
xmlString = xmlString.replace(/(\r\n|\n|\r)/gm, '\n');
xmlParser.parse(xmlString);
var expectedResult: string;
file = fs.File.fromPath(fs.path.join(__dirname, 'xml.expected'));
let expectedResult: string;
file = fs.File.fromPath(appFolder + '/assets/xml.expected');
expectedResult = file.readTextSync();
var i;
var maxLength = Math.max(actualResult.length, expectedResult.length);
let i;
const maxLength = Math.max(actualResult.length, expectedResult.length);
for (i = 0; i < maxLength; i++) {
var actualChar;
var actualCharCode;
let actualChar;
let actualCharCode;
if (i <= actualResult.length) {
actualChar = actualResult.charAt(i);
actualCharCode = actualResult.charCodeAt(i);
@ -213,10 +214,10 @@ export var test_XmlParser_NamespacesTest = function () {
TKUnit.assert(actualResult === expectedResult, 'Actual: ' + actualResult + '; Expected: ' + expectedResult);
},
undefined,
true
true,
);
var file = fs.File.fromPath(fs.path.join(__dirname, 'xml-with-namespaces.xml'));
var file = fs.File.fromPath(appFolder + '/assets/xml-with-namespaces.xml');
var xmlString = file.readTextSync();
xmlParser.parse(xmlString);
};

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Element xmlns="http://a-default"
xmlns:a1="http://a1"
xmlns:a2="http://a2"
xmlns:duplicate="http://a-duplicate"
expected-namespace="http://a-default">
<Element expected-namespace="http://a-default"/>
<a1:Element expected-namespace="http://a1"/>
<a2:Element expected-namespace="http://a2"/>
<Element xmlns="http://b-default"
xmlns:b1="http://b1"
xmlns:b2="http://b2"
xmlns:duplicate="http://b-duplicate"
expected-namespace="http://b-default">
<Element expected-namespace="http://b-default"/>
<b1:Element expected-namespace="http://b1"/>
<b2:Element expected-namespace="http://b2"/>
<duplicate:Element expected-namespace="http://b-duplicate"/>
</Element>
</Element>

View File

@ -1 +0,0 @@
{"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"}

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<DocumentElement param="value">
<First.Element some.attr="some.value">
&#xb6; Some Text &#x00AE;
</First.Element>
<?some_pi some_attr="some_value"?>
<SecondElement param2="something">
Pre-Text <Inline>Inlined text</Inline> Post-text.
</SecondElement>
<entities>Xml tags begin with &quot;&lt;&quot; and end with &quot;&gt;&quot; Ampersand is &amp; and apostrophe is &apos;</entities>
<script>
<![CDATA[
function sum(a,b)
{
return a+b;
}
]]>
</script>
<!--
Hello,
I am a multi-line XML comment.
-->
</DocumentElement>