npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

babel-openui5-module-formatter

v0.0.1

Published

This is a custom module formatter for the babel js transpiler. It transpiles ES6 modules to `sap.ui.define` calls (AMD-like syntax).

Downloads

1

Readme

babel-ui5-module-formatter Build Status npm version

This is a custom module formatter for the babel js transpiler. It transpiles ES6 modules to sap.ui.define calls (AMD-like syntax).

Install

$ npm install --save-dev babel-ui5-module-formatter

Usage

Configure your babel transpiler to use a custom module formatter as described here: https://babeljs.io/docs/usage/modules/#custom and here https://babeljs.io/docs/usage/options/.

Example

check this: https://github.com/geekflyer/babel-ui5-module-example

Current Limitations

  • The formatter transpiles your ES6 module code into sap.ui.define calls. Therefore generally speaking the same limitations as described here apply: https://openui5beta.hana.ondemand.com/#docs/api/symbols/sap.ui.html#.define . Noteworthy ones are:
    • Relative imports only work within the same or a subdirectory, but not a parent. E.g. import foo from '../bla/bar' won't work, while import foo from './sub/bar' works. You have to use absolute imports instead then, e.g. import foo from 'mycompany/myapp/bla/bar'. This problem might be solved by the formatter / transpiler in future, by statically resolving the module paths to absolute ones at transpile time.
    • In ES6 one can define named exports and default exports at the same time. However in AMD / sap.ui.define there's no equivalent. Therefore you should have per module either only a default export or named exports. If you violate this, the behaviour the transpiled module won't be as expected. For clarification refer to http://www.2ality.com/2014/09/es6-modules-final.html .
    • In ES6 syntax one can define global module / namespace mappings etc. via System.map. This doesn't work with the current transpiler and instead the global module mappings from UI5, e.g. jQuery.sap.registerModulepath and data-sap-ui-resourceroots= apply.
  • Even though the formatter supports named exports it does not support named imports yet. Instead one on has to import the whole module via the wildcard syntax. This will be fixed soon in the formatter. For example:
// mymodule.js
// named exports
export var foo = () => 'bla';
export var bar = () => 'blub';
// doesn't work at the moment:
import {foo} from './mymodule'
foo(); // ERROR
// works:
import * as mymodule from './mymodule';
mymodule.foo();

License

Apache 2.0 © Christian Theilemann