JS toolchainfrom jsmin to vite
LOT of toolsand perfect tools appeared and everything was perfect
and perfect tools appeared and everything was perfect
In reality,
feverish evolution
There was no need for a "build step"
deployment happend mostly through ..FTP đą
Brendan Eich created a language in 10 days
and we're still fixing his bugs today
Established software developers came in with their familiar tools
(when all you have is a hammer...)
The first browser wars leads to a wave of dedicated tooling
Doug Crockford writes his famous book and creates jslint and jsmin.
JavaScript starts to be seen as a real language!
strong foundationIt is important to acknowledge just how influential "the good parts" and jslint were for the development of the language, the tooling and the web!
faster engine!
Ryan Dahl publishes a revolutionary server side runtime for javascript
const http = require('http');
const server = http.createServer(function (req, res) {
res.end('Hello, World!');
});
server.listen(8080);
demonstrating the power of the event loop and non-blocking IO
the first update to the JS spec in 10 years
the first JS package manager
enabling a vibrant and enthusiastic community
The first popular js framework
const Todo = Backbone.Model.extend({
defaults: { title: '', completed: false }
});
const TodoView = Backbone.View.extend({
render: function() {
this.$el.html(' ' + this.model.get('title'));
return this;
}
});
Google releases its own framework
angular.module('todoApp', [])
.controller('TodoCtrl', function($scope) {
$scope.todo = { title: 'Angular', completed: false };
$scope.toggle = function() {
$scope.todo.completed = !$scope.todo.completed;
};
});
creating a new class of developer: the framework ninja
The first popular JS variant
compose = (f, g) -> (x) -> f g x
square = (x) -> x * x
addSix = (x) -> x + 6
addSixThenSquare = compose square, addSix
console.log addSixThenSquare(9)
console.log [0..4].map square
The first popular JS testing framework
describe("A suite is just a function", function() {
it("is the same with spec", function() {
expect(myFunc()).toBe(true);
})
})
mapping from transformed and minified code to the original, much easier to debug
The first node.js based bundler
browserify main.js -o bundle.js
The first purpose built js task runner
grunt.initConfig({
concat: { /* concat config */ },
uglify: { /* uglify config */ },
my_src_files: ['src/*.js', 'vendor/*.js'],
});
still the most popular build tool
{
entry: './src/index.tsx',
output: { filename: 'bundle.js', path: './dist') },
devtool: 'source-map',
resolve: { extensions: ['.ts', '.tsx', '.js', '.jsx'] },
module: {
rules: [
{ test: /.tsx?$/, use: 'ts-loader' },
{ test: /.jsx?$/, use: 'babel-loader' }
]
},
optimization: { minimize: true }
};
the most helpful but annoying linter
type LightSwitchConfig = { on: boolean; off: boolean; toggle: () => void };
type LightSwitch = Omit<Pick<LightSwitchConfig, keyof LightSwitchConfig>, 'toggle'> & {
state: Awaited<Promise<Extract<keyof Pick<LightSwitchConfig, 'on' | 'off'>, string>>>;
flip: (...args: Parameters<LightSwitchConfig['toggle']>) =>
ReturnType<typeof Promise.resolve<void>>;
};
starts the component revolution
class TodoItem extends React.Component {
state = { completed: false };
toggleComplete = () => {
this.setState({ completed: !this.state.completed });
};
render() {
return (
<div onClick={this.toggleComplete}>
{this.props.todo.title}
</div>
);
}
}
A task runner with a better API
gulp.task('build', () => {
return gulp.src('src/**/*.{ts,tsx,jsx}')
.pipe(sourcemaps.init())
.pipe(ts({ jsx: 'react' }))
.pipe(babel({ presets: ['@babel/preset-react'] }))
.pipe(concat('bundle.js'))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
});
the ordering of these pipes is very significant
One linter to rule them all
(just admit you imported the airbnb config without even thinking...)
Now your desktop app can be slow and bloated too!
const { app, BrowserWindow } = require('electron/main')
app.whenReady().then(() => {
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadFile('index.html')
})
Evan You releases "the framework for the rest of us"
<template>
<div @click="completed = !completed">
<input type="checkbox" v-model="completed" />
<span>{{ todo.title }}</span>
</div>
</template>
With the rapid evolution of the language came the need for transpilation
{
"plugins": [
"@babel/plugin-transform-react-jsx",
"@babel/plugin-transform-typescript"
]
}
Facebook open-sources their testing framework
describe('my beverage', () => {
test('is beer', () => {
expect(myBeverage.type).toBeInstanceOf(Beer);
});
test('is sour', () => {
expect(myBeverage.sour).toBeTruthy();
});
});
JavaScript finally gets all the features it has been dreaming of
cdn for the masses (of npm packages)
[some people thought they would never need a build tool again..]
Rich Harris releases a bundler made for speed and extensibility
{
entry: 'src/index.js',
dest: 'dist/bundle.js',
format: 'umd',
moduleName: 'MyLibrary',
plugins: [
resolve({ jsnext: true, browser: true }),
commonjs(),
babel({ presets: ['es2015-rollup'] }),
uglify()
]
}
move aside npm there is a faster cowboy in town
React with batteries included!
export default async function TodosPage() {
const todos = await fetchTodos();
return (
<div>
{todos.map(todo => (<Todo {...todo} />))}
</div>
);
}
Rich Harris releases his compiler-based framework
<script>
let completed = false;
let todo = { title: 'Learn Svelte' };
</script>
<div on:click={() => completed = !completed}>
<input type="checkbox" bind:checked={completed} />
<span>{todo.title}</span>
</div>
an even better package manager
Microsoft releases the first ever LSP..
..for TypeScript
format code automatically - no more tabs vs spaces
Some tools don't last, but they pave the way
{
/* even this not needed in the majority of cases */
"extends": "@parcel/config-default",
}
the web can now run serious languages
making your site fast is easy - just remove all the bloat
Put all your projects in one basket
a golang-based js/ts bundler focused on speed
a rust-based js/ts complier focused on speed
Evan You has a dream - a universal build tool
defineConfig({
plugins: [react()],
build: {
sourcemap: true,
minify: 'terser',
rollupOptions: {
output: { entryFileNames: 'bundle.js' }
}
},
esbuild: { jsx: 'automatic' }
});
Ryan Dahl strikes again!
FAST js runtime written in rust with builtin TS/JSX support
FAST js runtime written in zig with builtin TS/JSX support
(but with JavaScriptCore instead of v8)
Vercel develop a bundler 500x faster than webpack
a collection of independent JS tools
a lego style tool-chain for people who hate tool-chains
a meta framework focused on SSG
---
import {logo} from '../assets/logo.svg'
const { data } = Astro.props;
---
<Layout>
<header><Image src={logo} />My project</header>
{data && <Chart data={data} />}
</Layout>
an even more opinionated linter and formatter
thanks gofmt...
a package registry for the new age
almost all major platforms have their own js runtimes:
making the web an even more viable compiler target
a unified high-performance toolchain for JavaScript
ironically written in golang, not typescript
almost all major frameworks have their own compiler
I don't know.. đ¤ˇââī¸đ
ongoing evolution
(walled gardens, cryto scams, ai slop, etc)