(path: any, options: any, print: any)
| 2900 | } |
| 2901 | |
| 2902 | function printExportDeclaration(path: any, options: any, print: any) { |
| 2903 | const decl = path.getValue(); |
| 2904 | const parts: (string | Lines)[] = ["export "]; |
| 2905 | if (decl.exportKind && decl.exportKind === "type") { |
| 2906 | if (!decl.declaration) { |
| 2907 | parts.push("type "); |
| 2908 | } |
| 2909 | } |
| 2910 | const shouldPrintSpaces = options.objectCurlySpacing; |
| 2911 | |
| 2912 | namedTypes.Declaration.assert(decl); |
| 2913 | |
| 2914 | if (decl["default"] || decl.type === "ExportDefaultDeclaration") { |
| 2915 | parts.push("default "); |
| 2916 | } |
| 2917 | |
| 2918 | if (decl.declaration) { |
| 2919 | parts.push(path.call(print, "declaration")); |
| 2920 | } else if (decl.specifiers) { |
| 2921 | if ( |
| 2922 | decl.specifiers.length === 1 && |
| 2923 | decl.specifiers[0].type === "ExportBatchSpecifier" |
| 2924 | ) { |
| 2925 | parts.push("*"); |
| 2926 | } else if (decl.specifiers.length === 0) { |
| 2927 | parts.push("{}"); |
| 2928 | } else if (decl.specifiers[0].type === "ExportDefaultSpecifier") { |
| 2929 | const unbracedSpecifiers: any[] = []; |
| 2930 | const bracedSpecifiers: any[] = []; |
| 2931 | |
| 2932 | path.each(function (specifierPath: any) { |
| 2933 | const spec = specifierPath.getValue(); |
| 2934 | if (spec.type === "ExportDefaultSpecifier") { |
| 2935 | unbracedSpecifiers.push(print(specifierPath)); |
| 2936 | } else { |
| 2937 | bracedSpecifiers.push(print(specifierPath)); |
| 2938 | } |
| 2939 | }, "specifiers"); |
| 2940 | |
| 2941 | unbracedSpecifiers.forEach((lines, i) => { |
| 2942 | if (i > 0) { |
| 2943 | parts.push(", "); |
| 2944 | } |
| 2945 | parts.push(lines); |
| 2946 | }); |
| 2947 | |
| 2948 | if (bracedSpecifiers.length > 0) { |
| 2949 | let lines = fromString(", ").join(bracedSpecifiers); |
| 2950 | if (lines.getLineLength(1) > options.wrapColumn) { |
| 2951 | lines = concat([ |
| 2952 | fromString(",\n").join(bracedSpecifiers).indent(options.tabWidth), |
| 2953 | ",", |
| 2954 | ]); |
| 2955 | } |
| 2956 | |
| 2957 | if (unbracedSpecifiers.length > 0) { |
| 2958 | parts.push(", "); |
| 2959 | } |
no test coverage detected
searching dependent graphs…