From 20e5b33b4bcf9aa902aeae9ea34c93e15f8782bf Mon Sep 17 00:00:00 2001 From: aq17 Date: Mon, 5 Dec 2022 10:19:41 -0800 Subject: [PATCH] Revert "Merge #10831" This reverts commit 184903a06f9ab7d71d0f5b1547d6df9be2c95357, reversing changes made to 356d8ebf59c08eca03b7c11942151fe343b88069. --- pkg/codegen/nodejs/gen.go | 386 +++--------------- pkg/codegen/nodejs/gen_test.go | 48 --- pkg/codegen/testing/test/sdk_driver.go | 6 - .../nodejs/codegen-manifest.json | 3 - .../nodejs/tsconfig.json | 7 - .../nodejs/types/documentdb/index.ts | 3 - .../nodejs/types/documentdb/input.ts | 8 - .../nodejs/types/documentdb/output.ts | 36 -- .../nodejs/types/input.ts | 4 +- .../nodejs/types/output.ts | 32 +- .../cyclic-types/nodejs/tsconfig.json | 4 - .../cyclic-types/nodejs/types/input.ts | 1 - .../cyclic-types/nodejs/types/output.ts | 1 - .../dash-named-schema/nodejs/tsconfig.json | 4 - .../dash-named-schema/nodejs/types/input.ts | 1 - .../dash-named-schema/nodejs/types/output.ts | 1 - .../dashed-import-schema/nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 + .../nodejs/types/output.ts | 1 + .../different-enum/nodejs/tsconfig.json | 4 - .../different-enum/nodejs/types/input.ts | 1 + .../different-enum/nodejs/types/output.ts | 1 + .../enum-reference/nodejs/tsconfig.json | 4 - .../external-enum/nodejs/tsconfig.json | 4 - .../external-enum/nodejs/types/input.ts | 1 - .../external-enum/nodejs/types/output.ts | 1 - .../nodejs/tsconfig.json | 4 - .../nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../functions-secrets/nodejs/tsconfig.json | 4 - .../testdata/hyphen-url/nodejs/tsconfig.json | 4 - .../naming-collisions/nodejs/tsconfig.json | 4 - .../naming-collisions/nodejs/types/input.ts | 1 - .../naming-collisions/nodejs/types/output.ts | 1 - .../nodejs/tsconfig.json | 4 - .../nested-module/nodejs/tsconfig.json | 4 - .../nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../output-funcs/nodejs/tsconfig.json | 4 - .../output-funcs/nodejs/types/input.ts | 1 - .../output-funcs/nodejs/types/output.ts | 1 - .../plain-and-default/nodejs/tsconfig.json | 4 - .../plain-and-default/nodejs/types/input.ts | 1 - .../plain-and-default/nodejs/types/output.ts | 1 - .../nodejs/codegen-manifest.json | 6 - .../nodejs/tsconfig.json | 10 - .../nodejs/types/input.ts | 40 +- .../nodejs/types/mod1/index.ts | 3 - .../nodejs/types/mod1/input.ts | 23 -- .../nodejs/types/mod1/output.ts | 8 - .../nodejs/types/mod2/index.ts | 3 - .../nodejs/types/mod2/input.ts | 25 -- .../nodejs/types/mod2/output.ts | 8 - .../nodejs/types/output.ts | 8 +- .../nodejs/codegen-manifest.json | 6 - .../nodejs/tsconfig.json | 10 - .../nodejs/types/input.ts | 40 +- .../nodejs/types/mod1/index.ts | 3 - .../nodejs/types/mod1/input.ts | 23 -- .../nodejs/types/mod1/output.ts | 8 - .../nodejs/types/mod2/index.ts | 3 - .../nodejs/types/mod2/input.ts | 25 -- .../nodejs/types/mod2/output.ts | 8 - .../nodejs/types/output.ts | 8 +- .../plain-schema-gh6957/nodejs/tsconfig.json | 4 - .../plain-schema-gh6957/nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../nodejs/codegen-manifest.json | 3 - .../nodejs/tsconfig.json | 7 - .../nodejs/types/config/index.ts | 3 - .../nodejs/types/config/input.ts | 9 - .../nodejs/types/config/output.ts | 14 - .../nodejs/types/input.ts | 4 +- .../nodejs/types/output.ts | 9 +- .../regress-8403/nodejs/tsconfig.json | 4 - .../regress-8403/nodejs/types/input.ts | 1 - .../regress-8403/nodejs/types/output.ts | 1 - .../regress-node-8110/nodejs/tsconfig.json | 4 - .../regress-node-8110/nodejs/types/input.ts | 1 - .../regress-node-8110/nodejs/types/output.ts | 1 - .../replace-on-change/nodejs/tsconfig.json | 4 - .../replace-on-change/nodejs/types/input.ts | 1 - .../replace-on-change/nodejs/types/output.ts | 1 - .../nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../resource-args-python/nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../nodejs/tsconfig.json | 4 - .../testdata/secrets/nodejs/tsconfig.json | 4 - .../testdata/secrets/nodejs/types/input.ts | 1 - .../testdata/secrets/nodejs/types/output.ts | 1 - .../simple-enum-schema/nodejs/tsconfig.json | 4 - .../simple-enum-schema/nodejs/types/input.ts | 1 + .../simple-enum-schema/nodejs/types/output.ts | 1 + .../nodejs/tsconfig.json | 4 - .../nodejs/codegen-manifest.json | 3 - .../nodejs/tsconfig.json | 7 - .../nodejs/types/input.ts | 13 +- .../nodejs/types/nested/index.ts | 3 - .../nodejs/types/nested/input.ts | 17 - .../nodejs/types/nested/output.ts | 8 - .../nodejs/types/output.ts | 4 +- .../nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../simple-plain-schema/nodejs/tsconfig.json | 4 - .../simple-plain-schema/nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../nodejs/tsconfig.json | 4 - .../nodejs/types/input.ts | 1 - .../nodejs/types/output.ts | 1 - .../simple-yaml-schema/nodejs/tsconfig.json | 4 - .../simple-yaml-schema/nodejs/types/input.ts | 1 - .../simple-yaml-schema/nodejs/types/output.ts | 1 - .../type-references-resource/nodejs/README.md | 0 .../nodejs/codegen-manifest.json | 19 - .../type-references-resource/nodejs/index.ts | 30 -- .../nodejs/my_mod/index.ts | 25 -- .../nodejs/my_mod/triceratops.ts | 63 --- .../nodejs/package.json | 19 - .../nodejs/provider.ts | 44 -- .../nodejs/scripts/install-pulumi-plugin.js | 26 -- .../nodejs/tsconfig.json | 32 -- .../nodejs/types/index.ts | 13 - .../nodejs/types/input.ts | 11 - .../nodejs/types/my_mod/index.ts | 3 - .../nodejs/types/my_mod/input.ts | 10 - .../nodejs/types/my_mod/output.ts | 10 - .../nodejs/types/output.ts | 11 - .../nodejs/utilities.ts | 66 --- .../type-references-resource/schema.json | 47 --- pkg/codegen/testing/test/testdata/types.json | 3 - 142 files changed, 195 insertions(+), 1318 deletions(-) delete mode 100644 pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/README.md delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/codegen-manifest.json delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/triceratops.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/package.json delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/provider.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/scripts/install-pulumi-plugin.js delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/tsconfig.json delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/index.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/input.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/output.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/nodejs/utilities.ts delete mode 100644 pkg/codegen/testing/test/testdata/type-references-resource/schema.json diff --git a/pkg/codegen/nodejs/gen.go b/pkg/codegen/nodejs/gen.go index 3423952f6714..40241014db09 100644 --- a/pkg/codegen/nodejs/gen.go +++ b/pkg/codegen/nodejs/gen.go @@ -1545,80 +1545,46 @@ func (mod *modContext) genConfig(w io.Writer, variables []*schema.Property) erro return nil } -// getRelativePath returns a path to the top level of the package -// relative to directory passed in. You must pass in the name -// of a directory. If you provide a file name, like "index.ts", it's assumed -// to be a directory named "index.ts". -// It's a thin wrapper around the standard library's implementation. -func getRelativePath(dirname string) string { - var rel, err = filepath.Rel(dirname, "") +func (mod *modContext) getRelativePath() string { + rel, err := filepath.Rel(mod.mod, "") contract.Assert(err == nil) return path.Dir(filepath.ToSlash(rel)) } -// The parameter dirRoot is used as the relative path -func (mod *modContext) getRelativePath() string { - return getRelativePath(mod.mod) -} - -// sdkImports generates the imports at the top of a source file. -// This function is only intended to be called from resource files and -// at the index. For files nested in the `/types` folder, call -// sdkImportsForTypes instead. func (mod *modContext) sdkImports(nested, utilities bool) []string { - return mod.sdkImportsWithPath(nested, utilities, mod.mod) -} - -// sdkImportsWithPath generates the import functions at the top of each file. -// If nested is true, then the file is assumed not to be at the top-level i.e. -// it's located in a subfolder of the root, perhaps deeply nested. -// If utilities is true, then utility functions are imported. -// dirpath injects the directory name of the input file relative to the root of the package. -func (mod *modContext) sdkImportsWithPath(nested, utilities bool, dirpath string) []string { - // All files need to import the SDK. - var imports = []string{"import * as pulumi from \"@pulumi/pulumi\";"} - var relRoot = getRelativePath(dirpath) - // Add nested imports if enabled. + imports := []string{"import * as pulumi from \"@pulumi/pulumi\";"} + + relRoot := mod.getRelativePath() if nested { - imports = append(imports, mod.genNestedImports(relRoot)...) + imports = append(imports, []string{ + fmt.Sprintf(`import * as inputs from "%s/types/input";`, relRoot), + fmt.Sprintf(`import * as outputs from "%s/types/output";`, relRoot), + }...) + + if mod.pkg.Language["nodejs"].(NodePackageInfo).ContainsEnums { + code := `import * as enums from "%s/types/enums";` + if lookupNodePackageInfo(mod.pkg).UseTypeOnlyReferences { + code = `import type * as enums from "%s/types/enums";` + } + imports = append(imports, fmt.Sprintf(code, relRoot)) + } } - // Add utility imports if enabled. + if utilities { - imports = append(imports, utilitiesImport(relRoot)) + imports = append(imports, mod.utilitiesImport()) } return imports } -func utilitiesImport(relRoot string) string { +func (mod *modContext) utilitiesImport() string { + relRoot := mod.getRelativePath() return fmt.Sprintf("import * as utilities from \"%s/utilities\";", relRoot) } -// relRoot is the path that ajoins this module or file with the top-level -// of the repo. For example, if this file was located in "./foo/index.ts", -// then relRoot would be "..", since that's the path to the top-level directory. -func (mod *modContext) genNestedImports(relRoot string) []string { - // Always import all input and output types. - var imports = []string{ - fmt.Sprintf(`import * as inputs from "%s/types/input";`, relRoot), - fmt.Sprintf(`import * as outputs from "%s/types/output";`, relRoot), - } - // Next, if there are enums, then we import them too. - if mod.pkg.Language["nodejs"].(NodePackageInfo).ContainsEnums { - code := `import * as enums from "%s/types/enums";` - if lookupNodePackageInfo(mod.pkg).UseTypeOnlyReferences { - code = `import type * as enums from "%s/types/enums";` - } - imports = append(imports, fmt.Sprintf(code, relRoot)) - } - return imports -} - -// the parameter defaultNs is expected to be the top-level namespace. -// If its nil, then we skip importing types files, since they will not exist. -func (mod *modContext) buildImports() (codegen.StringSet, map[string]codegen.StringSet) { - var externalImports = codegen.NewStringSet() - var imports = map[string]codegen.StringSet{} +func (mod *modContext) genTypes() (string, string, error) { + externalImports, imports := codegen.NewStringSet(), map[string]codegen.StringSet{} + var hasDefaultObjects bool for _, t := range mod.types { if t.IsOverlay { // This type is generated by the provider, so no further action is required. @@ -1626,60 +1592,30 @@ func (mod *modContext) buildImports() (codegen.StringSet, map[string]codegen.Str } mod.getImports(t, externalImports, imports) - } - return externalImports, imports -} - -func (mod *modContext) genTypes() ([]*ioFile, error) { - var ( - inputFiles, outputFiles []*ioFile - err error - // Build a file tree out of the types, then emit them. - namespaces = mod.getNamespaces() - // Fetch the collection of imports needed by these modules. - externalImports, imports = mod.buildImports() - buildCtx = func(input bool) *ioContext { - return &ioContext{ - mod: mod, - input: input, - imports: imports, - externalImports: externalImports, - } + if codegen.IsProvideDefaultsFuncRequired(t) { + hasDefaultObjects = true } - - inputCtx = buildCtx(true) - outputCtx = buildCtx(false) - ) - // Convert the imports into a path relative to the root. - - var modifiedImports = map[string]codegen.StringSet{} - for name, value := range imports { - var modifiedName = path.Base(name) - // Special case: If we're importing the top-level of the module, leave as is. - if name == ".." { - modifiedImports[name] = value - continue - } - var relativePath = fmt.Sprintf("@/%s", modifiedName) - modifiedImports[relativePath] = value } - inputCtx.imports = modifiedImports - outputCtx.imports = modifiedImports - - // If there are no namespaces, then we generate empty - // input and output files. - if namespaces[""] == nil { - return nil, fmt.Errorf("encountered a nil top-level namespace, and namespaces can't be nil even if it is empty") + // Instantiating the default might require an environmental variable. This + // uses utilities. + if hasDefaultObjects { + externalImports.Add(fmt.Sprintf("import * as utilities from \"%s/utilities\";", mod.getRelativePath())) } - // Iterate through the namespaces, generating one per node in the tree. - if inputFiles, err = namespaces[""].intoIOFiles(inputCtx, "./types"); err != nil { - return nil, err + + inputs, outputs := &bytes.Buffer{}, &bytes.Buffer{} + mod.genHeader(inputs, mod.sdkImports(true, false), externalImports, imports) + mod.genHeader(outputs, mod.sdkImports(true, false), externalImports, imports) + + // Build a namespace tree out of the types, then emit them. + namespaces := mod.getNamespaces() + if err := mod.genNamespace(inputs, namespaces[""], true, 0); err != nil { + return "", "", err } - if outputFiles, err = namespaces[""].intoIOFiles(outputCtx, "./types"); err != nil { - return nil, err + if err := mod.genNamespace(outputs, namespaces[""], false, 0); err != nil { + return "", "", err } - return append(inputFiles, outputFiles...), nil + return inputs.String(), outputs.String(), nil } type namespace struct { @@ -1689,221 +1625,6 @@ type namespace struct { children []*namespace } -// The Debug method returns a string representation of -// the namespace for the purposes of debugging. -func (ns namespace) Debug() string { - var children []string - for _, child := range ns.children { - children = append(children, child.name) - } - var childrenStr = strings.Join(children, "\t\n") - return fmt.Sprintf( - "Namespace %s:\n\tTypes: %d\n\tEnums: %d\n\tChildren:\n%s", - ns.name, - len(ns.types), - len(ns.enums), - childrenStr, - ) -} - -// ioContext defines a set of parameters used when generating input/output -// type definitions. These parameters are stable no matter which directory -// is getting generated. -type ioContext struct { - mod *modContext - input bool - imports map[string]codegen.StringSet - externalImports codegen.StringSet -} - -// filename returns the unique name of the input/output file -// given a directory root. -func (ctx *ioContext) filename(dirRoot string) string { - var fname = fmt.Sprintf("%s.ts", ctx.filetype()) - return path.Join(dirRoot, fname) -} - -func (ctx *ioContext) filetype() string { - if ctx.input { - return "input" - } - return "output" -} - -// intoIOFiles converts this namespace into one or more files. -// It recursively builds one file for each node in the tree. -// If ctx.input=true, then it builds input types. Otherwise, it -// builds output types. -// The parameters in ctx are stable regardless of the depth of recursion, -// but parent is expected to change with each recursive call. -func (ns *namespace) intoIOFiles(ctx *ioContext, parent string) ([]*ioFile, error) { - // We generate the input and output namespaces when there are enums, - // regardless of whether they are empty. - if ns == nil { - return nil, fmt.Errorf("Generating IO files for a nil namespace") - } - - // We want to organize the items in the source file by alphabetical order. - // Before we go any further, sort the items so downstream calls don't have to. - ns.sortItems() - - // Declare a new file to store the contents exposed at this directory level. - var dirRoot = path.Join(parent, ns.name) - var file, err = ns.genOwnedTypes(ctx, dirRoot) - if err != nil { - return nil, err - } - var files = []*ioFile{file} - - // We have successfully written all types at this level to - // input.ts/output.ts. - // Next, we want to recurse to the next directory level. - // We also need to write the index.file at this level (only once), - // and when we do, we need to re-export the items subdirectories. - children, err := ns.genNestedTypes(ctx, dirRoot) - if err != nil { - return files, err - } - files = append(files, children...) - // Lastly, we write the index file for this directory once. - // We don't want to generate the file twice, when this function is called - // with input=true and again when input=false, so we only generate it - // when input=true. - // As a special case, we skip the top-level directory /types/, since that - // is written elsewhere. - if parent != "./types" && ctx.input { - var indexFile = ns.genIndexFile(ctx, dirRoot) - files = append(files, indexFile) - } - return files, nil -} - -// sortItems will sort each of the internal slices of this object. -func (ns *namespace) sortItems() { - sort.Slice(ns.types, func(i, j int) bool { - return objectTypeLessThan(ns.types[i], ns.types[j]) - }) - sort.Slice(ns.enums, func(i, j int) bool { - return tokenToName(ns.enums[i].Token) < tokenToName(ns.enums[j].Token) - }) - sort.Slice(ns.children, func(i, j int) bool { - return ns.children[i].name < ns.children[j].name - }) -} - -// genOwnedTypes generates the types for the file in the current context. -// The file is unique to the ioContext (either input/output) and the current -// directory (dirRoot). It skips over types that are neither input nor output types. -func (ns *namespace) genOwnedTypes(ctx *ioContext, dirRoot string) (*ioFile, error) { - // file is either an input file or an output file. - var file = newIOFile(ctx.filename(dirRoot)) - // We start every file with the header information. - ctx.mod.genHeader( - file.writer(), - ctx.mod.sdkImportsWithPath(true, true, dirRoot), - ctx.externalImports, - ctx.imports, - ) - // Next, we recursively export the nested types at each subdirectory. - for _, child := range ns.children { - // Defensive coding: child should never be null, but - // child.intoIOFiles will break if it is. - if child == nil { - continue - } - fmt.Fprintf(file.writer(), "export * as %[1]s from \"./%[1]s/%[2]s\";\n", child.name, ctx.filetype()) - } - - // Now, we write out the types declared at this directory - // level to the file. - for i, t := range ns.types { - var isInputType = ctx.input && ctx.mod.details(t).inputType - var isOutputType = !ctx.input && ctx.mod.details(t).outputType - // Only write input and output types. - if isInputType || isOutputType { - if err := ctx.mod.genType(file.writer(), t, ctx.input, 0); err != nil { - return file, err - } - if i != len(ns.types)-1 { - fmt.Fprintf(file.writer(), "\n") - } - } - } - return file, nil -} - -// genNestedTypes will recurse to child namespaces and generate those files. -// It will also generate the index file for this namespace, re-exporting -// identifiers in child namespaces as they are created. -func (ns *namespace) genNestedTypes(ctx *ioContext, dirRoot string) ([]*ioFile, error) { - var files []*ioFile - for _, child := range ns.children { - // Defensive coding: child should never be null, but - // child.intoIOFiles will break if it is. - if child == nil { - continue - } - // At this level, we export any nested definitions from - // the next level. - nestedFiles, err := child.intoIOFiles(ctx, dirRoot) - if err != nil { - return nil, err - } - // Collect these files to return. - files = append(files, nestedFiles...) - } - return files, nil -} - -// genIndexTypes generates an index.ts file for this directory. It must be called -// only once. It exports the files defined at this level in input.ts and output.ts, -// and it exposes the types in all submodules one level down. -func (ns *namespace) genIndexFile(ctx *ioContext, dirRoot string) *ioFile { - var indexPath = path.Join(dirRoot, "index.ts") - var file = newIOFile(indexPath) - ctx.mod.genHeader(file.writer(), nil, nil, nil) - // Export the types defined at the current level. - // Now, recursively export the items in each submodule. - for _, child := range ns.children { - // Defensive coding: child should never be null, but - // child.intoIOFiles will break if it is. - if child == nil { - continue - } - - fmt.Fprintf(file.writer(), "export * as %[1]s from \"./%[1]s/%[2]s\";\n", child.name, ctx.filetype()) - } - return file -} - -// An ioFile represents a file containing Input/Output type definitions. -type ioFile struct { - // Each file has a name relative to the top-level directory. - filename string - // This writer stores the contents of the file as we build it incrementally. - buffer *bytes.Buffer -} - -// newIOFile constructs a new ioFile -func newIOFile(name string) *ioFile { - return &ioFile{ - filename: name, - buffer: bytes.NewBuffer(nil), - } -} - -func (f *ioFile) name() string { - return f.filename -} - -func (f *ioFile) writer() io.Writer { - return f.buffer -} - -func (f *ioFile) contents() []byte { - return f.buffer.Bytes() -} - func (mod *modContext) getNamespaces() map[string]*namespace { namespaces := map[string]*namespace{} var getNamespace func(string) *namespace @@ -1944,14 +1665,6 @@ func (mod *modContext) getNamespaces() map[string]*namespace { ns.types = append(ns.types, t) } - // We need to ensure the top-level namespace is always populated, even - // if there are no types to export. - if _, ok := namespaces[""]; !ok { - namespaces[""] = &namespace{ - name: "", - } - } - return namespaces } @@ -2192,13 +1905,12 @@ func (mod *modContext) gen(fs codegen.Fs) error { // Nested types // Importing enums always imports inputs and outputs, so if we have enums we generate inputs and outputs if len(mod.types) > 0 || (mod.pkg.Language["nodejs"].(NodePackageInfo).ContainsEnums && mod.mod == "types") { - files, err := mod.genTypes() + input, output, err := mod.genTypes() if err != nil { return err } - for _, file := range files { - fs.Add(file.name(), file.contents()) - } + fs.Add(path.Join(modDir, "input.ts"), []byte(input)) + fs.Add(path.Join(modDir, "output.ts"), []byte(output)) } // Index @@ -2236,10 +1948,10 @@ func (mod *modContext) genIndex(exports []fileInfo) string { var imports []string // Include the SDK import if we'll be registering module resources. if len(mod.resources) != 0 { - imports = mod.sdkImports(false, true) + imports = mod.sdkImports(false /*nested*/, true /*utilities*/) } else if len(children) > 0 || len(mod.functions) > 0 { // Even if there are no resources, exports ref utilities. - imports = append(imports, utilitiesImport(mod.getRelativePath())) + imports = append(imports, mod.utilitiesImport()) } mod.genHeader(w, imports, nil, nil) @@ -2583,7 +2295,6 @@ func genTypeScriptProjectFile(info NodePackageInfo, files codegen.Fs) string { fmt.Fprintf(w, `{ "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -2594,9 +2305,6 @@ func genTypeScriptProjectFile(info NodePackageInfo, files codegen.Fs) string { "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/nodejs/gen_test.go b/pkg/codegen/nodejs/gen_test.go index dc791289f197..1c6289de4032 100644 --- a/pkg/codegen/nodejs/gen_test.go +++ b/pkg/codegen/nodejs/gen_test.go @@ -236,51 +236,3 @@ func Test_isStringType(t *testing.T) { }) } } - -// This test asserts that getRelativePath() -// returns the right relative path. This smoke test -// functions to pin the expected behavior to prevent regressions. -func TestGetRelativePath(t *testing.T) { - t.Parallel() - type TestCase struct { - filename string - expected string - } - // Recall that arguments are assumed to be directory names, - // even if they contain an extension. - var cases = []TestCase{ - { - filename: "foo.ts", - expected: "..", - }, { - filename: "foo/bar", - expected: "../..", - }, { - filename: "types/accessanalyzer/input", - expected: "../../..", - }, { - filename: "types/accessanalyzer/nested/input.ts", - expected: "../../../..", - }, { - filename: "types", - expected: "..", - }, { - filename: "./types/aws", - expected: "../..", - }, { - filename: "./types", - expected: "..", - }} - for _, tc := range cases { - var observed = getRelativePath(tc.filename) - require.Equal( - t, - tc.expected, - observed, - "Case (%s): Expected %s, Observed %s", - tc.filename, - tc.expected, - observed, - ) - } -} diff --git a/pkg/codegen/testing/test/sdk_driver.go b/pkg/codegen/testing/test/sdk_driver.go index 259cd3e4d5b9..a105126bb887 100644 --- a/pkg/codegen/testing/test/sdk_driver.go +++ b/pkg/codegen/testing/test/sdk_driver.go @@ -164,12 +164,6 @@ var PulumiPulumiSDKTests = []*SDKTest{ Description: "A resource with the same name as its property", SkipCompileCheck: codegen.NewStringSet(dotnet, nodejs), }, - { - Directory: "type-references-resource", - Description: "An instance where a type references a resource", - Skip: allLanguages.Except("nodejs/any"), - // SkipCompileCheck: codegen.NewStringSet(dotnet, golang, python), - }, { Directory: "hyphen-url", Description: "A resource url with a hyphen in its path", diff --git a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/codegen-manifest.json b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/codegen-manifest.json index bb356f455c4b..6d9fbb678803 100644 --- a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/codegen-manifest.json @@ -8,9 +8,6 @@ "provider.ts", "scripts/install-pulumi-plugin.js", "tsconfig.json", - "types/documentdb/index.ts", - "types/documentdb/input.ts", - "types/documentdb/output.ts", "types/index.ts", "types/input.ts", "types/output.ts", diff --git a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/tsconfig.json index d95d956a1532..db69a22a00ce 100644 --- a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ @@ -21,9 +17,6 @@ "documentdb/sqlResourceSqlContainer.ts", "index.ts", "provider.ts", - "types/documentdb/index.ts", - "types/documentdb/input.ts", - "types/documentdb/output.ts", "types/index.ts", "types/input.ts", "types/output.ts", diff --git a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/index.ts b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/index.ts deleted file mode 100644 index b7b2ea440d9f..000000000000 --- a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - diff --git a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/input.ts b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/input.ts deleted file mode 100644 index e0c860f46c12..000000000000 --- a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/input.ts +++ /dev/null @@ -1,8 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - diff --git a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/output.ts b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/output.ts deleted file mode 100644 index 18446cfc0823..000000000000 --- a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/documentdb/output.ts +++ /dev/null @@ -1,36 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - -export interface CompositePathResponse { - /** - * Sort order for composite paths. - */ - order?: string; - /** - * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) - */ - path?: string; -} - -/** - * Cosmos DB indexing policy - */ -export interface IndexingPolicyResponse { - /** - * List of composite path list - */ - compositeIndexes?: outputs.documentdb.CompositePathResponse[][]; -} - -export interface SqlContainerGetPropertiesResponseResource { - /** - * The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container - */ - indexingPolicy?: outputs.documentdb.IndexingPolicyResponse; -} - diff --git a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/input.ts index 7958b126ac7d..311e0b376968 100644 --- a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/input.ts @@ -4,6 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; -export * as documentdb from "./documentdb/input"; +export namespace documentdb { +} diff --git a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/output.ts index e3a208c41184..a57a6887c16c 100644 --- a/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/azure-native-nested-types/nodejs/types/output.ts @@ -4,6 +4,34 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; -export * as documentdb from "./documentdb/output"; +export namespace documentdb { + export interface CompositePathResponse { + /** + * Sort order for composite paths. + */ + order?: string; + /** + * The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) + */ + path?: string; + } + + /** + * Cosmos DB indexing policy + */ + export interface IndexingPolicyResponse { + /** + * List of composite path list + */ + compositeIndexes?: outputs.documentdb.CompositePathResponse[][]; + } + + export interface SqlContainerGetPropertiesResponseResource { + /** + * The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container + */ + indexingPolicy?: outputs.documentdb.IndexingPolicyResponse; + } + +} diff --git a/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/tsconfig.json index 86410fd0afff..6bb3117a6aef 100644 --- a/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/types/input.ts index efe5fda0c738..a277306fc819 100644 --- a/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/types/input.ts @@ -4,5 +4,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/types/output.ts index efe5fda0c738..a277306fc819 100644 --- a/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/cyclic-types/nodejs/types/output.ts @@ -4,5 +4,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/tsconfig.json index e2d149792e4b..63b822f490aa 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/types/input.ts index f74a299b5e5f..50af1ceddab5 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface TopLevelArgs { buzz?: pulumi.Input; diff --git a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/types/output.ts index 6f67e6c37c70..7f6f5354ebd6 100644 --- a/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/dash-named-schema/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface TopLevel { buzz?: string; diff --git a/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/tsconfig.json index 6b7fd81ee898..a363ab1f9b2e 100644 --- a/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/types/input.ts index fcefd058f114..5e35f2f8f160 100644 --- a/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/types/input.ts @@ -5,6 +5,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; + import * as utilities from "../utilities"; export interface ContainerArgs { diff --git a/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/types/output.ts index 2ed273ed9dc5..a1c27174dff9 100644 --- a/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/dashed-import-schema/nodejs/types/output.ts @@ -5,6 +5,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; + import * as utilities from "../utilities"; export interface Container { diff --git a/pkg/codegen/testing/test/testdata/different-enum/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/different-enum/nodejs/tsconfig.json index 6b7fd81ee898..a363ab1f9b2e 100644 --- a/pkg/codegen/testing/test/testdata/different-enum/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/different-enum/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/different-enum/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/different-enum/nodejs/types/input.ts index fcefd058f114..5e35f2f8f160 100644 --- a/pkg/codegen/testing/test/testdata/different-enum/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/different-enum/nodejs/types/input.ts @@ -5,6 +5,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; + import * as utilities from "../utilities"; export interface ContainerArgs { diff --git a/pkg/codegen/testing/test/testdata/different-enum/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/different-enum/nodejs/types/output.ts index 2ed273ed9dc5..a1c27174dff9 100644 --- a/pkg/codegen/testing/test/testdata/different-enum/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/different-enum/nodejs/types/output.ts @@ -5,6 +5,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; + import * as utilities from "../utilities"; export interface Container { diff --git a/pkg/codegen/testing/test/testdata/enum-reference/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/enum-reference/nodejs/tsconfig.json index 55e6eff32591..253ff9b94ac2 100644 --- a/pkg/codegen/testing/test/testdata/enum-reference/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/enum-reference/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/external-enum/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/external-enum/nodejs/tsconfig.json index 5da69d738206..ae729c26ccf1 100644 --- a/pkg/codegen/testing/test/testdata/external-enum/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/external-enum/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/external-enum/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/external-enum/nodejs/types/input.ts index b9997a16405a..176b5ce13afe 100644 --- a/pkg/codegen/testing/test/testdata/external-enum/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/external-enum/nodejs/types/input.ts @@ -5,5 +5,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/external-enum/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/external-enum/nodejs/types/output.ts index b9997a16405a..176b5ce13afe 100644 --- a/pkg/codegen/testing/test/testdata/external-enum/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/external-enum/nodejs/types/output.ts @@ -5,5 +5,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/external-node-compatibility/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/external-node-compatibility/nodejs/tsconfig.json index 7161a2622dd2..2b896e90f6fe 100644 --- a/pkg/codegen/testing/test/testdata/external-node-compatibility/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/external-node-compatibility/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/tsconfig.json index 6dc424dca798..b490e322b179 100644 --- a/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/types/input.ts index 71da4cf9ccfc..fccf3e175d96 100644 --- a/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; import * as pulumiRandom from "@pulumi/random"; diff --git a/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/types/output.ts index e026d7865101..714aa6b393e4 100644 --- a/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/external-resource-schema/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; import * as pulumiRandom from "@pulumi/random"; diff --git a/pkg/codegen/testing/test/testdata/functions-secrets/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/functions-secrets/nodejs/tsconfig.json index dded1c7c6c64..effb4ad7b246 100644 --- a/pkg/codegen/testing/test/testdata/functions-secrets/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/functions-secrets/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/hyphen-url/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/hyphen-url/nodejs/tsconfig.json index 4dd5b4972106..af7953c23573 100644 --- a/pkg/codegen/testing/test/testdata/hyphen-url/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/hyphen-url/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/tsconfig.json index 982b2533a963..580c6b03ddba 100644 --- a/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/types/input.ts index b9997a16405a..176b5ce13afe 100644 --- a/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/types/input.ts @@ -5,5 +5,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/types/output.ts index b9997a16405a..176b5ce13afe 100644 --- a/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/naming-collisions/nodejs/types/output.ts @@ -5,5 +5,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/nested-module-thirdparty/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/nested-module-thirdparty/nodejs/tsconfig.json index 422f5aa58e17..c947b95045f8 100644 --- a/pkg/codegen/testing/test/testdata/nested-module-thirdparty/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/nested-module-thirdparty/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/nested-module/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/nested-module/nodejs/tsconfig.json index 15f15b7345fb..d4e72d54ecae 100644 --- a/pkg/codegen/testing/test/testdata/nested-module/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/nested-module/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/tsconfig.json index 2dc5e6e81625..7e575cc7a849 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/types/input.ts index bdcafac05b74..2ffa9d559dff 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/types/input.ts @@ -5,7 +5,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; /** * Configuration filters diff --git a/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/types/output.ts index e9b2c5a7c92f..5cb5a6753c21 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/output-funcs-edgeorder/nodejs/types/output.ts @@ -5,7 +5,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; /** * Availability information of a product system. diff --git a/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/tsconfig.json index b25ec71a3f49..cc64437a5595 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/types/input.ts index 1c3b957d84ae..df48c5253e10 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface GetAmiIdsFilter { name: string; diff --git a/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/types/output.ts index ff7bb8563a2a..4d2e3f38de57 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/output-funcs-tfbridge20/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface GetAmiIdsFilter { name: string; diff --git a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/tsconfig.json index 45bcb384737a..5ea3ffc6d732 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/types/input.ts index d46e0bbb393d..b7e782170aa2 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; /** * Bastion Shareable Link. diff --git a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/types/output.ts index bdd2962eebc3..37867af15a5f 100644 --- a/pkg/codegen/testing/test/testdata/output-funcs/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/output-funcs/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; /** * Ssis environment reference. diff --git a/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/tsconfig.json index 3da835f281fc..42e418910eeb 100644 --- a/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/types/input.ts index b9997a16405a..176b5ce13afe 100644 --- a/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/types/input.ts @@ -5,5 +5,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/types/output.ts index b9997a16405a..176b5ce13afe 100644 --- a/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/plain-and-default/nodejs/types/output.ts @@ -5,5 +5,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/codegen-manifest.json b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/codegen-manifest.json index dbddbd48ce95..b3e8bd48b335 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/codegen-manifest.json @@ -11,12 +11,6 @@ "tsconfig.json", "types/index.ts", "types/input.ts", - "types/mod1/index.ts", - "types/mod1/input.ts", - "types/mod1/output.ts", - "types/mod2/index.ts", - "types/mod2/input.ts", - "types/mod2/output.ts", "types/output.ts", "utilities.ts" ] diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/tsconfig.json index a7c273fa3b97..9ed19d14809e 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ @@ -24,12 +20,6 @@ "provider.ts", "types/index.ts", "types/input.ts", - "types/mod1/index.ts", - "types/mod1/input.ts", - "types/mod1/output.ts", - "types/mod2/index.ts", - "types/mod2/input.ts", - "types/mod2/output.ts", "types/output.ts", "utilities.ts" ] diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/input.ts index 71ffc546be27..289f4e94771d 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/input.ts @@ -4,10 +4,9 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; + import * as utilities from "../utilities"; -export * as mod1 from "./mod1/input"; -export * as mod2 from "./mod2/input"; /** * BETA FEATURE - Options to configure the Helm Release resource. */ @@ -147,3 +146,40 @@ export function typArgsProvideDefaults(val: TypArgs): TypArgs { val: (val.val) ?? "mod main", }; } +export namespace mod1 { + /** + * A test for namespaces (mod 1) + */ + export interface TypArgs { + val?: pulumi.Input; + } + /** + * typArgsProvideDefaults sets the appropriate defaults for TypArgs + */ + export function typArgsProvideDefaults(val: TypArgs): TypArgs { + return { + ...val, + val: (val.val) ?? (utilities.getEnv("PULUMI_EXAMPLE_MOD1_DEFAULT") || "mod1"), + }; + } +} + +export namespace mod2 { + /** + * A test for namespaces (mod 2) + */ + export interface TypArgs { + mod1?: pulumi.Input; + val?: pulumi.Input; + } + /** + * typArgsProvideDefaults sets the appropriate defaults for TypArgs + */ + export function typArgsProvideDefaults(val: TypArgs): TypArgs { + return { + ...val, + mod1: (val.mod1 ? pulumi.output(val.mod1).apply(inputs.mod1.typArgsProvideDefaults) : undefined), + val: (val.val) ?? "mod2", + }; + } +} diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/index.ts b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/index.ts deleted file mode 100644 index b7b2ea440d9f..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/input.ts b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/input.ts deleted file mode 100644 index de43fdfec91a..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/input.ts +++ /dev/null @@ -1,23 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - -/** - * A test for namespaces (mod 1) - */ -export interface TypArgs { - val?: pulumi.Input; -} -/** - * typArgsProvideDefaults sets the appropriate defaults for TypArgs - */ -export function typArgsProvideDefaults(val: TypArgs): TypArgs { - return { - ...val, - val: (val.val) ?? (utilities.getEnv("PULUMI_EXAMPLE_MOD1_DEFAULT") || "mod1"), - }; -} diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/output.ts b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/output.ts deleted file mode 100644 index e0c860f46c12..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod1/output.ts +++ /dev/null @@ -1,8 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/index.ts b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/index.ts deleted file mode 100644 index b7b2ea440d9f..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/input.ts b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/input.ts deleted file mode 100644 index 0b64bcae655a..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/input.ts +++ /dev/null @@ -1,25 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - -/** - * A test for namespaces (mod 2) - */ -export interface TypArgs { - mod1?: pulumi.Input; - val?: pulumi.Input; -} -/** - * typArgsProvideDefaults sets the appropriate defaults for TypArgs - */ -export function typArgsProvideDefaults(val: TypArgs): TypArgs { - return { - ...val, - mod1: (val.mod1 ? pulumi.output(val.mod1).apply(inputs.mod1.typArgsProvideDefaults) : undefined), - val: (val.val) ?? "mod2", - }; -} diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/output.ts b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/output.ts deleted file mode 100644 index e0c860f46c12..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/mod2/output.ts +++ /dev/null @@ -1,8 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - diff --git a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/output.ts index 92e2a23376b2..dc79a613d6d5 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/plain-object-defaults/nodejs/types/output.ts @@ -4,10 +4,9 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; + import * as utilities from "../utilities"; -export * as mod1 from "./mod1/output"; -export * as mod2 from "./mod2/output"; /** * Options for tuning the Kubernetes client used by a Provider. */ @@ -34,3 +33,8 @@ export function kubeClientSettingsProvideDefaults(val: KubeClientSettings): Kube }; } +export namespace mod1 { +} + +export namespace mod2 { +} diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/codegen-manifest.json b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/codegen-manifest.json index dbddbd48ce95..b3e8bd48b335 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/codegen-manifest.json @@ -11,12 +11,6 @@ "tsconfig.json", "types/index.ts", "types/input.ts", - "types/mod1/index.ts", - "types/mod1/input.ts", - "types/mod1/output.ts", - "types/mod2/index.ts", - "types/mod2/input.ts", - "types/mod2/output.ts", "types/output.ts", "utilities.ts" ] diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/tsconfig.json index a7c273fa3b97..9ed19d14809e 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ @@ -24,12 +20,6 @@ "provider.ts", "types/index.ts", "types/input.ts", - "types/mod1/index.ts", - "types/mod1/input.ts", - "types/mod1/output.ts", - "types/mod2/index.ts", - "types/mod2/input.ts", - "types/mod2/output.ts", "types/output.ts", "utilities.ts" ] diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/input.ts index 71ffc546be27..e127fd599940 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/input.ts @@ -4,10 +4,9 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; + import * as utilities from "../utilities"; -export * as mod1 from "./mod1/input"; -export * as mod2 from "./mod2/input"; /** * BETA FEATURE - Options to configure the Helm Release resource. */ @@ -147,3 +146,40 @@ export function typArgsProvideDefaults(val: TypArgs): TypArgs { val: (val.val) ?? "mod main", }; } +export namespace mod1 { + /** + * A test for namespaces (mod 1) + */ + export interface TypArgs { + val?: pulumi.Input; + } + /** + * typArgsProvideDefaults sets the appropriate defaults for TypArgs + */ + export function typArgsProvideDefaults(val: TypArgs): TypArgs { + return { + ...val, + val: (val.val) ?? "mod1", + }; + } +} + +export namespace mod2 { + /** + * A test for namespaces (mod 2) + */ + export interface TypArgs { + mod1?: pulumi.Input; + val?: pulumi.Input; + } + /** + * typArgsProvideDefaults sets the appropriate defaults for TypArgs + */ + export function typArgsProvideDefaults(val: TypArgs): TypArgs { + return { + ...val, + mod1: (val.mod1 ? pulumi.output(val.mod1).apply(inputs.mod1.typArgsProvideDefaults) : undefined), + val: (val.val) ?? "mod2", + }; + } +} diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/index.ts b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/index.ts deleted file mode 100644 index b7b2ea440d9f..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/input.ts b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/input.ts deleted file mode 100644 index effc6a0be847..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/input.ts +++ /dev/null @@ -1,23 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - -/** - * A test for namespaces (mod 1) - */ -export interface TypArgs { - val?: pulumi.Input; -} -/** - * typArgsProvideDefaults sets the appropriate defaults for TypArgs - */ -export function typArgsProvideDefaults(val: TypArgs): TypArgs { - return { - ...val, - val: (val.val) ?? "mod1", - }; -} diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/output.ts b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/output.ts deleted file mode 100644 index e0c860f46c12..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod1/output.ts +++ /dev/null @@ -1,8 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/index.ts b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/index.ts deleted file mode 100644 index b7b2ea440d9f..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/input.ts b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/input.ts deleted file mode 100644 index 0b64bcae655a..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/input.ts +++ /dev/null @@ -1,25 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - -/** - * A test for namespaces (mod 2) - */ -export interface TypArgs { - mod1?: pulumi.Input; - val?: pulumi.Input; -} -/** - * typArgsProvideDefaults sets the appropriate defaults for TypArgs - */ -export function typArgsProvideDefaults(val: TypArgs): TypArgs { - return { - ...val, - mod1: (val.mod1 ? pulumi.output(val.mod1).apply(inputs.mod1.typArgsProvideDefaults) : undefined), - val: (val.val) ?? "mod2", - }; -} diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/output.ts b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/output.ts deleted file mode 100644 index e0c860f46c12..000000000000 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/mod2/output.ts +++ /dev/null @@ -1,8 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - diff --git a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/output.ts index 92e2a23376b2..dc79a613d6d5 100644 --- a/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/plain-object-disable-defaults/nodejs/types/output.ts @@ -4,10 +4,9 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; + import * as utilities from "../utilities"; -export * as mod1 from "./mod1/output"; -export * as mod2 from "./mod2/output"; /** * Options for tuning the Kubernetes client used by a Provider. */ @@ -34,3 +33,8 @@ export function kubeClientSettingsProvideDefaults(val: KubeClientSettings): Kube }; } +export namespace mod1 { +} + +export namespace mod2 { +} diff --git a/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/tsconfig.json index bd3a1d1fc00a..99579b972141 100644 --- a/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/types/input.ts index 7aac455e2f8e..e88c590f69c5 100644 --- a/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface FooArgs { a?: pulumi.Input; diff --git a/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/types/output.ts index efe5fda0c738..a277306fc819 100644 --- a/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/plain-schema-gh6957/nodejs/types/output.ts @@ -4,5 +4,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/codegen-manifest.json b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/codegen-manifest.json index d0d1a142860e..ee4317032e08 100644 --- a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/codegen-manifest.json @@ -9,9 +9,6 @@ "provider.ts", "scripts/install-pulumi-plugin.js", "tsconfig.json", - "types/config/index.ts", - "types/config/input.ts", - "types/config/output.ts", "types/enums/index.ts", "types/index.ts", "types/input.ts", diff --git a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/tsconfig.json index 37e41c201314..016bd0182259 100644 --- a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ @@ -22,9 +18,6 @@ "funcWithAllOptionalInputs.ts", "index.ts", "provider.ts", - "types/config/index.ts", - "types/config/input.ts", - "types/config/output.ts", "types/enums/index.ts", "types/index.ts", "types/input.ts", diff --git a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/index.ts b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/index.ts deleted file mode 100644 index b7b2ea440d9f..000000000000 --- a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - diff --git a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/input.ts b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/input.ts deleted file mode 100644 index 3fd1c4e5dae1..000000000000 --- a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/input.ts +++ /dev/null @@ -1,9 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as enums from "../../types/enums"; -import * as utilities from "../../utilities"; - diff --git a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/output.ts b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/output.ts deleted file mode 100644 index 69a6e8b1b030..000000000000 --- a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/config/output.ts +++ /dev/null @@ -1,14 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as enums from "../../types/enums"; -import * as utilities from "../../utilities"; - -export interface Sandwich { - bread?: string; - veggies?: string[]; -} - diff --git a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/input.ts index 6ff6d05d3e97..a43cbaa66807 100644 --- a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/input.ts @@ -5,6 +5,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; -export * as config from "./config/input"; +export namespace config { +} diff --git a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/output.ts index 23ef29cbdef0..80f20da1edf0 100644 --- a/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/provider-config-schema/nodejs/types/output.ts @@ -5,11 +5,16 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; -export * as config from "./config/output"; export interface Child { age?: number; name?: string; } +export namespace config { + export interface Sandwich { + bread?: string; + veggies?: string[]; + } + +} diff --git a/pkg/codegen/testing/test/testdata/regress-8403/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/regress-8403/nodejs/tsconfig.json index 8209dedaf392..45ff3f07a77c 100644 --- a/pkg/codegen/testing/test/testdata/regress-8403/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/regress-8403/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/regress-8403/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/regress-8403/nodejs/types/input.ts index efe5fda0c738..a277306fc819 100644 --- a/pkg/codegen/testing/test/testdata/regress-8403/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/regress-8403/nodejs/types/input.ts @@ -4,5 +4,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/regress-8403/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/regress-8403/nodejs/types/output.ts index 7eac2cbfeb91..7990bed12f46 100644 --- a/pkg/codegen/testing/test/testdata/regress-8403/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/regress-8403/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface GetCustomDbRolesResult { } diff --git a/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/tsconfig.json index 3f293b469740..a9470134b2ac 100644 --- a/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/types/input.ts index b9997a16405a..176b5ce13afe 100644 --- a/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/types/input.ts @@ -5,5 +5,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/types/output.ts index b9997a16405a..176b5ce13afe 100644 --- a/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/regress-node-8110/nodejs/types/output.ts @@ -5,5 +5,4 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; diff --git a/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/tsconfig.json index 9eb841aad40d..74d2b01d605a 100644 --- a/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/types/input.ts index 6966d245b39d..2712424d1c1a 100644 --- a/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; import {Cat, Dog} from ".."; diff --git a/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/types/output.ts index 273422fbe3a2..f77f44dd45f3 100644 --- a/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/replace-on-change/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; import {Cat, Dog} from ".."; diff --git a/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/tsconfig.json index dc46369ac6d8..6c3db385d156 100644 --- a/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/types/input.ts index 40b500952cfd..2fdb3ef7bc0a 100644 --- a/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface PetArgs { name?: pulumi.Input; diff --git a/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/types/output.ts index 38a8f8959fb2..64cd2c62ee0d 100644 --- a/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/resource-args-python-case-insensitive/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface Pet { name?: string; diff --git a/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/tsconfig.json index dc46369ac6d8..6c3db385d156 100644 --- a/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/types/input.ts index 40b500952cfd..2fdb3ef7bc0a 100644 --- a/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface PetArgs { name?: pulumi.Input; diff --git a/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/types/output.ts index 38a8f8959fb2..64cd2c62ee0d 100644 --- a/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/resource-args-python/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface Pet { name?: string; diff --git a/pkg/codegen/testing/test/testdata/resource-property-overlap/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/resource-property-overlap/nodejs/tsconfig.json index 74f4e16716e5..e2e0424ca402 100644 --- a/pkg/codegen/testing/test/testdata/resource-property-overlap/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/resource-property-overlap/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/secrets/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/secrets/nodejs/tsconfig.json index ba610b1c0872..01fe76ddb354 100644 --- a/pkg/codegen/testing/test/testdata/secrets/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/secrets/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/secrets/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/secrets/nodejs/types/input.ts index f1c57676cf40..6583cdec830d 100644 --- a/pkg/codegen/testing/test/testdata/secrets/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/secrets/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface ConfigArgs { foo?: pulumi.Input; diff --git a/pkg/codegen/testing/test/testdata/secrets/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/secrets/nodejs/types/output.ts index 521c9e74c30a..a9eb4e5564c9 100644 --- a/pkg/codegen/testing/test/testdata/secrets/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/secrets/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface Config { foo?: string; diff --git a/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/tsconfig.json index 6b7fd81ee898..a363ab1f9b2e 100644 --- a/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/types/input.ts index fcefd058f114..5e35f2f8f160 100644 --- a/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/types/input.ts @@ -5,6 +5,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; + import * as utilities from "../utilities"; export interface ContainerArgs { diff --git a/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/types/output.ts index 2ed273ed9dc5..a1c27174dff9 100644 --- a/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/simple-enum-schema/nodejs/types/output.ts @@ -5,6 +5,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; + import * as utilities from "../utilities"; export interface Container { diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema-single-value-returns/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/simple-methods-schema-single-value-returns/nodejs/tsconfig.json index 7161a2622dd2..2b896e90f6fe 100644 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema-single-value-returns/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/simple-methods-schema-single-value-returns/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/codegen-manifest.json b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/codegen-manifest.json index 55f5e9b24910..8551e38dfec7 100644 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/codegen-manifest.json +++ b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/codegen-manifest.json @@ -10,9 +10,6 @@ "tsconfig.json", "types/index.ts", "types/input.ts", - "types/nested/index.ts", - "types/nested/input.ts", - "types/nested/output.ts", "types/output.ts", "utilities.ts" ] diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/tsconfig.json index fa17bab2f597..0ccbcc941419 100644 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ @@ -23,9 +19,6 @@ "provider.ts", "types/index.ts", "types/input.ts", - "types/nested/index.ts", - "types/nested/input.ts", - "types/nested/output.ts", "types/output.ts", "utilities.ts" ] diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/input.ts index 5be103e5b302..5b9eb68ed95b 100644 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/input.ts @@ -4,6 +4,15 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; -export * as nested from "./nested/input"; +export namespace nested { + export interface Baz { + hello?: string; + world?: string; + } + + export interface BazArgs { + hello?: pulumi.Input; + world?: pulumi.Input; + } +} diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/index.ts b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/index.ts deleted file mode 100644 index b7b2ea440d9f..000000000000 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/input.ts b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/input.ts deleted file mode 100644 index fd6ed5813d91..000000000000 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/input.ts +++ /dev/null @@ -1,17 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - -export interface Baz { - hello?: string; - world?: string; -} - -export interface BazArgs { - hello?: pulumi.Input; - world?: pulumi.Input; -} diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/output.ts b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/output.ts deleted file mode 100644 index e0c860f46c12..000000000000 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/nested/output.ts +++ /dev/null @@ -1,8 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - diff --git a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/output.ts index e81e70ff57d7..c2c4ef2f51ae 100644 --- a/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/simple-methods-schema/nodejs/types/output.ts @@ -4,6 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; -export * as nested from "./nested/output"; +export namespace nested { +} diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/tsconfig.json index 0d739c3d4a5d..fa2ff8647b39 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/types/input.ts index 2b2ecb88052e..ec2d4029a3f7 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface FooArgs { a: boolean; diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/types/output.ts index 9eb73bcc2404..00978e1d5e30 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema-with-root-package/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface Foo { a: boolean; diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/tsconfig.json index 0fdb09e8befd..874122098657 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/types/input.ts index 567775464cc3..6e9b3c0bf494 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface Foo { a: boolean; diff --git a/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/types/output.ts index 9eb73bcc2404..00978e1d5e30 100644 --- a/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/simple-plain-schema/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; export interface Foo { a: boolean; diff --git a/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/tsconfig.json index 8f640b5bdb1c..b0d249aeace5 100644 --- a/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/types/input.ts index 6615b1d2911f..b3fb243ef5b0 100644 --- a/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; import {Resource} from ".."; diff --git a/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/types/output.ts index 6615b1d2911f..b3fb243ef5b0 100644 --- a/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/simple-resource-schema-custom-pypackage-name/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; import {Resource} from ".."; diff --git a/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/tsconfig.json index 549ecdb5e127..9e7bc6288035 100644 --- a/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/types/input.ts index ea24d93f683c..3f46a1eb5259 100644 --- a/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/types/input.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; import {Resource} from ".."; diff --git a/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/types/output.ts index 06a803f01d6e..841a179665ac 100644 --- a/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/simple-resource-schema/nodejs/types/output.ts @@ -4,7 +4,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import * as utilities from "../utilities"; import {Resource} from ".."; diff --git a/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/tsconfig.json index d842c6677980..1fc1716a1a2a 100644 --- a/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/tsconfig.json +++ b/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "baseUrl": ".", "outDir": "bin", "target": "es2016", "module": "commonjs", @@ -11,9 +10,6 @@ "experimentalDecorators": true, "noFallthroughCasesInSwitch": true, "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, "strict": true }, "files": [ diff --git a/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/types/input.ts index 774b7916ca54..dec6c211cb5b 100644 --- a/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/types/input.ts +++ b/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/types/input.ts @@ -5,7 +5,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; import {Resource} from ".."; diff --git a/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/types/output.ts index 06d28a71e5cc..6a2c459d4f55 100644 --- a/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/types/output.ts +++ b/pkg/codegen/testing/test/testdata/simple-yaml-schema/nodejs/types/output.ts @@ -5,7 +5,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; import * as enums from "../types/enums"; -import * as utilities from "../utilities"; import {Resource} from ".."; diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/README.md b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/codegen-manifest.json b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/codegen-manifest.json deleted file mode 100644 index b4e5513101a2..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/codegen-manifest.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "emittedFiles": [ - "README.md", - "index.ts", - "my_mod/index.ts", - "my_mod/triceratops.ts", - "package.json", - "provider.ts", - "scripts/install-pulumi-plugin.js", - "tsconfig.json", - "types/index.ts", - "types/input.ts", - "types/my_mod/index.ts", - "types/my_mod/input.ts", - "types/my_mod/output.ts", - "types/output.ts", - "utilities.ts" - ] -} diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/index.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/index.ts deleted file mode 100644 index 49de88cb48a9..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as utilities from "./utilities"; - -// Export members: -export { ProviderArgs } from "./provider"; -export type Provider = import("./provider").Provider; -export const Provider: typeof import("./provider").Provider = null as any; -utilities.lazyLoad(exports, ["Provider"], () => require("./provider")); - - -// Export sub-modules: -import * as my_mod from "./my_mod"; -import * as types from "./types"; - -export { - my_mod, - types, -}; -pulumi.runtime.registerResourcePackage("dinosaurs", { - version: utilities.getVersion(), - constructProvider: (name: string, type: string, urn: string): pulumi.ProviderResource => { - if (type !== "pulumi:providers:dinosaurs") { - throw new Error(`unknown provider type ${type}`); - } - return new Provider(name, undefined, { urn }); - }, -}); diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/index.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/index.ts deleted file mode 100644 index 1af01116c275..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as utilities from "../utilities"; - -// Export members: -export { TriceratopsArgs } from "./triceratops"; -export type Triceratops = import("./triceratops").Triceratops; -export const Triceratops: typeof import("./triceratops").Triceratops = null as any; -utilities.lazyLoad(exports, ["Triceratops"], () => require("./triceratops")); - - -const _module = { - version: utilities.getVersion(), - construct: (name: string, type: string, urn: string): pulumi.Resource => { - switch (type) { - case "dinosaurs:my_mod:Triceratops": - return new Triceratops(name, undefined, { urn }) - default: - throw new Error(`unknown resource type ${type}`); - } - }, -}; -pulumi.runtime.registerResourceModule("dinosaurs", "my_mod", _module) diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/triceratops.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/triceratops.ts deleted file mode 100644 index 2f889b43dfb0..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/triceratops.ts +++ /dev/null @@ -1,63 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as utilities from "../utilities"; - -/** - * My favorite dino - */ -export class Triceratops extends pulumi.CustomResource { - /** - * Get an existing Triceratops resource's state with the given name, ID, and optional extra - * properties used to qualify the lookup. - * - * @param name The _unique_ name of the resulting resource. - * @param id The _unique_ provider ID of the resource to lookup. - * @param opts Optional settings to control the behavior of the CustomResource. - */ - public static get(name: string, id: pulumi.Input, opts?: pulumi.CustomResourceOptions): Triceratops { - return new Triceratops(name, undefined as any, { ...opts, id: id }); - } - - /** @internal */ - public static readonly __pulumiType = 'dinosaurs:my_mod:Triceratops'; - - /** - * Returns true if the given object is an instance of Triceratops. This is designed to work even - * when multiple copies of the Pulumi SDK have been loaded into the same process. - */ - public static isInstance(obj: any): obj is Triceratops { - if (obj === undefined || obj === null) { - return false; - } - return obj['__pulumiType'] === Triceratops.__pulumiType; - } - - public /*out*/ readonly size!: pulumi.Output; - - /** - * Create a Triceratops resource with the given unique name, arguments, and options. - * - * @param name The _unique_ name of the resource. - * @param args The arguments to use to populate this resource's properties. - * @param opts A bag of options that control this resource's behavior. - */ - constructor(name: string, args?: TriceratopsArgs, opts?: pulumi.CustomResourceOptions) { - let resourceInputs: pulumi.Inputs = {}; - opts = opts || {}; - if (!opts.id) { - resourceInputs["size"] = undefined /*out*/; - } else { - resourceInputs["size"] = undefined /*out*/; - } - opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); - super(Triceratops.__pulumiType, name, resourceInputs, opts); - } -} - -/** - * The set of arguments for constructing a Triceratops resource. - */ -export interface TriceratopsArgs { -} diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/package.json b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/package.json deleted file mode 100644 index bba5d27b4d17..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "@pulumi/dinosaurs", - "version": "${VERSION}", - "scripts": { - "build": "tsc", - "install": "node scripts/install-pulumi-plugin.js resource dinosaurs ${VERSION}" - }, - "dependencies": { - "@pulumi/pulumi": "^3.12" - }, - "devDependencies": { - "@types/node": "^14", - "typescript": "^3.7.0" - }, - "pulumi": { - "resource": true, - "name": "dinosaurs" - } -} diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/provider.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/provider.ts deleted file mode 100644 index 8ec4b88027a6..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/provider.ts +++ /dev/null @@ -1,44 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as utilities from "./utilities"; - -export class Provider extends pulumi.ProviderResource { - /** @internal */ - public static readonly __pulumiType = 'dinosaurs'; - - /** - * Returns true if the given object is an instance of Provider. This is designed to work even - * when multiple copies of the Pulumi SDK have been loaded into the same process. - */ - public static isInstance(obj: any): obj is Provider { - if (obj === undefined || obj === null) { - return false; - } - return obj['__pulumiType'] === Provider.__pulumiType; - } - - - /** - * Create a Provider resource with the given unique name, arguments, and options. - * - * @param name The _unique_ name of the resource. - * @param args The arguments to use to populate this resource's properties. - * @param opts A bag of options that control this resource's behavior. - */ - constructor(name: string, args?: ProviderArgs, opts?: pulumi.ResourceOptions) { - let resourceInputs: pulumi.Inputs = {}; - opts = opts || {}; - { - } - opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); - super(Provider.__pulumiType, name, resourceInputs, opts); - } -} - -/** - * The set of arguments for constructing a Provider resource. - */ -export interface ProviderArgs { -} diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/scripts/install-pulumi-plugin.js b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/scripts/install-pulumi-plugin.js deleted file mode 100644 index fefc6e0eb097..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/scripts/install-pulumi-plugin.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -var childProcess = require("child_process"); - -var args = process.argv.slice(2); - -if (args.indexOf("${VERSION}") !== -1) { - process.exit(0); -} - -var res = childProcess.spawnSync("pulumi", ["plugin", "install"].concat(args), { - stdio: ["ignore", "inherit", "inherit"] -}); - -if (res.error && res.error.code === "ENOENT") { - console.error("\nThere was an error installing the resource provider plugin. " + - "It looks like `pulumi` is not installed on your system. " + - "Please visit https://pulumi.com/ to install the Pulumi CLI.\n" + - "You may try manually installing the plugin by running " + - "`pulumi plugin install " + args.join(" ") + "`"); -} else if (res.error || res.status !== 0) { - console.error("\nThere was an error installing the resource provider plugin. " + - "You may try to manually installing the plugin by running " + - "`pulumi plugin install " + args.join(" ") + "`"); -} - -process.exit(0); diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/tsconfig.json b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/tsconfig.json deleted file mode 100644 index 817c4a343ce9..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "outDir": "bin", - "target": "es2016", - "module": "commonjs", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "stripInternal": true, - "experimentalDecorators": true, - "noFallthroughCasesInSwitch": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "@/*": ["*"] - }, - "strict": true - }, - "files": [ - "index.ts", - "my_mod/index.ts", - "my_mod/triceratops.ts", - "provider.ts", - "types/index.ts", - "types/input.ts", - "types/my_mod/index.ts", - "types/my_mod/input.ts", - "types/my_mod/output.ts", - "types/output.ts", - "utilities.ts" - ] -} diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/index.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/index.ts deleted file mode 100644 index d1f303f60379..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as utilities from "../utilities"; - -// Export sub-modules: -import * as input from "./input"; -import * as output from "./output"; - -export { - input, - output, -}; diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/input.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/input.ts deleted file mode 100644 index 48d0c42e5692..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/input.ts +++ /dev/null @@ -1,11 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../types/input"; -import * as outputs from "../types/output"; -import * as utilities from "../utilities"; - -import {Triceratops} from "@/my_mod"; - -export * as my_mod from "./my_mod/input"; diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/index.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/index.ts deleted file mode 100644 index b7b2ea440d9f..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/input.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/input.ts deleted file mode 100644 index 79d8d682639c..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/input.ts +++ /dev/null @@ -1,10 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - -import {Triceratops} from "@/my_mod"; - diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/output.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/output.ts deleted file mode 100644 index 79d8d682639c..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/output.ts +++ /dev/null @@ -1,10 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../../types/input"; -import * as outputs from "../../types/output"; -import * as utilities from "../../utilities"; - -import {Triceratops} from "@/my_mod"; - diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/output.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/output.ts deleted file mode 100644 index e1a0a5d08f58..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/output.ts +++ /dev/null @@ -1,11 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -import * as pulumi from "@pulumi/pulumi"; -import * as inputs from "../types/input"; -import * as outputs from "../types/output"; -import * as utilities from "../utilities"; - -import {Triceratops} from "@/my_mod"; - -export * as my_mod from "./my_mod/output"; diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/utilities.ts b/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/utilities.ts deleted file mode 100644 index fae1054b6bab..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/nodejs/utilities.ts +++ /dev/null @@ -1,66 +0,0 @@ -// *** WARNING: this file was generated by test. *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - - -export function getEnv(...vars: string[]): string | undefined { - for (const v of vars) { - const value = process.env[v]; - if (value) { - return value; - } - } - return undefined; -} - -export function getEnvBoolean(...vars: string[]): boolean | undefined { - const s = getEnv(...vars); - if (s !== undefined) { - // NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what - // Terraform uses internally when parsing boolean values. - if (["1", "t", "T", "true", "TRUE", "True"].find(v => v === s) !== undefined) { - return true; - } - if (["0", "f", "F", "false", "FALSE", "False"].find(v => v === s) !== undefined) { - return false; - } - } - return undefined; -} - -export function getEnvNumber(...vars: string[]): number | undefined { - const s = getEnv(...vars); - if (s !== undefined) { - const f = parseFloat(s); - if (!isNaN(f)) { - return f; - } - } - return undefined; -} - -export function getVersion(): string { - let version = require('./package.json').version; - // Node allows for the version to be prefixed by a "v", while semver doesn't. - // If there is a v, strip it off. - if (version.indexOf('v') === 0) { - version = version.slice(1); - } - return version; -} - -/** @internal */ -export function resourceOptsDefaults(): any { - return { version: getVersion() }; -} - -/** @internal */ -export function lazyLoad(exports: any, props: string[], loadModule: any) { - for (let property of props) { - Object.defineProperty(exports, property, { - enumerable: true, - get: function() { - return loadModule()[property]; - }, - }); - } -} diff --git a/pkg/codegen/testing/test/testdata/type-references-resource/schema.json b/pkg/codegen/testing/test/testdata/type-references-resource/schema.json deleted file mode 100644 index 546954669410..000000000000 --- a/pkg/codegen/testing/test/testdata/type-references-resource/schema.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "version": "0.0.1", - "name": "dinosaurs", - "types": { - "dinosaurs:my_mod:BigDino": { - "description": "A big dinosaur", - "properties": { - "kind": { - "$ref": "#/types/dinosaurs:my_mod:Triceratops" - } - }, - "type": "object" - } - }, - "resources": { - "dinosaurs:my_mod:Triceratops": { - "description": "My favorite dino", - "properties": { - "size": { - "type": "integer" - } - }, - "type": "object" - } - }, - "functions": {}, - "language": { - "csharp": { - "projectReferences": [ - "..\\..\\..\\..\\..\\..\\..\\sdk\\dotnet\\Pulumi\\Pulumi.csproj" - ] - }, - "go": { - "importBasePath": "github.com/pulumi/pulumi/pkg/v3/codegen/testing/test/testdata/type-references-resource/go/example", - "generateExtraInputTypes": true - }, - "nodejs": { - "dependencies": { - "@pulumi/pulumi": "^3.12" - }, - "devDependencies": { - "typescript": "^3.7.0" - } - }, - "python": {} - } -} diff --git a/pkg/codegen/testing/test/testdata/types.json b/pkg/codegen/testing/test/testdata/types.json index 1a0c511e73eb..42f3fb153be9 100644 --- a/pkg/codegen/testing/test/testdata/types.json +++ b/pkg/codegen/testing/test/testdata/types.json @@ -4,9 +4,6 @@ "meta": { "moduleFormat": "(.*)" }, - "language": { - "nodejs": {} - }, "config": {}, "types": { "typetests::object": {