@venizia/dev-configs 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/compilers/bun.d.ts +2 -0
- package/dist/compilers/bun.d.ts.map +1 -1
- package/dist/compilers/bun.js +2 -1
- package/dist/compilers/bun.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -385,7 +385,8 @@ instead: `LintIgnore.oxlint({ config, patterns: LINT_IGNORE })`.
|
|
|
385
385
|
### BunCompiler
|
|
386
386
|
|
|
387
387
|
`BunCompiler.compile()` builds one Bun executable: minified, with a linked source map. The
|
|
388
|
-
compile target comes from `BUN_TARGET` and defaults to `bun-linux-x64`.
|
|
388
|
+
compile target comes from `BUN_TARGET` and defaults to `bun-linux-x64`. `define` passes compile-time
|
|
389
|
+
constants to `Bun.build`; a compile script uses it to bake the build stamp.
|
|
389
390
|
|
|
390
391
|
```typescript
|
|
391
392
|
import { BunCompiler } from '@venizia/dev-configs';
|
|
@@ -393,6 +394,16 @@ import { BunCompiler } from '@venizia/dev-configs';
|
|
|
393
394
|
await BunCompiler.compile({ entrypoint: './src/index.ts', outfile: './dist/app' });
|
|
394
395
|
```
|
|
395
396
|
|
|
397
|
+
Bake a value into the binary with `define`. Each value is a JSON-encoded expression:
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
await BunCompiler.compile({
|
|
401
|
+
entrypoint: './src/index.ts',
|
|
402
|
+
outfile: './dist/app',
|
|
403
|
+
define: { APP_FLAVOUR: JSON.stringify('blue') },
|
|
404
|
+
});
|
|
405
|
+
```
|
|
406
|
+
|
|
396
407
|
## Where it sits
|
|
397
408
|
|
|
398
409
|
The root of the chain, with no IGNIS dependency: **dev-configs** -> inversion -> {filter, helpers}
|
package/dist/compilers/bun.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export declare class BunCompiler {
|
|
|
10
10
|
outfile?: string;
|
|
11
11
|
target?: string;
|
|
12
12
|
plugins?: Bun.BunPlugin[];
|
|
13
|
+
/** Compile-time constants: each key is replaced by its value, a JSON-encoded expression, wherever the bundle reads it. */
|
|
14
|
+
define?: Record<string, string>;
|
|
13
15
|
}): Promise<void>;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=bun.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":"AAIA,gHAAgH;AAChH,qBAAa,WAAW;IACtB;;;;OAIG;WACU,OAAO,CAClB,IAAI,GAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"bun.d.ts","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":"AAIA,gHAAgH;AAChH,qBAAa,WAAW;IACtB;;;;OAIG;WACU,OAAO,CAClB,IAAI,GAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;QAC1B,0HAA0H;QAC1H,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5B,GACL,OAAO,CAAC,IAAI,CAAC;CAmCjB"}
|
package/dist/compilers/bun.js
CHANGED
|
@@ -12,7 +12,7 @@ class BunCompiler {
|
|
|
12
12
|
* `platformaticKafkaPlugins()` from `helpers`, which would invert that chain.
|
|
13
13
|
*/
|
|
14
14
|
static async compile(opts = {}) {
|
|
15
|
-
const { entrypoint = DEFAULT_ENTRYPOINT, outfile = DEFAULT_OUTFILE, target = Bun.env.BUN_TARGET ?? DEFAULT_COMPILE_TARGET, plugins = [], } = opts;
|
|
15
|
+
const { entrypoint = DEFAULT_ENTRYPOINT, outfile = DEFAULT_OUTFILE, target = Bun.env.BUN_TARGET ?? DEFAULT_COMPILE_TARGET, plugins = [], define = {}, } = opts;
|
|
16
16
|
const built = await Bun.build({
|
|
17
17
|
entrypoints: [entrypoint],
|
|
18
18
|
target: 'bun',
|
|
@@ -23,6 +23,7 @@ class BunCompiler {
|
|
|
23
23
|
target: target,
|
|
24
24
|
outfile,
|
|
25
25
|
},
|
|
26
|
+
define,
|
|
26
27
|
plugins,
|
|
27
28
|
});
|
|
28
29
|
if (!built.success) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bun.js","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAC7C,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAE/C,gHAAgH;AAChH,MAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,
|
|
1
|
+
{"version":3,"file":"bun.js","sourceRoot":"","sources":["../../src/compilers/bun.ts"],"names":[],"mappings":";;;AAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAC7C,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAE/C,gHAAgH;AAChH,MAAa,WAAW;IACtB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,OAOI,EAAE;QAEN,MAAM,EACJ,UAAU,GAAG,kBAAkB,EAC/B,OAAO,GAAG,eAAe,EACzB,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,EACrD,OAAO,GAAG,EAAE,EACZ,MAAM,GAAG,EAAE,GACZ,GAAG,IAAI,CAAC;QAET,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC;YAC5B,WAAW,EAAE,CAAC,UAAU,CAAC;YACzB,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;YAC1C,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACP,MAAM,EAAE,MAAiC;gBACzC,OAAO;aACR;YACD,MAAM;YACN,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,4FAA4F;YAC5F,8FAA8F;YAC9F,sGAAsG;YACtG,MAAM,IAAI,KAAK,CACb;gBACE,gDAAgD,UAAU,IAAI;gBAC9D,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;aAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAlDD,kCAkDC","sourcesContent":["const DEFAULT_ENTRYPOINT = './dist/index.js';\nconst DEFAULT_OUTFILE = './dist/bin';\nconst DEFAULT_COMPILE_TARGET = 'bun-linux-x64';\n\n/** Bundles and compiles a single Bun executable: minified, linked sourcemaps, target read from `BUN_TARGET`. */\nexport class BunCompiler {\n /**\n * `plugins` is a parameter, never resolved here - `dev-configs` sits below every other IGNIS\n * package (see the Makefile chain) and must not import a plugin factory such as\n * `platformaticKafkaPlugins()` from `helpers`, which would invert that chain.\n */\n static async compile(\n opts: {\n entrypoint?: string;\n outfile?: string;\n target?: string;\n plugins?: Bun.BunPlugin[];\n /** Compile-time constants: each key is replaced by its value, a JSON-encoded expression, wherever the bundle reads it. */\n define?: Record<string, string>;\n } = {},\n ): Promise<void> {\n const {\n entrypoint = DEFAULT_ENTRYPOINT,\n outfile = DEFAULT_OUTFILE,\n target = Bun.env.BUN_TARGET ?? DEFAULT_COMPILE_TARGET,\n plugins = [],\n define = {},\n } = opts;\n\n const built = await Bun.build({\n entrypoints: [entrypoint],\n target: 'bun',\n minify: { whitespace: true, syntax: true },\n sourcemap: 'linked',\n throw: false,\n compile: {\n target: target as Bun.Build.CompileTarget,\n outfile,\n },\n define,\n plugins,\n });\n\n if (!built.success) {\n // `getError` lives in `inversion`, which depends on `dev-configs` - importing it here would\n // create a circular workspace dependency, so a failed compile throws a plain `Error` instead.\n // eslint-disable-next-line venizia/no-new-error -- getError would be a dev-configs -> inversion cycle\n throw new Error(\n [\n `[BunCompiler] compile failed for entrypoint \"${entrypoint}\":`,\n ...built.logs.map(log => `[${log.level}] ${log.message}`),\n ].join('\\n'),\n );\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/dev-configs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Shareable development configurations for TypeScript projects: oxlint and oxfmt presets with per-rule builders, the ESLint naming-convention rule, the legacy ESLint flat config and Prettier presets, and TypeScript compiler options with critical decorator support (experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields). Single source of truth for consistent code style, type checking, and build settings across monorepo packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build-tools",
|