Skip to content

Commit a2da412

Browse files
authored
refactor: public API marking, extended compiler features, and private mangling (#2349)
2 parents a3c1535 + 33d5eaf commit a2da412

File tree

534 files changed

+7221
-4594
lines changed

Some content is hidden

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

534 files changed

+7221
-4594
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
],
1010
"scripts": {
1111
"clean": "npm run clean --workspaces --if-present",
12-
"lint": "npm run lint-ci --workspaces --if-present",
13-
"lint-ci": "npm run lint-ci --workspaces --if-present -- --reporter=github",
12+
"lint": "npm run lint --workspaces --if-present",
13+
"lint-ci": "npm run lint --workspaces --if-present -- --reporter=github",
1414
"typecheck": "npm run typecheck --workspaces --if-present",
1515
"dev": "npm run dev --workspace=packages/playground",
1616

packages/alphatab/biome.jsonc

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,80 @@
1818
"src/**",
1919
"test/**",
2020
"src.compiler/**",
21-
"playground/**",
22-
"playground-template/**"
21+
"playground/**"
2322
]
2423
},
2524
"linter": {
2625
"includes": [
2726
"*.ts",
2827
"src/**",
2928
"test/**",
30-
"src.compiler/**",
31-
"playground-template/**"
32-
]
29+
"src.compiler/**"
30+
],
31+
"rules": {
32+
"style": {
33+
"useNamingConvention": {
34+
"level": "error",
35+
"options": {
36+
"strictCase": false,
37+
"conventions": [
38+
{
39+
"selector": {
40+
"kind": "classMember",
41+
"modifiers": [
42+
"private"
43+
]
44+
},
45+
"match": "_(.+)",
46+
"formats": [
47+
"camelCase"
48+
]
49+
},
50+
{
51+
"selector": {
52+
"kind": "objectLiteralProperty"
53+
},
54+
"formats": [
55+
"camelCase",
56+
"PascalCase"
57+
]
58+
},
59+
{
60+
"selector": {
61+
"kind": "typeProperty"
62+
},
63+
"formats": [
64+
"camelCase",
65+
"PascalCase"
66+
]
67+
},
68+
{
69+
"selector": {
70+
"kind": "classProperty",
71+
"modifiers": [
72+
"static",
73+
"readonly"
74+
]
75+
},
76+
"formats": [
77+
"camelCase",
78+
"PascalCase"
79+
]
80+
},
81+
{
82+
"selector": {
83+
"kind": "enumMember"
84+
},
85+
"match": ".+",
86+
"formats": [
87+
"PascalCase",
88+
"CONSTANT_CASE"
89+
]
90+
}
91+
]
92+
}
93+
}
94+
}
95+
}
3396
}
3497
}

packages/alphatab/scripts/CloneEmitter.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ function toImportPath(fileName: string) {
1717
}
1818

1919
function isCloneMember(propertyDeclaration: ts.PropertyDeclaration) {
20+
if (ts.isPrivateIdentifier(propertyDeclaration.name)){
21+
return false;
22+
}
23+
2024
if (propertyDeclaration.modifiers) {
2125
if (
2226
propertyDeclaration.modifiers.find(
@@ -347,16 +351,20 @@ export default createEmitter('cloneable', (program, input) => {
347351
);
348352
}
349353

350-
statements.push(
351-
ts.factory.createClassDeclaration(
354+
const clz = ts.addSyntheticLeadingComment(ts.factory.createClassDeclaration(
352355
[ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
353356
`${input.name!.text}Cloner`,
354357
undefined,
355358
undefined,
356359
[createCloneMethod(program, input, importer)]
357-
)
360+
),
361+
ts.SyntaxKind.MultiLineCommentTrivia,
362+
'*\n * @internal\n ',
363+
true
358364
);
359365

366+
statements.push(clz);
367+
360368
const sourceFile = ts.factory.createSourceFile(
361369
[
362370
ts.factory.createImportDeclaration(

packages/alphatab/scripts/SerializerEmitter.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ export default createEmitter('json', (program, input) => {
4343
);
4444
}
4545

46-
statements.push(
47-
ts.factory.createClassDeclaration(
46+
const clz = ts.addSyntheticLeadingComment(ts.factory.createClassDeclaration(
4847
[ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
4948
`${input.name!.text}Serializer`,
5049
undefined,
@@ -54,9 +53,14 @@ export default createEmitter('json', (program, input) => {
5453
createToJsonMethod(input, serializable, importer),
5554
createSetPropertyMethod(input, serializable, importer)
5655
]
57-
)
56+
),
57+
ts.SyntaxKind.MultiLineCommentTrivia,
58+
'*\n * @internal\n ',
59+
true
5860
);
5961

62+
statements.push(clz);
63+
6064
const sourceFile = ts.factory.createSourceFile(
6165
[
6266
ts.factory.createImportDeclaration(

packages/alphatab/scripts/generate-typescript.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ fs.writeSync(
3636
`\
3737
${GENERATED_FILE_HEADER}
3838
39-
39+
/**
40+
* @internal
41+
*/
4042
export class VersionInfo {
4143
public static readonly version: string = '${version}';
4244
public static readonly date: string = '${new Date().toISOString()}';

0 commit comments

Comments
 (0)