-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BREAKING] Transform to native ESM (#501)
BREAKING CHANGE: This package has been transformed to native ESM. Therefore it no longer provides a CommonJS export. If your project uses CommonJS, it needs to be converted to ESM or use a dynamic import. For more information see also: - https://sap.github.io/ui5-tooling/updates/migrate-v3/ - https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c Co-authored-by: Florian Vogt <florian.vogt@sap.com> Co-authored-by: Yavor Ivanov <yavor.ivanov@sap.com>
- Loading branch information
1 parent
8edc10c
commit 05e3013
Showing
39 changed files
with
2,037 additions
and
2,807 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* This plugin fixes unexpected JSDoc behavior that prevents us from using types that start with an at-sign (@). | ||
* JSDoc doesn't see "{@" as a valid type expression, probably as there's also {@link ...}. | ||
*/ | ||
exports.handlers = { | ||
jsdocCommentFound: function(e) { | ||
e.comment = e.comment.replace(/{@ui5\//g, "{ @ui5/"); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
const ui5connect = require("connect-openui5"); | ||
import ui5connect from "connect-openui5"; | ||
|
||
function createMiddleware() { | ||
return ui5connect.proxy({ | ||
secure: false | ||
}); | ||
} | ||
|
||
module.exports = createMiddleware; | ||
export default createMiddleware; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,55 @@ | ||
const middlewareInfos = { | ||
compression: {path: "compression"}, | ||
cors: {path: "cors"}, | ||
csp: {path: "./csp"}, | ||
serveResources: {path: "./serveResources"}, | ||
serveIndex: {path: "./serveIndex"}, | ||
discovery: {path: "./discovery"}, | ||
versionInfo: {path: "./versionInfo"}, | ||
connectUi5Proxy: {path: "./connectUi5Proxy"}, | ||
serveThemes: {path: "./serveThemes"}, | ||
testRunner: {path: "./testRunner"}, | ||
nonReadRequests: {path: "./nonReadRequests"} | ||
csp: {path: "./csp.js"}, | ||
serveResources: {path: "./serveResources.js"}, | ||
serveIndex: {path: "./serveIndex.js"}, | ||
discovery: {path: "./discovery.js"}, | ||
versionInfo: {path: "./versionInfo.js"}, | ||
connectUi5Proxy: {path: "./connectUi5Proxy.js"}, | ||
serveThemes: {path: "./serveThemes.js"}, | ||
testRunner: {path: "./testRunner.js"}, | ||
nonReadRequests: {path: "./nonReadRequests.js"} | ||
}; | ||
|
||
function getMiddleware(middlewareName) { | ||
// see @ui5/server/internal/middlewareRepository#getMiddleware | ||
async function getMiddleware(middlewareName) { | ||
const middlewareInfo = middlewareInfos[middlewareName]; | ||
|
||
if (!middlewareInfo) { | ||
throw new Error(`middlewareRepository: Unknown Middleware ${middlewareName}`); | ||
} | ||
try { | ||
const middleware = require(middlewareInfo.path); | ||
const {default: middleware} = await import(middlewareInfo.path); | ||
return { | ||
middleware | ||
}; | ||
} catch (err) { | ||
throw new Error( | ||
`middlewareRepository: Failed to require middleware module for ${middlewareName}: ${err.message}`); | ||
`middlewareRepository: Failed to require middleware module for ${middlewareName}:\n${err.stack}`); | ||
} | ||
} | ||
/** | ||
* @private | ||
* @typedef {object} module:@ui5/server/internal/middlewareRepository~Middleware | ||
* @property {object} middleware The middleware | ||
*/ | ||
|
||
module.exports = { | ||
/** | ||
* @private | ||
* @module @ui5/server/internal/middlewareRepository | ||
* @borrows getMiddleware as getMiddleware | ||
*/ | ||
export default { | ||
|
||
/** | ||
* Determines the desired middleware | ||
* | ||
* @private | ||
* @static | ||
* @function | ||
* @param {string} middlewareName The name of the middleware | ||
* @returns {module:@ui5/server/internal/middlewareRepository~Middleware} The middleware | ||
*/ | ||
getMiddleware: getMiddleware | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ function createMiddleware() { | |
}; | ||
} | ||
|
||
module.exports = createMiddleware; | ||
export default createMiddleware; |
Oops, something went wrong.