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

@fiori/direct-load

v2.0.15

Published

This package is a part of [Fiori Tools Extensions](https://www.npmjs.com/package/fiori-tools) project which is set of plugins working on top of [SAP Fiori Tools](https://www.npmjs.com/package/@sap/ux-ui5-tooling) or [UI5 server](https://www.npmjs.com/pack

Downloads

4

Readme

Direct Load UI5 Middleware ( CDN injection )

This package is a part of Fiori Tools Extensions project which is set of plugins working on top of SAP Fiori Tools or UI5 server

What does it do?

By default UI5 server serves resources from a localhost. This way of serving resources creates additional load on your server to proxy and cache multiple files. From the other side, when using files from CDN browser already supports caching out of the box. UI5 docs describe such a technique as Bootstrapping From SAPUI5 CDN. The idea is simple - we use an absolute URL in bootstrap script instead of the relative one.

UI5 Middleware allows you to inject cdn using directLoad parameter. However the issue is - it allows to do this only for statically served files. Therefore such an extension doesn't bring that much value if you can just change the html file in your project.

Meanwhile the current extension implements a similar feature, but in a slightly different way. Instead of reading files from the file storage we intersept the html content by a given path and if it's ui5 page - it will inject an absolute URL into sap-ushell-bootstrap and sap-ui-bootstrap scripts

This extension will trasform html page like this:

<script id="sap-ushell-bootstrap" src="../../bootstrap/sandbox.js"></script>
<script id="sap-ui-bootstrap" src="../../../../../resources/sap-ui-core.js"></script>

into a page with resolved absolute links:

<script
  id="sap-ushell-bootstrap"
  src="https://sapui5.hana.ondemand.com/1.78.0/test-resources/sap/ushell/bootstrap/sandbox.js"
></script>

<script
  id="sap-ui-bootstrap"
  src="https://sapui5.hana.ondemand.com/1.78.0/resources/sap-ui-core.js"
></script>

How to use

To use this middeware you need to provide paths to listen ( should be html page currently ) and ui5 config

server:
  customMiddleware:
    - name: fiori-tools-proxy-cdn
      beforeMiddleware: fiori-tools-proxy
      configuration:
        paths:
          - /**/fioriSandbox.html        
        ui5:
          path:
            - /resources
            - /test-resources
          url: https://sapui5.hana.ondemand.com
        version: 1.78.0        

It is also possible to use yaml v1 tags to reuse your config from ui5-proxy-middleware / fiori-tools-proxy

server:
  customMiddleware:
    - name: ui5-proxy-middleware
      beforeMiddleware: compression
      configuration: &ui5-config
        ui5:
          path:
            - /resources
            - /test-resources
          url: https://sapui5.hana.ondemand.com
        version: 1.115.0
    - name: fiori-tools-proxy-cdn
      beforeMiddleware: ui5-proxy-middleware
      configuration:
        paths:
          - /**/fioriSandbox.html
        <<: *ui5-config