mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Remove bundledPackageName from release 4.1 (#41536)
* Merge release 4-1 * Remove unused tests
This commit is contained in:
@@ -4360,7 +4360,6 @@ namespace ts {
|
||||
getProjectReferenceRedirect: fileName => host.getProjectReferenceRedirect(fileName),
|
||||
isSourceOfProjectReferenceRedirect: fileName => host.isSourceOfProjectReferenceRedirect(fileName),
|
||||
fileExists: fileName => host.fileExists(fileName),
|
||||
getCompilerOptions: () => host.getCompilerOptions()
|
||||
} : undefined },
|
||||
encounteredError: false,
|
||||
visitedTypes: undefined,
|
||||
@@ -6015,8 +6014,7 @@ namespace ts {
|
||||
const resolverHost = {
|
||||
getCanonicalFileName,
|
||||
getCurrentDirectory: () => context.tracker.moduleResolverHost!.getCurrentDirectory(),
|
||||
getCommonSourceDirectory: () => context.tracker.moduleResolverHost!.getCommonSourceDirectory(),
|
||||
getCompilerOptions: () => context.tracker.moduleResolverHost!.getCompilerOptions()
|
||||
getCommonSourceDirectory: () => context.tracker.moduleResolverHost!.getCommonSourceDirectory()
|
||||
};
|
||||
const newName = getResolvedExternalModuleName(resolverHost, targetFile);
|
||||
return factory.createStringLiteral(newName);
|
||||
|
||||
@@ -1031,13 +1031,6 @@ namespace ts {
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Emit_class_fields_with_Define_instead_of_Set,
|
||||
},
|
||||
{
|
||||
name: "bundledPackageName",
|
||||
type: "string",
|
||||
affectsEmit: true,
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Provides_a_root_package_name_when_using_outFile_with_declarations,
|
||||
},
|
||||
|
||||
{
|
||||
name: "keyofStringsOnly",
|
||||
|
||||
@@ -1188,14 +1188,6 @@
|
||||
"category": "Error",
|
||||
"code": 1389
|
||||
},
|
||||
"Provides a root package name when using outFile with declarations.": {
|
||||
"category": "Message",
|
||||
"code": 1390
|
||||
},
|
||||
"The `bundledPackageName` option must be provided when using outFile and node module resolution with declaration emit.": {
|
||||
"category": "Error",
|
||||
"code": 1391
|
||||
},
|
||||
"The types of '{0}' are incompatible between these types.": {
|
||||
"category": "Error",
|
||||
"code": 2200
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace ts.moduleSpecifiers {
|
||||
}
|
||||
|
||||
function getLocalModuleSpecifier(moduleFileName: string, { getCanonicalFileName, sourceDirectory }: Info, compilerOptions: CompilerOptions, host: ModuleSpecifierResolutionHost, { ending, relativePreference }: Preferences): string {
|
||||
const { baseUrl, paths, rootDirs, bundledPackageName } = compilerOptions;
|
||||
const { baseUrl, paths, rootDirs } = compilerOptions;
|
||||
|
||||
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) ||
|
||||
removeExtensionAndIndexPostFix(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
|
||||
@@ -171,9 +171,8 @@ namespace ts.moduleSpecifiers {
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
const bundledPkgReference = bundledPackageName ? combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
|
||||
const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
|
||||
const fromPaths = paths && tryGetModuleNameFromPaths(removeFileExtension(bundledPkgReference), importRelativeToBaseUrl, paths);
|
||||
const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions);
|
||||
const fromPaths = paths && tryGetModuleNameFromPaths(removeFileExtension(relativeToBaseUrl), importRelativeToBaseUrl, paths);
|
||||
const nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
|
||||
if (!nonRelative) {
|
||||
return relativePath;
|
||||
|
||||
@@ -3224,11 +3224,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
// Without a package name, for multiple files being bundled into a .d.ts file you basically get a file which doesn't wrk
|
||||
if (outputFile && getEmitDeclarations(options) && getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeJs && !options.bundledPackageName) {
|
||||
createDiagnosticForOptionName(Diagnostics.The_bundledPackageName_option_must_be_provided_when_using_outFile_and_node_module_resolution_with_declaration_emit, options.out ? "out" : "outFile");
|
||||
}
|
||||
|
||||
if (options.resolveJsonModule) {
|
||||
if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
||||
|
||||
@@ -5729,7 +5729,6 @@ namespace ts {
|
||||
/** An error if set - this should only go through the -b pipeline and not actually be observed */
|
||||
/*@internal*/
|
||||
build?: boolean;
|
||||
bundledPackageName?: string;
|
||||
charset?: string;
|
||||
checkJs?: boolean;
|
||||
/* @internal */ configFilePath?: string;
|
||||
@@ -7857,7 +7856,6 @@ namespace ts {
|
||||
readonly redirectTargetsMap: RedirectTargetsMap;
|
||||
getProjectReferenceRedirect(fileName: string): string | undefined;
|
||||
isSourceOfProjectReferenceRedirect(fileName: string): boolean;
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
}
|
||||
|
||||
// Note: this used to be deprecated in our public API, but is still used internally
|
||||
|
||||
@@ -4069,7 +4069,6 @@ namespace ts {
|
||||
getCanonicalFileName(p: string): string;
|
||||
getCommonSourceDirectory(): string;
|
||||
getCurrentDirectory(): string;
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
}
|
||||
|
||||
export function getResolvedExternalModuleName(host: ResolveModuleNameResolutionHost, file: SourceFile, referenceFile?: SourceFile): string {
|
||||
@@ -4093,16 +4092,7 @@ namespace ts {
|
||||
const filePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
|
||||
const relativePath = getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
|
||||
const extensionless = removeFileExtension(relativePath);
|
||||
if (referencePath) {
|
||||
return ensurePathIsNonModuleName(extensionless);
|
||||
}
|
||||
const options = host.getCompilerOptions();
|
||||
const rootPkgName = options.bundledPackageName || "";
|
||||
const newPath = combinePaths(rootPkgName, extensionless);
|
||||
if (rootPkgName && getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeJs && endsWith(newPath, "/index")) {
|
||||
return newPath.slice(0, newPath.length - "/index".length);
|
||||
}
|
||||
return newPath;
|
||||
return referencePath ? ensurePathIsNonModuleName(extensionless) : extensionless;
|
||||
}
|
||||
|
||||
export function getOwnEmitOutputFilePath(fileName: string, host: EmitHost, extension: string) {
|
||||
|
||||
@@ -1786,8 +1786,7 @@ namespace ts {
|
||||
getSourceFiles: () => program.getSourceFiles(),
|
||||
redirectTargetsMap: program.redirectTargetsMap,
|
||||
getProjectReferenceRedirect: fileName => program.getProjectReferenceRedirect(fileName),
|
||||
isSourceOfProjectReferenceRedirect: fileName => program.isSourceOfProjectReferenceRedirect(fileName),
|
||||
getCompilerOptions: () => program.getCompilerOptions()
|
||||
isSourceOfProjectReferenceRedirect: fileName => program.isSourceOfProjectReferenceRedirect(fileName)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace ts {
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outFile": "common.js",
|
||||
"bundledPackageName": "common"
|
||||
|
||||
},
|
||||
"include": ["nominal.js"]
|
||||
}`,
|
||||
@@ -121,7 +121,7 @@ namespace ts {
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outFile": "sub-project.js",
|
||||
"bundledPackageName": "sub"
|
||||
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../common", "prepend": true }
|
||||
@@ -146,7 +146,7 @@ namespace ts {
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outFile": "sub-project-2.js",
|
||||
"bundledPackageName": "sub-2"
|
||||
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../sub-project", "prepend": true }
|
||||
|
||||
@@ -658,8 +658,7 @@ ${internal} enum internalEnum { a, b, c }`);
|
||||
declarationMap: true,
|
||||
skipDefaultLibCheck: true,
|
||||
sourceMap: true,
|
||||
outFile: "./bin/first-output.js",
|
||||
bundledPackageName: "first"
|
||||
outFile: "./bin/first-output.js"
|
||||
},
|
||||
files: [sources[Project.first][Source.ts][Part.one]]
|
||||
}));
|
||||
@@ -671,7 +670,6 @@ ${internal} enum internalEnum { a, b, c }`);
|
||||
stripInternal: true,
|
||||
sourceMap: true,
|
||||
outFile: "./thirdjs/output/third-output.js",
|
||||
bundledPackageName: "third"
|
||||
},
|
||||
references: [{ path: "../first", prepend: true }],
|
||||
files: [sources[Project.third][Source.ts][Part.one]]
|
||||
|
||||
@@ -326,13 +326,13 @@ export class someClass2 { }`),
|
||||
const coreTsConfig: File = {
|
||||
path: core[0].path,
|
||||
content: JSON.stringify({
|
||||
compilerOptions: { composite: true, declaration: true, outFile: "index.js", bundledPackageName: "core" }
|
||||
compilerOptions: { composite: true, declaration: true, outFile: "index.js" }
|
||||
})
|
||||
};
|
||||
const logicTsConfig: File = {
|
||||
path: logic[0].path,
|
||||
content: JSON.stringify({
|
||||
compilerOptions: { composite: true, declaration: true, outFile: "index.js", bundledPackageName: "logic" },
|
||||
compilerOptions: { composite: true, declaration: true, outFile: "index.js" },
|
||||
references: [{ path: "../core", prepend: true }]
|
||||
})
|
||||
};
|
||||
|
||||
@@ -193,7 +193,7 @@ let x: string = 10;`
|
||||
};
|
||||
const dependencyConfig: File = {
|
||||
path: `${dependecyLocation}/tsconfig.json`,
|
||||
content: JSON.stringify({ compilerOptions: { composite: true, outFile: "../dependency.js", bundledPackageName: "dep" } })
|
||||
content: JSON.stringify({ compilerOptions: { composite: true, outFile: "../dependency.js" } })
|
||||
};
|
||||
const usageTs: File = {
|
||||
path: `${usageLocation}/usage.ts`,
|
||||
@@ -205,7 +205,7 @@ fnErr();
|
||||
const usageConfig: File = {
|
||||
path: `${usageLocation}/tsconfig.json`,
|
||||
content: JSON.stringify({
|
||||
compilerOptions: { composite: true, outFile: "../usage.js", bundledPackageName: "usage" },
|
||||
compilerOptions: { composite: true, outFile: "../usage.js" },
|
||||
references: [{ path: "../dependency" }]
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user