Iirc externc expects extern format and may fail on actual js source. Sent from my LG G3, an AT&T 4G LTE smartphone
------ Original message------ From: Harbs Date: Sun, Jul 31, 2016 7:09 AM To: [email protected]; Subject:Re: FlexJS creating new typedefs I get nothing. Here’s what I tried. Maybe I’m using it wrong… Harbss-MacBook-Pro:build harbs$ /Users/harbs/Documents/Apache\ Flex\ Dist/FlexJSNightly/js/bin/externc -external /Users/harbs/Desktop/extern\ test/js/opentype.js -as-root /Users/harbs/Desktop/extern\ test/as\ out Using Falcon codebase: /Users/harbs/Documents/Apache Flex Dist/FlexJSNightly/js/bin/../.. Using Flex SDK: /Users/harbs/Documents/Apache Flex Dist/FlexJSNightly/js/bin/../.. Jul 31, 2016 4:48:06 PM com.google.javascript.jscomp.LoggerErrorManager println WARNING: [opentype]:5633: WARNING - unreachable code for (; pos < limit; pos++) { ^ Jul 31, 2016 4:48:06 PM com.google.javascript.jscomp.LoggerErrorManager printSummary WARNING: 0 error(s), 1 warning(s) 1.954506 seconds On Jul 31, 2016, at 9:20 AM, Alex Harui <[email protected]> wrote: > > > On 7/30/16, 10:59 PM, "Harbs" <[email protected]> wrote: > >> What’s the best way of going about creating new typedefs for a JS library >> which doesn’t have JSDoc type definitions? >> >> I’d like to create typedefs for OpenTypeJS[1] but there’s no comments to >> help. >> >> The only two ways I can think of are: >> 1. Go into the JS code and manually add comments for everything (and then >> do a pull request). Then use externc to produce a swc. >> 2. Create ActionScript stubs for all the functions and use compc to >> create a swc. >> >> Is there another option (or tool to make it easier) that I’m missing? >> Which of these two approaches makes more sense? > > What do you get when you run externc? Can the results be post-processed? > > IMO, option #1 is the theoretical best. If you can convince the OpenType > folks to switch to Google's JSDoc then you get any future changes for free > (assuming they are accurate). > > Option #2 will let you compile and debug so if you are in a hurry and > OpenType doesn't change much, AS Stubs might be quickest, but in > production you still need a JS file in externs format for the GCC > optimizer. ExternC has a -jsroot option to generate an externs format .js > file from js source with JSDoc. See the CreateJS build. > > Note that the Ant and Maven builds allow for patching of the downloaded > source. For CreateJS, we do a fair amount of find/replace to automate > creating a better set of .js files for externc to consume. > > HTH, > -Alex > >> >> [1]https://github.com/nodebox/opentype.js/ >
