mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-25 03:10:33 +03:00
refactor: set defaultOptions in shared/constants
This commit is contained in:
committed by
Alexander Lichter
parent
c1f97c4ea4
commit
2b24acc8b2
@@ -44,6 +44,15 @@ export const metaTemplateKeyName = 'template'
|
|||||||
// This is the key name for the content-holding property
|
// This is the key name for the content-holding property
|
||||||
export const contentKeyName = 'content'
|
export const contentKeyName = 'content'
|
||||||
|
|
||||||
|
export const defaultOptions = {
|
||||||
|
keyName,
|
||||||
|
attribute,
|
||||||
|
ssrAttribute,
|
||||||
|
tagIDKeyName,
|
||||||
|
contentKeyName,
|
||||||
|
metaTemplateKeyName
|
||||||
|
}
|
||||||
|
|
||||||
// List of metaInfo property keys which are configuration options (and dont generate html)
|
// List of metaInfo property keys which are configuration options (and dont generate html)
|
||||||
export const metaInfoOptionKeys = [
|
export const metaInfoOptionKeys = [
|
||||||
'titleChunk',
|
'titleChunk',
|
||||||
|
|||||||
+1
-19
@@ -1,23 +1,5 @@
|
|||||||
import { isObject, isFunction } from './is-type'
|
import { isObject, isFunction } from './is-type'
|
||||||
|
import { defaultOptions } from './constants'
|
||||||
import {
|
|
||||||
keyName,
|
|
||||||
attribute,
|
|
||||||
ssrAttribute,
|
|
||||||
tagIDKeyName,
|
|
||||||
metaTemplateKeyName,
|
|
||||||
contentKeyName
|
|
||||||
} from './constants'
|
|
||||||
|
|
||||||
// set some default options
|
|
||||||
const defaultOptions = {
|
|
||||||
keyName,
|
|
||||||
contentKeyName,
|
|
||||||
metaTemplateKeyName,
|
|
||||||
attribute,
|
|
||||||
ssrAttribute,
|
|
||||||
tagIDKeyName
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function setOptions(options) {
|
export default function setOptions(options) {
|
||||||
// combine options
|
// combine options
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _getMetaInfo from '../../src/shared/getMetaInfo'
|
import _getMetaInfo from '../../src/shared/getMetaInfo'
|
||||||
import { mount, loadVueMetaPlugin, vmTick } from '../utils'
|
import { mount, loadVueMetaPlugin, vmTick } from '../utils'
|
||||||
import { defaultOptions } from '../utils/constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
|
|
||||||
import GoodbyeWorld from '../components/goodbye-world.vue'
|
import GoodbyeWorld from '../components/goodbye-world.vue'
|
||||||
import HelloWorld from '../components/hello-world.vue'
|
import HelloWorld from '../components/hello-world.vue'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _getMetaInfo from '../../src/shared/getMetaInfo'
|
import _getMetaInfo from '../../src/shared/getMetaInfo'
|
||||||
import { loadVueMetaPlugin } from '../utils'
|
import { loadVueMetaPlugin } from '../utils'
|
||||||
import { defaultOptions } from '../utils/constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
|
|
||||||
const getMetaInfo = (component, escapeSequences) => _getMetaInfo(defaultOptions, component, escapeSequences)
|
const getMetaInfo = (component, escapeSequences) => _getMetaInfo(defaultOptions, component, escapeSequences)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _generateServerInjector from '../../src/server/generateServerInjector'
|
import _generateServerInjector from '../../src/server/generateServerInjector'
|
||||||
import { defaultOptions } from '../utils/constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
import metaInfoData from '../utils/meta-info-data'
|
import metaInfoData from '../utils/meta-info-data'
|
||||||
|
|
||||||
const generateServerInjector = (type, data) => _generateServerInjector(defaultOptions, type, data)
|
const generateServerInjector = (type, data) => _generateServerInjector(defaultOptions, type, data)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import _getMetaInfo from '../../src/shared/getMetaInfo'
|
import _getMetaInfo from '../../src/shared/getMetaInfo'
|
||||||
import { loadVueMetaPlugin } from '../utils'
|
import { loadVueMetaPlugin } from '../utils'
|
||||||
import { defaultOptions } from '../utils/constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
|
|
||||||
const getMetaInfo = component => _getMetaInfo(defaultOptions, component)
|
const getMetaInfo = component => _getMetaInfo(defaultOptions, component)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import triggerUpdate from '../../src/client/triggerUpdate'
|
import triggerUpdate from '../../src/client/triggerUpdate'
|
||||||
import batchUpdate from '../../src/client/batchUpdate'
|
import batchUpdate from '../../src/client/batchUpdate'
|
||||||
import { mount, vmTick, VueMetaBrowserPlugin, loadVueMetaPlugin } from '../utils'
|
import { mount, vmTick, VueMetaBrowserPlugin, loadVueMetaPlugin } from '../utils'
|
||||||
import { defaultOptions } from '../utils/constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
|
|
||||||
jest.mock('../../src/client/triggerUpdate')
|
jest.mock('../../src/client/triggerUpdate')
|
||||||
jest.mock('../../src/client/batchUpdate')
|
jest.mock('../../src/client/batchUpdate')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { mount, VueMetaServerPlugin, loadVueMetaPlugin } from '../utils'
|
import { mount, VueMetaServerPlugin, loadVueMetaPlugin } from '../utils'
|
||||||
import { defaultOptions } from '../utils/constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
|
|
||||||
jest.mock('../../package.json', () => ({
|
jest.mock('../../package.json', () => ({
|
||||||
version: 'test-version'
|
version: 'test-version'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { ensureIsArray } from '../../src/shared/ensure'
|
import { ensureIsArray } from '../../src/shared/ensure'
|
||||||
import setOptions from '../../src/shared/options'
|
import setOptions from '../../src/shared/options'
|
||||||
import { hasGlobalWindowFn } from '../../src/shared/window'
|
import { hasGlobalWindowFn } from '../../src/shared/window'
|
||||||
import { defaultOptions } from '../utils/constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
|
|
||||||
const noop = () => {}
|
const noop = () => {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import _updateClientMetaInfo from '../../src/client/updateClientMetaInfo'
|
import _updateClientMetaInfo from '../../src/client/updateClientMetaInfo'
|
||||||
import { defaultOptions } from '../utils/constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
import metaInfoData from '../utils/meta-info-data'
|
import metaInfoData from '../utils/meta-info-data'
|
||||||
|
|
||||||
const updateClientMetaInfo = (type, data) => _updateClientMetaInfo(defaultOptions, { [type]: data })
|
const updateClientMetaInfo = (type, data) => _updateClientMetaInfo(defaultOptions, { [type]: data })
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import {
|
|
||||||
keyName,
|
|
||||||
attribute,
|
|
||||||
ssrAttribute,
|
|
||||||
tagIDKeyName,
|
|
||||||
metaTemplateKeyName,
|
|
||||||
contentKeyName
|
|
||||||
} from '../../src/shared/constants'
|
|
||||||
|
|
||||||
export const defaultOptions = {
|
|
||||||
keyName,
|
|
||||||
attribute,
|
|
||||||
ssrAttribute,
|
|
||||||
tagIDKeyName,
|
|
||||||
metaTemplateKeyName,
|
|
||||||
contentKeyName
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1,8 +1,8 @@
|
|||||||
import { mount, createLocalVue } from '@vue/test-utils'
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
import { renderToString } from '@vue/server-test-utils'
|
import { renderToString } from '@vue/server-test-utils'
|
||||||
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
import VueMetaBrowserPlugin from '../../src/browser'
|
import VueMetaBrowserPlugin from '../../src/browser'
|
||||||
import VueMetaServerPlugin from '../../src'
|
import VueMetaServerPlugin from '../../src'
|
||||||
import { defaultOptions } from './constants'
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
mount,
|
mount,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { defaultOptions } from './constants'
|
import { defaultOptions } from '../../src/shared/constants'
|
||||||
|
|
||||||
const metaInfoData = {
|
const metaInfoData = {
|
||||||
title: {
|
title: {
|
||||||
|
|||||||
Reference in New Issue
Block a user