本文整理汇总了TypeScript中canonical-path.dirname函数的典型用法代码示例。如果您正苦于以下问题:TypeScript dirname函数的具体用法?TypeScript dirname怎么用?TypeScript dirname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dirname函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: stripExtension
exports.forEach(e => {
const basePath = stripExtension(e.from);
const relativePath = './' + relative(dirname(entryPointBasePath), basePath);
const exportFrom = entryPointBasePath !== basePath ? ` from '${relativePath}'` : '';
const exportStr = `\nexport {${e.identifier}}${exportFrom};`;
output.append(exportStr);
});
开发者ID:felixfbecker,项目名称:angular,代码行数:7,代码来源:esm_renderer.ts
示例2: writeFile
writeFile(file: FileInfo): void {
mkdir('-p', dirname(file.path));
const backPath = file.path + '.bak';
if (existsSync(file.path) && !existsSync(backPath)) {
mv(file.path, backPath);
}
writeFileSync(file.path, file.contents, 'utf8');
}
开发者ID:felixfbecker,项目名称:angular,代码行数:8,代码来源:transformer.ts
示例3: relative
bundle.src.program.getSourceFiles().forEach(sourceFile => {
if (!sourceFile.isDeclarationFile) {
const relativePath = relative(entryPointPath, sourceFile.fileName);
const newFilePath = join(newDir, relativePath);
mkdir('-p', dirname(newFilePath));
cp(sourceFile.fileName, newFilePath);
}
});
开发者ID:alxhub,项目名称:angular,代码行数:8,代码来源:new_entry_point_file_writer.ts
示例4: setup
function setup(file: {name: string, contents: string}, transformDts: boolean = false) {
const dir = dirname(file.name);
const program = makeProgram(file);
const sourceFile = program.getSourceFile(file.name) !;
const host = new Esm2015ReflectionHost(false, program.getTypeChecker());
const decorationAnalyses =
new DecorationAnalyzer(program.getTypeChecker(), host, [''], false).analyzeProgram(program);
const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host).analyzeProgram(program);
const renderer = new EsmRenderer(host, false, null, dir, dir, false);
return {host, program, sourceFile, renderer, decorationAnalyses, switchMarkerAnalyses};
}
开发者ID:foresthz,项目名称:angular,代码行数:11,代码来源:esm2015_renderer_spec.ts
示例5: makeBundleProgram
export function makeBundleProgram(
isCore: boolean, path: string, r3FileName: string, options: ts.CompilerOptions,
host: ts.CompilerHost): BundleProgram {
const r3SymbolsPath = isCore ? findR3SymbolsPath(dirname(path), r3FileName) : null;
const rootPaths = r3SymbolsPath ? [path, r3SymbolsPath] : [path];
const program = ts.createProgram(rootPaths, options, host);
const file = program.getSourceFile(path) !;
const r3SymbolsFile = r3SymbolsPath && program.getSourceFile(r3SymbolsPath) || null;
return {program, options, host, path, file, r3SymbolsPath, r3SymbolsFile};
}
开发者ID:Cammisuli,项目名称:angular,代码行数:11,代码来源:bundle_program.ts
示例6: writeFile
protected writeFile(file: FileInfo, entryPointPath: AbsoluteFsPath, newDir: AbsoluteFsPath):
void {
if (isDtsPath(file.path.replace(/\.map$/, ''))) {
// This is either `.d.ts` or `.d.ts.map` file
super.writeFileAndBackup(file);
} else {
const relativePath = relative(entryPointPath, file.path);
const newFilePath = join(newDir, relativePath);
mkdir('-p', dirname(newFilePath));
writeFileSync(newFilePath, file.contents, 'utf8');
}
}
开发者ID:alxhub,项目名称:angular,代码行数:12,代码来源:new_entry_point_file_writer.ts
示例7: writeFileAndBackup
protected writeFileAndBackup(file: FileInfo): void {
mkdir('-p', dirname(file.path));
const backPath = file.path + '.__ivy_ngcc_bak';
if (existsSync(backPath)) {
throw new Error(
`Tried to overwrite ${backPath} with an ngcc back up file, which is disallowed.`);
}
if (existsSync(file.path)) {
mv(file.path, backPath);
}
writeFileSync(file.path, file.contents, 'utf8');
}
开发者ID:Cammisuli,项目名称:angular,代码行数:12,代码来源:in_place_file_writer.ts
示例8: isDtsPath
exports.forEach(e => {
let exportFrom = '';
const isDtsFile = isDtsPath(entryPointBasePath);
const from = isDtsFile ? e.dtsFrom : e.from;
if (from) {
const basePath = stripExtension(from);
const relativePath = './' + relative(dirname(entryPointBasePath), basePath);
exportFrom = entryPointBasePath !== basePath ? ` from '${relativePath}'` : '';
}
// aliases should only be added in dts files as these are lost when rolling up dts file.
const exportStatement = e.alias && isDtsFile ? `${e.alias} as ${e.identifier}` : e.identifier;
const exportStr = `\nexport {${exportStatement}}${exportFrom};`;
output.append(exportStr);
});
开发者ID:Cammisuli,项目名称:angular,代码行数:16,代码来源:esm_renderer.ts
示例9: setup
function setup(file: {name: string, contents: string}) {
const dir = dirname(file.name);
const bundle = makeTestEntryPointBundle('esm5', [file]);
const typeChecker = bundle.src.program.getTypeChecker();
const host = new Esm5ReflectionHost(false, typeChecker);
const referencesRegistry = new NgccReferencesRegistry(host);
const decorationAnalyses =
new DecorationAnalyzer(typeChecker, host, referencesRegistry, [''], false)
.analyzeProgram(bundle.src.program);
const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host).analyzeProgram(bundle.src.program);
const renderer = new Esm5Renderer(host, false, bundle, dir, dir);
return {
host,
program: bundle.src.program,
sourceFile: bundle.src.file, renderer, decorationAnalyses, switchMarkerAnalyses
};
}
开发者ID:felixfbecker,项目名称:angular,代码行数:17,代码来源:esm5_renderer_spec.ts
示例10: setup
function setup(file: {name: string, contents: string}) {
const logger = new MockLogger();
const dir = dirname(file.name);
const bundle = makeTestEntryPointBundle('module', 'esm5', false, [file]);
const typeChecker = bundle.src.program.getTypeChecker();
const host = new Esm5ReflectionHost(logger, false, typeChecker);
const referencesRegistry = new NgccReferencesRegistry(host);
const decorationAnalyses =
new DecorationAnalyzer(
bundle.src.program, bundle.src.options, bundle.src.host, typeChecker, host,
referencesRegistry, [AbsoluteFsPath.fromUnchecked('/')], false)
.analyzeProgram();
const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host).analyzeProgram(bundle.src.program);
const renderer = new Esm5Renderer(logger, host, false, bundle, dir);
return {
host,
program: bundle.src.program,
sourceFile: bundle.src.file, renderer, decorationAnalyses, switchMarkerAnalyses
};
}
开发者ID:alxhub,项目名称:angular,代码行数:20,代码来源:esm5_renderer_spec.ts
注:本文中的canonical-path.dirname函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论