@podium/layout
Advanced tools
Comparing version 5.0.0-next.1 to 5.0.0-next.2
@@ -0,1 +1,15 @@ | ||
# [5.0.0-next.2](https://github.com/podium-lib/layout/compare/v5.0.0-next.1...v5.0.0-next.2) (2020-07-21) | ||
### Features | ||
* Remove deprecated return value on .js and .css methods ([e9052ed](https://github.com/podium-lib/layout/commit/e9052ed0b86f4690c8837dd09639ec5170f76e5c)) | ||
### BREAKING CHANGES | ||
* In version 4 of podium it became possible to set multiple assets to a layout through its `.js()` and `.css()` methods. This did make it impossible to let these methods return a reasonable value, but to keep a backwards compatibility with version 3 of Podium, the first item passed in was returned for compatibility. This removes this compatibility with version 3 of Podium. | ||
This resolves https://github.com/podium-lib/issues/issues/23 | ||
# [5.0.0-next.1](https://github.com/podium-lib/layout/compare/v4.6.0...v5.0.0-next.1) (2020-07-14) | ||
@@ -2,0 +16,0 @@ |
@@ -26,3 +26,2 @@ /* eslint-disable consistent-return */ | ||
const _compabillity = Symbol('_compabillity'); | ||
const _pathname = Symbol('_pathname'); | ||
@@ -33,22 +32,2 @@ const _sanitize = Symbol('_sanitize'); | ||
function deprecateJsReturn() { | ||
if (!deprecateJsReturn.warned) { | ||
deprecateJsReturn.warned = true; | ||
process.emitWarning( | ||
'Return value from method js() is now deprecated and will be removed in a future version. Please do not rely on this value.', | ||
'DeprecationWarning', | ||
); | ||
} | ||
} | ||
function deprecateCssReturn() { | ||
if (!deprecateCssReturn.warned) { | ||
deprecateCssReturn.warned = true; | ||
process.emitWarning( | ||
'Return value from method css() is now deprecated and will be removed in a future version. Please do not rely on this value.', | ||
'DeprecationWarning', | ||
); | ||
} | ||
} | ||
const PodiumLayout = class PodiumLayout { | ||
@@ -190,14 +169,6 @@ /* istanbul ignore next */ | ||
[_addCssAsset](options = {}) { | ||
if (!options.value) { | ||
const v = this[_compabillity](this.cssRoute); | ||
return this[_sanitize](v, options.prefix); | ||
} | ||
const clonedOptions = JSON.parse(JSON.stringify(options)); | ||
const args = { ...clonedOptions, pathname: this._pathname }; | ||
this.cssRoute.push(new AssetCss(args)); | ||
// deprecate | ||
deprecateCssReturn(); | ||
return this[_sanitize](args.value, args.prefix); | ||
const clonedOptions = JSON.parse(JSON.stringify(options)); | ||
clonedOptions.value = this[_sanitize](clonedOptions.value, clonedOptions.prefix) | ||
const args = { prefix: true, ...clonedOptions, pathname: this._pathname }; | ||
this.cssRoute.push(new AssetCss(args)); | ||
} | ||
@@ -212,14 +183,11 @@ | ||
} | ||
return this[_addCssAsset](options); | ||
this[_addCssAsset](options); | ||
} | ||
[_addJsAsset](options = {}) { | ||
if (!options.value) { | ||
const v = this[_compabillity](this.jsRoute); | ||
return this[_sanitize](v, options.prefix); | ||
} | ||
const clonedOptions = JSON.parse(JSON.stringify(options)); | ||
const args = { ...clonedOptions, pathname: this._pathname }; | ||
clonedOptions.value = this[_sanitize](clonedOptions.value, clonedOptions.prefix) | ||
const args = { prefix: true, ...clonedOptions, pathname: this._pathname }; | ||
// Convert data attribute object structure to array of key value objects | ||
@@ -238,6 +206,2 @@ if (typeof args.data === 'object' && args.data !== null) { | ||
this.jsRoute.push(new AssetJs(args)); | ||
// deprecate | ||
deprecateJsReturn(); | ||
return this[_sanitize](args.value, args.prefix); | ||
} | ||
@@ -252,3 +216,3 @@ | ||
} | ||
return this[_addJsAsset](options); | ||
this[_addJsAsset](options); | ||
} | ||
@@ -312,13 +276,4 @@ | ||
} | ||
// This is here only to cater for compabillity between version 3 and 4 | ||
// Can be removed when deprecation of the .assets terminated | ||
[_compabillity](arr) { | ||
const result = arr.map(obj => { | ||
return obj.value; | ||
}); | ||
return result.length === 0 ? '' : result[0]; | ||
} | ||
}; | ||
module.exports = PodiumLayout; |
{ | ||
"name": "@podium/layout", | ||
"version": "5.0.0-next.1", | ||
"version": "5.0.0-next.2", | ||
"description": "Module for composing full page layouts out of page fragments in a micro frontend architecture.", | ||
@@ -40,7 +40,7 @@ "main": "lib/layout.js", | ||
"@metrics/client": "2.5.0", | ||
"@podium/client": "4.4.2", | ||
"@podium/context": "4.1.6", | ||
"@podium/proxy": "4.2.1", | ||
"@podium/schemas": "4.0.2", | ||
"@podium/utils": "4.3.0", | ||
"@podium/client": "5.0.0-next.4", | ||
"@podium/context": "5.0.0-next.3", | ||
"@podium/proxy": "5.0.0-next.2", | ||
"@podium/schemas": "5.0.0-next.1", | ||
"@podium/utils": "5.0.0-next.2", | ||
"abslog": "2.4.0", | ||
@@ -47,0 +47,0 @@ "lodash.merge": "4.6.2", |
35428
268
+ Added@podium/client@5.0.0-next.4(transitive)
+ Added@podium/context@5.0.0-next.3(transitive)
+ Added@podium/proxy@5.0.0-next.2(transitive)
+ Added@podium/schemas@5.0.0-next.1(transitive)
+ Added@podium/utils@5.0.0-next.2(transitive)
+ Addedajv@6.12.3(transitive)
+ Addedlru-cache@6.0.0(transitive)
+ Addedyallist@4.0.0(transitive)
- Removed@podium/client@4.4.2(transitive)
- Removed@podium/context@4.1.6(transitive)
- Removed@podium/proxy@4.2.1(transitive)
- Removed@podium/schemas@4.0.1(transitive)
- Removed@podium/utils@4.2.54.3.0(transitive)
- Removedajv@6.11.0(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removedyallist@3.1.1(transitive)
Updated@podium/client@5.0.0-next.4
Updated@podium/context@5.0.0-next.3
Updated@podium/proxy@5.0.0-next.2
Updated@podium/schemas@5.0.0-next.1
Updated@podium/utils@5.0.0-next.2