pulumi/pkg/codegen
Anton Tayanovskyy 9597386a89
[codegen/node] Implement support for lazy-loaded Node modules (#10538)
* 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
..
docs Fix unsafe html emitted for Java properties (#9691) 2022-05-26 10:44:40 -07:00
dotnet Fix StackReference code gen (#10419) 2022-08-19 10:27:05 -07:00
go [go/codegen] Fix type collisions where InputType + "Map" clashes with resource type called "InputTypeMap" (#10551) 2022-08-31 22:35:26 +02:00
hcl2 Remove the go mod replace directives (#9873) 2022-06-17 09:27:52 -07:00
importer [schema] Faster schema loading via caching alongside plugins (#9686) 2022-06-13 23:27:11 -07:00
nodejs [codegen/node] Implement support for lazy-loaded Node modules (#10538) 2022-09-01 18:42:44 -04:00
pcl Accept options.version on pulumi convert (#10456) 2022-08-22 10:36:01 -07:00
python Fix StackReference code gen (#10419) 2022-08-19 10:27:05 -07:00
schema Split PluginInfo in Info and Spec (#10501) 2022-08-26 15:51:14 +01:00
testing [codegen/node] Implement support for lazy-loaded Node modules (#10538) 2022-09-01 18:42:44 -04:00
README.md Update README.md (#9575) 2022-05-10 13:51:02 +01:00
docs.go Support "lifting" single-valued method returns to their return type (#8111) 2021-10-01 11:33:02 -07:00
docs_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
utilities.go [codegen/dotnet] Allow generated SDKs to have a global namespace other then `Pulumi` (#8735) 2022-01-21 12:58:11 -08:00
utilities_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
utilities_types.go Shallow Plain Types (#9512) 2022-05-03 11:13:21 -07:00

README.md

Pulumi CrossCode

The github.com/pulumi/pulumi/pkg/v3/codegen package defines the core components of Pulumi's CrossCode technology. CrossCode provides a set of foundational capabilities for working across a variety of programming languages supported by the Pulumi platform.

The core components of CrossCode in this package are:

  • Schema: The definition of Pulumi Schema, a language-neutral specification of cloud resource models. Pulumi Schema is the interface definition language for all Pulumi Packages, and is used as input to SDK code generation for each supported Pulumi language.
  • SDK Code Generation for Node.js, Python, Go and .NET: These libraries define how to create Pulumi SDKs from a Pulumi Schema definition of a package. The resulting SDKs expose the resource, components and functions from that package into the the Pulumi programming model defined for the given language.
  • Docs Generation: In addition to generating per-language SDKs, CrossCode supports generating language-neutral documentation for a package from it's Pulumi Schema. This documentation is currently hosted in the Pulumi Registry, but can in principle be hosted in other contexts as well.
  • Pulumi Configuration Language: An internal representation of Pulumi programs which supports all core concepts of the Pulumi programming model in a minimal form. Although not exposed directly to users today, this intermediate representation is used to support a variety of program conversion tasks, from and to various supported Pulumi languages.
  • Program Generation for Node.js, Python, Go and .NET: Support for lowering Pulumi Configuration Language into each of the supported Pulumi languages, such that examples and programs can be generated for the language.

These foundations enable a vast array of features supported in the Pulumi Platform, including:

  • Pulumi support for Node.js, Python, Go, .NET, Java and YAML: Each Pulumi language is supported by defining a representation of the Pulumi resource model in that language, and then implementing SDK Code Generation and Program Generation for the language.
  • Pulumi Packages: Pulumi packages define a set of resources using Pulumi Schema, and use the CrossCode SDK Code Generators for every Pulumi language automatically.
  • pulumi import: Cloud infrastructure resources deployed outside of Pulumi can be imported into Pulumi, including generated Pulumi code in your language of choice which defines the infrastructure. This builds on the program generation support from CrossCode.
  • tf2pulumi, arm2pulumi, crd2pulumi, kube2pulumi and cf2pulumi: These tools convert the source IaC format into an intermediate Pulumi Configuration Language model, and then use the CrossCode program generation support to convert that ultimately into the language a Pulumi user wants to use for their infrastructure.
  • pulumi convert: The pulumi convert command allows Pulumi YAML programs to be converted into programs in any other Pulumi language. Because Pulumi YAML is a proper subset of what can be expressed in Pulumi Configuration Language, this conversion from Pulumi YAML to Pulumi Configuration Language and then into each Pulumi language can be done faithfully.
  • Pulumi Registry: The Pulumi Registry provides discovery and documentation hosting for all Pulumi Packages. It is powered by the Pulumi Schema and CrossCode documentation generation features.

Learn more about Pulumi CrossCode at https://www.pulumi.com/crosscode/.