diff --git a/src/browser.js b/src/browser.js index 037de92..0be29cf 100644 --- a/src/browser.js +++ b/src/browser.js @@ -1,7 +1,7 @@ import { version } from '../package.json' import createMixin from './shared/mixin' import setOptions from './shared/options' -import { isUndefined } from './shared/is-type' +import { isUndefined } from './utils/is-type' import $meta from './client/$meta' import { hasMetaInfo } from './shared/meta-helpers' diff --git a/src/client/batchUpdate.js b/src/client/batchUpdate.js index 5d6e278..6e9a7a9 100644 --- a/src/client/batchUpdate.js +++ b/src/client/batchUpdate.js @@ -1,4 +1,4 @@ -import { hasGlobalWindow } from '../shared/window' +import { hasGlobalWindow } from '../utils/window' // fallback to timers if rAF not present const stopUpdate = (hasGlobalWindow ? window.cancelAnimationFrame : null) || clearTimeout diff --git a/src/client/refresh.js b/src/client/refresh.js index c5d1136..3d6020b 100644 --- a/src/client/refresh.js +++ b/src/client/refresh.js @@ -1,5 +1,5 @@ import getMetaInfo from '../shared/getMetaInfo' -import { isFunction } from '../shared/is-type' +import { isFunction } from '../utils/is-type' import { clientSequences } from '../shared/escaping' import updateClientMetaInfo from './updateClientMetaInfo' diff --git a/src/client/updateClientMetaInfo.js b/src/client/updateClientMetaInfo.js index 30c7800..19abe89 100644 --- a/src/client/updateClientMetaInfo.js +++ b/src/client/updateClientMetaInfo.js @@ -1,5 +1,5 @@ import { metaInfoOptionKeys, metaInfoAttributeKeys } from '../shared/constants' -import { isArray } from '../shared/is-type' +import { isArray } from '../utils/is-type' import { updateAttribute, updateTag, updateTitle } from './updaters' function getTag(tags, tag) { diff --git a/src/client/updaters/attribute.js b/src/client/updaters/attribute.js index ec05073..446060f 100644 --- a/src/client/updaters/attribute.js +++ b/src/client/updaters/attribute.js @@ -1,5 +1,5 @@ import { booleanHtmlAttributes } from '../../shared/constants' -import { isArray } from '../../shared/is-type' +import { isArray } from '../../utils/is-type' /** * Updates the document's html tag attributes diff --git a/src/client/updaters/tag.js b/src/client/updaters/tag.js index 9739344..7c6bd84 100644 --- a/src/client/updaters/tag.js +++ b/src/client/updaters/tag.js @@ -1,4 +1,4 @@ -import { isUndefined } from '../../shared/is-type' +import { isUndefined } from '../../utils/is-type' /** * Updates meta tags inside and on the client. Borrowed from `react-helmet`: diff --git a/src/server/generators/attribute.js b/src/server/generators/attribute.js index 0ac406a..ff0933e 100644 --- a/src/server/generators/attribute.js +++ b/src/server/generators/attribute.js @@ -1,5 +1,5 @@ import { booleanHtmlAttributes } from '../../shared/constants' -import { isUndefined, isArray } from '../../shared/is-type' +import { isUndefined, isArray } from '../../utils/is-type' /** * Generates tag attributes for use on the server. diff --git a/src/server/generators/tag.js b/src/server/generators/tag.js index 2849ed2..e6ea38b 100644 --- a/src/server/generators/tag.js +++ b/src/server/generators/tag.js @@ -1,5 +1,5 @@ import { booleanHtmlAttributes, tagsWithoutEndTag, tagsWithInnerContent, tagAttributeAsInnerContent } from '../../shared/constants' -import { isUndefined } from '../../shared/is-type' +import { isUndefined } from '../../utils/is-type' /** * Generates meta, base, link, style, script, noscript tags for use on the server diff --git a/src/shared/escaping.js b/src/shared/escaping.js index f790b7f..ef0e4b0 100644 --- a/src/shared/escaping.js +++ b/src/shared/escaping.js @@ -1,5 +1,5 @@ +import { isString, isArray, isObject } from '../utils/is-type' import { metaInfoOptionKeys, disableOptionKeys } from './constants' -import { isString, isArray, isObject } from './is-type' export const serverSequences = [ [/&/g, '&'], diff --git a/src/shared/getComponentOption.js b/src/shared/getComponentOption.js index 7e46bec..f0d2d38 100644 --- a/src/shared/getComponentOption.js +++ b/src/shared/getComponentOption.js @@ -1,7 +1,7 @@ +import { isFunction, isObject } from '../utils/is-type' import { merge } from './merge' import { applyTemplate } from './template' import { inMetaInfoBranch } from './meta-helpers' -import { isFunction, isObject } from './is-type' /** * Returns the `opts.option` $option value of the given `opts.component`. diff --git a/src/shared/getMetaInfo.js b/src/shared/getMetaInfo.js index 0ab9627..9bb78c3 100644 --- a/src/shared/getMetaInfo.js +++ b/src/shared/getMetaInfo.js @@ -1,6 +1,6 @@ +import { ensureIsArray } from '../utils/ensure' import { applyTemplate } from './template' import { defaultInfo, disableOptionKeys } from './constants' -import { ensureIsArray } from './ensure' import { escape } from './escaping' import getComponentOption from './getComponentOption' diff --git a/src/shared/meta-helpers.js b/src/shared/meta-helpers.js index 382e7f0..d1d7ac2 100644 --- a/src/shared/meta-helpers.js +++ b/src/shared/meta-helpers.js @@ -1,4 +1,4 @@ -import { isUndefined, isObject } from './is-type' +import { isUndefined, isObject } from '../utils/is-type' // Vue $root instance has a _vueMeta object property, otherwise its a boolean true export function hasMetaInfo(vm = this) { diff --git a/src/shared/mixin.js b/src/shared/mixin.js index ce9a544..03ee7ed 100644 --- a/src/shared/mixin.js +++ b/src/shared/mixin.js @@ -1,7 +1,7 @@ import triggerUpdate from '../client/triggerUpdate' +import { isUndefined, isFunction } from '../utils/is-type' +import { ensuredPush } from '../utils/ensure' import { hasMetaInfo } from './meta-helpers' -import { isUndefined, isFunction } from './is-type' -import { ensuredPush } from './ensure' import { addNavGuards } from './nav-guards' export default function createMixin(Vue, options) { diff --git a/src/shared/nav-guards.js b/src/shared/nav-guards.js index eee2200..b86c525 100644 --- a/src/shared/nav-guards.js +++ b/src/shared/nav-guards.js @@ -1,4 +1,4 @@ -import { isFunction } from './is-type' +import { isFunction } from '../utils/is-type' export function addNavGuards(vm) { // return when nav guards already added or no router exists diff --git a/src/shared/options.js b/src/shared/options.js index 5595808..da36d43 100644 --- a/src/shared/options.js +++ b/src/shared/options.js @@ -1,4 +1,4 @@ -import { isObject } from './is-type' +import { isObject } from '../utils/is-type' import { defaultOptions } from './constants' export default function setOptions(options) { diff --git a/src/shared/template.js b/src/shared/template.js index cb6fd16..1de07b0 100644 --- a/src/shared/template.js +++ b/src/shared/template.js @@ -1,4 +1,4 @@ -import { isUndefined, isFunction } from './is-type' +import { isUndefined, isFunction } from '../utils/is-type' export function applyTemplate({ component, metaTemplateKeyName, contentKeyName }, headObject, template, chunk) { if (isUndefined(template)) { diff --git a/src/shared/ensure.js b/src/utils/ensure.js similarity index 100% rename from src/shared/ensure.js rename to src/utils/ensure.js diff --git a/src/shared/is-type.js b/src/utils/is-type.js similarity index 100% rename from src/shared/is-type.js rename to src/utils/is-type.js diff --git a/src/shared/window.js b/src/utils/window.js similarity index 100% rename from src/shared/window.js rename to src/utils/window.js diff --git a/test/unit/components.test.js b/test/unit/components.test.js index 07b76e0..2a32113 100644 --- a/test/unit/components.test.js +++ b/test/unit/components.test.js @@ -9,7 +9,7 @@ import Changed from '../components/changed.vue' const getMetaInfo = component => _getMetaInfo(defaultOptions, component) -jest.mock('../../src/shared/window', () => ({ +jest.mock('../../src/utils/window', () => ({ hasGlobalWindow: false })) diff --git a/test/unit/shared.test.js b/test/unit/shared.test.js index 7351cee..60c25b9 100644 --- a/test/unit/shared.test.js +++ b/test/unit/shared.test.js @@ -1,10 +1,10 @@ /** * @jest-environment node */ -import { ensureIsArray } from '../../src/shared/ensure' import setOptions from '../../src/shared/options' -import { hasGlobalWindowFn } from '../../src/shared/window' import { defaultOptions } from '../../src/shared/constants' +import { ensureIsArray } from '../../src/utils/ensure' +import { hasGlobalWindowFn } from '../../src/utils/window' describe('shared', () => { test('ensureIsArray ensures var is array', () => {