mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-25 09:20:34 +03:00
fix bug in htmlAttr handling causing missing attrs
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# vue-meta
|
# vue-meta
|
||||||
[](https://gitter.im/vue-meta/Lobby)
|
[](https://gitter.im/vue-meta/Lobby)
|
||||||
|
|
||||||
Manage page meta info in Vue 2.0 server-rendered components. Supports streaming. No dependencies.
|
Manage page meta info in Vue 2.0 server-rendered components. Supports streaming.
|
||||||
|
|
||||||
> **Please note** that this project is still in very early alpha development and is *not* considered to be production ready.
|
> **Please note** that this project is still in very early alpha development and is *not* considered to be production ready.
|
||||||
> **You have been warned.** There is no sanitization yet, no tests, and you might even find some features are still missing.
|
> **You have been warned.** There is no sanitization yet, no tests, and you might even find some features are still missing.
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
"rimraf": "^2.5.4",
|
"rimraf": "^2.5.4",
|
||||||
"rollup": "^0.36.3",
|
"rollup": "^0.36.3",
|
||||||
"rollup-plugin-buble": "^0.14.0",
|
"rollup-plugin-buble": "^0.14.0",
|
||||||
|
"rollup-plugin-commonjs": "^5.0.5",
|
||||||
|
"rollup-plugin-node-resolve": "^2.0.0",
|
||||||
"snazzy": "^5.0.0",
|
"snazzy": "^5.0.0",
|
||||||
"standard": "^8.5.0"
|
"standard": "^8.5.0"
|
||||||
},
|
},
|
||||||
@@ -43,5 +45,8 @@
|
|||||||
"Vue",
|
"Vue",
|
||||||
"define"
|
"define"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"deepmerge": "^1.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -1,3 +1,5 @@
|
|||||||
|
import commonjs from 'rollup-plugin-commonjs'
|
||||||
|
import nodeResolve from 'rollup-plugin-node-resolve'
|
||||||
import buble from 'rollup-plugin-buble'
|
import buble from 'rollup-plugin-buble'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -5,5 +7,11 @@ export default {
|
|||||||
format: 'umd',
|
format: 'umd',
|
||||||
dest: './lib/index.js',
|
dest: './lib/index.js',
|
||||||
moduleName: 'VueMeta',
|
moduleName: 'VueMeta',
|
||||||
plugins: [buble()]
|
plugins: [
|
||||||
|
buble(),
|
||||||
|
nodeResolve({
|
||||||
|
jsnext: true
|
||||||
|
}),
|
||||||
|
commonjs()
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -1,3 +1,4 @@
|
|||||||
|
import deepMerge from 'deepmerge'
|
||||||
import { VUE_META_ATTRIBUTE } from './constants'
|
import { VUE_META_ATTRIBUTE } from './constants'
|
||||||
|
|
||||||
// initialize vue-meta
|
// initialize vue-meta
|
||||||
@@ -69,11 +70,14 @@ VueMeta.install = function install (Vue) {
|
|||||||
return {
|
return {
|
||||||
toString () {
|
toString () {
|
||||||
let attributeStr = ''
|
let attributeStr = ''
|
||||||
|
let watchedAttrs = []
|
||||||
for (let attr in data) {
|
for (let attr in data) {
|
||||||
if (data.hasOwnProperty(attr)) {
|
if (data.hasOwnProperty(attr)) {
|
||||||
|
watchedAttrs.push(attr)
|
||||||
attributeStr += `${typeof data[attr] !== 'undefined' ? `${attr}="${data[attr]}"` : attr} `
|
attributeStr += `${typeof data[attr] !== 'undefined' ? `${attr}="${data[attr]}"` : attr} `
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
attributeStr += `${VUE_META_ATTRIBUTE}="${watchedAttrs.join(',')}"`
|
||||||
return attributeStr.trim()
|
return attributeStr.trim()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,7 +145,7 @@ function getMetaInfoDefinition (Vue, $instance, metaInfo = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ...then merge the data into metaInfo
|
// ...then merge the data into metaInfo
|
||||||
metaInfo = Vue.util.mergeOptions(metaInfo, componentMetaInfo)
|
metaInfo = deepMerge(metaInfo, componentMetaInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if any children also have a metaInfo option, if so, merge
|
// check if any children also have a metaInfo option, if so, merge
|
||||||
|
|||||||
@@ -74,6 +74,12 @@ brace-expansion@^1.0.0:
|
|||||||
balanced-match "^0.4.1"
|
balanced-match "^0.4.1"
|
||||||
concat-map "0.0.1"
|
concat-map "0.0.1"
|
||||||
|
|
||||||
|
browser-resolve@^1.11.0:
|
||||||
|
version "1.11.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce"
|
||||||
|
dependencies:
|
||||||
|
resolve "1.1.7"
|
||||||
|
|
||||||
buble@^0.14.0:
|
buble@^0.14.0:
|
||||||
version "0.14.0"
|
version "0.14.0"
|
||||||
resolved "https://registry.yarnpkg.com/buble/-/buble-0.14.0.tgz#f9b8005b92a5151d9eb972e3bd461ab84a6b59b9"
|
resolved "https://registry.yarnpkg.com/buble/-/buble-0.14.0.tgz#f9b8005b92a5151d9eb972e3bd461ab84a6b59b9"
|
||||||
@@ -90,6 +96,10 @@ buffer-shims@^1.0.0:
|
|||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51"
|
resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51"
|
||||||
|
|
||||||
|
builtin-modules@^1.1.0:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
|
||||||
|
|
||||||
caller-path@^0.1.0:
|
caller-path@^0.1.0:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f"
|
resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f"
|
||||||
@@ -170,6 +180,10 @@ deep-is@~0.1.3:
|
|||||||
version "0.1.3"
|
version "0.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
||||||
|
|
||||||
|
deepmerge:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-1.2.0.tgz#c36bf76bc1995b85d83e5b0362c97511562bfea8"
|
||||||
|
|
||||||
deglob@^2.0.0:
|
deglob@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/deglob/-/deglob-2.0.0.tgz#dd087aa2971a0b1feeea66483c2c82685c73be86"
|
resolved "https://registry.yarnpkg.com/deglob/-/deglob-2.0.0.tgz#dd087aa2971a0b1feeea66483c2c82685c73be86"
|
||||||
@@ -594,6 +608,12 @@ magic-string@^0.14.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
vlq "^0.2.1"
|
vlq "^0.2.1"
|
||||||
|
|
||||||
|
magic-string@^0.16.0:
|
||||||
|
version "0.16.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.16.0.tgz#970ebb0da7193301285fb1aa650f39bdd81eb45a"
|
||||||
|
dependencies:
|
||||||
|
vlq "^0.2.1"
|
||||||
|
|
||||||
minimatch@^3.0.2:
|
minimatch@^3.0.2:
|
||||||
version "3.0.3"
|
version "3.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
|
||||||
@@ -751,6 +771,10 @@ resolve-from@^1.0.0:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
|
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
|
||||||
|
|
||||||
|
resolve@^1.1.6, resolve@^1.1.7, resolve@1.1.7:
|
||||||
|
version "1.1.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
|
||||||
|
|
||||||
restore-cursor@^1.0.1:
|
restore-cursor@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541"
|
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541"
|
||||||
@@ -777,7 +801,25 @@ rollup-plugin-buble:
|
|||||||
buble "^0.14.0"
|
buble "^0.14.0"
|
||||||
rollup-pluginutils "^1.5.0"
|
rollup-pluginutils "^1.5.0"
|
||||||
|
|
||||||
rollup-pluginutils@^1.5.0:
|
rollup-plugin-commonjs:
|
||||||
|
version "5.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-5.0.5.tgz#14f93d92cb70e6c31142914b83cd3e904be30c1f"
|
||||||
|
dependencies:
|
||||||
|
acorn "^4.0.1"
|
||||||
|
estree-walker "^0.2.1"
|
||||||
|
magic-string "^0.16.0"
|
||||||
|
resolve "^1.1.7"
|
||||||
|
rollup-pluginutils "^1.5.1"
|
||||||
|
|
||||||
|
rollup-plugin-node-resolve:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.0.0.tgz#07e0ae94ac002a3ea36e8f33ca121d9f836b1309"
|
||||||
|
dependencies:
|
||||||
|
browser-resolve "^1.11.0"
|
||||||
|
builtin-modules "^1.1.0"
|
||||||
|
resolve "^1.1.6"
|
||||||
|
|
||||||
|
rollup-pluginutils@^1.5.0, rollup-pluginutils@^1.5.1:
|
||||||
version "1.5.2"
|
version "1.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408"
|
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user