How to use the google-closure-deps.depFile.getDepFileText function in google-closure-deps

To help you get started, we’ve selected a few google-closure-deps 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 teppeis / duck / src / gendeps.ts View on Github external
export function generateDepFileTextFromDeps(
  dependencies: depGraph.Dependency[],
  googBaseDir: string
): string {
  // `getDepFileText()` doesn't generate addDependency() for SCRIPT,
  // so change the type to CLOSURE_PROVIDE temporally.
  // TODO: fix upstream google-closure-deps and remove this
  const scriptDeps = dependencies.filter(dep => dep.type === depGraph.DependencyType.SCRIPT);
  scriptDeps.forEach(dep => {
    dep.type = depGraph.DependencyType.CLOSURE_PROVIDE;
  });
  const depFileText = depFile.getDepFileText(googBaseDir, dependencies);
  // restore the type
  scriptDeps.forEach(dep => {
    dep.type = depGraph.DependencyType.SCRIPT;
  });
  return depFileText;
}