1.1.45 • Published 3 years ago

@kruining/waterlogged v1.1.45

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Waterlogged

This is a super simple "library"(a whole single function) for running multiple formats for esbuild in parallel with some pretty logging inspired by Remix' compiler

Example

Install

npm i -D @kruining/waterlogged

Note Make sure you have esbuild installed. It is a peer dependency of this lib, this is so that you are free to choose the version of esbuild you want to run.

Usage

esbuild.mjs

import { compile } from './dist/index.mjs';

await compile([ 'esm', 'cjs' ], {
    entryPoints: [ './src/index.ts' ],
    outbase: 'src',
    outfile: 'lib/index.$formatExtension',
    bundle: false,
    sourcemap: true,
    minify: true,
    platform: 'node',
    target: [ 'esnext' ],
    watch: process.argv[2] === 'watch',
});

package.json

{
    ...,
    "scripts": {
        "build:typed": "node ./esbuild.mjs && tsc",
        "build": "node ./esbuild.mjs",
        "dev": "node ./esbuild.mjs watch",
        ...,
    },
    ...
}

Note: How you define and set up your watch mode is completely up to you, I simply added it to the docs as an example. This library just parallelizes your esbuilds based on the formats given and logs in a fancy format.

Arguments

paramtypedescription
formatsFormat[]an array of formats for esbuild's format option, with the same type
optionsOmit<BuildOptions, 'format'>just esbuild's options object, minus the format option

"Variables"

I have added simple string replacement logic for the outfile and outdir options. $format is replaced with the current format. And $formatExtionsion is replaced as per this table:

formatextension
esmmjs
cjscjs
iifejs
1.1.38

3 years ago

1.1.37

3 years ago

1.1.36

3 years ago

1.1.35

3 years ago

1.1.39

3 years ago

1.1.41

3 years ago

1.1.40

3 years ago

1.1.45

3 years ago

1.1.44

3 years ago

1.1.43

3 years ago

1.1.42

3 years ago

1.1.34

3 years ago

1.1.33

3 years ago

1.1.32

3 years ago

1.1.31

3 years ago

1.1.30

3 years ago

1.1.29

3 years ago

1.1.28

3 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.17

3 years ago

1.1.23

3 years ago

1.1.22

3 years ago

1.1.21

3 years ago

1.1.20

3 years ago

1.1.27

3 years ago

1.1.26

3 years ago

1.1.25

3 years ago

1.1.24

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.16

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.13

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago