|
1 | 1 | # About |
2 | 2 |
|
3 | 3 | This package contains tasks. |
4 | | -A task is a procedure which can be executed by the migration tooling and operates on the contents of a source file. |
| 4 | +A task is a procedure which can be executed by the migration tooling and operates on the contents of |
| 5 | +a source file. |
5 | 6 | The content is parsed into an AST and passed to the task. |
6 | | -It is used to: |
7 | | -* `analyze`: checks the AST and gathers findings and creates an analysis |
| 7 | +It performs the following tasks in order: |
| 8 | +* `analyze`: checks the AST, gathers findings and creates an analysis |
8 | 9 | * `migrate`: works on the analysis of the AST and modifies it |
9 | 10 |
|
10 | 11 | # Contents |
11 | 12 |
|
12 | 13 | It contains Task classes implementing the `Task` interface. |
| 14 | +* `addMissingDependencies`: find in the ast code usage where the dependency is missing from the |
| 15 | +`sap.ui.define`/`sap.ui.require` dependencies array. Very dynamic approach based on configuration |
| 16 | + of: |
| 17 | + * `finders` (scans the AST and looks for findings) |
| 18 | + * `replacers` (modifies the AST for a given finding) |
| 19 | + * `extenders` (manages the dependencies in the `sap.ui.define`/`sap.ui.require` call) |
| 20 | + |
| 21 | + Is used when the replacement is more complex and not a straight forward way, |
| 22 | + e.g. such as a renaming or a simple global-call with module call replacement. |
| 23 | +* `addRenderers`: checks controls and adds a missing Renderer dependency if required. |
| 24 | + Is limited to controls and their renderers |
| 25 | +* `amdCleanup`: checks the AMD syntax and if none found wraps all code inside a new sap.ui.define |
| 26 | + call. Runs in the beginning before all other tasks (high priority), because the AMD syntax is |
| 27 | + required for the dependency handling. |
| 28 | +* `fixTypeDependency`: Scans the code for the usage of types, which are defined in the library and |
| 29 | + adds a dependency to the library and references the type. |
| 30 | +* `replaceGlobals`: Scans the code for global function calls, e.g. `jQuery.sap.log(...)` and |
| 31 | + replaces these by a module call. |
| 32 | + It handles the dependency and is semi-flexible, which means the dependency handling is static and |
| 33 | + the replacements are typical module replacements, but also more complex replacements can be |
| 34 | + performed. |
| 35 | +* `variableNamePrettifier`: Scans the newly introduced variables (from dependencies) and cleans them |
| 36 | + up, if there were naming conflicts variable names are made unique by appending a number, |
| 37 | + e.g. `jQuery` and `jQuery0` and when after all tasks were run `jQuery0` remains solely, |
| 38 | + this task will replace it with `jQuery`. |
| 39 | + It runs after all other tasks (low priority). |
13 | 40 |
|
14 | 41 | ## Naming convention |
15 | 42 |
|
|
0 commit comments