WTF Is Code Extraction
By #MiškoHevery (Builder.io / #Qwik)
We are full-stack developers! That means we write both client and server code. But where should we place the server and client code? Conventional wisdom says that we should put them in different files. Except, it is not so simple; we also have code that runs both on the server and client. After all, we do Server-side rendering (SSR), so most of our client code also runs on the server.
I want to challenge the conventional wisdom and convince you that there is an existing trend of putting server and client code together and that it is better. Let’s call it: “code collocation.”
The idea of placing server and client code together is not new, and it is already happening in NextJS/Remix/SolidJS.
But we have a problem to solve. We need to provide code to the server and code to the client, and as of right now, server code can’t access the DOM API and client code can’t read server dependencies such as databases. So there needs to be a way to separate the code.
The act of separating the code and creating server and client code bundles is called code extraction. Three different strategies starting with the most basic to advanced ones, are:
- Export extraction
- Function extraction
- Closure extraction
Let’s dive into them.
🔥 Follow @javascriptdaily 🔥
https://www.builder.io/blog/wtf-is-code-extraction
By #MiškoHevery (Builder.io / #Qwik)
We are full-stack developers! That means we write both client and server code. But where should we place the server and client code? Conventional wisdom says that we should put them in different files. Except, it is not so simple; we also have code that runs both on the server and client. After all, we do Server-side rendering (SSR), so most of our client code also runs on the server.
I want to challenge the conventional wisdom and convince you that there is an existing trend of putting server and client code together and that it is better. Let’s call it: “code collocation.”
The idea of placing server and client code together is not new, and it is already happening in NextJS/Remix/SolidJS.
But we have a problem to solve. We need to provide code to the server and code to the client, and as of right now, server code can’t access the DOM API and client code can’t read server dependencies such as databases. So there needs to be a way to separate the code.
The act of separating the code and creating server and client code bundles is called code extraction. Three different strategies starting with the most basic to advanced ones, are:
- Export extraction
- Function extraction
- Closure extraction
Let’s dive into them.
🔥 Follow @javascriptdaily 🔥
https://www.builder.io/blog/wtf-is-code-extraction
Builder.io
WTF Is Code Extraction
Code extraction allows you to collocate client and server code in the same file. Let's take this idea to 11.
👍12🔥3❤2
JavaScript Daily
2023 Web Framework Performance Report - How do modern web frameworks compare in real-world usage & performance? - Does framework choice influence a site’s Core Web Vitals? - How related is framework choice to JavaScript payload size, and what is the impact?…
#EvanYou thread on the report...
🔥 Follow @javascriptdaily 🔥
https://twitter.com/youyuxi/status/1633249827755814912
🔥 Follow @javascriptdaily 🔥
https://twitter.com/youyuxi/status/1633249827755814912
Twitter
I have a lot of respect for the work the Astro team has been doing, but I want to share some important caveats that everyone should be aware of when reading, and especially publishing this kind of reports: (0/n)
👍2😁1
Web component JS frameworks overview by their syntax and features
https://component-party.dev
🔥 Follow @javascriptdaily 🔥
https://component-party.dev
🔥 Follow @javascriptdaily 🔥
Component Party
Compare JavaScript frameworks side-by-side: React, Vue, Angular, Svelte, Solid.js, and more. See syntax differences, features, and code examples for web development frameworks.
👍15🔥1👏1
TypeScript 5.0 rebuilt to use ECMAScript modules
With TypeScript 5.0, the TypeScript development team has restructured the entire codebase to use ECMAScript modules, reducing package size and improving performance.
TypeScript 5.0, due from Microsoft as a production release on March 16, has been restructured around the use of ECMAScript modules, a major infrastructure change for the strongly typed JavaScript variant.
Users of TypeScript 5.0, which currently is in a release candidate stage, will need to run Node.js 12 at a minimum. In return, npm installs promise to execute a little faster and take up less space, with the typescript package sized reduced by roughly 46%, Microsoft said in a March 9 bulletin. TypeScript too will be faster, with build times cut by 10% to 25%. API consumers of TypeScript likely will be unaffected.
🔥 Follow @javascriptdaily 🔥
https://www.infoworld.com/article/3690342/typescript-50-rebuilt-to-use-ecmascript-modules.html
With TypeScript 5.0, the TypeScript development team has restructured the entire codebase to use ECMAScript modules, reducing package size and improving performance.
TypeScript 5.0, due from Microsoft as a production release on March 16, has been restructured around the use of ECMAScript modules, a major infrastructure change for the strongly typed JavaScript variant.
Users of TypeScript 5.0, which currently is in a release candidate stage, will need to run Node.js 12 at a minimum. In return, npm installs promise to execute a little faster and take up less space, with the typescript package sized reduced by roughly 46%, Microsoft said in a March 9 bulletin. TypeScript too will be faster, with build times cut by 10% to 25%. API consumers of TypeScript likely will be unaffected.
🔥 Follow @javascriptdaily 🔥
https://www.infoworld.com/article/3690342/typescript-50-rebuilt-to-use-ecmascript-modules.html
InfoWorld
TypeScript 5.0 rebuilt to use ECMAScript modules
With TypeScript 5.0, the TypeScript development team has restructured the entire codebase to use ECMAScript modules, reducing package size and improving performance.
👍6❤1
32 Awesome JavaScript Snippets (one-liners) You Should Use
Some useful JavaScript stuff I have saved and I think it can help make your life as a developer easier.
🔥 Follow @javascriptdaily 🔥
https://www.rahul.biz/blog/32-javascript-snippets
Some useful JavaScript stuff I have saved and I think it can help make your life as a developer easier.
🔥 Follow @javascriptdaily 🔥
https://www.rahul.biz/blog/32-javascript-snippets
👍13❤3🔥2🥰1👏1😁1
👍3
ECMAScript excitement 😉
These proposals advanced #TC39 this week 🎉
3️⃣ Async Explicit Resource Mgmt
3️⃣ Import Attributes (*)
2️⃣ AsyncContext
2️⃣ Float16Array
2️⃣ Iterator.range
1️⃣ Await Dictionary
1️⃣ Class Method Param Decorators
1️⃣ Promise.withResolvers
1️⃣ TZ Canonicalization
🔥 Follow @javascriptdaily 🔥
These proposals advanced #TC39 this week 🎉
3️⃣ Async Explicit Resource Mgmt
3️⃣ Import Attributes (*)
2️⃣ AsyncContext
2️⃣ Float16Array
2️⃣ Iterator.range
1️⃣ Await Dictionary
1️⃣ Class Method Param Decorators
1️⃣ Promise.withResolvers
1️⃣ TZ Canonicalization
🔥 Follow @javascriptdaily 🔥
👍20❤2👏1
What's the best article you've read in the JavaScript or front-end space lately?
👍2
Storybook provides a workshop to build UIs in isolation. It helps you develop hard-to-reach states and edge cases without needing to run the whole app.
https://storybook.js.org/
https://storybook.js.org/
Storybook
Storybook: Frontend workshop for UI development
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and documentation. It's open source and free.
👍21🥰3🔥2
JavaScript based, automated data exploratory analysis and visualization tools. (Licence: AGPLv3)
https://github.com/Kanaries/Rath
https://github.com/Kanaries/Rath
GitHub
GitHub - Kanaries/Rath: Next generation of automated data exploratory analysis and visualization platform.
Next generation of automated data exploratory analysis and visualization platform. - Kanaries/Rath
👍4🔥3❤1
Dear Oracle, Please Release the JavaScript Trademark
Ryan Dahl
2022-09-03
In 1995 Netscape partnered with Sun Microsystems to create interactive websites. Famously Brendan Eich spent only 10 days to create the first version of JavaScript - a dynamic programming language with a roughly syntactic lineage from Sun’s Java language. As a result of this partnership Sun held the trademark “JavaScript”. In 2009 Oracle acquired Sun Microsystems and the JavaScript trademark as a result.
The trademark has no commercial value. Other than Oracle's JavaScript Extension Toolkit, Oracle does not have any products using the trademark and presumably no planned usage. Oracle doesn’t even participate in the development of any of the JavaScript engines like V8, JavaScriptCore, or Spidermonkey. It seems very likely that JavaScript trademark infringement would be unenforceable in court due to non-use.
Nevertheless the trademark is a dark cloud looming over the world’s most popular programming language. Careful law abiding engineers bend over backwards to avoid its use - leading to confusing terms like ECMAScript.
The best value Oracle could derive from the trademark would be from the goodwill it receives by granting it into the public domain. It’s understandable why this hasn’t yet happened - it would require a very forward thinking and high level Oracle employee to propose something so intangible. Yet it is obviously the right move to trade a worthless trademark for brand marketing and goodwill.
Oracle, please release the JavaScript trademark.
Source: https://tinyclouds.org/trademark
🔥 Follow @javascriptdaily 🔥
Ryan Dahl
2022-09-03
In 1995 Netscape partnered with Sun Microsystems to create interactive websites. Famously Brendan Eich spent only 10 days to create the first version of JavaScript - a dynamic programming language with a roughly syntactic lineage from Sun’s Java language. As a result of this partnership Sun held the trademark “JavaScript”. In 2009 Oracle acquired Sun Microsystems and the JavaScript trademark as a result.
The trademark has no commercial value. Other than Oracle's JavaScript Extension Toolkit, Oracle does not have any products using the trademark and presumably no planned usage. Oracle doesn’t even participate in the development of any of the JavaScript engines like V8, JavaScriptCore, or Spidermonkey. It seems very likely that JavaScript trademark infringement would be unenforceable in court due to non-use.
Nevertheless the trademark is a dark cloud looming over the world’s most popular programming language. Careful law abiding engineers bend over backwards to avoid its use - leading to confusing terms like ECMAScript.
The best value Oracle could derive from the trademark would be from the goodwill it receives by granting it into the public domain. It’s understandable why this hasn’t yet happened - it would require a very forward thinking and high level Oracle employee to propose something so intangible. Yet it is obviously the right move to trade a worthless trademark for brand marketing and goodwill.
Oracle, please release the JavaScript trademark.
Source: https://tinyclouds.org/trademark
🔥 Follow @javascriptdaily 🔥
Oracle
Oracle JavaScript Extension Toolkit (JET)
Oracle JET - JavaScript Extension Toolkit
👍9👏1
JavaScript Daily
Dear Oracle, Please Release the JavaScript Trademark Ryan Dahl 2022-09-03 In 1995 Netscape partnered with Sun Microsystems to create interactive websites. Famously Brendan Eich spent only 10 days to create the first version of JavaScript - a dynamic programming…
Trivia: This trademark issue is why the standardized form of JS is called ECMAScript.
Wikipedia
ECMAScript
official specification on which JavaScript and other languages are based
👍2
Angular v16.0.0 should be launching sometime in May. If you are an angular developer, or considering angular for your next project, knowing these new features are essential. Some of these are long standing features request from the community. Some features (signal, and SSR) bring Angular to par with other modern frameworks. With these features and more coming in v17, modern angular would start looking a lot different from what it is right now. Given the amount the changes angular is bringing in, if we don’t keep ourselves up to date, we won't be able to take advantage of these new features, and our codebase may start looking like a legacy code very soon.
https://itnext.io/angular-16-is-huge-67288a3ff58b
🔥 Follow @javascriptdaily 🔥
https://itnext.io/angular-16-is-huge-67288a3ff58b
🔥 Follow @javascriptdaily 🔥
Medium
Angular 16 is huge
At the time of writing this article, angular just published its first release candidate version of v16. There are lot of feature/changes…
👍7
Turns out even Nintendo uses JavaScript. A developer discovered that 2015's Mario vs. Donkey Kong: Tipping Stars for the Wii U and 3DS was written with HTML and JavaScript under the hood and managed to build a shim to get it running in a normal browser.
https://twitter.com/JasperRLZ/status/1648046875675856897
🔥 Follow @javascriptdaily 🔥
https://twitter.com/JasperRLZ/status/1648046875675856897
🔥 Follow @javascriptdaily 🔥
X (formerly Twitter)
Jasper (@jasperrlz.bsky.social) (@JasperRLZ) on X
There is a game called Mario vs. Donkey Kong: Tipping Stars for the Wii U. It is, inexplicably, written in HTML and JavaScript, with some custom APIs designed for the Wii U. But that means, with about 1400 lines of shim code, I can do this:
👍5❤1😁1
New JavaScript Features Coming in ECMAScript 2023
The next JavaScript update brings smaller additions familiar from other languages, but there are more significant developments in the wings.
🔥 Follow @javascriptdaily 🔥
https://thenewstack.io/the-new-javascript-features-coming-in-ecmascript-2023/
The next JavaScript update brings smaller additions familiar from other languages, but there are more significant developments in the wings.
🔥 Follow @javascriptdaily 🔥
https://thenewstack.io/the-new-javascript-features-coming-in-ecmascript-2023/
The New Stack
The New JavaScript Features Coming in ECMAScript 2023
The next JavaScript update brings smaller additions familiar from other languages, but there are more significant developments in the wings.
🔥6
Next.js 13.4 is here🎉🎉
Next.js 13.4 is a foundational release, marking stability for the App Router:
App Router (Stable):
- React Server Components
- Nested Routes & Layouts
- Simplified Data Fetching
- Streaming & Suspense
- Built-in SEO Support
Turbopack (Beta): Your local dev server, faster and with improved stability
Server Actions (Alpha): Mutate data on the server with zero client JavaScript
https://nextjs.org/blog/next-13-4
🔥 Follow @javascriptdaily 🔥
Next.js 13.4 is a foundational release, marking stability for the App Router:
App Router (Stable):
- React Server Components
- Nested Routes & Layouts
- Simplified Data Fetching
- Streaming & Suspense
- Built-in SEO Support
Turbopack (Beta): Your local dev server, faster and with improved stability
Server Actions (Alpha): Mutate data on the server with zero client JavaScript
https://nextjs.org/blog/next-13-4
🔥 Follow @javascriptdaily 🔥
nextjs.org
Next.js 13.4
Next.js 13.4 moves App Router to stable, Turbopack to beta, and introduces experimental support for Server Actions.
👍3
Vue 3.3 is here🎉🎉
<script setup> + TypeScript DX Improvements
- Imported and Complex Types Support in Macros
- Generic Components
- More Ergonomic defineEmits
- Typed Slots with defineSlots
Experimental Features
Reactive Props Destructure
defineModel
Other Notable Features
- defineOptions
- Better Getter Support with toRef and toValue
- JSX Import Source Support
Maintenance Infrastructure Improvements
🔥 Follow @javascriptdaily 🔥
https://blog.vuejs.org/posts/vue-3-3
<script setup> + TypeScript DX Improvements
- Imported and Complex Types Support in Macros
- Generic Components
- More Ergonomic defineEmits
- Typed Slots with defineSlots
Experimental Features
Reactive Props Destructure
defineModel
Other Notable Features
- defineOptions
- Better Getter Support with toRef and toValue
- JSX Import Source Support
Maintenance Infrastructure Improvements
🔥 Follow @javascriptdaily 🔥
https://blog.vuejs.org/posts/vue-3-3
blog.vuejs.org
Announcing Vue 3.3 | The Vue Point
The official blog for the Vue.js project
👍5🔥1
JavaScript Daily
Photo
An Introduction to the Bun JavaScript Runtime
A rival JavaScript runtime contender has entered the battle between Node.js and Deno. In this article, we take a first look at Bun, and the reasons it may tempt you away from your current favorite.
🔥 Follow @javascriptdaily 🔥
https://www.sitepoint.com/bun-javascript-runtime-introduction/
A rival JavaScript runtime contender has entered the battle between Node.js and Deno. In this article, we take a first look at Bun, and the reasons it may tempt you away from your current favorite.
🔥 Follow @javascriptdaily 🔥
https://www.sitepoint.com/bun-javascript-runtime-introduction/
SitePoint
An Introduction to the Bun JavaScript Runtime
Learn about Bun 1.0, a rival JavaScript runtime to Node.js and Deno, and the reasons it may tempt you away from your current favorite.
👍7❤1