Skip to content

Commit

Permalink
chore(release): 3.0.0-alpha.3
Browse files Browse the repository at this point in the history
  • Loading branch information
pimlie committed Apr 4, 2021
1 parent 9d62122 commit 5520faf
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 126 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [3.0.0-alpha.3](https://github.com/nuxt/vue-meta/compare/v3.0.0-alpha.2...v3.0.0-alpha.3) (2021-04-04)


### Features

* add fully static / client-only example ([c6c3b47](https://github.com/nuxt/vue-meta/commit/c6c3b4758664b0b7ea2487ed785128416d0905b5))
* make createMetaManager util args optional (use defaults) ([89d7f58](https://github.com/nuxt/vue-meta/commit/89d7f584910da78a6af6bc700dde61a8a1625658))


### Bug Fixes

* dont call clean before starting dev server ([683ea9c](https://github.com/nuxt/vue-meta/commit/683ea9c0765dea40b98093d6946cabc0369d79c2))
* fix/improve resolver types ([fcb47a9](https://github.com/nuxt/vue-meta/commit/fcb47a9d5f106704f1e187154b5691939130f630))
* only match vue-meta in jiti alias ([2b8c5e8](https://github.com/nuxt/vue-meta/commit/2b8c5e8866e54d9fd784a6f1bb3733d572aaa8af))
* replace node-env in rollup config ([ed6ba9f](https://github.com/nuxt/vue-meta/commit/ed6ba9fa942869e9c10dbd1df251381451117e74))
* use dynamic import for vue server-renderer ([8e2fed1](https://github.com/nuxt/vue-meta/commit/8e2fed1525f1c8594ab4bf4360ffb4af11ea8ddb))

## [3.0.0-alpha.2](https://github.com/nuxt/vue-meta/compare/v3.0.0-alpha.1...v3.0.0-alpha.2) (2021-02-28)


Expand Down
54 changes: 33 additions & 21 deletions dist/vue-meta.cjs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vue-meta v3.0.0-alpha.2
* vue-meta v3.0.0-alpha.3
* (c) 2021
* - Pim (@pimlie)
* - All the amazing contributors
Expand All @@ -12,7 +12,19 @@ Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');

const resolveOption = predicament => (options, contexts) => {
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
n[k] = e[k];
});
}
n['default'] = e;
return Object.freeze(n);
}

const resolveOption = (predicament, initialValue) => (options, contexts) => {
let resolvedIndex = -1;
contexts.reduce((acc, context, index) => {
const retval = predicament(acc, context);
Expand All @@ -21,7 +33,7 @@ const resolveOption = predicament => (options, contexts) => {
return retval;
}
return acc;
}, undefined);
}, initialValue);
if (resolvedIndex > -1) {
return options[resolvedIndex];
}
Expand All @@ -40,14 +52,15 @@ function setup(context) {
}
context.depth = depth;
}
const resolve = resolveOption((acc, context) => {
const resolve = resolveOption((currentValue, context) => {
const { depth } = context;
if (!acc || depth > acc) {
return acc;
if (!currentValue || depth > currentValue) {
return depth;
}
return currentValue;
});

var deepest = /*#__PURE__*/Object.freeze({
var defaultResolver = /*#__PURE__*/Object.freeze({
__proto__: null,
setup: setup,
resolve: resolve
Expand Down Expand Up @@ -161,10 +174,9 @@ function getTagConfigItem(tagOrName, key) {
* \/\*#\_\_PURE\_\_\*\/
* So that rollup can tree-shake them if necessary.
*/
(process.env.NODE_ENV !== 'production')
? Object.freeze({})
: {};
(process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
Object.freeze({})
;
Object.freeze([]) ;
const isArray = Array.isArray;
const isFunction = (val) => typeof val === 'function';
const isString = (val) => typeof val === 'string';
Expand Down Expand Up @@ -252,20 +264,23 @@ const recompute = (context, sources, target, path = []) => {
}
for (const key of keys) {
// This assumes consistent types usages for keys across sources
// @ts-ignore
if (isPlainObject(sources[0][key])) {
if (!target[key]) {
target[key] = {};
}
const keySources = [];
for (const source of sources) {
if (key in source) {
// @ts-ignore
keySources.push(source[key]);
}
}
recompute(context, keySources, target[key], [...path, key]);
continue;
}
// Ensure the target is an array if source is an array and target is empty
// @ts-ignore
if (!target[key] && isArray(sources[0][key])) {
target[key] = [];
}
Expand Down Expand Up @@ -309,7 +324,7 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
if (!value[IS_PROXY]) {
const keyPath = [...pathSegments, key];
value = createProxy(context, value, resolveContext, keyPath);
target[key] = value;
Reflect.set(target, key, value);
}
return value;
},
Expand Down Expand Up @@ -381,6 +396,7 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
let active = context.active;
let index = 0;
for (const segment of pathSegments) {
// @ts-ignore
proxies = proxies.map(proxy => proxy[segment]);
if (isArrayItem && index === pathSegments.length - 1) {
activeSegmentKey = segment;
Expand Down Expand Up @@ -421,11 +437,8 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
}
});

const createMergedObject = (resolve, active = {}) => {
const createMergedObject = (resolve, active) => {
const sources = [];
if (!active) {
active = {};
}
const context = {
active,
resolve,
Expand All @@ -443,7 +456,7 @@ const createMergedObject = (resolve, active = {}) => {
return proxy;
},
delSource: (sourceOrProxy, recompute = true) => {
const index = sources.findIndex(src => src === sourceOrProxy || src[PROXY_TARGET] === sourceOrProxy);
const index = sources.findIndex(source => source === sourceOrProxy || source[PROXY_TARGET] === sourceOrProxy);
if (index > -1) {
sources.splice(index, 1);
if (recompute) {
Expand Down Expand Up @@ -727,7 +740,7 @@ function addVnode(teleports, to, vnodes) {
}
teleports[to].push(...nodes);
}
const createMetaManager = (config, resolver) => MetaManager.create(config, resolver);
const createMetaManager = (config, resolver) => MetaManager.create(config || defaultConfig, resolver || defaultResolver);
class MetaManager {
constructor(config, target, resolver) {
this.ssrCleanedUp = false;
Expand Down Expand Up @@ -850,9 +863,8 @@ MetaManager.create = (config, resolver) => {
return manager;
};

// rollup doesnt like an import as it cant find the export so use require
const { renderToString } = require('@vue/server-renderer');
async function renderToStringWithMeta(app) {
const { renderToString } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@vue/server-renderer')); });
const ctx = {};
const html = await renderToString(app, ctx);
// TODO: better way of determining whether meta was rendered with the component or not
Expand All @@ -872,7 +884,7 @@ async function renderToStringWithMeta(app) {
}

exports.createMetaManager = createMetaManager;
exports.deepestResolver = deepest;
exports.deepestResolver = defaultResolver;
exports.defaultConfig = defaultConfig;
exports.getCurrentManager = getCurrentManager;
exports.renderToStringWithMeta = renderToStringWithMeta;
Expand Down
51 changes: 30 additions & 21 deletions dist/vue-meta.cjs.prod.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* vue-meta v3.0.0-alpha.2
* vue-meta v3.0.0-alpha.3
* (c) 2021
* - Pim (@pimlie)
* - All the amazing contributors
Expand All @@ -12,7 +12,19 @@ Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');

const resolveOption = predicament => (options, contexts) => {
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
n[k] = e[k];
});
}
n['default'] = e;
return Object.freeze(n);
}

const resolveOption = (predicament, initialValue) => (options, contexts) => {
let resolvedIndex = -1;
contexts.reduce((acc, context, index) => {
const retval = predicament(acc, context);
Expand All @@ -21,7 +33,7 @@ const resolveOption = predicament => (options, contexts) => {
return retval;
}
return acc;
}, undefined);
}, initialValue);
if (resolvedIndex > -1) {
return options[resolvedIndex];
}
Expand All @@ -40,14 +52,15 @@ function setup(context) {
}
context.depth = depth;
}
const resolve = resolveOption((acc, context) => {
const resolve = resolveOption((currentValue, context) => {
const { depth } = context;
if (!acc || depth > acc) {
return acc;
if (!currentValue || depth > currentValue) {
return depth;
}
return currentValue;
});

var deepest = /*#__PURE__*/Object.freeze({
var defaultResolver = /*#__PURE__*/Object.freeze({
__proto__: null,
setup: setup,
resolve: resolve
Expand Down Expand Up @@ -161,10 +174,6 @@ function getTagConfigItem(tagOrName, key) {
* \/\*#\_\_PURE\_\_\*\/
* So that rollup can tree-shake them if necessary.
*/
(process.env.NODE_ENV !== 'production')
? Object.freeze({})
: {};
(process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
const isArray = Array.isArray;
const isFunction = (val) => typeof val === 'function';
const isString = (val) => typeof val === 'string';
Expand Down Expand Up @@ -252,20 +261,23 @@ const recompute = (context, sources, target, path = []) => {
}
for (const key of keys) {
// This assumes consistent types usages for keys across sources
// @ts-ignore
if (isPlainObject(sources[0][key])) {
if (!target[key]) {
target[key] = {};
}
const keySources = [];
for (const source of sources) {
if (key in source) {
// @ts-ignore
keySources.push(source[key]);
}
}
recompute(context, keySources, target[key], [...path, key]);
continue;
}
// Ensure the target is an array if source is an array and target is empty
// @ts-ignore
if (!target[key] && isArray(sources[0][key])) {
target[key] = [];
}
Expand Down Expand Up @@ -309,7 +321,7 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
if (!value[IS_PROXY]) {
const keyPath = [...pathSegments, key];
value = createProxy(context, value, resolveContext, keyPath);
target[key] = value;
Reflect.set(target, key, value);
}
return value;
},
Expand Down Expand Up @@ -381,6 +393,7 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
let active = context.active;
let index = 0;
for (const segment of pathSegments) {
// @ts-ignore
proxies = proxies.map(proxy => proxy[segment]);
if (isArrayItem && index === pathSegments.length - 1) {
activeSegmentKey = segment;
Expand Down Expand Up @@ -421,11 +434,8 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
}
});

const createMergedObject = (resolve, active = {}) => {
const createMergedObject = (resolve, active) => {
const sources = [];
if (!active) {
active = {};
}
const context = {
active,
resolve,
Expand All @@ -443,7 +453,7 @@ const createMergedObject = (resolve, active = {}) => {
return proxy;
},
delSource: (sourceOrProxy, recompute = true) => {
const index = sources.findIndex(src => src === sourceOrProxy || src[PROXY_TARGET] === sourceOrProxy);
const index = sources.findIndex(source => source === sourceOrProxy || source[PROXY_TARGET] === sourceOrProxy);
if (index > -1) {
sources.splice(index, 1);
if (recompute) {
Expand Down Expand Up @@ -723,7 +733,7 @@ function addVnode(teleports, to, vnodes) {
}
teleports[to].push(...nodes);
}
const createMetaManager = (config, resolver) => MetaManager.create(config, resolver);
const createMetaManager = (config, resolver) => MetaManager.create(config || defaultConfig, resolver || defaultResolver);
class MetaManager {
constructor(config, target, resolver) {
this.ssrCleanedUp = false;
Expand Down Expand Up @@ -846,9 +856,8 @@ MetaManager.create = (config, resolver) => {
return manager;
};

// rollup doesnt like an import as it cant find the export so use require
const { renderToString } = require('@vue/server-renderer');
async function renderToStringWithMeta(app) {
const { renderToString } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@vue/server-renderer')); });
const ctx = {};
const html = await renderToString(app, ctx);
// TODO: better way of determining whether meta was rendered with the component or not
Expand All @@ -868,7 +877,7 @@ async function renderToStringWithMeta(app) {
}

exports.createMetaManager = createMetaManager;
exports.deepestResolver = deepest;
exports.deepestResolver = defaultResolver;
exports.defaultConfig = defaultConfig;
exports.getCurrentManager = getCurrentManager;
exports.renderToStringWithMeta = renderToStringWithMeta;
Expand Down
Loading

0 comments on commit 5520faf

Please sign in to comment.