Skip to content

Commit

Permalink
TS externs: tsconfig.json to verify, and update generator
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Feb 5, 2025
1 parent 34140f4 commit 151133e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"scripts": {
"build": "npm run build-lib && npm run build-lib-esm && npm run build-dist && npm run build-swc",
"build-dist": "webpack --config webpack.dev.js && webpack --config webpack.prod.js",
"build-lib": "cd scripts && haxe build.hxml && tsc --noEmit ../lib/**/*.d.ts",
"build-lib": "cd scripts && haxe build.hxml && tsc",
"build-lib-esm": "cd scripts && node generate-es2015 gen",
"build-lib-esm-reexports-barrels": "cd scripts && node generate-es2015 non-gen",
"build-swc": "compc -load-config=node_modules/@apache-royale/royale-js/royale-asjs/frameworks/js-config.xml -keep-as3-metadata=JSModule -include-sources=lib -compiler.targets=SWF -external-library-path+=node_modules/openfl/dist/openfl.swc -output=dist/actuate.swc",
Expand Down
6 changes: 6 additions & 0 deletions scripts/TSExternsGenerator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -607,13 +607,19 @@ class TSExternsGenerator {
var qname = baseTypeToQname(superClass, [], false);
qnames.set(qname, true);
}
for (param in classType.superClass.params) {
addMacroTypeQnamesForImport(param, qnames, classType.pack);
}
}
for (interfaceRef in classType.interfaces) {
var interfaceType = interfaceRef.t.get();
if (!shouldSkipBaseType(interfaceType, true) && !canSkipBaseTypeImport(interfaceType, classType.pack)) {
var qname = baseTypeToQname(interfaceType, [], false);
qnames.set(qname, true);
}
for (param in interfaceRef.params) {
addMacroTypeQnamesForImport(param, qnames, classType.pack);
}
}
if (classType.constructor != null) {
var classField = classType.constructor.get();
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ ImportAll
-D openfl
-D commonjs
--remap flash:openfl
--macro AS3ExternsGenerator.generate({outputPath: "../lib", includedPackages: ["motion"], allowedPackageReferences: []})
--macro TSExternsGenerator.generate({outputPath: "../lib", includedPackages: ["motion"], allowedPackageReferences: []})
--macro AS3ExternsGenerator.generate({outputPath: "../lib", includedPackages: ["motion"], allowedPackageReferences: ["openfl"], renameSymbols: ["openfl.VectorData", "openfl.Vector", "openfl.utils.ByteArrayData", "openfl.utils.ByteArray"]})
--macro TSExternsGenerator.generate({outputPath: "../lib", includedPackages: ["motion"], allowedPackageReferences: ["openfl"], renameSymbols: ["openfl.VectorData", "openfl.Vector", "openfl.utils.ByteArrayData", "openfl.utils.ByteArray"]})
--no-inline
15 changes: 15 additions & 0 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2015",
"module": "CommonJS",
"moduleResolution": "node",
"noEmit": true,
"paths": {
"openfl": ["../node_modules/openfl/lib/openfl"],
"openfl/*": ["../node_modules/openfl/lib/openfl/*"]
}
},
"include": [
"../lib/**/*.d.ts"
]
}

0 comments on commit 151133e

Please sign in to comment.