How to use the @angular-devkit/build-angular/src/utils/i18n-inlining.i18nInlineEmittedFiles function in @angular-devkit/build-angular

To help you get started, we’ve selected a few @angular-devkit/build-angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enten / udk / angular / lib / build / ng-devkit.ts View on Github external
return async output => {
    const { emittedFiles = [], webpackStats } = output;
    if (!output.success || !i18n.shouldInline) {
      return output as ServerBuilderOutput;
    }

    if (!webpackStats) {
      throw new Error('Webpack stats build result is required.');
    }

    const outputPaths = ensureOutputPaths(baseOutputPath, i18n);

    /*const success = */
    await i18nInlineEmittedFiles(
      context,
      emittedFiles,
      i18n,
      baseOutputPath,
      Array.from(outputPaths.values()),
      [],
      // tslint:disable-next-line: no-non-null-assertion
      webpackStats.outputPath!,
      target <= ScriptTarget.ES5,
      options.i18nMissingTranslation,
    );

    if (!output.success) {
      return output as ServerBuilderOutput;
    }
github enten / udk / angular / lib / build / ng-devkit.ts View on Github external
let noModuleFiles: EmittedFiles[] | undefined;
      let moduleFiles: EmittedFiles[] | undefined;
      let files: EmittedFiles[] | undefined;

      const scriptsEntryPointName = normalizeExtraEntryPoints(
        options.scripts || [],
        'scripts',
      ).map(x => x.bundleName);

      if (isDifferentialLoadingNeeded && options.watch) {
        moduleFiles = emittedFiles;
        files = moduleFiles.filter(
          x => x.extension === '.css' || (x.name && scriptsEntryPointName.includes(x.name)),
        );
        if (i18n.shouldInline) {
          const success = await i18nInlineEmittedFiles(
            context,
            emittedFiles,
            i18n,
            baseOutputPath,
            Array.from(outputPaths.values()),
            scriptsEntryPointName,
            // tslint:disable-next-line: no-non-null-assertion
            webpackStats.outputPath!,
            target <= ScriptTarget.ES5,
            options.i18nMissingTranslation,
          );
          if (!success) {
            return finalize(false);
          }
        }
      } else if (isDifferentialLoadingNeeded) {
github enten / udk / angular / lib / build / ng-devkit.ts View on Github external
(webpackStats && webpackStats.hash) || '',
            Date.now() - startTime,
            true,
          );
        context.logger.info(bundleInfoText);
        if (webpackStats && webpackStats.warnings.length > 0) {
          context.logger.warn(statsWarningsToString(webpackStats, { colors: true }));
        }
        if (webpackStats && webpackStats.errors.length > 0) {
          context.logger.error(statsErrorsToString(webpackStats, { colors: true }));
        }
      } else {
        files = emittedFiles.filter(x => x.name !== 'polyfills-es5');
        noModuleFiles = emittedFiles.filter(x => x.name === 'polyfills-es5');
        if (i18n.shouldInline) {
          const success = await i18nInlineEmittedFiles(
            context,
            emittedFiles,
            i18n,
            baseOutputPath,
            Array.from(outputPaths.values()),
            scriptsEntryPointName,
            // tslint:disable-next-line: no-non-null-assertion
            webpackStats.outputPath!,
            target <= ScriptTarget.ES5,
            options.i18nMissingTranslation,
          );
          if (!success) {
            return finalize(false);
          }
        }
      }

@angular-devkit/build-angular

Angular Webpack Build Facade

MIT
Latest version published 3 days ago

Package Health Score

100 / 100
Full package analysis

Popular @angular-devkit/build-angular functions