Commit Graph

4 Commits

Author SHA1 Message Date
Abhinav Gupta fc081e08e3
pkg/codegen/nodejs: Prefer contract.Assertf over Assert
Incremental step towards 

Migrates uses of contract.{Assert, AssertNoError, Require}
to `*f` variants so that we're required to provide more error context.

Refs 
2023-03-01 13:22:32 -08:00
Anton Tayanovskyy dc3f1afeb2 Remove state from lazyLoadGen 2022-09-28 10:47:42 -04:00
Anton Tayanovskyy 3e249ef16d Fix lazy load node codegen to issue loads earlier avoiding observable null exceptions 2022-09-28 10:47:42 -04:00
Anton Tayanovskyy 9597386a89
[codegen/node] Implement support for lazy-loaded Node modules ()
* First experiment: export a type directly, but still use require.

* WIP: Add lazy-loading to utils, build export list.

* Untested: add submodule export generation with lazy-loading

* WIP: Syntactically valid submodule export

* Add tests, finish submodExportList generation

* Clean up comments

* Fix compilation error

* WIP

* Lazy-load class modules and re-export them

* Revert original approach

* Handle the class-with-method case eagerly

* Accept codegen

* Fix typo in method namespace condition

* Fix lazyLoadProperty to call require() in source context

* Support lazy-loading function modules

* Revert useles diff, PR feedback

* Remove extra ws diff

* Remove unused

* Accept codegen output

* Function-only files still need utilites import

* Optimize for not loading enums all the time

* Improve further

* Accept codegen

* Implement flags to control lazy-loading

* Accept codegen tests

* Illustrate on azure-native-nested-types

* Test lazy-loaded functions on output-funcs

* Start factoring out

* More cases

* More unit tests

* Reduce flag surface

* Separate fileInfo structs into its own module

* Merge lazyloads

* Accept codegen changes

* CHANGELOG

* Lint

* Revert caching require()

* Accept codegen

Co-authored-by: Robbie McKinstry <robbiemckinstry@Robbies-MacBook-Pro.local>
Co-authored-by: Robbie McKinstry <robbiemckinstry@macbook-pro.mynetworksettings.com>
2022-09-01 18:42:44 -04:00