SqrTT / prophet

Prophet Debugger (SFCC sandboxes via SDAPI 2.0) extension for VS Code

Home Page:https://marketplace.visualstudio.com/items?itemName=SqrTT.prophet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: better support for JavaScript from compatibility mode 22.7

carey opened this issue · comments

commented

Salesforce have added support for some useful ES6+ APIs that aren't supported by the Prophet extension. It would be helpful if these standard classes and functions could be supported:

  • ArrayBuffer, DataView and several IntNArray and UintNArray classes, and corresponding methods on dw.util.Bytes.
  • Array.entries, Array.fill, Array.findIndex, Array.from, Array.includes, Array.of and probably some others we haven't tried to use.
  • BigInt, including literals like 42n.
  • Number.isNaN and some other less useful isX and parseX functions.
  • Object.values, Object.entries and Object.fromEntries.
  • String.startsWith, String.endsWith, String.includes, String.padStart, String.padEnd, String.repeat, String.raw and a few String.trim methods.
  • Symbol.

I have also noticed an error in the definition of dw.util.Map.entrySet(): it's declared as returning a dw.util.Set<V> but it actually returns a dw.util.Set<dw.util.MapEntry<K,V>>.

Hi @carey
Thank you for reporting/reminder

yes, I'll add new definition

types has been updated in v1.4.38

PS. Unfortunately, (as always), SFCC don't follow standards and IntNArray... has different implementation which don't allow use libs from npm... :(

commented

Thanks, I've updated and the new type definitions are working. I've only noticed a couple of issues:

  • new ArrayBuffer() gets an error 'ArrayBuffer' only refers to a type, but MDN and the Commerce Cloud documentation say that it has a constructor.
  • The Bytes constructor isn't accepting a Uint8Array as a parameter, although apparently Uint8Array is a view, and it works.

Hi @carey
Mentioned issues has been fixed in 1.4.40

commented

Thanks. The new and updated types are working well for me now.