diff --git a/package-lock.json b/package-lock.json
index 52be32e..612b11a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "vue-cli-plugin-sitemap",
- "version": "1.0.4",
+ "version": "2.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/src/validation.js b/src/validation.js
index 64acfd0..21e61b2 100644
--- a/src/validation.js
+++ b/src/validation.js
@@ -196,13 +196,16 @@ const optionsValidator = ajv.compile({
anyOf: [
{
- minLength: 0,
- maxLength: 0,
+ minLength: 0,
+ maxLength: 0,
},
{
- format: 'uri',
- pattern: '\\.[a-z]+$',
- }
+ format: 'uri',
+ pattern: '\\.[a-z]+(?::\\d{1,4})?$',
+ },
+ {
+ pattern: '^https?:\\/\\/(?:\\d{1,3}\\.){3}\\d{1,3}(?::\\d{1,4})?$',
+ },
]
},
trailingSlash: {
diff --git a/test/sitemap.test.js b/test/sitemap.test.js
index 6a84390..b87c5ce 100644
--- a/test/sitemap.test.js
+++ b/test/sitemap.test.js
@@ -49,6 +49,20 @@ describe("single sitemap generation", () => {
})).to.deep.equal(wrapSitemap(
'https://website.nethttps://website.net/about'
));
+
+ expect(await generate({
+ baseURL: 'https://website.net:7000',
+ urls: ['/', '/about'],
+ })).to.deep.equal(wrapSitemap(
+ 'https://website.net:7000https://website.net:7000/about'
+ ));
+
+ expect(await generate({
+ baseURL: 'https://162.75.90.1',
+ urls: ['/', '/about'],
+ })).to.deep.equal(wrapSitemap(
+ 'https://162.75.90.1https://162.75.90.1/about'
+ ));
});
it("removes trailing slashes", async () => {
diff --git a/test/validation.test.js b/test/validation.test.js
index 3706e89..74b8b17 100644
--- a/test/validation.test.js
+++ b/test/validation.test.js
@@ -35,13 +35,18 @@ describe("the validation of the options returns an error when:", () => {
expect(validate({ outputDir: './sitemap' })).to.be.true;
});
- it("'baseURL' is not a proper URI", () => {
- expect(validate({ baseURL: 'not an URI' })).to.be.false;
- expect(validate({ baseURL: 'somedomain.wtf' })).to.be.false;
- expect(validate({ baseURL: 'https://missing-something' })).to.be.false;
-
- expect(validate({ baseURL: 'https://domain.fr' })).to.be.true;
- expect(validate({ baseURL: 'http://www.other-domain.fr' })).to.be.true;
+ it("'baseURL' is not a proper URI or IPv4 address", () => {
+ expect(validate({ baseURL: 'not an URI' })).to.be.false;
+ expect(validate({ baseURL: 'somedomain.wtf' })).to.be.false;
+ expect(validate({ baseURL: 'https://missing-something' })).to.be.false;
+ expect(validate({ baseURL: '127.0' })).to.be.false;
+
+ expect(validate({ baseURL: 'https://domain.fr' })).to.be.true;
+ expect(validate({ baseURL: 'http://www.other-domain.fr' })).to.be.true;
+ expect(validate({ baseURL: 'http://www.website.com:8080' })).to.be.true;
+ expect(validate({ baseURL: 'https://webapp.com:27' })).to.be.true;
+ expect(validate({ baseURL: 'https://127.0.0.1' })).to.be.true;
+ expect(validate({ baseURL: 'https://127.0.0.1:8000' })).to.be.true;
});
describe("the default URL meta tags are invalid, because", () => {