@podium/client
Advanced tools
Comparing version 5.0.0-next.2 to 5.0.0-next.3
@@ -0,1 +1,17 @@ | ||
# [5.0.0-next.3](https://github.com/podium-lib/client/compare/v5.0.0-next.2...v5.0.0-next.3) (2020-07-16) | ||
### Features | ||
* Remove .js() and .css() methods ([#128](https://github.com/podium-lib/client/issues/128)) ([db6d306](https://github.com/podium-lib/client/commit/db6d30617160db76d85e8839c7f896ef3dc97b41)) | ||
### BREAKING CHANGES | ||
* Remove .js() and .css() methods to retrieve fetched js and css for all podlets. Also removes the `resolveJs` and `resolveCss` arguments when registering a podlet. | ||
Resolves: https://github.com/podium-lib/issues/issues/25 | ||
Co-authored-by: Trygve Lie <trygve.lie@finn.no> | ||
# [5.0.0-next.2](https://github.com/podium-lib/client/compare/v5.0.0-next.1...v5.0.0-next.2) (2020-07-12) | ||
@@ -2,0 +18,0 @@ |
@@ -50,22 +50,2 @@ /* eslint-disable import/order */ | ||
function cssDeprecated() { | ||
if (!cssDeprecated.warned) { | ||
cssDeprecated.warned = true; | ||
process.emitWarning( | ||
'The client.css() method is deprecated. Use the .css property on the response object of each podlet instead. For further information, please see: https://podium-lib.io/blog/2019/06/14/version-4.0.0#the-fetch-method-now-resolves-with-a-response-object', | ||
'DeprecationWarning', | ||
); | ||
} | ||
} | ||
function jsDeprecated() { | ||
if (!jsDeprecated.warned) { | ||
jsDeprecated.warned = true; | ||
process.emitWarning( | ||
'The client.js() method is deprecated. Use the .js property on the response object of each podlet instead. For further information, please see: https://podium-lib.io/blog/2019/06/14/version-4.0.0#the-fetch-method-now-resolves-with-a-response-object', | ||
'DeprecationWarning', | ||
); | ||
} | ||
} | ||
const PodiumClient = class PodiumClient extends EventEmitter { | ||
@@ -214,36 +194,2 @@ constructor(options = {}) { | ||
js() { | ||
jsDeprecated(); | ||
return [].concat.apply( | ||
[], | ||
Array.from(this[_resources]) | ||
.map(item => { | ||
const manifest = this[_registry].get(item[1].name); | ||
if (manifest && manifest.assets) { | ||
return manifest.assets.js; | ||
} | ||
return undefined; | ||
}) | ||
.filter(item => item), | ||
); | ||
} | ||
css() { | ||
cssDeprecated(); | ||
return [].concat.apply( | ||
[], | ||
Array.from(this[_resources]) | ||
.map(item => { | ||
const manifest = this[_registry].get(item[1].name); | ||
if (manifest && manifest.assets) { | ||
return manifest.assets.css; | ||
} | ||
return undefined; | ||
}) | ||
.filter(item => item), | ||
); | ||
} | ||
dump() { | ||
@@ -250,0 +196,0 @@ return this[_registry].dump(); |
@@ -12,4 +12,2 @@ /* eslint-disable no-underscore-dangle */ | ||
const _reqOptions = Symbol('podium:httpoutgoing:reqoptions'); | ||
const _resolveCss = Symbol('podium:httpoutgoing:resolvecss'); | ||
const _resolveJs = Symbol('podium:httpoutgoing:resolvejs'); | ||
const _throwable = Symbol('podium:httpoutgoing:throwable'); | ||
@@ -30,4 +28,2 @@ const _manifest = Symbol('podium:httpoutgoing:manifest'); | ||
{ | ||
resolveCss = false, | ||
resolveJs = false, | ||
throwable = false, | ||
@@ -67,7 +63,2 @@ redirectable = false, | ||
// If relative CSS/JS paths should be resolved into an absolute | ||
// path based on the URI to the podlets manifest | ||
this[_resolveCss] = resolveCss; | ||
this[_resolveJs] = resolveJs; | ||
// In the case of failure, should the resource throw or not | ||
@@ -124,10 +115,2 @@ this[_throwable] = throwable; | ||
get resolveCss() { | ||
return this[_resolveCss]; | ||
} | ||
get resolveJs() { | ||
return this[_resolveJs]; | ||
} | ||
get throwable() { | ||
@@ -134,0 +117,0 @@ return this[_throwable]; |
@@ -160,67 +160,2 @@ /* eslint-disable no-param-reassign */ | ||
// START: Maintain backwards compatibility to V3 manifests | ||
// Potentially a V3 manifest | ||
if (manifest.value.assets) { | ||
// .assets.js has a value but .js does not. Replicate the value to .js | ||
if ( | ||
Array.isArray(manifest.value.js) && | ||
manifest.value.js.length === 0 && | ||
manifest.value.assets.js !== '' | ||
) { | ||
manifest.value.js.push({ | ||
value: manifest.value.assets.js, | ||
}); | ||
} | ||
// .js has a value but .assets.js. Replicate first value of .js to .assets.js | ||
if ( | ||
Array.isArray(manifest.value.js) && | ||
manifest.value.js.length !== 0 && | ||
manifest.value.assets.js === '' | ||
) { | ||
if (manifest.value.js[0].value) { | ||
manifest.value.assets.js = | ||
manifest.value.js[0].value; | ||
} | ||
} | ||
// .assets.css has a value but .css does not. Replicate the value to .css | ||
if ( | ||
Array.isArray(manifest.value.css) && | ||
manifest.value.css.length === 0 && | ||
manifest.value.assets.css !== '' | ||
) { | ||
manifest.value.css.push({ | ||
value: manifest.value.assets.css, | ||
}); | ||
} | ||
// .css has a value but .assets.css. Replicate first value of .css to .assets.css | ||
if ( | ||
Array.isArray(manifest.value.css) && | ||
manifest.value.css.length !== 0 && | ||
manifest.value.assets.css === '' | ||
) { | ||
if (manifest.value.css[0].value) { | ||
manifest.value.assets.css = | ||
manifest.value.css[0].value; | ||
} | ||
} | ||
} | ||
if (outgoing.resolveCss && manifest.value.assets.css) { | ||
manifest.value.assets.css = utils.uriRelativeToAbsolute( | ||
manifest.value.assets.css, | ||
outgoing.manifestUri, | ||
); | ||
} | ||
if (outgoing.resolveJs && manifest.value.assets.js) { | ||
manifest.value.assets.js = utils.uriRelativeToAbsolute( | ||
manifest.value.assets.js, | ||
outgoing.manifestUri, | ||
); | ||
} | ||
// END: Maintain backwards compatibility to V3 manifests | ||
// Build absolute content and fallback URIs | ||
@@ -227,0 +162,0 @@ if (manifest.value.fallback !== '') { |
{ | ||
"name": "@podium/client", | ||
"version": "5.0.0-next.2", | ||
"version": "5.0.0-next.3", | ||
"main": "lib/client.js", | ||
@@ -40,4 +40,4 @@ "license": "MIT", | ||
"@metrics/client": "2.5.0", | ||
"@podium/schemas": "4.0.2", | ||
"@podium/utils": "4.3.0", | ||
"@podium/schemas": "5.0.0-next.1", | ||
"@podium/utils": "5.0.0-next.2", | ||
"abslog": "2.4.0", | ||
@@ -44,0 +44,0 @@ "http-cache-semantics": "^4.0.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80057
1394
+ Added@podium/schemas@5.0.0-next.1(transitive)
+ Added@podium/utils@5.0.0-next.2(transitive)
+ Addedajv@6.12.3(transitive)
- Removed@podium/schemas@4.0.2(transitive)
- Removed@podium/utils@4.3.0(transitive)
- Removedajv@6.12.26.12.6(transitive)
Updated@podium/schemas@5.0.0-next.1
Updated@podium/utils@5.0.0-next.2