1.1.45 • Published 1 year ago

@kruining/waterlogged v1.1.45

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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

1 year ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.35

2 years ago

1.1.39

1 year ago

1.1.41

1 year ago

1.1.40

1 year ago

1.1.45

1 year ago

1.1.44

1 year ago

1.1.43

1 year ago

1.1.42

1 year ago

1.1.34

2 years ago

1.1.33

2 years ago

1.1.32

2 years ago

1.1.31

2 years ago

1.1.30

2 years ago

1.1.29

2 years ago

1.1.28

2 years ago

1.1.19

2 years ago

1.1.18

2 years ago

1.1.17

2 years ago

1.1.23

2 years ago

1.1.22

2 years ago

1.1.21

2 years ago

1.1.20

2 years ago

1.1.27

2 years ago

1.1.26

2 years ago

1.1.25

2 years ago

1.1.24

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago