Skip to content

Commit 5520faf

Browse files
committed
chore(release): 3.0.0-alpha.3
1 parent 9d62122 commit 5520faf

10 files changed

+181
-126
lines changed

Diff for: CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

33
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.
44

5+
## [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)
6+
7+
8+
### Features
9+
10+
* add fully static / client-only example ([c6c3b47](https://github.com/nuxt/vue-meta/commit/c6c3b4758664b0b7ea2487ed785128416d0905b5))
11+
* make createMetaManager util args optional (use defaults) ([89d7f58](https://github.com/nuxt/vue-meta/commit/89d7f584910da78a6af6bc700dde61a8a1625658))
12+
13+
14+
### Bug Fixes
15+
16+
* dont call clean before starting dev server ([683ea9c](https://github.com/nuxt/vue-meta/commit/683ea9c0765dea40b98093d6946cabc0369d79c2))
17+
* fix/improve resolver types ([fcb47a9](https://github.com/nuxt/vue-meta/commit/fcb47a9d5f106704f1e187154b5691939130f630))
18+
* only match vue-meta in jiti alias ([2b8c5e8](https://github.com/nuxt/vue-meta/commit/2b8c5e8866e54d9fd784a6f1bb3733d572aaa8af))
19+
* replace node-env in rollup config ([ed6ba9f](https://github.com/nuxt/vue-meta/commit/ed6ba9fa942869e9c10dbd1df251381451117e74))
20+
* use dynamic import for vue server-renderer ([8e2fed1](https://github.com/nuxt/vue-meta/commit/8e2fed1525f1c8594ab4bf4360ffb4af11ea8ddb))
21+
522
## [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)
623

724

Diff for: dist/vue-meta.cjs.js

+33-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-meta v3.0.0-alpha.2
2+
* vue-meta v3.0.0-alpha.3
33
* (c) 2021
44
* - Pim (@pimlie)
55
* - All the amazing contributors
@@ -12,7 +12,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
1212

1313
var vue = require('vue');
1414

15-
const resolveOption = predicament => (options, contexts) => {
15+
function _interopNamespace(e) {
16+
if (e && e.__esModule) return e;
17+
var n = Object.create(null);
18+
if (e) {
19+
Object.keys(e).forEach(function (k) {
20+
n[k] = e[k];
21+
});
22+
}
23+
n['default'] = e;
24+
return Object.freeze(n);
25+
}
26+
27+
const resolveOption = (predicament, initialValue) => (options, contexts) => {
1628
let resolvedIndex = -1;
1729
contexts.reduce((acc, context, index) => {
1830
const retval = predicament(acc, context);
@@ -21,7 +33,7 @@ const resolveOption = predicament => (options, contexts) => {
2133
return retval;
2234
}
2335
return acc;
24-
}, undefined);
36+
}, initialValue);
2537
if (resolvedIndex > -1) {
2638
return options[resolvedIndex];
2739
}
@@ -40,14 +52,15 @@ function setup(context) {
4052
}
4153
context.depth = depth;
4254
}
43-
const resolve = resolveOption((acc, context) => {
55+
const resolve = resolveOption((currentValue, context) => {
4456
const { depth } = context;
45-
if (!acc || depth > acc) {
46-
return acc;
57+
if (!currentValue || depth > currentValue) {
58+
return depth;
4759
}
60+
return currentValue;
4861
});
4962

50-
var deepest = /*#__PURE__*/Object.freeze({
63+
var defaultResolver = /*#__PURE__*/Object.freeze({
5164
__proto__: null,
5265
setup: setup,
5366
resolve: resolve
@@ -161,10 +174,9 @@ function getTagConfigItem(tagOrName, key) {
161174
* \/\*#\_\_PURE\_\_\*\/
162175
* So that rollup can tree-shake them if necessary.
163176
*/
164-
(process.env.NODE_ENV !== 'production')
165-
? Object.freeze({})
166-
: {};
167-
(process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
177+
Object.freeze({})
178+
;
179+
Object.freeze([]) ;
168180
const isArray = Array.isArray;
169181
const isFunction = (val) => typeof val === 'function';
170182
const isString = (val) => typeof val === 'string';
@@ -252,20 +264,23 @@ const recompute = (context, sources, target, path = []) => {
252264
}
253265
for (const key of keys) {
254266
// This assumes consistent types usages for keys across sources
267+
// @ts-ignore
255268
if (isPlainObject(sources[0][key])) {
256269
if (!target[key]) {
257270
target[key] = {};
258271
}
259272
const keySources = [];
260273
for (const source of sources) {
261274
if (key in source) {
275+
// @ts-ignore
262276
keySources.push(source[key]);
263277
}
264278
}
265279
recompute(context, keySources, target[key], [...path, key]);
266280
continue;
267281
}
268282
// Ensure the target is an array if source is an array and target is empty
283+
// @ts-ignore
269284
if (!target[key] && isArray(sources[0][key])) {
270285
target[key] = [];
271286
}
@@ -309,7 +324,7 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
309324
if (!value[IS_PROXY]) {
310325
const keyPath = [...pathSegments, key];
311326
value = createProxy(context, value, resolveContext, keyPath);
312-
target[key] = value;
327+
Reflect.set(target, key, value);
313328
}
314329
return value;
315330
},
@@ -381,6 +396,7 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
381396
let active = context.active;
382397
let index = 0;
383398
for (const segment of pathSegments) {
399+
// @ts-ignore
384400
proxies = proxies.map(proxy => proxy[segment]);
385401
if (isArrayItem && index === pathSegments.length - 1) {
386402
activeSegmentKey = segment;
@@ -421,11 +437,8 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
421437
}
422438
});
423439

424-
const createMergedObject = (resolve, active = {}) => {
440+
const createMergedObject = (resolve, active) => {
425441
const sources = [];
426-
if (!active) {
427-
active = {};
428-
}
429442
const context = {
430443
active,
431444
resolve,
@@ -443,7 +456,7 @@ const createMergedObject = (resolve, active = {}) => {
443456
return proxy;
444457
},
445458
delSource: (sourceOrProxy, recompute = true) => {
446-
const index = sources.findIndex(src => src === sourceOrProxy || src[PROXY_TARGET] === sourceOrProxy);
459+
const index = sources.findIndex(source => source === sourceOrProxy || source[PROXY_TARGET] === sourceOrProxy);
447460
if (index > -1) {
448461
sources.splice(index, 1);
449462
if (recompute) {
@@ -727,7 +740,7 @@ function addVnode(teleports, to, vnodes) {
727740
}
728741
teleports[to].push(...nodes);
729742
}
730-
const createMetaManager = (config, resolver) => MetaManager.create(config, resolver);
743+
const createMetaManager = (config, resolver) => MetaManager.create(config || defaultConfig, resolver || defaultResolver);
731744
class MetaManager {
732745
constructor(config, target, resolver) {
733746
this.ssrCleanedUp = false;
@@ -850,9 +863,8 @@ MetaManager.create = (config, resolver) => {
850863
return manager;
851864
};
852865

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

874886
exports.createMetaManager = createMetaManager;
875-
exports.deepestResolver = deepest;
887+
exports.deepestResolver = defaultResolver;
876888
exports.defaultConfig = defaultConfig;
877889
exports.getCurrentManager = getCurrentManager;
878890
exports.renderToStringWithMeta = renderToStringWithMeta;

Diff for: dist/vue-meta.cjs.prod.js

+30-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-meta v3.0.0-alpha.2
2+
* vue-meta v3.0.0-alpha.3
33
* (c) 2021
44
* - Pim (@pimlie)
55
* - All the amazing contributors
@@ -12,7 +12,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
1212

1313
var vue = require('vue');
1414

15-
const resolveOption = predicament => (options, contexts) => {
15+
function _interopNamespace(e) {
16+
if (e && e.__esModule) return e;
17+
var n = Object.create(null);
18+
if (e) {
19+
Object.keys(e).forEach(function (k) {
20+
n[k] = e[k];
21+
});
22+
}
23+
n['default'] = e;
24+
return Object.freeze(n);
25+
}
26+
27+
const resolveOption = (predicament, initialValue) => (options, contexts) => {
1628
let resolvedIndex = -1;
1729
contexts.reduce((acc, context, index) => {
1830
const retval = predicament(acc, context);
@@ -21,7 +33,7 @@ const resolveOption = predicament => (options, contexts) => {
2133
return retval;
2234
}
2335
return acc;
24-
}, undefined);
36+
}, initialValue);
2537
if (resolvedIndex > -1) {
2638
return options[resolvedIndex];
2739
}
@@ -40,14 +52,15 @@ function setup(context) {
4052
}
4153
context.depth = depth;
4254
}
43-
const resolve = resolveOption((acc, context) => {
55+
const resolve = resolveOption((currentValue, context) => {
4456
const { depth } = context;
45-
if (!acc || depth > acc) {
46-
return acc;
57+
if (!currentValue || depth > currentValue) {
58+
return depth;
4759
}
60+
return currentValue;
4861
});
4962

50-
var deepest = /*#__PURE__*/Object.freeze({
63+
var defaultResolver = /*#__PURE__*/Object.freeze({
5164
__proto__: null,
5265
setup: setup,
5366
resolve: resolve
@@ -161,10 +174,6 @@ function getTagConfigItem(tagOrName, key) {
161174
* \/\*#\_\_PURE\_\_\*\/
162175
* So that rollup can tree-shake them if necessary.
163176
*/
164-
(process.env.NODE_ENV !== 'production')
165-
? Object.freeze({})
166-
: {};
167-
(process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
168177
const isArray = Array.isArray;
169178
const isFunction = (val) => typeof val === 'function';
170179
const isString = (val) => typeof val === 'string';
@@ -252,20 +261,23 @@ const recompute = (context, sources, target, path = []) => {
252261
}
253262
for (const key of keys) {
254263
// This assumes consistent types usages for keys across sources
264+
// @ts-ignore
255265
if (isPlainObject(sources[0][key])) {
256266
if (!target[key]) {
257267
target[key] = {};
258268
}
259269
const keySources = [];
260270
for (const source of sources) {
261271
if (key in source) {
272+
// @ts-ignore
262273
keySources.push(source[key]);
263274
}
264275
}
265276
recompute(context, keySources, target[key], [...path, key]);
266277
continue;
267278
}
268279
// Ensure the target is an array if source is an array and target is empty
280+
// @ts-ignore
269281
if (!target[key] && isArray(sources[0][key])) {
270282
target[key] = [];
271283
}
@@ -309,7 +321,7 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
309321
if (!value[IS_PROXY]) {
310322
const keyPath = [...pathSegments, key];
311323
value = createProxy(context, value, resolveContext, keyPath);
312-
target[key] = value;
324+
Reflect.set(target, key, value);
313325
}
314326
return value;
315327
},
@@ -381,6 +393,7 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
381393
let active = context.active;
382394
let index = 0;
383395
for (const segment of pathSegments) {
396+
// @ts-ignore
384397
proxies = proxies.map(proxy => proxy[segment]);
385398
if (isArrayItem && index === pathSegments.length - 1) {
386399
activeSegmentKey = segment;
@@ -421,11 +434,8 @@ const createHandler = (context, resolveContext, pathSegments = []) => ({
421434
}
422435
});
423436

424-
const createMergedObject = (resolve, active = {}) => {
437+
const createMergedObject = (resolve, active) => {
425438
const sources = [];
426-
if (!active) {
427-
active = {};
428-
}
429439
const context = {
430440
active,
431441
resolve,
@@ -443,7 +453,7 @@ const createMergedObject = (resolve, active = {}) => {
443453
return proxy;
444454
},
445455
delSource: (sourceOrProxy, recompute = true) => {
446-
const index = sources.findIndex(src => src === sourceOrProxy || src[PROXY_TARGET] === sourceOrProxy);
456+
const index = sources.findIndex(source => source === sourceOrProxy || source[PROXY_TARGET] === sourceOrProxy);
447457
if (index > -1) {
448458
sources.splice(index, 1);
449459
if (recompute) {
@@ -723,7 +733,7 @@ function addVnode(teleports, to, vnodes) {
723733
}
724734
teleports[to].push(...nodes);
725735
}
726-
const createMetaManager = (config, resolver) => MetaManager.create(config, resolver);
736+
const createMetaManager = (config, resolver) => MetaManager.create(config || defaultConfig, resolver || defaultResolver);
727737
class MetaManager {
728738
constructor(config, target, resolver) {
729739
this.ssrCleanedUp = false;
@@ -846,9 +856,8 @@ MetaManager.create = (config, resolver) => {
846856
return manager;
847857
};
848858

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

870879
exports.createMetaManager = createMetaManager;
871-
exports.deepestResolver = deepest;
880+
exports.deepestResolver = defaultResolver;
872881
exports.defaultConfig = defaultConfig;
873882
exports.getCurrentManager = getCurrentManager;
874883
exports.renderToStringWithMeta = renderToStringWithMeta;

0 commit comments

Comments
 (0)