Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libs and update source to latest versions #680

Merged
merged 3 commits into from
Nov 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,810 changes: 285 additions & 1,525 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 13 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,35 @@
"test-kotlin-ci": "cd src.kotlin/alphaTab && gradlew jvmTest"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^19.0.0",
"@types/css-font-loading-module": "0.0.4",
"@types/jasmine": "^3.7.1",
"@types/resize-observer-browser": "^0.1.5",
"concurrently": "^6.1.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@types/jasmine": "^3.10.2",
"@types/resize-observer-browser": "^0.1.6",
"concurrently": "^6.3.0",
"cors": "^2.8.5",
"fs-extra": "^10.0.0",
"git-branch": "^2.0.1",
"karma": "^6.3.2",
"karma": "^6.3.7",
"karma-chrome-launcher": "^3.1.0",
"karma-express-http-server": "0.0.1",
"karma-jasmine": "^4.0.1",
"karma-jasmine-html-reporter": "^1.6.0",
"karma-jasmine-html-reporter": "^1.7.0",
"karma-rollup-preprocessor": "^7.0.7",
"karma-spec-reporter": "0.0.32",
"lodash": "^4.17.21",
"multer": "^1.4.2",
"multer": "^1.4.3",
"rimraf": "^3.0.2",
"rollup": "^2.47.0",
"rollup": "^2.59.0",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-dts": "^3.0.1",
"rollup-plugin-license": "^2.3.0",
"rollup-plugin-dts": "^4.0.1",
"rollup-plugin-license": "^2.6.0",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"terser": "^5.7.0",
"ts-node": "^9.1.1",
"terser": "^5.9.0",
"ts-node": "^10.4.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-config-standard": "^9.0.0",
"ttypescript": "^1.5.12",
"typescript": "^4.2.4"
"typescript": "^4.4.4"
},
"files": [
"/dist/alphaTab.js",
Expand Down
14 changes: 12 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@ const resolve = require('./rollup.resolve');
const terser = require('rollup-plugin-terser').terser;
const dts = require('rollup-plugin-dts').default;
const copy = require('rollup-plugin-copy');
const branch = require('git-branch');
const license = require('rollup-plugin-license');
const serve = require('rollup-plugin-serve');
const fs = require('fs');

function getGitBranch() {
const filepath = '.git/HEAD';
if (!fs.existsSync(filepath)) {
throw new Error('.git/HEAD does not exist');
}
const buf = fs.readFileSync(filepath);
const match = /ref: refs\/heads\/([^\n]+)/.exec(buf.toString());
return match ? match[1] : '';
}

const commonOutput = {
name: 'alphaTab',
Expand Down Expand Up @@ -57,7 +67,7 @@ module.exports = [
},
data() {
let buildNumber = process.env.GITHUB_RUN_NUMBER || 0;
let gitBranch = branch.sync();
let gitBranch = getGitBranch();
return {
branch: gitBranch,
build: buildNumber
Expand Down
2 changes: 1 addition & 1 deletion src.compiler/csharp/CSharpAstTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ export default class CSharpAstTransformer {
!!d.initializer.modifiers &&
!!d.initializer.modifiers.find(m => m.kind === ts.SyntaxKind.AsyncKeyword);

const functionType = type.symbol.declarations.find(d =>
const functionType = type.symbol.declarations!.find(d =>
ts.isFunctionTypeNode(d)
) as ts.FunctionTypeNode;

Expand Down
57 changes: 36 additions & 21 deletions src.compiler/csharp/CSharpEmitterContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,20 +756,22 @@ export default class CSharpEmitterContext {

private buildCoreNamespace(aliasSymbol: ts.Symbol) {
let suffix = '';
for (const decl of aliasSymbol.declarations) {
let fileName = path.basename(decl.getSourceFile().fileName).toLowerCase();
if (fileName.startsWith('lib.') && fileName.endsWith('.d.ts')) {
fileName = fileName.substring(4, fileName.length - 5);
if (fileName.length) {
suffix = fileName.split('.').map(s => {
if (s.match(/es[0-9]{4}/)) {
return '.' + this.toPascalCase('ecmaScript');
}
if (s.match(/es[0-9]{1}/)) {
return '.' + this.toPascalCase('ecmaScript');
}
return '.' + this.toPascalCase(s);
})[0];
if (aliasSymbol.declarations) {
for (const decl of aliasSymbol.declarations) {
let fileName = path.basename(decl.getSourceFile().fileName).toLowerCase();
if (fileName.startsWith('lib.') && fileName.endsWith('.d.ts')) {
fileName = fileName.substring(4, fileName.length - 5);
if (fileName.length) {
suffix = fileName.split('.').map(s => {
if (s.match(/es[0-9]{4}/)) {
return '.' + this.toPascalCase('ecmaScript');
}
if (s.match(/es[0-9]{1}/)) {
return '.' + this.toPascalCase('ecmaScript');
}
return '.' + this.toPascalCase(s);
})[0];
}
}
}
}
Expand Down Expand Up @@ -935,9 +937,14 @@ export default class CSharpEmitterContext {

// unwrap symbol of expression to get declared type
let symbol = this.typeChecker.getSymbolAtLocation(expression);
if (!symbol || !symbol.declarations || symbol.declarations.length === 0) {
if (!symbol) {
return undefined;
}
const declarations = symbol.declarations;
if (!declarations || declarations.length === 0) {
return undefined;
}

if (symbol.flags & ts.SymbolFlags.Alias) {
symbol = this.typeChecker.getAliasedSymbol(symbol);
}
Expand All @@ -946,7 +953,7 @@ export default class CSharpEmitterContext {
}

// declared type must be nullable
let declaredType = this.typeChecker.getTypeAtLocation(symbol.declarations[0]);
let declaredType = this.typeChecker.getTypeAtLocation(declarations[0]);
if (!this.isNullableType(declaredType)) {
return undefined;
}
Expand Down Expand Up @@ -991,7 +998,11 @@ export default class CSharpEmitterContext {
// we consider the expression as smart casted if the declared symbol has a different
// contextual type than the declared type.
let symbol = this.typeChecker.getSymbolAtLocation(expression);
if (!symbol || !symbol.declarations || symbol.declarations.length === 0) {
if (!symbol) {
return false;
}
const declarations = symbol.declarations;
if (!declarations || declarations.length === 0) {
return false;
}

Expand All @@ -1008,7 +1019,7 @@ export default class CSharpEmitterContext {
return false;
}

let declaredType = this.typeChecker.getTypeAtLocation(symbol.declarations[0]);
let declaredType = this.typeChecker.getTypeAtLocation(declarations[0]);
if (!this.isNullableType(declaredType)) {
return false;
}
Expand Down Expand Up @@ -1037,7 +1048,11 @@ export default class CSharpEmitterContext {
// we consider the expression as smart casted if the declared symbol has a different
// contextual type than the declared type.
let symbol = this.typeChecker.getSymbolAtLocation(expression);
if (!symbol || !symbol.declarations || symbol.declarations.length === 0) {
if (!symbol) {
return null;
}
const declarations = symbol.declarations;
if(!declarations || declarations.length === 0){
return null;
}

Expand All @@ -1057,7 +1072,7 @@ export default class CSharpEmitterContext {
}
}

let declaredType = this.typeChecker.getTypeAtLocation(symbol.declarations[0]);
let declaredType = this.typeChecker.getTypeAtLocation(declarations[0]);

let contextualTypeNullable = contextualType;
contextualType = this.typeChecker.getNonNullableType(contextualType);
Expand Down Expand Up @@ -1363,7 +1378,7 @@ export default class CSharpEmitterContext {
public isStaticSymbol(tsSymbol: ts.Symbol) {
return (
(tsSymbol.flags & ts.SymbolFlags.EnumMember) !== 0 ||
!!tsSymbol.declarations.find(
!!tsSymbol.declarations?.find(
d => d.modifiers && !!d.modifiers.find(m => m.kind === ts.SyntaxKind.StaticKeyword)
)
);
Expand Down
2 changes: 1 addition & 1 deletion src.compiler/kotlin/KotlinAstPrinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ export default class KotlinAstPrinter extends AstPrinterBase {

protected isMethodAsDelegate(expr: cs.MemberAccessExpression) {
if (
expr.tsSymbol &&
expr.tsSymbol?.valueDeclaration &&
ts.isMethodDeclaration(expr.tsSymbol.valueDeclaration) &&
!ts.isCallExpression(expr.tsNode!.parent)
) {
Expand Down
1 change: 1 addition & 0 deletions src.compiler/kotlin/KotlinEmitterContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default class KotlinEmitterContext extends CSharpEmitterContext {
}

if (
classType.symbol.valueDeclaration &&
ts.isClassDeclaration(classType.symbol.valueDeclaration) &&
classType.symbol.valueDeclaration.heritageClauses
) {
Expand Down
Loading