Module: angularJs/parser

Methods

(static) buildTree(scripts, dependencies, definitions, path) → {Array}

Builds the dependencies tree.

Parameters:
Name Type Description
scripts Array

The flat list of scripts with for each script:

dependencies Array

The list of dependency names of the script

definitions Array

The list of definition names of the script

path String

The script path

Source:
Returns:

The list of scripts with their dependencies

Type
Array

(static) findDependencies(expression)

Finds out AngularJS definitions and dependencies for the given content.

This is recursive.

The following JavaScript expressions are used to identify definitions:

  • angular.module('moduleName', [])
  • angular.module('moduleName').component()
  • angular.module('moduleName').directive()
  • angular.module('moduleName').controller()
  • angular.module('moduleName').factory()
  • angular.module('moduleName').service()
  • angular.module('moduleName').constant()
  • angular.module('moduleName').service()
  • angular.module('moduleName').decorator()
  • angular.module('moduleName').filter()
  • angular.module('moduleName').config()
  • angular.module('moduleName').run()

The following JavaScript expressions are used to identify dependencies:

  • MyAngularJsElement.$inject = ['Dependency1', 'Dependency2'];
  • angular.module('moduleName', ['DependencyModule'])

The following JavaScript expressions are used to identify associated modules:

  • angular.module('moduleName')
Parameters:
Name Type Description
expression Object

The JavaScript expression to analyze

Source:

(static) generateTemplatesCache(templatesPath, outputPath, moduleName, prefixopt, callback)

Generates an AngularJS file with all given templates directly loaded into $templateCache.

Parameters:
Name Type Attributes Description
templatesPath Array

The list of templates files paths to add to cache

outputPath String

The path of the resulting AngularJS file

moduleName String

The AngularJS module to use to load templates into $templateCache

prefix String <optional>

A prefix to apply to each template name

callback callback

Function to call when its done

Source:

(static) getResources(tree) → {module:angularJs/parser~getResourcesReturnValue}

Retrieves CSS and JS files from tree of scripts in a flattened order.

Parameters:
Name Type Description
tree Object

The tree of resources

Source:
Returns:

The list of files by types

Type
module:angularJs/parser~getResourcesReturnValue

(static) orderSources(sourcesFilesPaths) → {module:angularJs/parser~orderSourcesCallback}

Orders a list of components JavaScript and SCSS files.

JavaScript and SCSS files are ordered in the way they should be laoded.

Parameters:
Name Type Description
sourcesFilesPaths Array

The list of JavaScript and SCSS sources to order

Source:
Returns:

Function to call when its done

Type
module:angularJs/parser~orderSourcesCallback

(private, inner) findLongestDependencyChains(scripts, scriptopt, modulesToIgnoreopt) → {Array}

Browses a flat list of scripts to find a script longest dependency chains.

Each script may have several dependencies, each dependency can also have several dependencies. findLongestDependencyChains helps find the longest dependency chain of one of the script. As the script may have several longest dependency chain, a list of chains is returned.

A chain is an ordered list of script paths.

This is recursive.

Parameters:
Name Type Attributes Description
scripts Array

The flat list of scripts with for each script:

Properties
Name Type Description
dependencies Array

The list of dependency names of the script

definitions Array

The list of definition names of the script

path String

The script path

script Object <optional>

The script to analyze (default to the first one of the list of scripts)

modulesToIgnore Array <optional>

The list of module names to ignore to avoid circular dependencies

Source:
Returns:

The longest dependency chains

Type
Array

(private, inner) findScript(scripts, property, value) → {Object|null}

Fetches a script from a list of scripts.

Parameters:
Name Type Description
scripts Array

The list of scripts

property String

The script property used to identify the script to fetch

value String

The expected value of the script property

Source:
Returns:

The found script or null if not found

Type
Object | null

(private, inner) getTreeResources(node) → {module:angularJs/parser~getTreeResourcesReturnValue}

Retrieves CSS and JS files from tree of scripts in a flattened order.

This is recursive.

Parameters:
Name Type Description
node Object

The node from where to start

Properties
Name Type Description
path String

The file path

styles Array

The list of css / scss file paths

Source:
Returns:

The list of files by types

Type
module:angularJs/parser~getTreeResourcesReturnValue

Type Definitions

getResourcesReturnValue

Type:
  • Object
Properties:
Name Type Description
css Array

The list of css files in the right order

js Array

The list of js files in the right order

Source:

getTreeResourcesReturnValue

Type:
  • Object
Properties:
Name Type Description
childrenCss Array

The list of children CSS files

childrenJs Array

The list of children CSS files

subChildrenCss Array

The list of sub children CSS files

subChildrenJs Array

The list of sub children JS files

Source:

orderSourcesCallback

Type:
  • Object
Source: