dart-archive/custom-element-apigen

Update to work with polymer js 1.0

Closed this issue · 4 comments

Investigate using https://github.com/Polymer/hydrolysis to get info about the js elements, instead of the existing regex based parser. This would be a large refactor but should be a lot more maintainable.

Rock on.

0.2.0-dev branch now works on all 1.0 elements, using hydrolysis. Still waiting on tests to verify but everything seems ready to go. New repo is https://github.com/dart-lang/polymer_elements and it contains all elements, instead of creating 7 separate packages. This should be easier to maintain/etc.

I started playing with this package to try and gen PolymerLabs/more-routing and it bombed out looking for hydrolsyis. I figured maybe I'm missing something, so I tried running it from the polymer_elements. Same issue:

pub run custom_element_apigen:update polymer_elements_config.yaml 
1 of 181: lib/src/font-roboto/roboto.htmlUnhandled exception:
Uncaught Error: Failed to parse element files!

exit code: 1
stderr: module.js:338
    throw err;
          ^
Error: Cannot find module 'hydrolysis'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/egrimes/.pub-cache/git/custom_element_apigen-3a476d12536c14623e2ccf26187fa0a2f0025a10/lib/src/js/analyze.js:1:73)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

stdout: 

Stack Trace:
#0      _parseError (package:custom_element_apigen/generate_dart_api.dart:167)
#1      _parseFile.<_parseFile_async_body> (package:custom_element_apigen/generate_dart_api.dart:153)
#2      _RootZone.runUnary (dart:async/zone.dart:1166)
#3      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:494)
#4      _Future._propagateToListeners (dart:async/future_impl.dart:577)
#5      _Future._completeWithValue (dart:async/future_impl.dart:368)
#6      Future.wait.<anonymous closure> (dart:async/future.dart:299)
#7      _RootZone.runUnary (dart:async/zone.dart:1166)
#8      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:494)
#9      _Future._propagateToListeners (dart:async/future_impl.dart:577)
#10     _Future._completeWithValue (dart:async/future_impl.dart:368)
#11     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:422)
#12     _microtaskLoop (dart:async/schedule_microtask.dart:43)
#13     _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#14     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#15     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)

#0      _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:895)
#1      _microtaskLoop (dart:async/schedule_microtask.dart:43)
#2      _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#3      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)

Ah ya the readme needs to be updated. You now have to install node/npm and then globally install the hydrolysis package. Then everything should work.