|
| 1 | +--- |
| 2 | +slug: version-5.0.0 |
| 3 | +title: Version 5.0.0 |
| 4 | +authors: richard |
| 5 | +tags: [podium, version, release] |
| 6 | +--- |
| 7 | + |
| 8 | +The Podium team is pleased to annouce and make available the release of version 5.0.0 of Podium. 🥳 🎉 |
| 9 | + |
| 10 | +This is a breaking change from the v4.x line but since most of the changes are either under the hood or the removal of deprecations, upgrading, except in a couple notible exceptions, |
| 11 | +should be pretty simple for most users and may require no changes at all. |
| 12 | + |
| 13 | +<!--truncate--> |
| 14 | + |
| 15 | +### Breaking changes |
| 16 | + |
| 17 | +There are a couple breaking changes in this release that will need to be addressed if they affect you. |
| 18 | + |
| 19 | +#### 1. The Podium codebase has been converted to ESM and no longer supports common JS. |
| 20 | + |
| 21 | +While you can still mix and match podlets and layouts on Podium version 4 and 5, you will need to convert your codebase to ESM before upgrading to Podium version 5 podlets and layouts. |
| 22 | +See [this post](https://tsmx.net/convert-existing-nodejs-project-from-commonjs-to-esm/) for a guide if you need one. |
| 23 | + |
| 24 | +#### 2. An instance of HttpIncoming must now be passed as the first argument to the Podium client |
| 25 | + |
| 26 | +n.b. If you are currently not seeing any deprecation warnings in your Podium version 4 apps, this won't affect you. |
| 27 | + |
| 28 | +The `.fetch()` and `.stream()` methods. Usage of the fetch/stream methods without passing in HttpIncoming was deprecated a long while ago. |
| 29 | + |
| 30 | +In Podium version 4, the following was acceptable but will now throw with version 5. |
| 31 | +```js |
| 32 | +const header = layout.client.register({...}); |
| 33 | + |
| 34 | +app.get("/", (req, res) => { |
| 35 | + await header.fetch(); |
| 36 | +}); |
| 37 | +``` |
| 38 | + |
| 39 | +In Podium version 5, you need to ensure you pass in an HttpIncoming object like so: |
| 40 | +```js |
| 41 | +const header = layout.client.register({...}); |
| 42 | + |
| 43 | +app.get("/", (req, res) => { |
| 44 | + const incoming = res.locals.podium; |
| 45 | + await header.fetch(incoming); |
| 46 | +}); |
| 47 | +``` |
| 48 | + |
| 49 | +#### 3. Removal of deprecated Podium v3 compatibility in the manifest file and codebase. |
| 50 | + |
| 51 | +n.b. If you are currently not seeing any deprecation warnings in your Podium version 4 apps, this won't affect you. |
| 52 | + |
| 53 | +The `assets` key and its sub keys `js` and `css` have been removed from the manifest file. |
| 54 | + |
| 55 | +Previously through all of Podium version 4, we maintained both the `assets` key and `js` and `css` keys for backwards compatibility with Podium version 3. |
| 56 | +The value for `assets.js` would always be the same as for `js` and the value for `assets.css` would always be the same as `css`. |
| 57 | + |
| 58 | +Like so: |
| 59 | + |
| 60 | +```json |
| 61 | +{ |
| 62 | + "assets": { "js": [], "css": [] }, |
| 63 | + "js": [], |
| 64 | + "css": [] |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +With Podium version 5, we've dropped the `assets` key (and therefore compatibility with Podium version 3) so that the manifest file will now look like: |
| 69 | + |
| 70 | +```json |
| 71 | +{ |
| 72 | + "js": [], |
| 73 | + "css": [] |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +#### 4. Support for Node v10 and lower has been intentionally dropped and we are now actively only testing against Node v16 and higher. |
| 78 | + |
| 79 | +Releases are now made against Node v20 and we actively run test suites against Node version 16 and up. Versions 12 and 14 should work but we make no guarantees. |
| 80 | + |
| 81 | +#### 5. .js and .css methods on the Podium layout and Podium podlet modules, which are used to set assets, no longer return a value |
| 82 | + |
| 83 | +n.b. If you are currently not seeing any deprecation warnings in your Podium version 4 apps, this won't affect you. |
| 84 | + |
| 85 | +The podlet and layout `.js` and `.css` methods used to return a value. This was deprecated a long ways back and has now been removed. |
| 86 | + |
| 87 | +```js |
| 88 | +const result = layout.js() |
| 89 | +// result is null |
| 90 | +const result = podlet.js() |
| 91 | +// result is null |
| 92 | +``` |
| 93 | + |
| 94 | +#### 6. Previously deprecated Podium client `change` and `dispose` events removed. |
| 95 | + |
| 96 | +These client registry events, emitted from the Podium client, were previously deprecated and have now been removed. |
| 97 | +You most likely aren't, but check your codebase to ensure you aren't relying on these events. |
| 98 | + |
| 99 | +### Other notable changes |
| 100 | + |
| 101 | +None of the following changes require any action when upgrading. |
| 102 | + |
| 103 | +#### 1. Under the hood, the Podium client request module has been replaced. |
| 104 | + |
| 105 | +The [Request](https://www.npmjs.com/package/request) module is deprecated and we've opted to replace it with [Undici](https://www.npmjs.com/package/undici), a fast modern alternative. |
| 106 | + |
| 107 | +#### 2. The podlet manifest file now supports an array of proxy endpoints instead of just an object. |
| 108 | + |
| 109 | +Previously, proxy entries in the podlet manifest were defined as an object and looked like this: |
| 110 | + |
| 111 | +```json |
| 112 | +{ |
| 113 | + "proxy": { |
| 114 | + "one": "/target/path/one", |
| 115 | + "two": "/target/path/two", |
| 116 | + } |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +This has been changed to support an array syntax in which multiple proxies definitions can be added |
| 121 | + |
| 122 | +```json |
| 123 | +{ |
| 124 | + "proxy": [ |
| 125 | + { "name": "one": "target": "/target/path/one" }, |
| 126 | + { "name": "two": "target": "/target/path/two" }, |
| 127 | + ] |
| 128 | +} |
| 129 | +``` |
| 130 | + |
| 131 | +The object syntax has been preserved for backwards compatibility. |
| 132 | + |
| 133 | +#### 3. Added prettier printing of Podium client responses when using console.log |
| 134 | + |
| 135 | +Log output used to look like: |
| 136 | + |
| 137 | +```js |
| 138 | +PodiumClientResponse { |
| 139 | + [Symbol(podium:client:response:redirect)]: '', |
| 140 | + [Symbol(podium:client:response:content)]: '', |
| 141 | + [Symbol(podium:client:response:headers)]: {}, |
| 142 | + [Symbol(podium:client:response:css)]: [], |
| 143 | + [Symbol(podium:client:response:js)]: [] |
| 144 | +} |
| 145 | +``` |
| 146 | + |
| 147 | +But now looks like: |
| 148 | + |
| 149 | +```js |
| 150 | +{ |
| 151 | + redirect: '', |
| 152 | + content: '', |
| 153 | + headers: {}, |
| 154 | + css: [], |
| 155 | + js: [] |
| 156 | +} |
| 157 | +``` |
0 commit comments