Replace a deprecated UI5 API with an expression

Proprietary

Replaces a deprecated UI5 API whose successor is an expression rather than a name, rendering a template over the call's own arguments and adding the sap.ui.define dependencies the result needs. jQuery.sap.startsWith(s, p) becomes s.startsWith(p), and jQuery.sap.delayedCall(ms, o, m) becomes setTimeout(o[m].bind(o), ms).

io.moderne.javascript.ui5.ReplaceTemplatedUi5Api

Required

The replacement written as code. #0 upward are the modules newModules names, in order; $1 upward are the call's own arguments, spliced in as they were written. The template replaces the whole matched node.

Optional

The global chain the deprecated API is written as. Exclusive with module and member, and one of the two ways of naming the API is required.

The module the deprecated member is reached on. Given together with member, and exclusive with global.

The deprecated member reached on module.

The modules the template needs bound, in the order it names them as #0 upward. Exclusive with newGlobal.

A browser global the template names as #0, where the successor is not a UI5 module at all. Exclusive with newModules.

Whether the deprecated API is matched as a call rather than a plain property access.

Argument positions that must be given, since the template reads them. Positions are 1-based, matching the template's $1 upward.

Argument positions that must be omitted or literally undefined, either because the successor has no equivalent or because the template stops naming arguments here and would otherwise drop them.

Argument positions that must be omitted, or written as null or undefined.

An argument position whose value is known to be a string, which is what lets the template call a String.prototype method on it directly.

An argument position whose value is known to be a function rather than the method name the deprecated API equally accepts, which is what lets the template bind it.

An argument position that must be an object literal or null, which is what Object.create accepts.

An argument position the template names twice, so evaluating it twice has to mean what evaluating it once did.

An argument position that must be written exactly as equalsSource, e.g. the true that selects a deep merge.

The source equalsArgument must be written as.

An argument position that must be a string literal, e.g. the pad character padStart takes one of.

The shortest stringLiteralArgument may be.

The longest stringLiteralArgument may be.

An argument position holding a string literal the successor spells differently.

The separator respellArgument is written with today.

The separator the successor takes instead.

mod run . --recipe=io.moderne.javascript.ui5.ReplaceTemplatedUi5Api \ -P template='$1.startsWith($2)'

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.