Skip to content

Commit e6d0292

Browse files
committed
Merge branch 'release/1.6.0'
2 parents a0a40a9 + cbc16f4 commit e6d0292

21 files changed

+205
-1511
lines changed

.snyk

Lines changed: 0 additions & 30 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ To prevent that error use [eslint-plugin-vue-types](https://github.com/dwightjac
110110

111111
Vue.js does not validate components' props when used in a production build. If you're using a bundler such as Webpack or rollup you can shrink vue-types filesize by around **70%** (minified and gzipped) by removing the validation logic while preserving the library's API methods. To achieve that result setup an alias to `vue-types/es/shim.js` (`vue-types/dist/shim.js` if you're using CommonJS modules).
112112

113+
If you're including the library via a `script` tag use the dedicated shim build file:
114+
115+
```html
116+
<script src="https://unpkg.com/vue-types@latest/umd/vue-types.shim.min.js"></script>
117+
```
118+
119+
**Note:** In order to use a specific version of the library change `@latest` with `@<version-number>`:
120+
121+
```html
122+
<!-- use the shim from version 1.6.0 -->
123+
<script src="https://unpkg.com/[email protected]/umd/vue-types.shim.min.js"></script>
124+
```
125+
113126
### Webpack
114127

115128
The following example will shim the module in Webpack by adding an [alias field](https://webpack.js.org/configuration/resolve/#resolve-alias) to the configuration when `NODE_ENV` is set to `"production"`:

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports.__esModule = true;
44
exports.default = void 0;
55

6-
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
6+
var _isPlainObject = _interopRequireDefault(require("is-plain-object"));
77

88
var _utils = require("./utils");
99

dist/shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports.default = void 0;
55

66
var _vue = _interopRequireDefault(require("vue"));
77

8-
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
8+
var _isPlainObject = _interopRequireDefault(require("is-plain-object"));
99

1010
var _sensibles = require("./sensibles");
1111

dist/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports.toType = toType;
1111
exports.validateType = validateType;
1212
exports.warn = exports.isFunction = exports.isArray = exports.isInteger = exports.has = exports.hasOwn = void 0;
1313

14-
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
14+
var _isPlainObject = _interopRequireDefault(require("is-plain-object"));
1515

1616
var _vue = _interopRequireDefault(require("vue"));
1717

es/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
22

3-
import isPlainObject from 'lodash/isPlainObject';
3+
import isPlainObject from 'is-plain-object';
44
import { toType, getType, isFunction, validateType, isInteger, isArray, warn } from './utils';
55
import { setDefaults } from './sensibles';
66
var VueTypes = {

es/shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue from 'vue';
2-
import isPlainObject from 'lodash/isPlainObject';
2+
import isPlainObject from 'is-plain-object';
33
import { setDefaults } from './sensibles';
44

55
var isArray = Array.isArray || function (value) {

es/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import isPlainObject from 'lodash/isPlainObject';
1+
import isPlainObject from 'is-plain-object';
22
import Vue from 'vue';
33
var ObjProto = Object.prototype;
44
var toString = ObjProto.toString;

package.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-types",
3-
"version": "1.5.7",
3+
"version": "1.6.0",
44
"description": "Prop types utility for Vue",
55
"author": "Marco Solazzi",
66
"license": "MIT",
@@ -31,9 +31,7 @@
3131
"test:saucelab": "cross-env BABEL_ENV=rollup karma start karma-sauce.conf.js --single-run",
3232
"test:types": "tsc --noEmit -p ./types/test/",
3333
"lint": "eslint src/*.js test/*.js types/**/*.ts types/**/*.d.ts",
34-
"start": "rollup -c ./examples/rollup.config.js -w",
35-
"snyk-protect": "snyk protect",
36-
"prepublish": "npm run snyk-protect"
34+
"start": "rollup -c ./examples/rollup.config.js -w"
3735
},
3836
"keywords": [
3937
"vue",
@@ -51,7 +49,6 @@
5149
"@babel/cli": "7.5.0",
5250
"@babel/core": "7.5.0",
5351
"@babel/preset-env": "7.5.0",
54-
"@types/lodash": "4.14.135",
5552
"@types/node": "12.0.12",
5653
"@typescript-eslint/eslint-plugin": "1.11.0",
5754
"@typescript-eslint/parser": "1.11.0",
@@ -75,10 +72,10 @@
7572
"prettier": "1.18.2",
7673
"puppeteer": "1.18.1",
7774
"rimraf": "2.6.3",
78-
"rollup": "1.16.6",
75+
"rollup": "1.18.0",
7976
"rollup-plugin-alias": "1.5.2",
8077
"rollup-plugin-babel": "4.3.3",
81-
"rollup-plugin-commonjs": "10.0.1",
78+
"rollup-plugin-commonjs": "10.0.2",
8279
"rollup-plugin-filesize": "6.1.1",
8380
"rollup-plugin-node-builtins": "2.1.2",
8481
"rollup-plugin-node-globals": "1.4.0",
@@ -92,8 +89,7 @@
9289
"vue-class-component": "~7.1.0"
9390
},
9491
"dependencies": {
95-
"lodash": "^4.17.10",
96-
"snyk": "^1.192.0"
92+
"is-plain-object": "3.0.0"
9793
},
9894
"browserslist": [
9995
"last 3 versions",
@@ -102,6 +98,5 @@
10298
"Edge >= 12",
10399
"iOS >= 10",
104100
"Android >= 4.4"
105-
],
106-
"snyk": true
101+
]
107102
}

rollup.config.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ const baseOutputConfig = {
3131
globals: { vue: 'Vue' }
3232
}
3333

34+
const productionPlugins = [replace({
35+
'process.env.NODE_ENV': JSON.stringify('production')
36+
}), ...plugins, uglify({
37+
warnings: false,
38+
mangle: true,
39+
compress: {
40+
pure_funcs: ['warn']
41+
},
42+
output: {
43+
comments: /^!/
44+
}
45+
}), filesize()]
46+
3447
export default [
3548
{
3649
input: 'src/index.js',
@@ -44,17 +57,12 @@ export default [
4457
input: 'src/index.js',
4558
output: Object.assign({ file: 'umd/vue-types.min.js' }, baseOutputConfig),
4659
external: ['vue'],
47-
plugins: [replace({
48-
'process.env.NODE_ENV': JSON.stringify('production')
49-
}), ...plugins, uglify({
50-
warnings: false,
51-
mangle: true,
52-
compress: {
53-
pure_funcs: ['warn']
54-
},
55-
output: {
56-
comments: /^!/
57-
}
58-
}), filesize()]
60+
plugins: productionPlugins
61+
},
62+
{
63+
input: 'src/shim.js',
64+
output: Object.assign({ file: 'umd/vue-types.shim.min.js' }, baseOutputConfig),
65+
external: ['vue'],
66+
plugins: productionPlugins
5967
}
6068
]

0 commit comments

Comments
 (0)