Merge pull request #47 from ncform/vul

chore: fixed vulnerabilities
This commit is contained in:
daniel-dx
2019-03-17 16:04:11 +08:00
committed by GitHub
16 changed files with 26422 additions and 18184 deletions
+2076 -2786
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -37,7 +37,7 @@
]
},
"devDependencies": {
"babel-core": "6.14.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.5",
"babel-loader": "^7.1.5",
"babel-plugin-transform-runtime": "^6.3.13",
@@ -45,9 +45,9 @@
"babel-preset-es2015": "^6.24.1",
"babel-preset-power-assert": "^1.0.0",
"babel-preset-stage-3": "^6.24.1",
"babel-register": "6.14.0",
"babel-register": "^6.26.0",
"babel-runtime": "^6.3.19",
"commitizen": "^2.10.1",
"commitizen": "^3.0.7",
"conventional-changelog": "^2.0.1",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^4.19.1",
+8 -124
View File
@@ -1,10 +1,7 @@
const gulp = require("gulp");
const loadPlugins = require("gulp-load-plugins");
const del = require("del");
const glob = require("glob");
const path = require("path");
const { Instrumenter } = require("isparta");
const webpack = require("webpack");
const webpackStream = require("webpack-stream");
const mochaGlobals = require("./test/setup/.globals");
@@ -23,16 +20,13 @@ function cleanDist(done) {
del([destinationFolder]).then(() => done());
}
function cleanTmp(done) {
del(["tmp"]).then(() => done());
}
function build() {
return gulp
.src(path.join("src", config.entryFileName))
.pipe(
webpackStream({
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
mode:
process.env.NODE_ENV === "production" ? "production" : "development",
output: {
filename: `${exportFileName}.js`,
libraryTarget: "umd",
@@ -68,136 +62,26 @@ function _mocha() {
);
}
function _registerBabel() {
require("babel-register");
}
function test() {
_registerBabel();
return _mocha();
}
function coverage(done) {
_registerBabel();
gulp
.src(["src/**/*.js"])
.pipe(
$.istanbul({
instrumenter: Instrumenter,
includeUntested: true
})
)
.pipe($.istanbul.hookRequire())
.on("finish", () =>
test()
.pipe($.istanbul.writeReports())
.on("end", done)
);
}
const watchFiles = ["src/**/*", "test/**/*", "package.json", "**/.eslintrc"];
// Run the headless unit tests as you make changes.
function watch() {
gulp.watch(watchFiles, ["test"]);
gulp.watch(watchFiles, test);
}
function watchBuild() {
gulp.watch(watchFiles, ["build"]);
gulp.watch(watchFiles, build);
}
function testBrowser() {
// Our testing bundle is made up of our unit tests, which
// should individually load up pieces of our application.
// We also include the browser setup file.
const testFiles = glob.sync("./test/unit/**/*.js");
const allFiles = ["./test/setup/browser.js"].concat(testFiles);
// Lets us differentiate between the first build and subsequent builds
let firstBuild = true;
// This empty stream might seem like a hack, but we need to specify all of our files through
// the `entry` option of webpack. Otherwise, it ignores whatever file(s) are placed in here.
return gulp
.src("")
.pipe($.plumber())
.pipe(
webpackStream(
{
watch: true,
entry: allFiles,
output: {
filename: "__spec-build.js"
},
externals: {
axios: {
root: "axios",
commonjs2: "axios",
commonjs: "axios",
amd: "axios"
}
},
// Externals isn't necessary here since these are for tests.
module: {
rules: [
// This is what allows us to author in future JavaScript
// {test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'},
{ test: /\.js$/, loader: "babel-loader" },
// This allows the test setup scripts to load `package.json`
{
test: /\.json$/,
exclude: /node_modules/,
loader: "json-loader"
}
]
},
plugins: [
// By default, webpack does `n=>n` compilation with entry files. This concatenates
// them into a single chunk.
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 })
],
devtool: "inline-source-map"
},
null,
() => {
if (firstBuild) {
$.livereload.listen({
port: 35729,
host: "localhost",
basePath: ".",
start: true
});
gulp.watch(watchFiles, ["lint"]);
} else {
$.livereload.reload("./tmp/__spec-build.js");
}
firstBuild = false;
}
)
)
.pipe(gulp.dest("./tmp"));
}
// Remove the built files
gulp.task("clean", cleanDist);
// Remove our temporary files
gulp.task("clean-tmp", cleanTmp);
// Build two versions of the library
// gulp.task('build', ['clean'], build);
gulp.task("build", ["clean"], build);
exports.build = gulp.series(cleanDist, build);
// Set up coverage and run tests
gulp.task("coverage", coverage);
exports.watch = watch;
// Set up a livereload environment for our spec runner `test/runner.html`
gulp.task("test-browser", ["clean-tmp"], testBrowser);
exports["watch-build"] = watchBuild;
// Run the headless unit tests as you make changes.
gulp.task("watch", watch);
gulp.task("watch-build", watchBuild);
// An alias of test
gulp.task("default", ["test"]);
exports.default = exports.build;
+4675 -2424
View File
File diff suppressed because it is too large Load Diff
+10 -12
View File
@@ -5,10 +5,8 @@
"main": "dist/ncformCommon.min.js",
"scripts": {
"test": "mocha --recursive --require ./test/unit/testHelper.js -t 5000",
"test-browser": "gulp test-browser",
"watch": "gulp watch",
"build": "gulp build",
"coverage": "gulp coverage",
"watch": "gulp watch",
"watch-build": "gulp watch-build",
"release": "cross-env NODE_ENV=production gulp build"
},
@@ -26,29 +24,29 @@
"author": "daniel.xiao",
"license": "MIT",
"devDependencies": {
"babel-core": "6.14.0",
"babel-core": "^6.26.3",
"babel-polyfill": "6.13.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-power-assert": "^1.0.0",
"babel-register": "6.14.0",
"babel-register": "^6.26.0",
"chai": "3.5.0",
"cross-env": "^5.2.0",
"del": "2.2.2",
"glob": "7.0.6",
"gulp": "3.9.1",
"gulp": "^4.0.0",
"gulp-eslint": "3.0.1",
"gulp-filter": "4.0.0",
"gulp-istanbul": "1.1.1",
"gulp-livereload": "3.8.1",
"gulp-load-plugins": "1.2.4",
"gulp-mocha": "3.0.1",
"gulp-istanbul": "^1.1.3",
"gulp-livereload": "^4.0.1",
"gulp-load-plugins": "^1.5.0",
"gulp-mocha": "^6.0.0",
"gulp-plumber": "1.1.0",
"gulp-rename": "1.2.2",
"gulp-sourcemaps": "1.6.0",
"gulp-uglify": "2.0.0",
"isparta": "4.0.0",
"isparta": "^4.1.1",
"json-loader": "0.5.4",
"mocha": "3.0.2",
"mocha": "^6.0.2",
"sinon": "1.17.5",
"sinon-chai": "2.8.0",
"webpack-stream": "^5.1.0"
+3 -1
View File
@@ -2,7 +2,9 @@ global.chai = require('chai');
global.sinon = require('sinon');
global.chai.use(require('sinon-chai'));
require('babel-core/register');
require('babel-core/register')({
ignore: /node_modules\/(?!lodash-es)/
});
require('./setup')();
/*
+489 -489
View File
File diff suppressed because it is too large Load Diff
+18 -19
View File
@@ -2,8 +2,6 @@ const gulp = require("gulp");
const path = require("path");
const rm = require("rimraf");
const webpack = require("webpack");
const notify = require("gulp-notify");
const gulpSequence = require("gulp-sequence");
const url = require("url");
const querystring = require("querystring");
const browserSync = require("browser-sync").create();
@@ -31,9 +29,7 @@ function handleErrors(err, stats) {
}
}
/* ====================== gulp tasks ====================== */
gulp.task("webpack", done => {
function webpackBuild(done) {
webpack(webpackConfig, (err, stats) => {
if (err || stats.hasErrors()) {
handleErrors(err, stats);
@@ -47,21 +43,20 @@ gulp.task("webpack", done => {
done();
}
});
});
}
gulp.task("clean", next => {
rm(config.dist, () => next());
});
function clean(cb) {
rm(config.dist, () => cb());
}
gulp.task("watch", () => {
gulp.watch(path.join(config.src, "**/*.*"), () => {
gulpSequence("webpack")(err => {
if (!err) reload();
});
function watch() {
gulp.watch(["src/**/*"], cb => {
webpackBuild(reload);
cb();
});
});
}
gulp.task("serve", () => {
function serve() {
function startServer() {
delete require.cache[require.resolve("./mock/data")];
browserSync.init({
@@ -104,8 +99,12 @@ gulp.task("serve", () => {
browserSync.exit();
startServer();
});
});
}
gulp.task("build", gulpSequence("clean", ["webpack"]));
/* ====================== gulp tasks ====================== */
gulp.task("dev", gulpSequence("build", ["serve", "watch"]));
exports.build = gulp.series(clean, webpackBuild);
exports.dev = gulp.series(exports.build, gulp.parallel(serve, watch));
exports.default = exports.build;
+6726 -4015
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -12,14 +12,14 @@
"devDependencies": {
"autoprefixer": "^6.0.2",
"axios": "^0.17.1",
"babel-core": "^6.2.21",
"babel-core": "^6.26.3",
"babel-eslint": "^6.0.4",
"babel-plugin-transform-runtime": "^6.3.13",
"babel-preset-es2015": "^6.24.1",
"babel-preset-power-assert": "^1.0.0",
"babel-preset-stage-3": "^6.24.1",
"babel-runtime": "^6.3.19",
"browser-sync": "^2.9.1",
"browser-sync": "^2.26.3",
"concat": "^1.0.0",
"css-loader": "^0.23.1",
"csswring": "^4.0.0",
@@ -28,15 +28,15 @@
"eslint-loader": "^1.0.0",
"eslint-plugin-html": "^1.5.3",
"file-loader": "^0.8.5",
"gulp": "^3.9.1",
"gulp": "^4.0.0",
"gulp-jshint": "^2.0.0",
"gulp-notify": "^2.2.0",
"gulp-notify": "^3.2.0",
"gulp-sequence": "^0.4.6",
"html-loader": "^0.5.1",
"map-stream": "0.0.6",
"mocha": "^4.0.1",
"node-libs-browser": "^1.0.0",
"node-sass": "^4.5.3",
"node-sass": "^4.11.0",
"postcss-loader": "^0.8.0",
"postcss-sprites": "^4.0.0",
"power-assert": "^1.4.4",
@@ -44,7 +44,7 @@
"sass-loader": "^6.0.6",
"source-map-loader": "^0.1.5",
"style-loader": "^0.13.0",
"url-loader": "^0.5.7",
"url-loader": "^1.1.2",
"vue-hot-reload-api": "^2.0.6",
"vue-html-loader": "^1.1.0",
"vue-style-loader": "^1.0.0"
+23 -26
View File
@@ -2,8 +2,6 @@ const gulp = require("gulp");
const path = require("path");
const rm = require("rimraf");
const webpack = require("webpack");
const notify = require("gulp-notify");
const gulpSequence = require("gulp-sequence");
const url = require("url");
const querystring = require("querystring");
const browserSync = require("browser-sync").create();
@@ -30,13 +28,7 @@ function handleErrors(err, stats) {
}
}
function watchBuild() {
gulp.watch(path.join(config.src, "**/*.*"), ["build"]);
}
/* ====================== gulp tasks ====================== */
gulp.task("webpack", done => {
function webpackBuild(done) {
webpack(webpackConfig, (err, stats) => {
if (err || stats.hasErrors()) {
handleErrors(err, stats);
@@ -50,21 +42,24 @@ gulp.task("webpack", done => {
done();
}
});
});
}
gulp.task("clean", next => {
rm(config.dist, () => next());
});
function watchBuild() {
gulp.watch(["src/**/*"], webpackBuild);
}
gulp.task("watch", () => {
gulp.watch(path.join(config.src, "**/*.*"), () => {
gulpSequence("webpack")(err => {
if (!err) reload();
});
function clean(cb) {
rm(config.dist, () => cb());
}
function watch() {
gulp.watch(["src/**/*"], cb => {
webpackBuild(reload);
cb();
});
});
}
gulp.task("serve", () => {
function serve() {
function startServer() {
delete require.cache[require.resolve("./mock/data")];
const mockConfig = require("./mock/data");
@@ -108,12 +103,14 @@ gulp.task("serve", () => {
browserSync.exit();
startServer();
});
});
}
gulp.task("build", cb => {
gulpSequence("clean", ["webpack"])(cb);
});
/* ====================== gulp tasks ====================== */
gulp.task("watch-build", watchBuild);
exports.build = gulp.series(clean, webpackBuild);
gulp.task("dev", gulpSequence("build", ["serve", "watch"]));
exports["watch-build"] = watchBuild;
exports.dev = gulp.series(webpackBuild, gulp.parallel(serve, watch));
exports.default = exports.build;
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -13,13 +13,13 @@
"@ncform/ncform": "^0.1.28",
"autoprefixer": "^6.0.2",
"axios": "^0.17.1",
"babel-core": "^6.2.21",
"babel-core": "^6.26.3",
"babel-eslint": "^6.0.4",
"babel-plugin-transform-runtime": "^6.3.13",
"babel-preset-es2015": "^6.24.1",
"babel-preset-power-assert": "^1.0.0",
"babel-runtime": "^6.3.19",
"browser-sync": "^2.9.1",
"browser-sync": "^2.26.3",
"concat": "^1.0.0",
"cross-env": "^5.2.0",
"css-loader": "^0.23.1",
@@ -28,15 +28,15 @@
"eslint-loader": "^1.0.0",
"eslint-plugin-html": "^1.5.3",
"file-loader": "^0.8.5",
"gulp": "^3.9.1",
"gulp": "^4.0.0",
"gulp-jshint": "^2.0.0",
"gulp-notify": "^2.2.0",
"gulp-notify": "^3.2.0",
"gulp-sequence": "^0.4.6",
"html-loader": "^0.5.1",
"map-stream": "0.0.6",
"mocha": "^4.0.1",
"node-libs-browser": "^1.0.0",
"node-sass": "^4.5.3",
"node-sass": "^4.11.0",
"postcss-loader": "^0.8.0",
"postcss-sprites": "^4.0.0",
"power-assert": "^1.4.4",
@@ -44,7 +44,7 @@
"sass-loader": "^6.0.6",
"source-map-loader": "^0.1.5",
"style-loader": "^0.13.0",
"url-loader": "^0.5.7",
"url-loader": "^1.1.2",
"vue-hot-reload-api": "^2.0.6",
"vue-html-loader": "^1.1.0",
"vue-style-loader": "^1.0.0"
+24 -27
View File
@@ -2,8 +2,6 @@ const gulp = require("gulp");
const path = require("path");
const rm = require("rimraf");
const webpack = require("webpack");
const notify = require("gulp-notify");
const gulpSequence = require("gulp-sequence");
const url = require("url");
const querystring = require("querystring");
const browserSync = require("browser-sync").create();
@@ -30,13 +28,7 @@ function handleErrors(err, stats) {
}
}
function watchBuild() {
gulp.watch(path.join(config.src, "**/*.*"), ["build"]);
}
/* ====================== gulp tasks ====================== */
gulp.task("webpack", done => {
function webpackBuild(cb) {
webpack(webpackConfig, (err, stats) => {
if (err || stats.hasErrors()) {
handleErrors(err, stats);
@@ -48,23 +40,26 @@ gulp.task("webpack", done => {
})
);
}
done();
cb();
});
});
}
gulp.task("clean", next => {
rm(config.dist, () => next());
});
function watchBuild() {
gulp.watch(["src/**/*"], webpackBuild);
}
gulp.task("watch", () => {
gulp.watch(path.join(config.src, "**/*.*"), () => {
gulpSequence("webpack")(err => {
if (!err) reload();
});
function clean(cb) {
rm(config.dist, () => cb());
}
function watch() {
gulp.watch(["src/**/*"], cb => {
webpackBuild(reload);
cb();
});
});
}
gulp.task("serve", () => {
function serve() {
function startServer() {
delete require.cache[require.resolve("./mock/data")];
const mockConfig = require("./mock/data");
@@ -107,12 +102,14 @@ gulp.task("serve", () => {
browserSync.exit();
startServer();
});
});
}
gulp.task("build", cb => {
gulpSequence("clean", ["webpack"])(cb);
});
/* ====================== gulp tasks ====================== */
gulp.task("dev", gulpSequence("build", ["serve", "watch"]));
exports.build = gulp.series(clean, webpackBuild);
gulp.task("watch-build", watchBuild);
exports.dev = gulp.series(exports.build, gulp.parallel(serve, watch));
exports["watch-build"] = watchBuild;
exports.default = exports.build;
+5677 -4254
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -28,27 +28,27 @@
"devDependencies": {
"autoprefixer": "^6.0.2",
"bootstrap": "^4.1.1",
"browser-sync": "^2.9.1",
"browser-sync": "^2.26.3",
"concat": "^1.0.0",
"cross-env": "^5.2.0",
"css-loader": "^0.23.1",
"csswring": "^4.0.0",
"eslint": "~2.2.0",
"eslint": "^5.15.2",
"eslint-loader": "^1.0.0",
"eslint-plugin-html": "^1.5.3",
"file-loader": "^0.8.5",
"gulp": "^3.9.1",
"gulp": "^4.0.0",
"gulp-jshint": "^2.0.0",
"gulp-notify": "^2.2.0",
"gulp-notify": "^3.2.0",
"gulp-sequence": "^0.4.6",
"html-loader": "^0.5.1",
"jsdom": "13.1.0",
"jsdom": "^14.0.0",
"jsdom-global": "3.0.2",
"map-stream": "0.0.6",
"mocha": "^4.0.1",
"nock": "^10.0.1",
"node-libs-browser": "^1.0.0",
"node-sass": "^4.5.3",
"node-sass": "^4.11.0",
"postcss-loader": "^0.8.0",
"postcss-sprites": "^4.0.0",
"power-assert": "^1.4.4",
@@ -56,7 +56,7 @@
"sass-loader": "^6.0.6",
"source-map-loader": "^0.1.5",
"style-loader": "^0.13.0",
"url-loader": "^0.5.7",
"url-loader": "^1.1.2",
"vue-hot-reload-api": "^2.0.6",
"vue-html-loader": "^1.1.0",
"vue-style-loader": "^1.0.0"