Documentation
¶
Overview ¶
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
nolint: lll, goconst
Pulling out some of the repeated strings tokens into constants would harm readability, so we just ignore the goconst linter's warning.
nolint: lll, goconst
When GeneratePackage generates TypeScript files, there is a need to track internally which definitions are emitted into these files to re-export them efficiently. This file defines helper structs for this information. The tracking is approximate.
Index ¶
- Constants
- Variables
- func Check(t *testing.T, path string, dependencies codegen.StringSet, linkLocal bool)
- func GeneratePackage(tool string, pkg *schema.Package, extraFiles map[string][]byte) (map[string][]byte, error)
- func GenerateProgram(program *pcl.Program) (map[string][]byte, hcl.Diagnostics, error)
- func GenerateProgramBatchTest(t *testing.T, testCases []test.ProgramTest)
- func GenerateProject(directory string, project workspace.Project, program *pcl.Program) error
- func LanguageResources(pkg *schema.Package) (map[string]LanguageResource, error)
- func TypeCheck(t *testing.T, path string, _ codegen.StringSet, linkLocal bool)
- type DocLanguageHelper
- func (d DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType(pkg *schema.Package, modName, typeName string, input bool) string
- func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string
- func (d DocLanguageHelper) GetDocLinkForResourceInputOrOutputType(pkg *schema.Package, modName, typeName string, input bool) string
- func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, modName, typeName string) string
- func (d DocLanguageHelper) GetEnumName(e *schema.Enum, typeName string) (string, error)
- func (d DocLanguageHelper) GetFunctionName(modName string, f *schema.Function) string
- func (d DocLanguageHelper) GetLanguageTypeString(pkg *schema.Package, moduleName string, t schema.Type, input bool) string
- func (d DocLanguageHelper) GetMethodName(m *schema.Method) string
- func (d DocLanguageHelper) GetMethodResultName(pkg *schema.Package, modName string, r *schema.Resource, m *schema.Method) string
- func (d DocLanguageHelper) GetModuleDocLink(pkg *schema.Package, modName string) (string, string)
- func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error)
- func (d DocLanguageHelper) GetResourceFunctionResultName(modName string, f *schema.Function) string
- type LanguageProperty
- type LanguageResource
- type NodeObjectInfo
- type NodePackageInfo
Constants ¶
const MinimumNodeTypesVersion string = "^14"
const MinimumTypescriptVersion string = "^4.3.5"
const MinimumValidSDKVersion string = "^3.42.0"
The minimum version of @pulumi/pulumi compatible with the generated SDK.
const PulumiToken = "pulumi"
Variables ¶
var Importer schema.Language = importer(0)
Importer implements schema.Language for NodeJS.
Functions ¶
func GeneratePackage ¶
func GenerateProgram ¶
func GenerateProgramBatchTest ¶ added in v3.44.0
func GenerateProgramBatchTest(t *testing.T, testCases []test.ProgramTest)
func GenerateProject ¶ added in v3.31.0
func LanguageResources ¶
func LanguageResources(pkg *schema.Package) (map[string]LanguageResource, error)
LanguageResources returns a map of resources that can be used by downstream codegen. The map key is the resource schema token.
Types ¶
type DocLanguageHelper ¶
type DocLanguageHelper struct{}
DocLanguageHelper is the NodeJS-specific implementation of the DocLanguageHelper.
func (DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType ¶
func (d DocLanguageHelper) GetDocLinkForFunctionInputOrOutputType(pkg *schema.Package, modName, typeName string, input bool) string
GetDocLinkForFunctionInputOrOutputType returns the doc link for an input or output type of a Function.
func (DocLanguageHelper) GetDocLinkForPulumiType ¶
func (d DocLanguageHelper) GetDocLinkForPulumiType(pkg *schema.Package, typeName string) string
GetDocLinkForPulumiType returns the NodeJS API doc link for a Pulumi type.
func (DocLanguageHelper) GetDocLinkForResourceInputOrOutputType ¶
func (d DocLanguageHelper) GetDocLinkForResourceInputOrOutputType(pkg *schema.Package, modName, typeName string, input bool) string
GetDocLinkForResourceInputOrOutputType returns the doc link for an input or output type of a Resource.
func (DocLanguageHelper) GetDocLinkForResourceType ¶
func (d DocLanguageHelper) GetDocLinkForResourceType(pkg *schema.Package, modName, typeName string) string
GetDocLinkForResourceType returns the NodeJS API doc for a type belonging to a resource provider.
func (DocLanguageHelper) GetEnumName ¶
GetEnumName returns the enum name specific to NodeJS.
func (DocLanguageHelper) GetFunctionName ¶
func (d DocLanguageHelper) GetFunctionName(modName string, f *schema.Function) string
func (DocLanguageHelper) GetLanguageTypeString ¶
func (d DocLanguageHelper) GetLanguageTypeString(pkg *schema.Package, moduleName string, t schema.Type, input bool) string
GetLanguageTypeString returns the language-specific type given a Pulumi schema type.
func (DocLanguageHelper) GetMethodName ¶ added in v3.10.2
func (d DocLanguageHelper) GetMethodName(m *schema.Method) string
func (DocLanguageHelper) GetMethodResultName ¶ added in v3.10.2
func (DocLanguageHelper) GetModuleDocLink ¶
GetModuleDocLink returns the display name and the link for a module.
func (DocLanguageHelper) GetPropertyName ¶
func (d DocLanguageHelper) GetPropertyName(p *schema.Property) (string, error)
GetPropertyName returns the property name specific to NodeJS.
func (DocLanguageHelper) GetResourceFunctionResultName ¶
func (d DocLanguageHelper) GetResourceFunctionResultName(modName string, f *schema.Function) string
GetResourceFunctionResultName returns the name of the result type when a function is used to lookup an existing resource.
type LanguageProperty ¶
type LanguageProperty struct {
ConstValue string // If set, the constant value of the property (e.g., "flowcontrol.apiserver.k8s.io/v1alpha1")
Name string // The name of the property (e.g., "FlowSchemaSpec")
Package string // The package path containing the property definition (e.g., "outputs.flowcontrol.v1alpha1")
}
LanguageProperty holds information about a resource property to be used by downstream codegen.
type LanguageResource ¶
type LanguageResource struct {
*schema.Resource
Name string // The resource name (e.g., "FlowSchema")
Package string // The name of the package containing the resource definition (e.g., "flowcontrol.v1alpha1")
Properties []LanguageProperty // Properties of the resource
}
LanguageResource holds information about a resource to be used by downstream codegen.
type NodeObjectInfo ¶
type NodeObjectInfo struct {
// List of properties that are required on the input side of a type.
RequiredInputs []string `json:"requiredInputs"`
// List of properties that are required on the output side of a type.
RequiredOutputs []string `json:"requiredOutputs"`
}
NodeObjectInfo contains NodeJS-specific information for an object.
type NodePackageInfo ¶
type NodePackageInfo struct {
// Custom name for the NPM package.
PackageName string `json:"packageName,omitempty"`
// Description for the NPM package.
PackageDescription string `json:"packageDescription,omitempty"`
// Readme contains the text for the package's README.md files.
Readme string `json:"readme,omitempty"`
// NPM dependencies to add to package.json.
Dependencies map[string]string `json:"dependencies,omitempty"`
// NPM dev-dependencies to add to package.json.
DevDependencies map[string]string `json:"devDependencies,omitempty"`
// NPM peer-dependencies to add to package.json.
PeerDependencies map[string]string `json:"peerDependencies,omitempty"`
// NPM resolutions to add to package.json
Resolutions map[string]string `json:"resolutions,omitempty"`
// A specific version of TypeScript to include in package.json.
TypeScriptVersion string `json:"typescriptVersion,omitempty"`
// A map containing overrides for module names to package names.
ModuleToPackage map[string]string `json:"moduleToPackage,omitempty"`
// Toggle compatibility mode for a specified target.
Compatibility string `json:"compatibility,omitempty"`
// Disable support for unions in output types.
DisableUnionOutputTypes bool `json:"disableUnionOutputTypes,omitempty"`
// An indicator for whether the package contains enums.
ContainsEnums bool `json:"containsEnums,omitempty"`
// A map allowing you to map the name of a provider to the name of the module encapsulating the provider.
ProviderNameToModuleName map[string]string `json:"providerNameToModuleName,omitempty"`
// The name of the plugin, which might be different from the package name.
PluginName string `json:"pluginName,omitempty"`
// The version of the plugin, which might be different from the version of the package..
PluginVersion string `json:"pluginVersion,omitempty"`
// Additional files to include in TypeScript compilation.
// These paths are added to the `files` section of the
// generated `tsconfig.json`. A typical use case for this is
// compiling hand-authored unit test files that check the
// generated code.
ExtraTypeScriptFiles []string `json:"extraTypeScriptFiles,omitempty"`
// Determines whether to make single-return-value methods return an output object or the single value.
LiftSingleValueMethodReturns bool `json:"liftSingleValueMethodReturns,omitempty"`
// Respect the Pkg.Version field in the schema
RespectSchemaVersion bool `json:"respectSchemaVersion,omitempty"`
// Experimental flag that permits `import type *` style code
// to be generated to optimize startup time of programs
// consuming the provider by minimizing the set of Node
// modules loaded at startup. Turning this on may currently
// generate non-compiling code for some providers; but if the
// code compiles it is safe to use. Also, turning this on
// requires TypeScript 3.8 or higher to compile the generated
// code.
UseTypeOnlyReferences bool `json:"useTypeOnlyReferences,omitempty"`
}
NodePackageInfo contains NodeJS-specific information for a package.