Comparing version 0.1.0 to 0.1.1
@@ -7,6 +7,10 @@ 'use strict'; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
var _get = function get(_x5, _x6, _x7) { var _again = true; _function: while (_again) { desc = parent = getter = undefined; _again = false; var object = _x5, | ||
property = _x6, | ||
receiver = _x7; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x5 = parent; _x6 = property; _x7 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
var NoURLError = (function (_Error) { | ||
@@ -18,7 +22,3 @@ function NoURLError() { | ||
var _this = new _Error(message, 'NoURLError'); | ||
_this.__proto__ = NoURLError.prototype; | ||
_this; | ||
return _this; | ||
_get(Object.getPrototypeOf(NoURLError.prototype), 'constructor', this).call(this, message, 'NoURLError'); | ||
} | ||
@@ -39,7 +39,3 @@ | ||
var _this2 = new _Error2(message, 'NoURLProtocolError'); | ||
_this2.__proto__ = NoURLProtocolError.prototype; | ||
_this2; | ||
return _this2; | ||
_get(Object.getPrototypeOf(NoURLProtocolError.prototype), 'constructor', this).call(this, message, 'NoURLProtocolError'); | ||
} | ||
@@ -60,7 +56,3 @@ | ||
var _this3 = new _Error3(message, 'ChangeFreqInvalidError'); | ||
_this3.__proto__ = ChangeFreqInvalidError.prototype; | ||
_this3; | ||
return _this3; | ||
_get(Object.getPrototypeOf(ChangeFreqInvalidError.prototype), 'constructor', this).call(this, message, 'ChangeFreqInvalidError'); | ||
} | ||
@@ -81,7 +73,3 @@ | ||
var _this4 = new _Error4(message, 'PriorityInvalidError'); | ||
_this4.__proto__ = PriorityInvalidError.prototype; | ||
_this4; | ||
return _this4; | ||
_get(Object.getPrototypeOf(PriorityInvalidError.prototype), 'constructor', this).call(this, message, 'PriorityInvalidError'); | ||
} | ||
@@ -88,0 +76,0 @@ |
@@ -7,7 +7,7 @@ 'use strict'; | ||
var _interopRequireDefault = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
@@ -18,5 +18,5 @@ var _xmlbuilder = require('xmlbuilder'); | ||
var _chunkArray$validateURL$validateChangeFreq$validatePriority$validateLastMod = require('./utils'); | ||
var _utils = require('./utils'); | ||
var _NoURLError = require('./errors.js'); | ||
var _errorsJs = require('./errors.js'); | ||
@@ -47,4 +47,4 @@ function _transformSitemapsTreeToList(_x2) { | ||
sitemaps.forEach(function (sm) { | ||
sm.sitemaps.forEach(function (sm) { | ||
nestedSitemaps.push(sm); | ||
sm.sitemaps.forEach(function (nestedSm) { | ||
nestedSitemaps.push(nestedSm); | ||
}); | ||
@@ -86,3 +86,3 @@ }); | ||
if (!urlData) { | ||
throw new _NoURLError.NoURLError(); | ||
throw new _errorsJs.NoURLError(); | ||
} | ||
@@ -93,3 +93,3 @@ if (Array.isArray(urlData)) { | ||
}); | ||
return; | ||
return this; | ||
} | ||
@@ -101,9 +101,9 @@ if (typeof urlData === 'string') { | ||
var data = { | ||
url: _chunkArray$validateURL$validateChangeFreq$validatePriority$validateLastMod.validateURL(urlData.url), | ||
changefreq: urlData.changefreq ? _chunkArray$validateURL$validateChangeFreq$validatePriority$validateLastMod.validateChangeFreq(urlData.changefreq) : 'weekly', | ||
priority: urlData.priority ? _chunkArray$validateURL$validateChangeFreq$validatePriority$validateLastMod.validatePriority(urlData.priority) : 0.5 | ||
url: _utils.validateURL(urlData.url), | ||
changefreq: urlData.changefreq ? _utils.validateChangeFreq(urlData.changefreq) : 'weekly', | ||
priority: urlData.priority ? _utils.validatePriority(urlData.priority) : 0.5 | ||
}; | ||
if (urlData.lastmod || urlData.lastmodISO) { | ||
data.lastmod = _chunkArray$validateURL$validateChangeFreq$validatePriority$validateLastMod.validateLastMod(urlData.lastmod, urlData.lastmodISO); | ||
data.lastmod = _utils.validateLastMod(urlData.lastmod, urlData.lastmodISO); | ||
} | ||
@@ -149,3 +149,3 @@ | ||
var chunkedUrls = _chunkArray$validateURL$validateChangeFreq$validatePriority$validateLastMod.chunkArray(sitemap.urls, sitemap.limit); | ||
var chunkedUrls = _utils.chunkArray(sitemap.urls, sitemap.limit); | ||
var chunkedSitemaps = chunkedUrls.map(function (urls, i) { | ||
@@ -152,0 +152,0 @@ var surrogate = new Sitemap(sitemap); |
@@ -7,4 +7,2 @@ 'use strict'; | ||
var _interopRequireDefault = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; | ||
/** | ||
@@ -25,9 +23,11 @@ * Pads the left-side of a string with a specific | ||
var _urlParser = require('url'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _urlParser2 = _interopRequireDefault(_urlParser); | ||
var _url = require('url'); | ||
var _NoURLError$NoURLProtocolError$ChangeFreqInvalidError$PriorityInvalidError = require('./errors'); | ||
var _url2 = _interopRequireDefault(_url); | ||
var parseURL = _urlParser2['default'].parse.bind(_urlParser2['default']); | ||
var _errors = require('./errors'); | ||
var parseURL = _url2['default'].parse.bind(_url2['default']); | ||
function lpad(n, len) { | ||
@@ -54,3 +54,3 @@ var chr = arguments[2] === undefined ? '0' : arguments[2]; | ||
if (!isValid) { | ||
throw new _NoURLError$NoURLProtocolError$ChangeFreqInvalidError$PriorityInvalidError.ChangeFreqInvalidError(); | ||
throw new _errors.ChangeFreqInvalidError(); | ||
} | ||
@@ -62,6 +62,6 @@ return changefreq; | ||
if (!url) { | ||
throw new _NoURLError$NoURLProtocolError$ChangeFreqInvalidError$PriorityInvalidError.NoURLError(); | ||
throw new _errors.NoURLError(); | ||
} | ||
if (!parseURL(url).protocol) { | ||
throw new _NoURLError$NoURLProtocolError$ChangeFreqInvalidError$PriorityInvalidError.NoURLProtocolError(); | ||
throw new _errors.NoURLProtocolError(); | ||
} | ||
@@ -74,3 +74,3 @@ return url; | ||
if (!(priority >= 0 && priority <= 1)) { | ||
throw new _NoURLError$NoURLProtocolError$ChangeFreqInvalidError$PriorityInvalidError.PriorityInvalidError(); | ||
throw new _errors.PriorityInvalidError(); | ||
} | ||
@@ -77,0 +77,0 @@ return priority; |
@@ -7,2 +7,3 @@ var gulp = require('gulp'); | ||
var tag_version = require('gulp-tag-version'); | ||
var eslint = require('gulp-eslint'); | ||
@@ -15,2 +16,5 @@ gulp.task('watch', function () { | ||
return gulp.src('lib/**/*.js') | ||
.pipe(eslint()) | ||
.pipe(eslint.formatEach()) | ||
.pipe(eslint.failOnError()) | ||
.pipe(babel()) | ||
@@ -17,0 +21,0 @@ .pipe(gulp.dest('dist')); |
@@ -23,2 +23,2 @@ export class NoURLError extends Error { | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import xmlbuilder from "xmlbuilder" | ||
import xmlbuilder from 'xmlbuilder'; | ||
import { | ||
@@ -8,5 +8,5 @@ chunkArray, | ||
validateLastMod | ||
} from './utils' | ||
} from './utils'; | ||
import {NoURLError} from './errors.js' | ||
import {NoURLError} from './errors.js'; | ||
@@ -20,3 +20,3 @@ | ||
sitemaps.sitemaps.forEach(sm => result.push(sm)); | ||
return _transformSitemapsTreeToList(sitemaps.sitemaps, result) | ||
return _transformSitemapsTreeToList(sitemaps.sitemaps, result); | ||
} | ||
@@ -26,5 +26,5 @@ | ||
sitemaps.forEach(sm => { | ||
sm.sitemaps.forEach(sm => { | ||
nestedSitemaps.push(sm) | ||
}) | ||
sm.sitemaps.forEach(nestedSm => { | ||
nestedSitemaps.push(nestedSm); | ||
}); | ||
}); | ||
@@ -60,3 +60,3 @@ | ||
urlData.forEach(url => this.addUrl(url)); | ||
return; | ||
return this; | ||
} | ||
@@ -169,2 +169,1 @@ if (typeof urlData === 'string') { | ||
} | ||
@@ -54,3 +54,3 @@ import urlParser from 'url'; | ||
} | ||
if (!parseURL(url)['protocol']) { | ||
if (!parseURL(url).protocol) { | ||
throw new NoURLProtocolError(); | ||
@@ -78,2 +78,2 @@ } | ||
return [dt.getFullYear(), lpad(dt.getMonth() + 1, 2), lpad(dt.getDate(), 2)].join('-'); | ||
} | ||
} |
{ | ||
"name": "sitemap2", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Sitemap-generating framework", | ||
@@ -10,3 +10,3 @@ "keywords": [ | ||
], | ||
"repository": "git@github.com:vlkosinov/sitemap.js.git", | ||
"repository": "git@github.com:vlkosinov/sitemap2.git", | ||
"author": "Vlad Kosinov <vladkosinov@gmail.com>", | ||
@@ -24,2 +24,3 @@ "dependencies": { | ||
"gulp-bump": "^0.3.0", | ||
"gulp-eslint": "^0.11.1", | ||
"gulp-filter": "^2.0.2", | ||
@@ -36,4 +37,5 @@ "gulp-git": "^1.2.1", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "TEST_TARGET=dist mocha", | ||
"coverage": "TEST_TARGET=lib babel-node node_modules/.bin/isparta cover node_modules/.bin/_mocha --compilers js:babel/register && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" | ||
} | ||
} |
@@ -1,6 +0,9 @@ | ||
sitemap2.js | ||
[![Build Status](https://travis-ci.org/vlkosinov/sitemap2.svg?branch=master)](https://travis-ci.org/vlkosinov/sitemap2) | ||
[![Coverage Status](https://coveralls.io/repos/vlkosinov/sitemap2/badge.svg?branch=master)](https://coveralls.io/r/vlkosinov/sitemap2?branch=master) | ||
[![npm version](https://badge.fury.io/js/sitemap2.svg)](http://badge.fury.io/js/sitemap2) | ||
sitemap2 | ||
========== | ||
**sitemap2.js** is a high-level sitemap-generating framework that | ||
makes creating [sitemap XML](http://www.sitemaps.org/) files easy. | ||
**sitemap2** is a high-level sitemap-generating framework that makes creating [sitemap XML](http://www.sitemaps.org/) files easy. | ||
@@ -42,7 +45,4 @@ ## Installation | ||
License | ||
------- | ||
MIT |
@@ -1,12 +0,14 @@ | ||
var Sitemap = require('../lib'); | ||
var errors = require('../lib/errors'); | ||
var readDir = require('fs-readdir-recursive'), | ||
path = require('path'), | ||
fs = require('fs'); | ||
var chai = require('chai'); | ||
var expect = chai.expect; | ||
var should = chai.should(); | ||
var chai = require('chai'), | ||
expect = chai.expect, | ||
should = chai.should(); | ||
var readDir = require('fs-readdir-recursive'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var TEST_TARGET = process.env['TEST_TARGET']; | ||
var Sitemap = require(path.resolve(TEST_TARGET)); | ||
var errors = require(path.resolve(TEST_TARGET), '/errors'); | ||
function setValueByPathInObject(value, path, obj) { | ||
@@ -13,0 +15,0 @@ if (path.length === 1) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
34625
16
28
692
6