This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

3
node_modules/feed/.github/FUNDING.yml generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# These are supported funding model platforms
github: jpmonette

33
node_modules/feed/.github/ISSUE_TEMPLATE/bug_report.md generated vendored Normal file
View File

@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Actual behavior**
A clear and concise description of what is the actual outcome.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Versions (please complete the following information):**
- NodeJS:
- TypeScript:
- npm/yarn:
- feed:
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here. Also make sure to add any documentation related.

1
node_modules/feed/.prettierrc.yml generated vendored Normal file
View File

@@ -0,0 +1 @@
printWidth: 120

13
node_modules/feed/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,13 @@
language: node_js
node_js:
- "node"
cache:
directories:
- node_modules
before_install:
- export TZ=Europe/London
script:
- "npm run-script test-travis"
after_script:
- "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
- "codeclimate-test-reporter < ./coverage/lcov.info"

6
node_modules/feed/.vscode/settings.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}

1
node_modules/feed/AUTHORS generated vendored Executable file
View File

@@ -0,0 +1 @@
Jean-Philippe Monette <contact@jpmonette.net> (http://blogue.jpmonette.net/)

187
node_modules/feed/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,187 @@
# Change Log
## [4.2.2](https://github.com/jpmonette/feed/tree/4.2.2) (2021-01-22)
[Full Changelog](https://github.com/jpmonette/feed/compare/4.2.1...4.2.2)
**Implemented enhancements:**
- Export types in feed [\#128](https://github.com/jpmonette/feed/issues/128)
**Merged pull requests:**
- Bump node-notifier from 8.0.0 to 8.0.1 [\#137](https://github.com/jpmonette/feed/pull/137) ([dependabot[bot]](https://github.com/apps/dependabot))
- fix: export types from feed [\#136](https://github.com/jpmonette/feed/pull/136) ([gustavkj](https://github.com/gustavkj))
- Bump deps [\#129](https://github.com/jpmonette/feed/pull/129) ([jpmonette](https://github.com/jpmonette))
- Bump lodash from 4.17.15 to 4.17.19 [\#127](https://github.com/jpmonette/feed/pull/127) ([dependabot[bot]](https://github.com/apps/dependabot))
## [4.2.1](https://github.com/jpmonette/feed/tree/4.2.1) (2020-07-05)
[Full Changelog](https://github.com/jpmonette/feed/compare/4.2.0...4.2.1)
**Closed issues:**
- RSS pubDate set to "date" rather than "published", unlike Atom [\#117](https://github.com/jpmonette/feed/issues/117)
**Merged pull requests:**
- Sanitizing XML feeds [\#125](https://github.com/jpmonette/feed/pull/125) ([decebal](https://github.com/decebal))
- author.uri and author.email should be optional in atom \#115 [\#124](https://github.com/jpmonette/feed/pull/124) ([decebal](https://github.com/decebal))
- fix: 🐛 overwrite pubDate on rss when published is specified [\#121](https://github.com/jpmonette/feed/pull/121) ([decebal](https://github.com/decebal))
## [4.2.0](https://github.com/jpmonette/feed/tree/4.2.0) (2020-05-25)
[Full Changelog](https://github.com/jpmonette/feed/compare/4.1.0...4.2.0)
**Closed issues:**
- Getting an error during Netlify deploy \(and npm run build\) [\#118](https://github.com/jpmonette/feed/issues/118)
- atom:link in RSS feed should point to self, not atom [\#113](https://github.com/jpmonette/feed/issues/113)
**Merged pull requests:**
- Update dependencies + Formatting + Add Comments [\#123](https://github.com/jpmonette/feed/pull/123) ([jpmonette](https://github.com/jpmonette))
- fix: 🐛 atom link needs to point to self [\#122](https://github.com/jpmonette/feed/pull/122) ([decebal](https://github.com/decebal))
- feat: 🎸 add mandatory rss2 attributes on enclosure [\#120](https://github.com/jpmonette/feed/pull/120) ([decebal](https://github.com/decebal))
- Bump acorn from 5.7.3 to 5.7.4 [\#116](https://github.com/jpmonette/feed/pull/116) ([dependabot[bot]](https://github.com/apps/dependabot))
## [4.1.0](https://github.com/jpmonette/feed/tree/4.1.0) (2019-12-29)
[Full Changelog](https://github.com/jpmonette/feed/compare/4.0.0...4.1.0)
**Closed issues:**
- Update the default of date on atom to be published [\#108](https://github.com/jpmonette/feed/issues/108)
- export base xml-js object [\#102](https://github.com/jpmonette/feed/issues/102)
- Add extra attributes on \<rss\> tag [\#98](https://github.com/jpmonette/feed/issues/98)
- item.id is ignored in rss output [\#96](https://github.com/jpmonette/feed/issues/96)
- How to generate \<dc:creator\> [\#90](https://github.com/jpmonette/feed/issues/90)
- Specify namespace and custom attributes [\#88](https://github.com/jpmonette/feed/issues/88)
**Merged pull requests:**
- Bump handlebars from 4.1.2 to 4.5.3 [\#110](https://github.com/jpmonette/feed/pull/110) ([dependabot[bot]](https://github.com/apps/dependabot))
- Item category for all feed types [\#109](https://github.com/jpmonette/feed/pull/109) ([mattimbrain](https://github.com/mattimbrain))
- Bump lodash from 4.17.11 to 4.17.15 [\#106](https://github.com/jpmonette/feed/pull/106) ([dependabot[bot]](https://github.com/apps/dependabot))
- Fix RSS ignoring item.id [\#105](https://github.com/jpmonette/feed/pull/105) ([ArtskydJ](https://github.com/ArtskydJ))
- Change default RSS docs url + Allow docs override [\#97](https://github.com/jpmonette/feed/pull/97) ([sonniesedge](https://github.com/sonniesedge))
## [4.0.0](https://github.com/jpmonette/feed/tree/4.0.0) (2019-07-06)
[Full Changelog](https://github.com/jpmonette/feed/compare/3.0.0...4.0.0)
**Merged pull requests:**
- Push to 4.0.0 [\#95](https://github.com/jpmonette/feed/pull/95) ([jpmonette](https://github.com/jpmonette))
- Update homepage to github repo [\#92](https://github.com/jpmonette/feed/pull/92) ([kevinsimper](https://github.com/kevinsimper))
## [3.0.0](https://github.com/jpmonette/feed/tree/3.0.0) (2019-05-28)
[Full Changelog](https://github.com/jpmonette/feed/compare/2.0.4...3.0.0)
**Merged pull requests:**
- Migrate from xml to xml-js [\#93](https://github.com/jpmonette/feed/pull/93) ([jpmonette](https://github.com/jpmonette))
- Migrate from xml to xml-js [\#91](https://github.com/jpmonette/feed/pull/91) ([jpmonette](https://github.com/jpmonette))
## [2.0.4](https://github.com/jpmonette/feed/tree/2.0.4) (2019-03-02)
[Full Changelog](https://github.com/jpmonette/feed/compare/2.0.0...2.0.4)
**Implemented enhancements:**
- Feed support for Category on Items [\#71](https://github.com/jpmonette/feed/issues/71)
**Closed issues:**
- TypeError: Feed is not a constructor [\#80](https://github.com/jpmonette/feed/issues/80)
- Example Code, `posts` Undefined [\#78](https://github.com/jpmonette/feed/issues/78)
- npm package broken [\#77](https://github.com/jpmonette/feed/issues/77)
- Cannot display the publish time of essay correctly. [\#67](https://github.com/jpmonette/feed/issues/67)
- Feedly.com not accepting it [\#62](https://github.com/jpmonette/feed/issues/62)
- TypeError: d.getUTCFullYear is not a function [\#59](https://github.com/jpmonette/feed/issues/59)
- Extra properties [\#57](https://github.com/jpmonette/feed/issues/57)
- Support paged feeds [\#52](https://github.com/jpmonette/feed/issues/52)
- RSS author is still \(again\) broken [\#50](https://github.com/jpmonette/feed/issues/50)
- writing feed as a stream of articles \[feature request\] [\#44](https://github.com/jpmonette/feed/issues/44)
- New line is not transformed to \<BR\> [\#42](https://github.com/jpmonette/feed/issues/42)
- I would like to provide some custom namespace for my item nodes [\#38](https://github.com/jpmonette/feed/issues/38)
- Missing 'type="image/\*"' attribute for image enclosures [\#37](https://github.com/jpmonette/feed/issues/37)
- How to append items to an existing RSS-2.0 Feed [\#33](https://github.com/jpmonette/feed/issues/33)
- Namespace prefix content on encoded is not defined [\#32](https://github.com/jpmonette/feed/issues/32)
- support for multiple enclosures in one item? [\#31](https://github.com/jpmonette/feed/issues/31)
**Merged pull requests:**
- add optional language field [\#86](https://github.com/jpmonette/feed/pull/86) ([zsolt-dev](https://github.com/zsolt-dev))
- Make `feed` option optional [\#85](https://github.com/jpmonette/feed/pull/85) ([Vinnl](https://github.com/Vinnl))
- Change html\_content to content\_html [\#81](https://github.com/jpmonette/feed/pull/81) ([leereamsnyder](https://github.com/leereamsnyder))
- Fix TypeScript declarations [\#73](https://github.com/jpmonette/feed/pull/73) ([lenovouser](https://github.com/lenovouser))
## [2.0.0](https://github.com/jpmonette/feed/tree/2.0.0) (2018-08-04)
[Full Changelog](https://github.com/jpmonette/feed/compare/1.1.0...2.0.0)
**Closed issues:**
- Items in feed not added image property [\#63](https://github.com/jpmonette/feed/issues/63)
**Merged pull requests:**
- We are moving to TypeScript! [\#72](https://github.com/jpmonette/feed/pull/72) ([jpmonette](https://github.com/jpmonette))
- Remove octal number from example [\#70](https://github.com/jpmonette/feed/pull/70) ([manniL](https://github.com/manniL))
- Push to version 1.1.1 [\#66](https://github.com/jpmonette/feed/pull/66) ([jpmonette](https://github.com/jpmonette))
- fix\(images\): Fixes image enclosures for items [\#65](https://github.com/jpmonette/feed/pull/65) ([zfoster](https://github.com/zfoster))
- add support for extensions in json1 [\#60](https://github.com/jpmonette/feed/pull/60) ([alx](https://github.com/alx))
## [1.1.0](https://github.com/jpmonette/feed/tree/1.1.0) (2017-06-03)
[Full Changelog](https://github.com/jpmonette/feed/compare/1.0.1...1.1.0)
**Closed issues:**
- \</link\> stripped out [\#53](https://github.com/jpmonette/feed/issues/53)
- "updated" broken [\#51](https://github.com/jpmonette/feed/issues/51)
- validateURL is not nice function [\#23](https://github.com/jpmonette/feed/issues/23)
**Merged pull requests:**
- Version 1.1.0 [\#58](https://github.com/jpmonette/feed/pull/58) ([jpmonette](https://github.com/jpmonette))
- Add Support for JSON Feed v1 [\#56](https://github.com/jpmonette/feed/pull/56) ([benmccormick](https://github.com/benmccormick))
- Add custom generator string options.generator [\#55](https://github.com/jpmonette/feed/pull/55) ([VarunBatraIT](https://github.com/VarunBatraIT))
## [1.0.1](https://github.com/jpmonette/feed/tree/1.0.1) (2017-04-02)
**Implemented enhancements:**
- Allow for manual setting of the feed updated date [\#14](https://github.com/jpmonette/feed/issues/14)
- Readme should mention missing stuff [\#3](https://github.com/jpmonette/feed/issues/3)
- Tests [\#2](https://github.com/jpmonette/feed/issues/2)
- Author fields in feed items? [\#1](https://github.com/jpmonette/feed/issues/1)
**Fixed bugs:**
- Forgot a "console.log" [\#5](https://github.com/jpmonette/feed/issues/5)
**Closed issues:**
- Cut a new release [\#47](https://github.com/jpmonette/feed/issues/47)
- RSS author tag for each post should contain only email [\#41](https://github.com/jpmonette/feed/issues/41)
- URL in repo description is a dead link [\#36](https://github.com/jpmonette/feed/issues/36)
- Lots of commits missing in npm [\#35](https://github.com/jpmonette/feed/issues/35)
- AppFog 404 Not Found [\#20](https://github.com/jpmonette/feed/issues/20)
- Generated Atom feed has a few problems according to validator [\#19](https://github.com/jpmonette/feed/issues/19)
- content encoding [\#17](https://github.com/jpmonette/feed/issues/17)
- TypeError: Object July 21, 1983 01:15:00 has no method 'toUTCString' [\#11](https://github.com/jpmonette/feed/issues/11)
- The code breaks when atom feed is requested [\#8](https://github.com/jpmonette/feed/issues/8)
- Author email and link should be optional [\#6](https://github.com/jpmonette/feed/issues/6)
**Merged pull requests:**
- Initial Babel migration commit [\#49](https://github.com/jpmonette/feed/pull/49) ([jpmonette](https://github.com/jpmonette))
- Resolves \#41 - Fix “author” tag based on W3 Validator [\#48](https://github.com/jpmonette/feed/pull/48) ([jpmonette](https://github.com/jpmonette))
- fixed the failing test due to date provided [\#45](https://github.com/jpmonette/feed/pull/45) ([parit](https://github.com/parit))
- Update package.json [\#43](https://github.com/jpmonette/feed/pull/43) ([f0rr0](https://github.com/f0rr0))
- Feed id is required. Demonstrate that in README [\#39](https://github.com/jpmonette/feed/pull/39) ([KyleAMathews](https://github.com/KyleAMathews))
- Support for the entry\#published attribute [\#34](https://github.com/jpmonette/feed/pull/34) ([benilovj](https://github.com/benilovj))
- Validation fixes [\#26](https://github.com/jpmonette/feed/pull/26) ([download13](https://github.com/download13))
- disable url validation [\#24](https://github.com/jpmonette/feed/pull/24) ([bewest](https://github.com/bewest))
- feed.item\(\) is deprecated [\#18](https://github.com/jpmonette/feed/pull/18) ([KyleAMathews](https://github.com/KyleAMathews))
- adding contributors and copyright for atom [\#12](https://github.com/jpmonette/feed/pull/12) ([shafan](https://github.com/shafan))
- Updates to better pass the W3C validator, and other improvements [\#10](https://github.com/jpmonette/feed/pull/10) ([smebberson](https://github.com/smebberson))
- Fixed iterator bug [\#9](https://github.com/jpmonette/feed/pull/9) ([brickcap](https://github.com/brickcap))
- here's my change to ensure array iteration works even if arrays have other properties [\#7](https://github.com/jpmonette/feed/pull/7) ([haszari](https://github.com/haszari))
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

84
node_modules/feed/CODE_OF_CONDUCT.md generated vendored Normal file
View File

@@ -0,0 +1,84 @@
# Code of Conduct
## 1. Purpose
A primary goal of Feed is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).
This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.
We invite all those who participate in Feed to help us create safe and positive experiences for everyone.
## 2. Open Source Citizenship
A supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community.
Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society.
If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know.
## 3. Expected Behavior
The following behaviors are expected and requested of all community members:
* Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.
* Exercise consideration and respect in your speech and actions.
* Attempt collaboration before conflict.
* Refrain from demeaning, discriminatory, or harassing behavior and speech.
* Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.
* Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations.
## 4. Unacceptable Behavior
The following behaviors are considered harassment and are unacceptable within our community:
* Violence, threats of violence or violent language directed against another person.
* Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language.
* Posting or displaying sexually explicit or violent material.
* Posting or threatening to post other peoples personally identifying information ("doxing").
* Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.
* Inappropriate photography or recording.
* Inappropriate physical contact. You should have someones consent before touching them.
* Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances.
* Deliberate intimidation, stalking or following (online or in person).
* Advocating for, or encouraging, any of the above behavior.
* Sustained disruption of community events, including talks and presentations.
## 5. Consequences of Unacceptable Behavior
Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated.
Anyone asked to stop unacceptable behavior is expected to comply immediately.
If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event).
## 6. Reporting Guidelines
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. contact@jpmonette.net.
Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.
## 7. Addressing Grievances
If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Jean-Philippe Monette with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.
## 8. Scope
We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venuesonline and in-personas well as in all one-on-one communications pertaining to community business.
This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members.
## 9. Contact info
contact@jpmonette.net
## 10. License and attribution
This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).
Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)

32
node_modules/feed/CONTRIBUTING.md generated vendored Normal file
View File

@@ -0,0 +1,32 @@
# How to contribute
We'd love to accept your patches and contributions to this project. There are a just a few small guidelines you need to follow.
## Submitting a patch
1. It's generally best to start by opening a new issue describing the bug or
feature you're intending to fix. Even if you think it's relatively minor,
it's helpful to know what people are working on. Mention in the initial
issue that you are planning to work on that bug or feature so that it can
be assigned to you.
2. Considering each syndication client seem to have their own specificities, make
sure you provide enough information about the client in question if you want
to add new elements or update existing ones. Link to their official documentation
and provide examples.
3. Create and run tests. Your new addition must be covered by unit tests.
4. Follow the normal process of [forking][] the project, and setup a new
branch to work in.
5. Do your best to have [well-formed commit messages][] for each change.
This provides consistency throughout the project, and ensures that commit
messages are able to be formatted properly by various git tools.
6. Finally, push the commits to your fork and submit a [pull request][].
[forking]: https://help.github.com/articles/fork-a-repo
[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[squash]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits
[pull request]: https://help.github.com/articles/creating-a-pull-request

3
node_modules/feed/CONTRIBUTORS.md generated vendored Normal file
View File

@@ -0,0 +1,3 @@
Ben McCormick <ben.mccormick@windsorcircle.com>
Jean-Philippe Monette <contact@jpmonette.net>
Pierre Galvez <contact@pierre-galvez.fr>

7
node_modules/feed/LICENSE generated vendored Executable file
View File

@@ -0,0 +1,7 @@
Copyright (C) 2013, Jean-Philippe Monette <contact@jpmonette.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 in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

136
node_modules/feed/README.md generated vendored Executable file
View File

@@ -0,0 +1,136 @@
<p align="center">
<img src="https://user-images.githubusercontent.com/1114325/60746552-2c059a00-9f77-11e9-9632-e21dea9dd06b.png" alt="Feed for Node.js" width="326">
<br>
<a href="https://travis-ci.org/jpmonette/feed"><img src="https://travis-ci.org/jpmonette/feed.svg?branch=master" alt="Build Status"></a> <a href='https://coveralls.io/github/jpmonette/feed?branch=master'><img src='https://coveralls.io/repos/github/jpmonette/feed/badge.svg?branch=master' alt='Coverage Status' /></a> <a href="https://badge.fury.io/js/feed"><img src="https://badge.fury.io/js/feed.svg" alt="npm version" height="18"></a> <a href="https://github.com/facebook/jest"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg" alt="Tested with Jest"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
</p>
<p align="center"><code>jpmonette/feed</code> - <strong>RSS 2.0, JSON Feed 1.0, and Atom 1.0</strong> generator for <strong>Node.js</strong><br>
Making content syndication simple and intuitive!</p>
---
**👩🏻‍💻 Developer Ready**: Quickly generate syndication feeds for your Website.
**💪🏼 Strongly Typed**: Developed using TypeScript / type-safe.
**🔒 Tested**: Tests & snapshot for each syndication format to avoid regressions.
# Getting Started
## Installation
```bash
$ yarn add feed
```
## Example
```js
import { Feed } from "feed";
const feed = new Feed({
title: "Feed Title",
description: "This is my personal feed!",
id: "http://example.com/",
link: "http://example.com/",
language: "en", // optional, used only in RSS 2.0, possible values: http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
image: "http://example.com/image.png",
favicon: "http://example.com/favicon.ico",
copyright: "All rights reserved 2013, John Doe",
updated: new Date(2013, 6, 14), // optional, default = today
generator: "awesome", // optional, default = 'Feed for Node.js'
feedLinks: {
json: "https://example.com/json",
atom: "https://example.com/atom"
},
author: {
name: "John Doe",
email: "johndoe@example.com",
link: "https://example.com/johndoe"
}
});
posts.forEach(post => {
feed.addItem({
title: post.title,
id: post.url,
link: post.url,
description: post.description,
content: post.content,
author: [
{
name: "Jane Doe",
email: "janedoe@example.com",
link: "https://example.com/janedoe"
},
{
name: "Joe Smith",
email: "joesmith@example.com",
link: "https://example.com/joesmith"
}
],
contributor: [
{
name: "Shawn Kemp",
email: "shawnkemp@example.com",
link: "https://example.com/shawnkemp"
},
{
name: "Reggie Miller",
email: "reggiemiller@example.com",
link: "https://example.com/reggiemiller"
}
],
date: post.date,
image: post.image
});
});
feed.addCategory("Technologie");
feed.addContributor({
name: "Johan Cruyff",
email: "johancruyff@example.com",
link: "https://example.com/johancruyff"
});
console.log(feed.rss2());
// Output: RSS 2.0
console.log(feed.atom1());
// Output: Atom 1.0
console.log(feed.json1());
// Output: JSON Feed 1.0
```
## Migrating from `< 3.0.0`
If you are migrating from a version older than `3.0.0`, be sure to update your import as we migrated to ES6 named imports.
If your environment supports the ES6 module syntax, you can `import` as described above:
```ts
import { Feed } from "feed";
```
Otherwise, you can stick with `require()`:
```diff
- const Feed = require('feed');
+ const Feed = require('feed').Feed;
```
## More Information
- Follow [@jpmonette](https://twitter.com/jpmonette) on Twitter for updates
- Read my personal blog [Blogue de Jean-Philippe Monette](http://blogue.jpmonette.net/) to learn more about what I do!
## License
Copyright (C) 2013, Jean-Philippe Monette <contact@jpmonette.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 in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

14
node_modules/feed/jest.config.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
module.exports = {
verbose: true,
collectCoverage: true,
transform: {
"^.+\\.tsx?$": "ts-jest",
},
testEnvironment: "node",
testPathIgnorePatterns: ["/node_modules/", "__tests__/util/"],
testRegex: "(/__tests__/.*\\.spec)\\.(jsx?|tsx?)$",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
moduleNameMapper: {
"@app/(.*)": "<rootDir>/src/$1",
},
};

3
node_modules/feed/lib/atom1.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { Feed } from "./feed";
declare const _default: (ins: Feed) => string;
export default _default;

121
node_modules/feed/lib/atom1.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var convert = require("xml-js");
var config_1 = require("./config");
var utils_1 = require("./utils");
exports.default = (function (ins) {
var options = ins.options;
var base = {
_declaration: { _attributes: { version: "1.0", encoding: "utf-8" } },
feed: {
_attributes: { xmlns: "http://www.w3.org/2005/Atom" },
id: options.id,
title: options.title,
updated: options.updated ? options.updated.toISOString() : new Date().toISOString(),
generator: utils_1.sanitize(options.generator || config_1.generator)
}
};
if (options.author) {
base.feed.author = formatAuthor(options.author);
}
base.feed.link = [];
if (options.link) {
base.feed.link.push({ _attributes: { rel: "alternate", href: utils_1.sanitize(options.link) } });
}
var atomLink = utils_1.sanitize(options.feed || (options.feedLinks && options.feedLinks.atom));
if (atomLink) {
base.feed.link.push({ _attributes: { rel: "self", href: utils_1.sanitize(atomLink) } });
}
if (options.hub) {
base.feed.link.push({ _attributes: { rel: "hub", href: utils_1.sanitize(options.hub) } });
}
if (options.description) {
base.feed.subtitle = options.description;
}
if (options.image) {
base.feed.logo = options.image;
}
if (options.favicon) {
base.feed.icon = options.favicon;
}
if (options.copyright) {
base.feed.rights = options.copyright;
}
base.feed.category = [];
ins.categories.map(function (category) {
base.feed.category.push({ _attributes: { term: category } });
});
base.feed.contributor = [];
ins.contributors.map(function (contributor) {
base.feed.contributor.push(formatAuthor(contributor));
});
base.feed.entry = [];
ins.items.map(function (item) {
var entry = {
title: { _attributes: { type: "html" }, _cdata: item.title },
id: utils_1.sanitize(item.id || item.link),
link: [{ _attributes: { href: utils_1.sanitize(item.link) } }],
updated: item.date.toISOString()
};
if (item.description) {
entry.summary = {
_attributes: { type: "html" },
_cdata: item.description,
};
}
if (item.content) {
entry.content = {
_attributes: { type: "html" },
_cdata: item.content,
};
}
if (Array.isArray(item.author)) {
entry.author = [];
item.author.map(function (author) {
entry.author.push(formatAuthor(author));
});
}
if (Array.isArray(item.category)) {
entry.category = [];
item.category.map(function (category) {
entry.category.push(formatCategory(category));
});
}
if (item.contributor && Array.isArray(item.contributor)) {
entry.contributor = [];
item.contributor.map(function (contributor) {
entry.contributor.push(formatAuthor(contributor));
});
}
if (item.published) {
entry.published = item.published.toISOString();
}
if (item.copyright) {
entry.rights = item.copyright;
}
base.feed.entry.push(entry);
});
return convert.js2xml(base, { compact: true, ignoreComment: true, spaces: 4 });
});
var formatAuthor = function (author) {
var name = author.name, email = author.email, link = author.link;
var out = { name: name };
if (email) {
out.email = email;
}
if (link) {
out.uri = utils_1.sanitize(link);
}
return out;
};
var formatCategory = function (category) {
var name = category.name, scheme = category.scheme, term = category.term;
return {
_attributes: {
label: name,
scheme: scheme,
term: term,
},
};
};
//# sourceMappingURL=atom1.js.map

1
node_modules/feed/lib/atom1.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"atom1.js","sourceRoot":"","sources":["../src/atom1.ts"],"names":[],"mappings":";;AAAA,gCAAkC;AAClC,mCAAqC;AAGrC,iCAAmC;AAMnC,mBAAe,UAAC,GAAS;IACf,IAAA,OAAO,GAAK,GAAG,QAAR,CAAS;IAExB,IAAM,IAAI,GAAQ;QAChB,YAAY,EAAE,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QACpE,IAAI,EAAE;YACJ,WAAW,EAAE,EAAE,KAAK,EAAE,6BAA6B,EAAE;YACrD,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnF,SAAS,EAAE,gBAAQ,CAAC,OAAO,CAAC,SAAS,IAAI,kBAAS,CAAC;SACpD;KACF,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACjD;IAED,IAAI,CAAC,IAAI,CAAC,IAAI,GA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C9B,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AACjF,CAAC,EAAC;AAMF,IAAM,YAAY,GAAG,UAAC,MAAc;IAC1B,IAAA,IAAI,GAAkB,MAAM,KAAxB,EAAE,KAAK,GAAW,MAAM,MAAjB,EAAE,IAAI,GAAK,MAAM,KAAX,CAAY;IAErC,IAAM,GAAG,GAAoD,EAAE,IAAI,MAAA,EAAE,CAAC;IACtE,IAAI,KAAK,EAAE;QACT,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;KACnB;IAED,IAAI,IAAI,EAAE;QACR,GAAG,CAAC,GAAG,GAAG,gBAAQ,CAAC,IAAI,CAAC,CAAC;KAC1B;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAMF,IAAM,cAAc,GAAG,UAAC,QAAkB;IAChC,IAAA,IAAI,GAAmB,QAAQ,KAA3B,EAAE,MAAM,GAAW,QAAQ,OAAnB,EAAE,IAAI,GAAK,QAAQ,KAAb,CAAc;IAExC,OAAO;QACL,WAAW,EAAE;YACX,KAAK,EAAE,IAAI;YACX,MAAM,QAAA;YACN,IAAI,MAAA;SACL;KACF,CAAC;AACJ,CAAC,CAAC"}

1
node_modules/feed/lib/config/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare const generator = "https://github.com/jpmonette/feed";

5
node_modules/feed/lib/config/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generator = void 0;
exports.generator = "https://github.com/jpmonette/feed";
//# sourceMappingURL=index.js.map

1
node_modules/feed/lib/config/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,mCAAmC,CAAC"}

17
node_modules/feed/lib/feed.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { Author, Extension, FeedOptions, Item } from "./typings";
export { Author, Extension, FeedOptions, Item };
export declare class Feed {
options: FeedOptions;
items: Item[];
categories: string[];
contributors: Author[];
extensions: Extension[];
constructor(options: FeedOptions);
addItem: (item: Item) => number;
addCategory: (category: string) => number;
addContributor: (contributor: Author) => number;
addExtension: (extension: Extension) => number;
atom1: () => string;
rss2: () => string;
json1: () => string;
}

26
node_modules/feed/lib/feed.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Feed = void 0;
var atom1_1 = require("./atom1");
var json_1 = require("./json");
var rss2_1 = require("./rss2");
var Feed = (function () {
function Feed(options) {
var _this = this;
this.items = [];
this.categories = [];
this.contributors = [];
this.extensions = [];
this.addItem = function (item) { return _this.items.push(item); };
this.addCategory = function (category) { return _this.categories.push(category); };
this.addContributor = function (contributor) { return _this.contributors.push(contributor); };
this.addExtension = function (extension) { return _this.extensions.push(extension); };
this.atom1 = function () { return atom1_1.default(_this); };
this.rss2 = function () { return rss2_1.default(_this); };
this.json1 = function () { return json_1.default(_this); };
this.options = options;
}
return Feed;
}());
exports.Feed = Feed;
//# sourceMappingURL=feed.js.map

1
node_modules/feed/lib/feed.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"feed.js","sourceRoot":"","sources":["../src/feed.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,+BAAgC;AAChC,+BAA+B;AAQ/B;IAOE,cAAY,OAAoB;QAAhC,iBAEC;QAPD,UAAK,GAAW,EAAE,CAAC;QACnB,eAAU,GAAa,EAAE,CAAC;QAC1B,iBAAY,GAAa,EAAE,CAAC;QAC5B,eAAU,GAAgB,EAAE,CAAC;QAUtB,YAAO,GAAG,UAAC,IAAU,IAAK,OAAA,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAArB,CAAqB,CAAC;QAMhD,gBAAW,GAAG,UAAC,QAAgB,IAAK,OAAA,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAA9B,CAA8B,CAAC;QAMnE,mBAAc,GAAG,UAAC,WAAmB,IAAK,OAAA,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAnC,CAAmC,CAAC;QAM9E,iBAAY,GAAG,UAAC,SAAoB,IAAK,OAAA,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAA/B,CAA+B,CAAC;QAKzE,UAAK,GAAG,cAAc,OAAA,eAAU,CAAC,KAAI,CAAC,EAAhB,CAAgB,CAAC;QAKvC,SAAI,GAAG,cAAc,OAAA,cAAS,CAAC,KAAI,CAAC,EAAf,CAAe,CAAC;QAKrC,UAAK,GAAG,cAAc,OAAA,cAAU,CAAC,KAAI,CAAC,EAAhB,CAAgB,CAAC;QAxC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAwCH,WAAC;AAAD,CAAC,AAjDD,IAiDC;AAjDY,oBAAI"}

3
node_modules/feed/lib/json.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { Feed } from "./feed";
declare const _default: (ins: Feed) => string;
export default _default;

86
node_modules/feed/lib/json.js generated vendored Normal file
View File

@@ -0,0 +1,86 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (ins) {
var options = ins.options, items = ins.items, extensions = ins.extensions;
var feed = {
version: "https://jsonfeed.org/version/1",
title: options.title,
};
if (options.link) {
feed.home_page_url = options.link;
}
if (options.feedLinks && options.feedLinks.json) {
feed.feed_url = options.feedLinks.json;
}
if (options.description) {
feed.description = options.description;
}
if (options.image) {
feed.icon = options.image;
}
if (options.author) {
feed.author = {};
if (options.author.name) {
feed.author.name = options.author.name;
}
if (options.author.link) {
feed.author.url = options.author.link;
}
}
extensions.map(function (e) {
feed[e.name] = e.objects;
});
feed.items = items.map(function (item) {
var feedItem = {
id: item.id,
content_html: item.content,
};
if (item.link) {
feedItem.url = item.link;
}
if (item.title) {
feedItem.title = item.title;
}
if (item.description) {
feedItem.summary = item.description;
}
if (item.image) {
feedItem.image = item.image;
}
if (item.date) {
feedItem.date_modified = item.date.toISOString();
}
if (item.published) {
feedItem.date_published = item.published.toISOString();
}
if (item.author) {
var author = item.author;
if (author instanceof Array) {
author = author[0];
}
feedItem.author = {};
if (author.name) {
feedItem.author.name = author.name;
}
if (author.link) {
feedItem.author.url = author.link;
}
}
if (Array.isArray(item.category)) {
feedItem.tags = [];
item.category.map(function (category) {
if (category.name) {
feedItem.tags.push(category.name);
}
});
}
if (item.extensions) {
item.extensions.map(function (e) {
feedItem[e.name] = e.objects;
});
}
return feedItem;
});
return JSON.stringify(feed, null, 4);
});
//# sourceMappingURL=json.js.map

1
node_modules/feed/lib/json.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":";;AAOA,mBAAe,UAAC,GAAS;IACf,IAAA,OAAO,GAAwB,GAAG,QAA3B,EAAE,KAAK,GAAiB,GAAG,MAApB,EAAE,UAAU,GAAK,GAAG,WAAR,CAAS;IAE3C,IAAI,IAAI,GAAQ;QACd,OAAO,EAAE,gCAAgC;QACzC,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;KACnC;IAED,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE;QAC/C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;KACxC;IAED,IAAI,OAAO,CAAC,WAAW,EAAE;QACvB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;KACxC;IAED,IAAI,OAAO,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feed/lib/rss2.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { Feed } from "./feed";
declare const _default: (ins: Feed) => string;
export default _default;

168
node_modules/feed/lib/rss2.js generated vendored Normal file
View File

@@ -0,0 +1,168 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var convert = require("xml-js");
var config_1 = require("./config");
var utils_1 = require("./utils");
exports.default = (function (ins) {
var options = ins.options;
var isAtom = false;
var isContent = false;
var base = {
_declaration: { _attributes: { version: "1.0", encoding: "utf-8" } },
rss: {
_attributes: { version: "2.0" },
channel: {
title: { _text: options.title },
link: { _text: utils_1.sanitize(options.link) },
description: { _text: options.description },
lastBuildDate: { _text: options.updated ? options.updated.toUTCString() : new Date().toUTCString() },
docs: { _text: options.docs ? options.docs : "https://validator.w3.org/feed/docs/rss2.html" },
generator: { _text: options.generator || config_1.generator },
},
},
};
if (options.language) {
base.rss.channel.language = { _text: options.language };
}
if (options.ttl) {
base.rss.channel.ttl = { _text: options.ttl };
}
if (options.image) {
base.rss.channel.image = {
title: { _text: options.title },
url: { _text: options.image },
link: { _text: utils_1.sanitize(options.link) }
};
}
if (options.copyright) {
base.rss.channel.copyright = { _text: options.copyright };
}
ins.categories.map(function (category) {
if (!base.rss.channel.category) {
base.rss.channel.category = [];
}
base.rss.channel.category.push({ _text: category });
});
var atomLink = options.feed || (options.feedLinks && options.feedLinks.rss);
if (atomLink) {
isAtom = true;
base.rss.channel["atom:link"] = [
{
_attributes: {
href: utils_1.sanitize(atomLink),
rel: "self",
type: "application/rss+xml",
},
},
];
}
if (options.hub) {
isAtom = true;
if (!base.rss.channel["atom:link"]) {
base.rss.channel["atom:link"] = [];
}
base.rss.channel["atom:link"] = {
_attributes: {
href: utils_1.sanitize(options.hub),
rel: "hub"
}
};
}
base.rss.channel.item = [];
ins.items.map(function (entry) {
var item = {};
if (entry.title) {
item.title = { _cdata: entry.title };
}
if (entry.link) {
item.link = { _text: utils_1.sanitize(entry.link) };
}
if (entry.guid) {
item.guid = { _text: entry.guid };
}
else if (entry.id) {
item.guid = { _text: entry.id };
}
else if (entry.link) {
item.guid = { _text: utils_1.sanitize(entry.link) };
}
if (entry.date) {
item.pubDate = { _text: entry.date.toUTCString() };
}
if (entry.published) {
item.pubDate = { _text: entry.published.toUTCString() };
}
if (entry.description) {
item.description = { _cdata: entry.description };
}
if (entry.content) {
isContent = true;
item["content:encoded"] = { _cdata: entry.content };
}
if (Array.isArray(entry.author)) {
item.author = [];
entry.author.map(function (author) {
if (author.email && author.name) {
item.author.push({ _text: author.email + " (" + author.name + ")" });
}
});
}
if (Array.isArray(entry.category)) {
item.category = [];
entry.category.map(function (category) {
item.category.push(formatCategory(category));
});
}
if (entry.enclosure) {
item.enclosure = formatEnclosure(entry.enclosure);
}
if (entry.image) {
item.enclosure = formatEnclosure(entry.image, "image");
}
if (entry.audio) {
item.enclosure = formatEnclosure(entry.audio, "audio");
}
if (entry.video) {
item.enclosure = formatEnclosure(entry.video, "video");
}
base.rss.channel.item.push(item);
});
if (isContent) {
base.rss._attributes["xmlns:dc"] = "http://purl.org/dc/elements/1.1/";
base.rss._attributes["xmlns:content"] = "http://purl.org/rss/1.0/modules/content/";
}
if (isAtom) {
base.rss._attributes["xmlns:atom"] = "http://www.w3.org/2005/Atom";
}
return convert.js2xml(base, { compact: true, ignoreComment: true, spaces: 4 });
});
var formatEnclosure = function (enclosure, mimeCategory) {
if (mimeCategory === void 0) { mimeCategory = "image"; }
if (typeof enclosure === "string") {
var type_1 = new URL(enclosure).pathname.split(".").slice(-1)[0];
return { _attributes: { url: enclosure, length: 0, type: mimeCategory + "/" + type_1 } };
}
var type = new URL(enclosure.url).pathname.split(".").slice(-1)[0];
return { _attributes: __assign({ length: 0, type: mimeCategory + "/" + type }, enclosure) };
};
var formatCategory = function (category) {
var name = category.name, domain = category.domain;
return {
_text: name,
_attributes: {
domain: domain,
},
};
};
//# sourceMappingURL=rss2.js.map

1
node_modules/feed/lib/rss2.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

59
node_modules/feed/lib/typings/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,59 @@
export interface Item {
title: string;
id?: string;
link: string;
date: Date;
description?: string;
content?: string;
category?: Category[];
guid?: string;
image?: string | Enclosure;
audio?: string | Enclosure;
video?: string | Enclosure;
enclosure?: Enclosure;
author?: Author[];
contributor?: Author[];
published?: Date;
copyright?: string;
extensions?: Extension[];
}
export interface Enclosure {
url: string;
type?: string;
length?: number;
title?: string;
duration?: number;
}
export interface Author {
name?: string;
email?: string;
link?: string;
}
export interface Category {
name?: string;
domain?: string;
scheme?: string;
term?: string;
}
export interface FeedOptions {
id: string;
title: string;
updated?: Date;
generator?: string;
language?: string;
ttl?: number;
feed?: string;
feedLinks?: any;
hub?: string;
docs?: string;
author?: Author;
link?: string;
description?: string;
image?: string;
favicon?: string;
copyright: string;
}
export interface Extension {
name: string;
objects: any;
}

3
node_modules/feed/lib/typings/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=index.js.map

1
node_modules/feed/lib/typings/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/typings/index.ts"],"names":[],"mappings":""}

1
node_modules/feed/lib/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function sanitize(url: string | undefined): string | undefined;

11
node_modules/feed/lib/utils.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sanitize = void 0;
function sanitize(url) {
if (typeof (url) === 'undefined') {
return;
}
return url.replace(/&/g, '&amp;');
}
exports.sanitize = sanitize;
//# sourceMappingURL=utils.js.map

1
node_modules/feed/lib/utils.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,QAAQ,CAAC,GAAuB;IAC9C,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,WAAW,EAAE;QAChC,OAAO;KACR;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AALD,4BAKC"}

50
node_modules/feed/package.json generated vendored Executable file
View File

@@ -0,0 +1,50 @@
{
"name": "feed",
"version": "4.2.2",
"description": "Feed is a RSS, Atom and JSON feed generator for Node.js, making content syndication simple and intuitive!",
"homepage": "https://github.com/jpmonette/feed",
"author": "Jean-Philippe Monette <contact@jpmonette.net>",
"license": "MIT",
"main": "lib/feed.js",
"types": "lib/feed.d.ts",
"scripts": {
"changelog": "github_changelog_generator jpmonette/feed --token $GITHUB_TOKEN",
"build": "rimraf lib/ && mkdir lib && tsc",
"prepublish": "npm run build",
"test": "export NODE_ENV=test && jest --silent",
"test-travis": "export NODE_ENV=test && jest --coverage"
},
"keywords": [
"rss",
"atom",
"feed",
"syndication",
"xml",
"wrapper",
"blog"
],
"dependencies": {
"xml-js": "^1.6.11"
},
"devDependencies": {
"@types/jest": "^26.0.14",
"codeclimate-test-reporter": "^0.5.1",
"coveralls": "^3.1.0",
"jest": "^26.5.3",
"prettier": "^2.1.2",
"source-map-loader": "^1.1.1",
"ts-jest": "^26.4.1",
"tslint": "^6.1.2",
"typescript": "^4.0.3"
},
"engines": {
"node": ">=0.4.0"
},
"bugs": {
"url": "https://github.com/jpmonette/feed/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/jpmonette/feed.git"
}
}

View File

@@ -0,0 +1,63 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`atom 1.0 should generate a valid feed 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<feed xmlns=\\"http://www.w3.org/2005/Atom\\">
<id>http://example.com/</id>
<title>Feed Title</title>
<updated>2013-07-13T23:00:00.000Z</updated>
<generator>https://github.com/jpmonette/feed</generator>
<author>
<name>John Doe</name>
<email>johndoe@example.com</email>
<uri>https://example.com/johndoe?link=sanitized&amp;value=2</uri>
</author>
<link rel=\\"alternate\\" href=\\"http://example.com/\\"/>
<link rel=\\"self\\" href=\\"http://example.com/sampleFeed.rss\\"/>
<link rel=\\"hub\\" href=\\"wss://example.com/\\"/>
<subtitle>This is my personnal feed!</subtitle>
<logo>http://example.com/image.png</logo>
<icon>http://example.com/image.ico</icon>
<rights>All rights reserved 2013, John Doe</rights>
<category term=\\"Technology\\"/>
<contributor>
<name>Johan Cruyff</name>
<email>johancruyff@example.com</email>
<uri>https://example.com/johancruyff</uri>
</contributor>
<entry>
<title type=\\"html\\"><![CDATA[Hello World]]></title>
<id>https://example.com/hello-world?id=this&amp;that=true</id>
<link href=\\"https://example.com/hello-world?link=sanitized&amp;value=2\\"/>
<updated>2013-07-13T23:00:00.000Z</updated>
<summary type=\\"html\\"><![CDATA[This is an article about Hello World.]]></summary>
<content type=\\"html\\"><![CDATA[Content of my item]]></content>
<author>
<name>Jane Doe</name>
<email>janedoe@example.com</email>
<uri>https://example.com/janedoe?link=sanitized&amp;value=2</uri>
</author>
<author>
<name>Joe Smith</name>
<email>joesmith@example.com</email>
<uri>https://example.com/joesmith</uri>
</author>
<author>
<name>Joe Smith, Name Only</name>
</author>
<category label=\\"Grateful Dead\\"/>
<category label=\\"MSFT\\"/>
<contributor>
<name>Shawn Kemp</name>
<email>shawnkemp@example.com</email>
<uri>https://example.com/shawnkemp</uri>
</contributor>
<contributor>
<name>Reggie Miller</name>
<email>reggiemiller@example.com</email>
<uri>https://example.com/reggiemiller</uri>
</contributor>
<published>2013-07-10T23:00:00.000Z</published>
</entry>
</feed>"
`;

View File

@@ -0,0 +1,48 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`json 1 should generate a valid feed 1`] = `
"{
\\"version\\": \\"https://jsonfeed.org/version/1\\",
\\"title\\": \\"Feed Title\\",
\\"home_page_url\\": \\"http://example.com/\\",
\\"feed_url\\": \\"http://example.com/sampleFeed.json\\",
\\"description\\": \\"This is my personnal feed!\\",
\\"icon\\": \\"http://example.com/image.png\\",
\\"author\\": {
\\"name\\": \\"John Doe\\",
\\"url\\": \\"https://example.com/johndoe?link=sanitized&value=2\\"
},
\\"_example_extension\\": {
\\"about\\": \\"just an extension example\\",
\\"dummy\\": \\"example\\"
},
\\"items\\": [
{
\\"id\\": \\"https://example.com/hello-world?id=this&that=true\\",
\\"content_html\\": \\"Content of my item\\",
\\"url\\": \\"https://example.com/hello-world?link=sanitized&value=2\\",
\\"title\\": \\"Hello World\\",
\\"summary\\": \\"This is an article about Hello World.\\",
\\"image\\": \\"https://example.com/hello-world.jpg\\",
\\"date_modified\\": \\"2013-07-13T23:00:00.000Z\\",
\\"date_published\\": \\"2013-07-10T23:00:00.000Z\\",
\\"author\\": {
\\"name\\": \\"Jane Doe\\",
\\"url\\": \\"https://example.com/janedoe?link=sanitized&value=2\\"
},
\\"tags\\": [
\\"Grateful Dead\\",
\\"MSFT\\"
],
\\"_item_extension_1\\": {
\\"about\\": \\"just an item extension example\\",
\\"dummy1\\": \\"example\\"
},
\\"_item_extension_2\\": {
\\"about\\": \\"just a second item extension example\\",
\\"dummy1\\": \\"example\\"
}
}
]
}"
`;

View File

@@ -0,0 +1,263 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`rss 2.0 should generate a valid feed 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<rss version=\\"2.0\\" xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\" xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\" xmlns:atom=\\"http://www.w3.org/2005/Atom\\">
<channel>
<title>Feed Title</title>
<link>http://example.com/</link>
<description>This is my personnal feed!</description>
<lastBuildDate>Sat, 13 Jul 2013 23:00:00 GMT</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>https://github.com/jpmonette/feed</generator>
<language>en</language>
<ttl>60</ttl>
<image>
<title>Feed Title</title>
<url>http://example.com/image.png</url>
<link>http://example.com/</link>
</image>
<copyright>All rights reserved 2013, John Doe</copyright>
<category>Technology</category>
<atom:link href=\\"wss://example.com/\\" rel=\\"hub\\"/>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world?link=sanitized&amp;value=2</link>
<guid>https://example.com/hello-world?id=this&amp;that=true</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure url=\\"https://example.com/hello-world.jpg\\" length=\\"0\\" type=\\"image/jpg\\"/>
</item>
</channel>
</rss>"
`;
exports[`rss 2.0 should generate a valid feed with audio 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<rss version=\\"2.0\\" xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\" xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\" xmlns:atom=\\"http://www.w3.org/2005/Atom\\">
<channel>
<title>Feed Title</title>
<link>http://example.com/</link>
<description>This is my personnal feed!</description>
<lastBuildDate>Sat, 13 Jul 2013 23:00:00 GMT</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>https://github.com/jpmonette/feed</generator>
<language>en</language>
<ttl>60</ttl>
<image>
<title>Feed Title</title>
<url>http://example.com/image.png</url>
<link>http://example.com/</link>
</image>
<copyright>All rights reserved 2013, John Doe</copyright>
<category>Technology</category>
<atom:link href=\\"wss://example.com/\\" rel=\\"hub\\"/>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world?link=sanitized&amp;value=2</link>
<guid>https://example.com/hello-world?id=this&amp;that=true</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure url=\\"https://example.com/hello-world.jpg\\" length=\\"0\\" type=\\"image/jpg\\"/>
</item>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world2</link>
<guid>419c523a-28f4-489c-877e-9604be64c001</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure length=\\"12665\\" type=\\"image/jpg\\" url=\\"https://example.com/hello-world.jpg\\"/>
</item>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world2</link>
<guid>419c523a-28f4-489c-877e-9604be64c001</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure length=\\"12665\\" type=\\"image/jpg\\" url=\\"https://example.com/hello-world.jpg\\"/>
</item>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world3</link>
<guid>https://example.com/hello-world3</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure length=\\"12665\\" type=\\"audio/mpeg\\" url=\\"https://example.com/hello-world.mp3\\"/>
</item>
</channel>
</rss>"
`;
exports[`rss 2.0 should generate a valid feed with enclosure 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<rss version=\\"2.0\\" xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\" xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\" xmlns:atom=\\"http://www.w3.org/2005/Atom\\">
<channel>
<title>Feed Title</title>
<link>http://example.com/</link>
<description>This is my personnal feed!</description>
<lastBuildDate>Sat, 13 Jul 2013 23:00:00 GMT</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>https://github.com/jpmonette/feed</generator>
<language>en</language>
<ttl>60</ttl>
<image>
<title>Feed Title</title>
<url>http://example.com/image.png</url>
<link>http://example.com/</link>
</image>
<copyright>All rights reserved 2013, John Doe</copyright>
<category>Technology</category>
<atom:link href=\\"wss://example.com/\\" rel=\\"hub\\"/>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world?link=sanitized&amp;value=2</link>
<guid>https://example.com/hello-world?id=this&amp;that=true</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure url=\\"https://example.com/hello-world.jpg\\" length=\\"0\\" type=\\"image/jpg\\"/>
</item>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world2</link>
<guid>419c523a-28f4-489c-877e-9604be64c001</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure length=\\"12665\\" type=\\"image/jpg\\" url=\\"https://example.com/hello-world.jpg\\"/>
</item>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world2</link>
<guid>419c523a-28f4-489c-877e-9604be64c001</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure length=\\"12665\\" type=\\"image/jpg\\" url=\\"https://example.com/hello-world.jpg\\"/>
</item>
</channel>
</rss>"
`;
exports[`rss 2.0 should generate a valid feed with image properties 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<rss version=\\"2.0\\" xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\" xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\" xmlns:atom=\\"http://www.w3.org/2005/Atom\\">
<channel>
<title>Feed Title</title>
<link>http://example.com/</link>
<description>This is my personnal feed!</description>
<lastBuildDate>Sat, 13 Jul 2013 23:00:00 GMT</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>https://github.com/jpmonette/feed</generator>
<language>en</language>
<ttl>60</ttl>
<image>
<title>Feed Title</title>
<url>http://example.com/image.png</url>
<link>http://example.com/</link>
</image>
<copyright>All rights reserved 2013, John Doe</copyright>
<category>Technology</category>
<atom:link href=\\"wss://example.com/\\" rel=\\"hub\\"/>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world?link=sanitized&amp;value=2</link>
<guid>https://example.com/hello-world?id=this&amp;that=true</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure url=\\"https://example.com/hello-world.jpg\\" length=\\"0\\" type=\\"image/jpg\\"/>
</item>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world2</link>
<guid>419c523a-28f4-489c-877e-9604be64c001</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure length=\\"12665\\" type=\\"image/jpg\\" url=\\"https://example.com/hello-world.jpg\\"/>
</item>
</channel>
</rss>"
`;
exports[`rss 2.0 should generate a valid feed with video 1`] = `
"<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>
<rss version=\\"2.0\\" xmlns:dc=\\"http://purl.org/dc/elements/1.1/\\" xmlns:content=\\"http://purl.org/rss/1.0/modules/content/\\" xmlns:atom=\\"http://www.w3.org/2005/Atom\\">
<channel>
<title>Feed Title</title>
<link>http://example.com/</link>
<description>This is my personnal feed!</description>
<lastBuildDate>Sat, 13 Jul 2013 23:00:00 GMT</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<generator>https://github.com/jpmonette/feed</generator>
<language>en</language>
<ttl>60</ttl>
<image>
<title>Feed Title</title>
<url>http://example.com/image.png</url>
<link>http://example.com/</link>
</image>
<copyright>All rights reserved 2013, John Doe</copyright>
<atom:link href=\\"wss://example.com/\\" rel=\\"hub\\"/>
<item>
<title><![CDATA[Hello World]]></title>
<link>https://example.com/hello-world4</link>
<guid>419c523a-28f4-489c-877e-9604be64c005</guid>
<pubDate>Wed, 10 Jul 2013 23:00:00 GMT</pubDate>
<description><![CDATA[This is an article about Hello World.]]></description>
<content:encoded><![CDATA[Content of my item]]></content:encoded>
<author>janedoe@example.com (Jane Doe)</author>
<author>joesmith@example.com (Joe Smith)</author>
<category>Grateful Dead</category>
<category domain=\\"http://www.fool.com/cusips\\">MSFT</category>
<enclosure url=\\"https://example.com/hello-world.mp4\\" length=\\"0\\" type=\\"video/mp4\\"/>
</item>
</channel>
</rss>"
`;

8
node_modules/feed/src/__tests__/atom1.spec.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { sampleFeed } from "./setup";
describe("atom 1.0", () => {
it("should generate a valid feed", () => {
const actual = sampleFeed.atom1();
expect(actual).toMatchSnapshot();
});
});

8
node_modules/feed/src/__tests__/json.spec.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { sampleFeed } from "./setup";
describe("json 1", () => {
it("should generate a valid feed", () => {
const actual = sampleFeed.json1();
expect(actual).toMatchSnapshot();
});
});

230
node_modules/feed/src/__tests__/rss2.spec.ts generated vendored Normal file
View File

@@ -0,0 +1,230 @@
import { Feed } from "../feed";
import { published, sampleFeed, updated } from "./setup";
describe("rss 2.0", () => {
it("should generate a valid feed", () => {
const actual = sampleFeed.rss2();
expect(actual).toMatchSnapshot();
});
it("should generate a valid feed with image properties", () => {
sampleFeed.addItem({
title: "Hello World",
guid: "419c523a-28f4-489c-877e-9604be64c001",
link: "https://example.com/hello-world2",
description: "This is an article about Hello World.",
content: "Content of my item",
author: [
{
name: "Jane Doe",
email: "janedoe@example.com",
link: "https://example.com/janedoe",
},
{
name: "Joe Smith",
email: "joesmith@example.com",
link: "https://example.com/joesmith",
},
],
extensions: [
{
name: "_item_extension_1",
objects: {
about: "just an item extension example",
dummy1: "example",
},
},
{
name: "_item_extension_2",
objects: {
about: "just a second item extension example",
dummy1: "example",
},
},
],
category: [
{
name: "Grateful Dead",
},
{
name: "MSFT",
domain: "http://www.fool.com/cusips",
},
],
date: updated,
image: { url: "https://example.com/hello-world.jpg", length: 12665 },
published,
});
const actual = sampleFeed.rss2();
expect(actual).toMatchSnapshot();
});
it("should generate a valid feed with enclosure", () => {
sampleFeed.addItem({
title: "Hello World",
guid: "419c523a-28f4-489c-877e-9604be64c001",
link: "https://example.com/hello-world2",
description: "This is an article about Hello World.",
content: "Content of my item",
author: [
{
name: "Jane Doe",
email: "janedoe@example.com",
link: "https://example.com/janedoe",
},
{
name: "Joe Smith",
email: "joesmith@example.com",
link: "https://example.com/joesmith",
},
],
extensions: [
{
name: "_item_extension_1",
objects: {
about: "just an item extension example",
dummy1: "example",
},
},
{
name: "_item_extension_2",
objects: {
about: "just a second item extension example",
dummy1: "example",
},
},
],
category: [
{
name: "Grateful Dead",
},
{
name: "MSFT",
domain: "http://www.fool.com/cusips",
},
],
date: updated,
enclosure: { url: "https://example.com/hello-world.jpg", length: 12665 },
published,
});
const actual = sampleFeed.rss2();
expect(actual).toMatchSnapshot();
});
it("should generate a valid feed with audio", () => {
sampleFeed.addItem({
title: "Hello World",
link: "https://example.com/hello-world3",
description: "This is an article about Hello World.",
content: "Content of my item",
author: [
{
name: "Jane Doe",
email: "janedoe@example.com",
link: "https://example.com/janedoe",
},
{
name: "Joe Smith",
email: "joesmith@example.com",
link: "https://example.com/joesmith",
},
],
extensions: [
{
name: "_item_extension_1",
objects: {
about: "just an item extension example",
dummy1: "example",
},
},
{
name: "_item_extension_2",
objects: {
about: "just a second item extension example",
dummy1: "example",
},
},
],
category: [
{
name: "Grateful Dead",
},
{
name: "MSFT",
domain: "http://www.fool.com/cusips",
},
],
date: updated,
audio: { url: "https://example.com/hello-world.mp3", length: 12665, type: "audio/mpeg" },
published,
});
const actual = sampleFeed.rss2();
expect(actual).toMatchSnapshot();
});
it("should generate a valid feed with video", () => {
const sampleFeed = new Feed({
title: "Feed Title",
description: "This is my personnal feed!",
link: "http://example.com/",
id: "http://example.com/",
language: "en",
ttl: 60,
image: "http://example.com/image.png",
copyright: "All rights reserved 2013, John Doe",
hub: "wss://example.com/",
updated, // optional, default = today
author: {
name: "John Doe",
email: "johndoe@example.com",
link: "https://example.com/johndoe",
},
});
sampleFeed.addItem({
title: "Hello World",
id: "419c523a-28f4-489c-877e-9604be64c005",
link: "https://example.com/hello-world4",
description: "This is an article about Hello World.",
content: "Content of my item",
author: [
{
name: "Jane Doe",
email: "janedoe@example.com",
link: "https://example.com/janedoe",
},
{
name: "Joe Smith",
email: "joesmith@example.com",
link: "https://example.com/joesmith",
},
],
extensions: [
{
name: "_item_extension_1",
objects: {
about: "just an item extension example",
dummy1: "example",
},
},
{
name: "_item_extension_2",
objects: {
about: "just a second item extension example",
dummy1: "example",
},
},
],
category: [
{
name: "Grateful Dead",
},
{
name: "MSFT",
domain: "http://www.fool.com/cusips",
},
],
date: updated,
video: "https://example.com/hello-world.mp4",
published,
});
const actual = sampleFeed.rss2();
expect(actual).toMatchSnapshot();
});
});

108
node_modules/feed/src/__tests__/setup.ts generated vendored Normal file
View File

@@ -0,0 +1,108 @@
import { Feed } from "../feed";
export const updated = new Date("Sat, 13 Jul 2013 23:00:00 GMT");
export const published = new Date("Sat, 10 Jul 2013 23:00:00 GMT");
export const sampleFeed = new Feed({
title: "Feed Title",
description: "This is my personnal feed!",
link: "http://example.com/",
id: "http://example.com/",
feed: "http://example.com/sampleFeed.rss",
feedLinks: {
json: "http://example.com/sampleFeed.json",
},
language: "en",
ttl: 60,
image: "http://example.com/image.png",
favicon: "http://example.com/image.ico",
copyright: "All rights reserved 2013, John Doe",
hub: "wss://example.com/",
updated, // optional, default = today
author: {
name: "John Doe",
email: "johndoe@example.com",
link: "https://example.com/johndoe?link=sanitized&value=2"
}
});
sampleFeed.addCategory("Technology");
sampleFeed.addContributor({
name: "Johan Cruyff",
email: "johancruyff@example.com",
link: "https://example.com/johancruyff",
});
sampleFeed.addItem({
title: "Hello World",
id: "https://example.com/hello-world?id=this&that=true",
link: "https://example.com/hello-world?link=sanitized&value=2",
description: "This is an article about Hello World.",
content: "Content of my item",
author: [
{
name: "Jane Doe",
email: "janedoe@example.com",
link: "https://example.com/janedoe?link=sanitized&value=2",
},
{
name: "Joe Smith",
email: "joesmith@example.com",
link: "https://example.com/joesmith",
},
{
name: "Joe Smith, Name Only",
}
],
contributor: [
{
name: "Shawn Kemp",
email: "shawnkemp@example.com",
link: "https://example.com/shawnkemp",
},
{
name: "Reggie Miller",
email: "reggiemiller@example.com",
link: "https://example.com/reggiemiller",
},
],
extensions: [
{
name: "_item_extension_1",
objects: {
about: "just an item extension example",
dummy1: "example",
},
},
{
name: "_item_extension_2",
objects: {
about: "just a second item extension example",
dummy1: "example",
},
},
],
category: [
{
name: "Grateful Dead",
},
{
name: "MSFT",
domain: "http://www.fool.com/cusips",
},
],
date: updated,
image: "https://example.com/hello-world.jpg",
enclosure: { url: "https://example.com/hello-world.jpg", length: 12665, type: "image/jpeg" },
published,
});
sampleFeed.addExtension({
name: "_example_extension",
objects: {
about: "just an extension example",
dummy: "example",
},
});

15
node_modules/feed/src/__tests__/utils.spec.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import { sanitize } from "../utils";
describe("Sanitizing", () => {
it("should sanitize & to &amp;", () => {
expect('&amp;').toEqual(sanitize('&'));
});
it("should handle multiple &", () => {
expect('https://test.com/?page=1&amp;size=3&amp;length=10').toEqual(sanitize('https://test.com/?page=1&size=3&length=10'));
});
it("should handle undefined", () => {
var undefined;
expect(sanitize(undefined)).toBeUndefined();
});
});

202
node_modules/feed/src/atom1.ts generated vendored Normal file
View File

@@ -0,0 +1,202 @@
import * as convert from "xml-js";
import { generator } from "./config";
import { Feed } from "./feed";
import { Author, Category, Item } from "./typings";
import { sanitize } from "./utils";
/**
* Returns an Atom feed
* @param ins
*/
export default (ins: Feed) => {
const { options } = ins;
const base: any = {
_declaration: { _attributes: { version: "1.0", encoding: "utf-8" } },
feed: {
_attributes: { xmlns: "http://www.w3.org/2005/Atom" },
id: options.id,
title: options.title,
updated: options.updated ? options.updated.toISOString() : new Date().toISOString(),
generator: sanitize(options.generator || generator)
}
};
if (options.author) {
base.feed.author = formatAuthor(options.author);
}
base.feed.link = [];
// link (rel="alternate")
if (options.link) {
base.feed.link.push({ _attributes: { rel: "alternate", href: sanitize(options.link) } });
}
// link (rel="self")
const atomLink = sanitize(options.feed || (options.feedLinks && options.feedLinks.atom));
if (atomLink) {
base.feed.link.push({ _attributes: { rel: "self", href: sanitize(atomLink) } });
}
// link (rel="hub")
if (options.hub) {
base.feed.link.push({ _attributes: { rel: "hub", href: sanitize(options.hub) } });
}
/**************************************************************************
* "feed" node: optional elements
*************************************************************************/
if (options.description) {
base.feed.subtitle = options.description;
}
if (options.image) {
base.feed.logo = options.image;
}
if (options.favicon) {
base.feed.icon = options.favicon;
}
if (options.copyright) {
base.feed.rights = options.copyright;
}
base.feed.category = [];
ins.categories.map((category: string) => {
base.feed.category.push({ _attributes: { term: category } });
});
base.feed.contributor = [];
ins.contributors.map((contributor: Author) => {
base.feed.contributor.push(formatAuthor(contributor));
});
// icon
base.feed.entry = [];
/**************************************************************************
* "entry" nodes
*************************************************************************/
ins.items.map((item: Item) => {
//
// entry: required elements
//
let entry: convert.ElementCompact = {
title: { _attributes: { type: "html" }, _cdata: item.title },
id: sanitize(item.id || item.link),
link: [{ _attributes: { href: sanitize(item.link) } }],
updated: item.date.toISOString()
};
//
// entry: recommended elements
//
if (item.description) {
entry.summary = {
_attributes: { type: "html" },
_cdata: item.description,
};
}
if (item.content) {
entry.content = {
_attributes: { type: "html" },
_cdata: item.content,
};
}
// entry author(s)
if (Array.isArray(item.author)) {
entry.author = [];
item.author.map((author: Author) => {
entry.author.push(formatAuthor(author));
});
}
// content
// link - relative link to article
//
// entry: optional elements
//
// category
if (Array.isArray(item.category)) {
entry.category = [];
item.category.map((category: Category) => {
entry.category.push(formatCategory(category));
});
}
// contributor
if (item.contributor && Array.isArray(item.contributor)) {
entry.contributor = [];
item.contributor.map((contributor: Author) => {
entry.contributor.push(formatAuthor(contributor));
});
}
// published
if (item.published) {
entry.published = item.published.toISOString();
}
// source
// rights
if (item.copyright) {
entry.rights = item.copyright;
}
base.feed.entry.push(entry);
});
return convert.js2xml(base, { compact: true, ignoreComment: true, spaces: 4 });
};
/**
* Returns a formatted author
* @param author
*/
const formatAuthor = (author: Author) => {
const { name, email, link } = author;
const out: { name?: string, email?: string, uri?: string } = { name };
if (email) {
out.email = email;
}
if (link) {
out.uri = sanitize(link);
}
return out;
};
/**
* Returns a formatted category
* @param category
*/
const formatCategory = (category: Category) => {
const { name, scheme, term } = category;
return {
_attributes: {
label: name,
scheme,
term,
},
};
};

1
node_modules/feed/src/config/index.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export const generator = "https://github.com/jpmonette/feed";

60
node_modules/feed/src/feed.ts generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import renderAtom from "./atom1";
import renderJSON from "./json";
import renderRSS from "./rss2";
import { Author, Extension, FeedOptions, Item } from "./typings";
export { Author, Extension, FeedOptions, Item };
/**
* Class used to generate Feeds
*/
export class Feed {
options: FeedOptions;
items: Item[] = [];
categories: string[] = [];
contributors: Author[] = [];
extensions: Extension[] = [];
constructor(options: FeedOptions) {
this.options = options;
}
/**
* Add a feed item
* @param item
*/
public addItem = (item: Item) => this.items.push(item);
/**
* Add a category
* @param category
*/
public addCategory = (category: string) => this.categories.push(category);
/**
* Add a contributor
* @param contributor
*/
public addContributor = (contributor: Author) => this.contributors.push(contributor);
/**
* Adds an extension
* @param extension
*/
public addExtension = (extension: Extension) => this.extensions.push(extension);
/**
* Returns a Atom 1.0 feed
*/
public atom1 = (): string => renderAtom(this);
/**
* Returns a RSS 2.0 feed
*/
public rss2 = (): string => renderRSS(this);
/**
* Returns a JSON1 feed
*/
public json1 = (): string => renderJSON(this);
}

108
node_modules/feed/src/json.ts generated vendored Normal file
View File

@@ -0,0 +1,108 @@
import { Feed } from "./feed";
import { Author, Category, Extension, Item } from "./typings";
/**
* Returns a JSON feed
* @param ins
*/
export default (ins: Feed) => {
const { options, items, extensions } = ins;
let feed: any = {
version: "https://jsonfeed.org/version/1",
title: options.title,
};
if (options.link) {
feed.home_page_url = options.link;
}
if (options.feedLinks && options.feedLinks.json) {
feed.feed_url = options.feedLinks.json;
}
if (options.description) {
feed.description = options.description;
}
if (options.image) {
feed.icon = options.image;
}
if (options.author) {
feed.author = {};
if (options.author.name) {
feed.author.name = options.author.name;
}
if (options.author.link) {
feed.author.url = options.author.link;
}
}
extensions.map((e: Extension) => {
feed[e.name] = e.objects;
});
feed.items = items.map((item: Item) => {
let feedItem: any = {
id: item.id,
// json_feed distinguishes between html and text content
// but since we only take a single type, we'll assume HTML
content_html: item.content,
};
if (item.link) {
feedItem.url = item.link;
}
if (item.title) {
feedItem.title = item.title;
}
if (item.description) {
feedItem.summary = item.description;
}
if (item.image) {
feedItem.image = item.image;
}
if (item.date) {
feedItem.date_modified = item.date.toISOString();
}
if (item.published) {
feedItem.date_published = item.published.toISOString();
}
if (item.author) {
let author: Author | Author[] = item.author;
if (author instanceof Array) {
// json feed only supports 1 author per post
author = author[0];
}
feedItem.author = {};
if (author.name) {
feedItem.author.name = author.name;
}
if (author.link) {
feedItem.author.url = author.link;
}
}
if (Array.isArray(item.category)) {
feedItem.tags = [];
item.category.map((category: Category) => {
if (category.name) {
feedItem.tags.push(category.name);
}
});
}
if (item.extensions) {
item.extensions.map((e: Extension) => {
feedItem[e.name] = e.objects;
});
}
return feedItem;
});
return JSON.stringify(feed, null, 4);
};

237
node_modules/feed/src/rss2.ts generated vendored Normal file
View File

@@ -0,0 +1,237 @@
import * as convert from "xml-js";
import { generator } from "./config";
import { Feed } from "./feed";
import { Author, Category, Enclosure, Item } from "./typings";
import { sanitize } from "./utils";
/**
* Returns a RSS 2.0 feed
*/
export default (ins: Feed) => {
const { options } = ins;
let isAtom = false;
let isContent = false;
const base: any = {
_declaration: { _attributes: { version: "1.0", encoding: "utf-8" } },
rss: {
_attributes: { version: "2.0" },
channel: {
title: { _text: options.title },
link: { _text: sanitize(options.link) },
description: { _text: options.description },
lastBuildDate: { _text: options.updated ? options.updated.toUTCString() : new Date().toUTCString() },
docs: { _text: options.docs ? options.docs : "https://validator.w3.org/feed/docs/rss2.html" },
generator: { _text: options.generator || generator },
},
},
};
/**
* Channel language
* https://validator.w3.org/feed/docs/rss2.html#ltlanguagegtSubelementOfLtchannelgt
*/
if (options.language) {
base.rss.channel.language = { _text: options.language };
}
/**
* Channel ttl
* https://validator.w3.org/feed/docs/rss2.html#ltttlgtSubelementOfLtchannelgt
*/
if (options.ttl) {
base.rss.channel.ttl = { _text: options.ttl };
}
/**
* Channel Image
* https://validator.w3.org/feed/docs/rss2.html#ltimagegtSubelementOfLtchannelgt
*/
if (options.image) {
base.rss.channel.image = {
title: { _text: options.title },
url: { _text: options.image },
link: { _text: sanitize(options.link) }
};
}
/**
* Channel Copyright
* https://validator.w3.org/feed/docs/rss2.html#optionalChannelElements
*/
if (options.copyright) {
base.rss.channel.copyright = { _text: options.copyright };
}
/**
* Channel Categories
* https://validator.w3.org/feed/docs/rss2.html#comments
*/
ins.categories.map((category) => {
if (!base.rss.channel.category) {
base.rss.channel.category = [];
}
base.rss.channel.category.push({ _text: category });
});
/**
* Feed URL
* http://validator.w3.org/feed/docs/warning/MissingAtomSelfLink.html
*/
const atomLink = options.feed || (options.feedLinks && options.feedLinks.rss);
if (atomLink) {
isAtom = true;
base.rss.channel["atom:link"] = [
{
_attributes: {
href: sanitize(atomLink),
rel: "self",
type: "application/rss+xml",
},
},
];
}
/**
* Hub for PubSubHubbub
* https://code.google.com/p/pubsubhubbub/
*/
if (options.hub) {
isAtom = true;
if (!base.rss.channel["atom:link"]) {
base.rss.channel["atom:link"] = [];
}
base.rss.channel["atom:link"] = {
_attributes: {
href: sanitize(options.hub),
rel: "hub"
}
};
}
/**
* Channel Categories
* https://validator.w3.org/feed/docs/rss2.html#hrelementsOfLtitemgt
*/
base.rss.channel.item = [];
ins.items.map((entry: Item) => {
let item: any = {};
if (entry.title) {
item.title = { _cdata: entry.title };
}
if (entry.link) {
item.link = { _text: sanitize(entry.link) };
}
if (entry.guid) {
item.guid = { _text: entry.guid };
} else if (entry.id) {
item.guid = { _text: entry.id };
} else if (entry.link) {
item.guid = { _text: sanitize(entry.link) };
}
if (entry.date) {
item.pubDate = { _text: entry.date.toUTCString() };
}
if (entry.published) {
item.pubDate = { _text: entry.published.toUTCString() };
}
if (entry.description) {
item.description = { _cdata: entry.description };
}
if (entry.content) {
isContent = true;
item["content:encoded"] = { _cdata: entry.content };
}
/**
* Item Author
* https://validator.w3.org/feed/docs/rss2.html#ltauthorgtSubelementOfLtitemgt
*/
if (Array.isArray(entry.author)) {
item.author = [];
entry.author.map((author: Author) => {
if (author.email && author.name) {
item.author.push({ _text: author.email + " (" + author.name + ")" });
}
});
}
/**
* Item Category
* https://validator.w3.org/feed/docs/rss2.html#ltcategorygtSubelementOfLtitemgt
*/
if (Array.isArray(entry.category)) {
item.category = [];
entry.category.map((category: Category) => {
item.category.push(formatCategory(category));
});
}
/**
* Item Enclosure
* https://validator.w3.org/feed/docs/rss2.html#ltenclosuregtSubelementOfLtitemgt
*/
if (entry.enclosure) {
item.enclosure = formatEnclosure(entry.enclosure);
}
if (entry.image) {
item.enclosure = formatEnclosure(entry.image, "image");
}
if (entry.audio) {
item.enclosure = formatEnclosure(entry.audio, "audio");
}
if (entry.video) {
item.enclosure = formatEnclosure(entry.video, "video");
}
base.rss.channel.item.push(item);
});
if (isContent) {
base.rss._attributes["xmlns:dc"] = "http://purl.org/dc/elements/1.1/";
base.rss._attributes["xmlns:content"] = "http://purl.org/rss/1.0/modules/content/";
}
if (isAtom) {
base.rss._attributes["xmlns:atom"] = "http://www.w3.org/2005/Atom";
}
return convert.js2xml(base, { compact: true, ignoreComment: true, spaces: 4 });
};
/**
* Returns a formated enclosure
* @param enclosure
* @param mimeCategory
*/
const formatEnclosure = (enclosure: string | Enclosure, mimeCategory = "image") => {
if (typeof enclosure === "string") {
const type = new URL(enclosure).pathname.split(".").slice(-1)[0];
return { _attributes: { url: enclosure, length: 0, type: `${mimeCategory}/${type}` } };
}
const type = new URL(enclosure.url).pathname.split(".").slice(-1)[0];
return { _attributes: { length: 0, type: `${mimeCategory}/${type}`, ...enclosure } };
};
/**
* Returns a formated category
* @param category
*/
const formatCategory = (category: Category) => {
const { name, domain } = category;
return {
_text: name,
_attributes: {
domain,
},
};
};

72
node_modules/feed/src/typings/index.ts generated vendored Normal file
View File

@@ -0,0 +1,72 @@
export interface Item {
title: string;
id?: string;
link: string;
date: Date;
description?: string;
content?: string;
category?: Category[];
guid?: string;
image?: string | Enclosure;
audio?: string | Enclosure;
video?: string | Enclosure;
enclosure?: Enclosure;
author?: Author[];
contributor?: Author[];
published?: Date;
copyright?: string;
extensions?: Extension[];
}
export interface Enclosure {
url: string;
type?: string;
length?: number;
title?: string;
duration?: number;
}
export interface Author {
name?: string;
email?: string;
link?: string;
}
export interface Category {
name?: string;
domain?: string;
scheme?: string;
term?: string;
}
export interface FeedOptions {
id: string;
title: string;
updated?: Date;
generator?: string;
language?: string;
ttl?: number;
feed?: string;
feedLinks?: any;
hub?: string;
docs?: string;
author?: Author;
link?: string;
description?: string;
image?: string;
favicon?: string;
copyright: string;
}
export interface Extension {
name: string;
objects: any;
}

6
node_modules/feed/src/utils.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
export function sanitize(url: string | undefined): string | undefined {
if (typeof (url) === 'undefined') {
return;
}
return url.replace(/&/g, '&amp;');
}

23
node_modules/feed/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"baseUrl": ".",
"declaration": true,
"lib": [
"es2015",
"dom"
],
"module": "commonjs",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"outDir": "./lib",
"removeComments": true,
"sourceMap": true,
"strict": true,
"target": "es5"
},
"include": ["./src/**/*"],
"exclude": ["node_modules", "lib", "src/__tests__/**/*"]
}