• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript compiler-cli.calcProjectFileAndBasePath函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@angular/compiler-cli.calcProjectFileAndBasePath函数的典型用法代码示例。如果您正苦于以下问题:TypeScript calcProjectFileAndBasePath函数的具体用法?TypeScript calcProjectFileAndBasePath怎么用?TypeScript calcProjectFileAndBasePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了calcProjectFileAndBasePath函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: runOneBuild

export function runOneBuild(args: string[], inputs?: {[path: string]: string}): boolean {
  if (args[0] === '-p') args.shift();
  // Strip leading at-signs, used to indicate a params file
  const project = args[0].replace(/^@+/, '');

  const [parsedOptions, errors] = parseTsconfig(project);
  if (errors && errors.length) {
    console.error(ng.formatDiagnostics(errors));
    return false;
  }
  const {options: tsOptions, bazelOpts, files, config} = parsedOptions;
  const expectedOuts = config['angularCompilerOptions']['expectedOut'];

  const {basePath} = ng.calcProjectFileAndBasePath(project);
  const compilerOpts = ng.createNgCompilerOptions(basePath, config, tsOptions);
  const tsHost = ts.createCompilerHost(compilerOpts, true);
  const {diagnostics} = compile({
    allowNonHermeticReads: ALLOW_NON_HERMETIC_READS,
    allDepsCompiledWithBazel: ALL_DEPS_COMPILED_WITH_BAZEL,
    compilerOpts,
    tsHost,
    bazelOpts,
    files,
    inputs,
    expectedOuts
  });
  if (diagnostics.length) {
    console.error(ng.formatDiagnostics(diagnostics));
  }
  return diagnostics.every(d => d.category !== ts.DiagnosticCategory.Error);
}
开发者ID:gautamkrishnar,项目名称:angular,代码行数:31,代码来源:index.ts


示例2: main

function main(args: string[]) {
  const project = args[1];
  const [{options: tsOptions, bazelOpts, files, config}] = parseTsconfig(project);
  const {basePath} = calcProjectFileAndBasePath(project);
  const ngOptions = createNgCompilerOptions(basePath, config, tsOptions);

  const {diagnostics} = performCompilation(files, ngOptions);
  if (diagnostics.length) {
    console.error(formatDiagnostics(ngOptions, diagnostics));
  }
  return diagnostics.some(d => d.category === ts.DiagnosticCategory.Error) ? 1 : 0;
}
开发者ID:DanielKucal,项目名称:angular,代码行数:12,代码来源:index.ts


示例3: runOneBuild

function runOneBuild(args: string[], inputs?: {[path: string]: string}): boolean {
  if (args[0] === '-p') args.shift();
  // Strip leading at-signs, used to indicate a params file
  const project = args[0].replace(/^@+/, '');
  const [{options: tsOptions, bazelOpts, files, config}] = parseTsconfig(project);
  const expectedOuts = config['angularCompilerOptions']['expectedOut'];

  const {basePath} = ng.calcProjectFileAndBasePath(project);
  const compilerOpts = ng.createNgCompilerOptions(basePath, config, tsOptions);
  const tsHost = ts.createCompilerHost(compilerOpts, true);
  const {diagnostics} = compile({
    allowNonHermeticReads: ALLOW_NON_HERMETIC_READS,
    compilerOpts,
    tsHost,
    bazelOpts,
    files,
    inputs,
    expectedOuts
  });
  return diagnostics.every(d => d.category !== ts.DiagnosticCategory.Error);
}
开发者ID:ox4,项目名称:angular,代码行数:21,代码来源:index.ts


示例4: runOneBuild

function runOneBuild(args: string[], inputs?: {[path: string]: string}): boolean {
  if (args[0] === '-p') args.shift();
  // Strip leading at-signs, used to indicate a params file
  const project = args[0].replace(/^@+/, '');
  let fileLoader: FileLoader;
  if (inputs) {
    fileLoader = new CachedFileLoader(fileCache, ALLOW_NON_HERMETIC_READS);
    // Resolve the inputs to absolute paths to match TypeScript internals
    const resolvedInputs: {[path: string]: string} = {};
    for (const key of Object.keys(inputs)) {
      resolvedInputs[path.resolve(key)] = inputs[key];
    }
    fileCache.updateCache(resolvedInputs);
  } else {
    fileLoader = new UncachedFileLoader();
  }
  const [{options: tsOptions, bazelOpts, files, config}] = parseTsconfig(project);
  const expectedOuts = config['angularCompilerOptions']['expectedOut'];

  const {basePath} = ng.calcProjectFileAndBasePath(project);
  const compilerOpts = ng.createNgCompilerOptions(basePath, config, tsOptions);
  const {diagnostics} = compile({fileLoader, compilerOpts, bazelOpts, files, expectedOuts});
  return diagnostics.every(d => d.category !== ts.DiagnosticCategory.Error);
}
开发者ID:MarkPieszak,项目名称:angular,代码行数:24,代码来源:index.ts


示例5: runOneBuild

export function runOneBuild(args: string[], inputs?: {[path: string]: string}): boolean {
  if (args[0] === '-p') args.shift();
  // Strip leading at-signs, used to indicate a params file
  const project = args[0].replace(/^@+/, '');

  const [parsedOptions, errors] = parseTsconfig(project);
  if (errors && errors.length) {
    console.error(ng.formatDiagnostics(errors));
    return false;
  }
  const {options: tsOptions, bazelOpts, files, config} = parsedOptions;
  const angularCompilerOptions: {[k: string]: unknown} = config['angularCompilerOptions'] || {};

  // Allow Bazel users to control some of the bazel options.
  // Since TypeScript's "extends" mechanism applies only to "compilerOptions"
  // we have to repeat some of their logic to get the user's "angularCompilerOptions".
  if (config['extends']) {
    // Load the user's config file
    // Note: this doesn't handle recursive extends so only a user's top level
    // `angularCompilerOptions` will be considered. As this code is going to be
    // removed with Ivy, the added complication of handling recursive extends
    // is likely not needed.
    let userConfigFile = resolveNormalizedPath(path.dirname(project), config['extends']);
    if (!userConfigFile.endsWith('.json')) userConfigFile += '.json';
    const {config: userConfig, error} = ts.readConfigFile(userConfigFile, ts.sys.readFile);
    if (error) {
      console.error(ng.formatDiagnostics([error]));
      return false;
    }

    // All user angularCompilerOptions values that a user has control
    // over should be collected here
    if (userConfig.angularCompilerOptions) {
      angularCompilerOptions.diagnostics =
          angularCompilerOptions.diagnostics || userConfig.angularCompilerOptions.diagnostics;
      angularCompilerOptions.trace =
          angularCompilerOptions.trace || userConfig.angularCompilerOptions.trace;

      angularCompilerOptions.disableExpressionLowering =
          angularCompilerOptions.disableExpressionLowering ||
          userConfig.angularCompilerOptions.disableExpressionLowering;
      angularCompilerOptions.disableTypeScriptVersionCheck =
          angularCompilerOptions.disableTypeScriptVersionCheck ||
          userConfig.angularCompilerOptions.disableTypeScriptVersionCheck;

      angularCompilerOptions.i18nOutLocale =
          angularCompilerOptions.i18nOutLocale || userConfig.angularCompilerOptions.i18nOutLocale;
      angularCompilerOptions.i18nOutFormat =
          angularCompilerOptions.i18nOutFormat || userConfig.angularCompilerOptions.i18nOutFormat;
      angularCompilerOptions.i18nOutFile =
          angularCompilerOptions.i18nOutFile || userConfig.angularCompilerOptions.i18nOutFile;

      angularCompilerOptions.i18nInFormat =
          angularCompilerOptions.i18nInFormat || userConfig.angularCompilerOptions.i18nInFormat;
      angularCompilerOptions.i18nInLocale =
          angularCompilerOptions.i18nInLocale || userConfig.angularCompilerOptions.i18nInLocale;
      angularCompilerOptions.i18nInFile =
          angularCompilerOptions.i18nInFile || userConfig.angularCompilerOptions.i18nInFile;

      angularCompilerOptions.i18nInMissingTranslations =
          angularCompilerOptions.i18nInMissingTranslations ||
          userConfig.angularCompilerOptions.i18nInMissingTranslations;
      angularCompilerOptions.i18nUseExternalIds = angularCompilerOptions.i18nUseExternalIds ||
          userConfig.angularCompilerOptions.i18nUseExternalIds;

      angularCompilerOptions.preserveWhitespaces = angularCompilerOptions.preserveWhitespaces ||
          userConfig.angularCompilerOptions.preserveWhitespaces;
    }
  }

  const expectedOuts = config['angularCompilerOptions']['expectedOut'];

  const {basePath} = ng.calcProjectFileAndBasePath(project);
  const compilerOpts = ng.createNgCompilerOptions(basePath, config, tsOptions);
  const tsHost = ts.createCompilerHost(compilerOpts, true);
  const {diagnostics} = compile({
    allDepsCompiledWithBazel: ALL_DEPS_COMPILED_WITH_BAZEL,
    compilerOpts,
    tsHost,
    bazelOpts,
    files,
    inputs,
    expectedOuts
  });
  if (diagnostics.length) {
    console.error(ng.formatDiagnostics(diagnostics));
  }
  return diagnostics.every(d => d.category !== ts.DiagnosticCategory.Error);
}
开发者ID:zackarychapple,项目名称:angular,代码行数:89,代码来源:index.ts



注:本文中的@angular/compiler-cli.calcProjectFileAndBasePath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript compiler-cli.createCompilerHost函数代码示例发布时间:2022-05-28
下一篇:
TypeScript compiler.UrlResolver类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap