pulumi/pkg/codegen/internal/test/testdata
James Nugent e6981898eb
Update package import handling for Node.js (#7474)
* Allow non-pulumi imports for Node.js

Currently the code generator is assuming that Node.js dependencies are
following a naming scheme that is prefixed with `pulumi/`. If this is
not the case the generated import statement is incorrect.

This commit adds a map `ProviderNameToModuleName` to the language
definition that allows you to map the name of the extracted provider of
a dependency to a module name that the generator now uses to create the
import statement.

* Prepend "pulumi" to import names in Node.js SDK

It is common when writing multi-language components to have a module
name which conflicts with a provider name. This can produce unusable
code, since you cannot simultaneously import a package as `aws` and have
a namespace `aws`, for example.

This commit makes this situation much less likely, by renaming the
imported identifier for providers to `pulumiX` where it would
previously have been `x`.

This has an unfortunate side effect of making the examples in the
documentation slightly uglier, since import statements for third-party
packages are now of the form `import * as pulumiAws from "@pulumi/aws"`.
I don't see a way to discern whether code generation is for SDKs vs
examples however, and short of plumbing that through, I don't see a way
around this, so test expectations are updated accordingly.

Co-authored-by: Ben Schiborr <bschiborr@apple.com>
2021-07-16 10:27:20 -07:00
..
external-resource-schema Update package import handling for Node.js (#7474) 2021-07-16 10:27:20 -07:00
nested-module [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
nested-module-thirdparty [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
plain-schema-gh6957 Update package import handling for Node.js (#7474) 2021-07-16 10:27:20 -07:00
provider-config-schema [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
resource-args-python [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
schema Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
simple-enum-schema [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
simple-methods-schema Update package import handling for Node.js (#7474) 2021-07-16 10:27:20 -07:00
simple-plain-schema [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
simple-plain-schema-with-root-package [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
simple-resource-schema [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
simple-resource-schema-custom-pypackage-name [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
simple-yaml-schema [codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
aws-eks.pp
aws-eks.pp.cs
aws-eks.pp.go Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
aws-eks.pp.py Use input/output classes in program gen (#5086) 2020-08-06 15:09:23 -07:00
aws-eks.pp.ts [codegen/nodejs] Await invokes in async contexts. (#4598) 2020-05-11 10:21:56 -07:00
aws-fargate.pp
aws-fargate.pp.cs [codegen/*] Add support for resource options. (#4925) 2020-06-29 16:33:52 -07:00
aws-fargate.pp.go Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
aws-fargate.pp.py Ensure the correct qualified code is emitted for Python ResourceOptions (#5824) 2020-11-24 02:21:25 +00:00
aws-fargate.pp.ts [codegen/*] Add support for resource options. (#4925) 2020-06-29 16:33:52 -07:00
aws-s3-folder.pp
aws-s3-folder.pp.cs
aws-s3-folder.pp.go Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
aws-s3-folder.pp.py Use input/output classes in program gen (#5086) 2020-08-06 15:09:23 -07:00
aws-s3-folder.pp.ts [codegen/*] Improve range type binding + codegen. (#4552) 2020-05-04 15:04:35 -07:00
aws-s3-logging.pp
aws-s3-logging.pp.cs Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
aws-s3-logging.pp.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
aws-s3-logging.pp.py Use input/output classes in program gen (#5086) 2020-08-06 15:09:23 -07:00
aws-s3-logging.pp.ts Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
aws-webserver.pp
aws-webserver.pp.cs
aws-webserver.pp.go Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
aws-webserver.pp.py Use input/output classes in program gen (#5086) 2020-08-06 15:09:23 -07:00
aws-webserver.pp.ts HCL2/NodeJS: fix proxy apply lowering for promises (#4317) 2020-04-07 09:25:50 -07:00
aws.json Fix inconsistent object type naming. (#6686) 2021-04-15 19:03:28 -07:00
azure-native.json Discriminated unions in schema and programgen 2021-05-05 10:01:22 +02:00
azure-native.pp Discriminated unions in schema and programgen 2021-05-05 10:01:22 +02:00
azure-native.pp.cs Discriminated unions in schema and programgen 2021-05-05 10:01:22 +02:00
azure-native.pp.go Discriminated unions in schema and programgen 2021-05-05 10:01:22 +02:00
azure-native.pp.py Discriminated unions in schema and programgen 2021-05-05 10:01:22 +02:00
azure-native.pp.ts Discriminated unions in schema and programgen 2021-05-05 10:01:22 +02:00
azure-sa.pp Convert config params to outputs only if promise types are seen 2020-10-07 12:29:33 -07:00
azure-sa.pp.cs Convert config params to outputs only if promise types are seen 2020-10-07 12:29:33 -07:00
azure-sa.pp.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
azure-sa.pp.py Convert config params to outputs only if promise types are seen 2020-10-07 12:29:33 -07:00
azure-sa.pp.ts Convert config params to outputs only if promise types are seen 2020-10-07 12:29:33 -07:00
azure.json [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
kubernetes-operator.pp Use a package map where appropriate (#5127) 2020-08-06 19:09:18 -07:00
kubernetes-operator.pp.cs Fix C# program gen for Kubernetes examples (#5129) 2020-08-07 09:31:42 -06:00
kubernetes-operator.pp.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
kubernetes-operator.pp.py Remove UsesIOClasses check. (#5827) 2020-11-24 19:15:37 -06:00
kubernetes-operator.pp.ts Use a package map where appropriate (#5127) 2020-08-06 19:09:18 -07:00
kubernetes-pod.pp Use input/output classes in program gen (#5086) 2020-08-06 15:09:23 -07:00
kubernetes-pod.pp.cs Fix C# program gen for Kubernetes examples (#5129) 2020-08-07 09:31:42 -06:00
kubernetes-pod.pp.go Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
kubernetes-pod.pp.py Remove UsesIOClasses check. (#5827) 2020-11-24 19:15:37 -06:00
kubernetes-pod.pp.ts tests for kubernetes program generation (#5105) 2020-08-05 09:15:36 -07:00
kubernetes-template.pp Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
kubernetes-template.pp.cs Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
kubernetes-template.pp.go Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
kubernetes-template.pp.py Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
kubernetes-template.pp.ts Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
kubernetes.json tests for kubernetes program generation (#5105) 2020-08-05 09:15:36 -07:00
random-pet.pp [Go program gen]: namespaceless resources (#4915) 2020-06-29 18:10:34 -07:00
random-pet.pp.cs [Go program gen]: namespaceless resources (#4915) 2020-06-29 18:10:34 -07:00
random-pet.pp.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
random-pet.pp.py [Go program gen]: namespaceless resources (#4915) 2020-06-29 18:10:34 -07:00
random-pet.pp.ts [Go program gen]: namespaceless resources (#4915) 2020-06-29 18:10:34 -07:00
random.json [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
resource-options.pp [codegen/*] Add support for resource options. (#4925) 2020-06-29 16:33:52 -07:00
resource-options.pp.cs [codegen/*] Add support for resource options. (#4925) 2020-06-29 16:33:52 -07:00
resource-options.pp.go Reify Input and Optional types in the schema type system. (#7059) 2021-06-24 09:17:55 -07:00
resource-options.pp.py Ensure the correct qualified code is emitted for Python ResourceOptions (#5824) 2020-11-24 02:21:25 +00:00
resource-options.pp.ts [codegen/*] Add support for resource options. (#4925) 2020-06-29 16:33:52 -07:00
secret.pp [codegen/*] Add support for explicit secrets. (#4927) 2020-06-30 11:35:24 -07:00
secret.pp.cs [codegen/*] Add support for explicit secrets. (#4927) 2020-06-30 11:35:24 -07:00
secret.pp.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
secret.pp.py [codegen/*] Add support for explicit secrets. (#4927) 2020-06-30 11:35:24 -07:00
secret.pp.ts [codegen/*] Add support for explicit secrets. (#4927) 2020-06-30 11:35:24 -07:00
types.json [codegen] Add more type tests. (#7475) 2021-07-09 13:33:15 -07:00