From 754697f35bae2a87772ec7838b341d0c8ffddfae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Mon, 1 Jan 2024 12:46:38 +0200 Subject: [PATCH] Support for es modules, and bump deps --- CONTRIBUTING.md | 75 ++++++++++++++++++++++++++++++++---------------- DOCUMENTATION.md | 6 ++-- LICENSE | 2 +- README.md | 27 ++++++++--------- lib/index.js | 3 ++ package.json | 2 +- 6 files changed, 72 insertions(+), 43 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 50a8d46..cbe6e0b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,41 +1,66 @@ -# Contributing :star: :star2: :dizzy: +# :eight_spoked_asterisk: :stars: :sparkles: :dizzy: :star2: :star2: :sparkles: :dizzy: :star2: :star2: Contributing :star: :star2: :dizzy: :sparkles: :star: :star2: :dizzy: :sparkles: :stars: :eight_spoked_asterisk: -So, you want to contribute to this project? That's awesome! However, before doing so, please read the following simple steps on how to contribute. This will make life easier and avoid wasting time on things that are not requested. ✨ +So, you want to contribute to this project! That's awesome. However, before +doing so, please read the following simple steps explaining how to contribute. This will +make life easier and help avoid wasting time on things that are not +requested. :sparkles: -## Discuss the changes before making them -To begin, open an issue in the repository using the [bug tracker][1]. Describe the contribution you'd like to make, the bug you've found, or any other ideas you have. This step will help us get you started on the right track. +## Discuss the changes before doing them + - First of all, open an issue in the repository, using the [bug tracker][1], + describing the contribution you would like to make, the bug you found or any + other ideas you have. This will help us to get you started on the right + foot. -If it is relevant, include platform and software information (e.g., operating system, Node.JS version, etc.) and screenshots to help us understand what you're experiencing. + - If it makes sense, add the platform and software information (e.g. operating + system, Node.JS version etc.), screenshots (so we can see what you are + seeing). -We recommend waiting for feedback before proceeding to the next steps. However, if the issue is clear, such as a typo, and the fix is simple, you can go ahead and fix it. + - It is recommended to wait for feedback before continuing the next steps. + However, if the issue is clear (e.g. a typo) and the fix is simple, you can + continue to fix it. -## Fixing Issues -Begin by forking the project to your own account, and create a branch for your fix, naming it either `some-great-feature` or `some-issue-fix`. +## Fixing issues + - Fork the project in your account and create a branch with your fix: + `some-great-feature` or `some-issue-fix`. -Commit your changes to that branch, adhering to the [code style][2]. If the project includes tests (usually located in the `test` directory), we encourage you to add a test as well. :memo: + - Commit your changes in that branch, writing the code following the + [code style][2]. If the project contains tests (generally, the `test` + directory), you are encouraged to add a test as well. :memo: -If the project includes a `package.json` or a `bower.json` file, add yourself to the `contributors` array (or `authors` in the case of `bower.json`). If the array doesn't exist, create it as shown below: + - If the project contains a `package.json` or a `bower.json` file add yourself + in the `contributors` array (or `authors` in the case of `bower.json`; + if the array does not exist, create it): -```json -{ - "contributors": [ - "Your Name (http://your.website)" - ] -} -``` + ```json + { + "contributors": [ + "Your Name (http://your.website)" + ] + } + ``` -## Creating a Pull Request -Start by opening a pull request and make sure to reference the initial issue in the pull request message (e.g., *fixes #*). Provide a clear and descriptive title to help everyone understand what is being fixed or improved. +## Creating a pull request -If applicable, consider adding screenshots, gifs, or any other visual aids that can make it easier to understand the changes you've made. + - Open a pull request, and reference the initial issue in the pull request + message (e.g. *fixes #*). Write a good description and + title, so everybody will know what is fixed/improved. -## Wait for Feedback -Before accepting your contributions, we will review them. You may receive feedback regarding what needs to be addressed in your modified code. If so, simply continue making commits to your branch, and the pull request will be automatically updated. + - If it makes sense, add screenshots, gifs etc., so it is easier to see what + is going on. -## Everyone Is Happy! -Ultimately, your contributions will be merged, and everyone will be delighted! 😄 Contributions are more than welcome! +## Wait for feedback +Before accepting your contributions, we will review them. You may get feedback +about what should be fixed in your modified code. If so, just keep committing +in your branch and the pull request will be updated automatically. + +## Everyone is happy! +Finally, your contributions will be merged, and everyone will be happy! :smile: +Contributions are more than welcome! Thanks! :sweat_smile: -[1]: /issues + + +[1]: https://github.com/LienJS/Lien/issues + [2]: https://github.com/IonicaBizau/code-style diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index a8e3177..87c7190 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -110,7 +110,7 @@ Sets, gets or deletes the cookie. - **String** `value`: If provided and it not `null`, the cookie will be set. If it's null, the cookie will be deleted. If `value` is not provided, the cookie value will be returned. #### Return -- **String** `null`, if the cookie was deleted. `undefined` if the cookie doesn't exist. The cookie value if this exists. +- **String|null|undefined** `null`, if the cookie was deleted. `undefined` if the cookie doesn't exist. The cookie value if this exists. ### `file(path, customRoot)` Serves a file to the response. @@ -218,7 +218,7 @@ Gets the transformer for a url. - **String** `method`: The method. #### Return -- **Transformer** The transformer (if it exists) or `null`. +- **Transformer|null** The transformer (if it exists) or `null`. ### `getHooksStrict(type, url, method)` Similar to `getHooks`, but doesn't concat hooks based on the regex @@ -231,7 +231,7 @@ matching but only if they are the same regex. - **String** `method`: The method. #### Return -- **Transformer** The transformer (if it exists) or `null`. +- **Transformer|null** The transformer (if it exists) or `null`. ### `insertHook(type, url, method, trans)` Inserts a new hook. diff --git a/LICENSE b/LICENSE index 7a30c2d..707aab1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-23 Ionică Bizău (https://ionicabizau.net/) +Copyright (c) 2014-24 Ionică Bizău (https://ionicabizau.net/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index c917a0e..520fe4d 100644 --- a/README.md +++ b/README.md @@ -244,7 +244,7 @@ Sets, gets or deletes the cookie. - **String** `value`: If provided and it not `null`, the cookie will be set. If it's null, the cookie will be deleted. If `value` is not provided, the cookie value will be returned. #### Return -- **String** `null`, if the cookie was deleted. `undefined` if the cookie doesn't exist. The cookie value if this exists. +- **String|null|undefined** `null`, if the cookie was deleted. `undefined` if the cookie doesn't exist. The cookie value if this exists. ### `file(path, customRoot)` Serves a file to the response. @@ -352,7 +352,7 @@ Gets the transformer for a url. - **String** `method`: The method. #### Return -- **Transformer** The transformer (if it exists) or `null`. +- **Transformer|null** The transformer (if it exists) or `null`. ### `getHooksStrict(type, url, method)` Similar to `getHooks`, but doesn't concat hooks based on the regex @@ -365,7 +365,7 @@ matching but only if they are the same regex. - **String** `method`: The method. #### Return -- **Transformer** The transformer (if it exists) or `null`. +- **Transformer|null** The transformer (if it exists) or `null`. ### `insertHook(type, url, method, trans)` Inserts a new hook. @@ -483,24 +483,25 @@ Thanks! :heart: ## :dizzy: Where is this library used? If you are using this library in one of your projects, add it in this list. :sparkles: + - `@dottjt/mediareade` + - `@everything-registry/sub-chunk-2069` - `bloggify` - - `gh-contributions` - `bloggify-cli` - - `web-term` + - `bloggify-prebuilt` - `bloggify-server-prebuilt` - - `@dottjt/mediareade` - - `youtube-album-uploader` - - `youtube-album-uploader-multiple` - `bnotify` - - `test-youtube-api` - - `bloggify-prebuilt` + - `chewb-youtube-uploader` + - `fb-token-updater` + - `gh-contributions` - `learning-node-file-upload` + - `learning-nodejs-file-upload` - `lien-github-comments-example` - - `fb-token-updater` - `nodejs-youtube-uploader` - - `chewb-youtube-uploader` + - `test-youtube-api` + - `web-term` - `wrabbit` - - `learning-nodejs-file-upload` + - `youtube-album-uploader` + - `youtube-album-uploader-multiple` diff --git a/lib/index.js b/lib/index.js index 9c59e61..d8e875b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -509,6 +509,9 @@ class Lien extends EventEmitter { if (typeof options.session.store === "string") { try { this.SessionStoreModule = require(options.session.store); + if (this.SessionStoreModule.__esModule && this.SessionStoreModule.default) { + this.SessionStoreModule = this.SessionStoreModule.default; + } } catch (e) { if (e.code === "MODULE_NOT_FOUND") { this.emit("error", new Error(`The ${options.session.store} should be installed in your app to use it as session store.`)); diff --git a/package.json b/package.json index 9991a0e..8e2a609 100644 --- a/package.json +++ b/package.json @@ -51,4 +51,4 @@ "transformer": "^1.0.1", "ul": "^5.2.1" } -} \ No newline at end of file +}