@elysiumjs/hephaestus 0.3.0 → 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/CHANGELOG.md +20 -0
- package/dist/assets/embedder.d.ts +38 -0
- package/dist/assets/index.d.ts +1 -0
- package/dist/builder/binary.builder.d.ts +32 -0
- package/dist/builder/index.d.ts +1 -0
- package/dist/commands/build.command.d.ts +14 -0
- package/dist/commands/docker.command.d.ts +12 -0
- package/dist/commands/docker.generator.d.ts +20 -0
- package/dist/commands/embed.command.d.ts +11 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/loader.d.ts +8 -0
- package/dist/hephaestus.module.d.ts +7 -0
- package/dist/index.d.ts +10 -0
- package/dist/platform/index.d.ts +1 -0
- package/dist/platform/targets.d.ts +22 -0
- package/dist/types.d.ts +72 -0
- package/package.json +14 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @elysiumjs/hephaestus
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`04773f2`](https://github.com/na2axl/elysiumjs/commit/04773f2acd4ab1c762a80ee903715d90f1c08e21) Thanks [@na2axl](https://github.com/na2axl)! - Ship the type declarations. The packages pointed `types` at `dist/index.d.ts` but their build never wrote it, so TypeScript projects got no types for them.
|
|
8
|
+
|
|
9
|
+
## 0.3.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`68a0cdd`](https://github.com/na2axl/elysiumjs/commit/68a0cdd8b2e4a003d6e0af2d78985623cae40428), [`2c49acd`](https://github.com/na2axl/elysiumjs/commit/2c49acd3b552aa43765d70339fa216961499e1b5), [`76ba0ff`](https://github.com/na2axl/elysiumjs/commit/76ba0ff18f3c196cebc2189426328f67cb699f46), [`4ebf029`](https://github.com/na2axl/elysiumjs/commit/4ebf029611e6d753a4f1bfdbe247a75d954d9ded), [`bacce71`](https://github.com/na2axl/elysiumjs/commit/bacce7146f667a1a46bf474dc0344fb0111ae12a)]:
|
|
14
|
+
- @elysiumjs/core@0.10.0
|
|
15
|
+
|
|
16
|
+
## 0.3.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`5fef4a7`](https://github.com/na2axl/elysiumjs/commit/5fef4a7199f502fc4fe035299e7670739459a108)]:
|
|
21
|
+
- @elysiumjs/core@0.9.0
|
|
22
|
+
|
|
3
23
|
## 0.3.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { HephaestusConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Manifest mapping asset paths to their base64 content and MIME type.
|
|
4
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
5
|
+
*/
|
|
6
|
+
export interface AssetManifest {
|
|
7
|
+
[path: string]: {
|
|
8
|
+
content: string;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Embeds assets into a generated loader module for use in compiled binaries.
|
|
14
|
+
*
|
|
15
|
+
* For static assets known at development time, prefer Bun's native file embedding:
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import icon from './icon.png' with { type: 'file' };
|
|
18
|
+
* const bytes = await Bun.file(icon).arrayBuffer();
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* This class is for dynamic glob-based embedding from config.
|
|
22
|
+
*
|
|
23
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
24
|
+
*/
|
|
25
|
+
export declare class AssetEmbedder {
|
|
26
|
+
private config;
|
|
27
|
+
constructor(config: HephaestusConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Scans for assets matching the config patterns and generates a loader module.
|
|
30
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
31
|
+
* @returns A string containing the generated asset loader module.
|
|
32
|
+
*/
|
|
33
|
+
embed(): Promise<string>;
|
|
34
|
+
private buildManifest;
|
|
35
|
+
private isExcluded;
|
|
36
|
+
private generateLoader;
|
|
37
|
+
private getMimeType;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type AssetManifest, AssetEmbedder } from './embedder';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HephaestusConfig, PlatformTarget } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Result of a single binary compilation.
|
|
4
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
5
|
+
*/
|
|
6
|
+
export interface BuildResult {
|
|
7
|
+
platform: PlatformTarget;
|
|
8
|
+
outputPath: string;
|
|
9
|
+
size: number;
|
|
10
|
+
duration: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Compiles Elysium projects into single-binary executables using Bun.
|
|
14
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
15
|
+
*/
|
|
16
|
+
export declare class BinaryBuilder {
|
|
17
|
+
private config;
|
|
18
|
+
constructor(config: HephaestusConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Builds a single binary for a specific platform, or the current one if not specified.
|
|
21
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
22
|
+
* @param platform The target platform. Defaults to the current platform.
|
|
23
|
+
* @returns The build result with metrics.
|
|
24
|
+
*/
|
|
25
|
+
build(platform?: PlatformTarget): Promise<BuildResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Builds binaries for all configured platforms, or the current one if none are configured.
|
|
28
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
29
|
+
* @returns An array of build results.
|
|
30
|
+
*/
|
|
31
|
+
buildAll(): Promise<BuildResult[]>;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type BuildResult, BinaryBuilder } from './binary.builder';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@elysiumjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* Command used to build the project into a standalone binary.
|
|
4
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
5
|
+
*/
|
|
6
|
+
export declare class HephaestusBuildCommand extends Command {
|
|
7
|
+
static readonly command: string;
|
|
8
|
+
static readonly description: string;
|
|
9
|
+
static readonly dev: boolean;
|
|
10
|
+
private platform?;
|
|
11
|
+
private allPlatforms;
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
private formatSize;
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@elysiumjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* Command used to generate a Dockerfile for the compiled binary.
|
|
4
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
5
|
+
*/
|
|
6
|
+
export declare class HephaestusDockerCommand extends Command {
|
|
7
|
+
static readonly command: string;
|
|
8
|
+
static readonly description: string;
|
|
9
|
+
static readonly dev: boolean;
|
|
10
|
+
private output;
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HephaestusConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a multi-stage Dockerfile for compiled Elysium binaries.
|
|
4
|
+
*
|
|
5
|
+
* The runtime stage uses Alpine (not Bun) because the compiled binary
|
|
6
|
+
* is self-contained. Healthcheck uses `wget` (available in Alpine base).
|
|
7
|
+
*
|
|
8
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
9
|
+
*/
|
|
10
|
+
export declare class DockerGenerator {
|
|
11
|
+
private config;
|
|
12
|
+
constructor(config: HephaestusConfig);
|
|
13
|
+
/**
|
|
14
|
+
* Generates the Dockerfile and writes it to the output directory.
|
|
15
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
16
|
+
* @param outputDir The directory to write the Dockerfile to.
|
|
17
|
+
*/
|
|
18
|
+
generate(outputDir: string): void;
|
|
19
|
+
private renderDockerfile;
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from '@elysiumjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* Command used to generate asset loader module from configured patterns.
|
|
4
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
5
|
+
*/
|
|
6
|
+
export declare class HephaestusEmbedCommand extends Command {
|
|
7
|
+
static readonly command: string;
|
|
8
|
+
static readonly description: string;
|
|
9
|
+
static readonly dev: boolean;
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { loadConfig } from './loader';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HephaestusConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Loads and validates the Hephaestus build configuration from the project root.
|
|
4
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
5
|
+
* @param cwd The working directory to search for config files.
|
|
6
|
+
* @returns The validated configuration.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadConfig(cwd?: string): Promise<HephaestusConfig>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { HephaestusModule } from './hephaestus.module';
|
|
2
|
+
export type { HephaestusConfig, PlatformTarget } from './types';
|
|
3
|
+
export { HephaestusConfigSchema, PlatformTargetSchema } from './types';
|
|
4
|
+
export type { BuildResult } from './builder';
|
|
5
|
+
export { BinaryBuilder } from './builder';
|
|
6
|
+
export type { AssetManifest } from './assets';
|
|
7
|
+
export { AssetEmbedder } from './assets';
|
|
8
|
+
export { DockerGenerator } from './commands/docker.generator';
|
|
9
|
+
export { loadConfig } from './config';
|
|
10
|
+
export { bunTarget, detectCurrentPlatform, getOutputName } from './platform';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { bunTarget, detectCurrentPlatform, getOutputName } from './targets';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PlatformTarget } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a Hephaestus platform target to a Bun target string.
|
|
4
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
5
|
+
* @param platform The Hephaestus platform target.
|
|
6
|
+
* @returns The Bun `--target` value.
|
|
7
|
+
*/
|
|
8
|
+
export declare function bunTarget(platform: PlatformTarget): string;
|
|
9
|
+
/**
|
|
10
|
+
* Detects the current platform and returns the corresponding target.
|
|
11
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
12
|
+
* @returns The detected platform target.
|
|
13
|
+
*/
|
|
14
|
+
export declare function detectCurrentPlatform(): PlatformTarget;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the output file name for a given platform.
|
|
17
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
18
|
+
* @param baseName The base binary name.
|
|
19
|
+
* @param platform The target platform.
|
|
20
|
+
* @returns The platform-specific output file name.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getOutputName(baseName: string, platform: PlatformTarget): string;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Supported compilation target platforms.
|
|
4
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
5
|
+
*/
|
|
6
|
+
export declare const PlatformTargetSchema: z.ZodEnum<{
|
|
7
|
+
"darwin-arm64": "darwin-arm64";
|
|
8
|
+
"darwin-x64": "darwin-x64";
|
|
9
|
+
"linux-arm64": "linux-arm64";
|
|
10
|
+
"linux-x64": "linux-x64";
|
|
11
|
+
"linux-x64-baseline": "linux-x64-baseline";
|
|
12
|
+
"windows-x64": "windows-x64";
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* A supported compilation target platform.
|
|
16
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
17
|
+
*/
|
|
18
|
+
export type PlatformTarget = z.infer<typeof PlatformTargetSchema>;
|
|
19
|
+
/**
|
|
20
|
+
* Hephaestus build configuration schema.
|
|
21
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
22
|
+
*/
|
|
23
|
+
export declare const HephaestusConfigSchema: z.ZodObject<{
|
|
24
|
+
entry: z.ZodDefault<z.ZodString>;
|
|
25
|
+
output: z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
dir: z.ZodDefault<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
platforms: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
30
|
+
"darwin-arm64": "darwin-arm64";
|
|
31
|
+
"darwin-x64": "darwin-x64";
|
|
32
|
+
"linux-arm64": "linux-arm64";
|
|
33
|
+
"linux-x64": "linux-x64";
|
|
34
|
+
"linux-x64-baseline": "linux-x64-baseline";
|
|
35
|
+
"windows-x64": "windows-x64";
|
|
36
|
+
}>>>;
|
|
37
|
+
build: z.ZodPrefault<z.ZodObject<{
|
|
38
|
+
minify: z.ZodDefault<z.ZodBoolean>;
|
|
39
|
+
sourcemap: z.ZodDefault<z.ZodBoolean>;
|
|
40
|
+
bytecode: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
split: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
assets: z.ZodPrefault<z.ZodObject<{
|
|
44
|
+
embed: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
45
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
env: z.ZodPrefault<z.ZodObject<{
|
|
48
|
+
generateExample: z.ZodDefault<z.ZodBoolean>;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
docker: z.ZodOptional<z.ZodObject<{
|
|
51
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
buildImage: z.ZodDefault<z.ZodString>;
|
|
53
|
+
runtimeImage: z.ZodDefault<z.ZodString>;
|
|
54
|
+
expose: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
55
|
+
healthcheck: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
path: z.ZodDefault<z.ZodString>;
|
|
57
|
+
interval: z.ZodDefault<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
release: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
include: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
62
|
+
compress: z.ZodDefault<z.ZodEnum<{
|
|
63
|
+
"tar.gz": "tar.gz";
|
|
64
|
+
zip: "zip";
|
|
65
|
+
}>>;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
/**
|
|
69
|
+
* Hephaestus build configuration.
|
|
70
|
+
* @author Axel Nana <axel.nana@workbud.com>
|
|
71
|
+
*/
|
|
72
|
+
export type HephaestusConfig = z.infer<typeof HephaestusConfigSchema>;
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elysiumjs/hephaestus",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Compilation and bundling utilities for Elysium.js apps.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"author": "Workbud Technologies Inc.",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/
|
|
10
|
+
"url": "git+https://github.com/na2axl/elysiumjs.git",
|
|
11
|
+
"directory": "@elysiumjs/hephaestus"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [
|
|
13
14
|
"elysium",
|
|
@@ -19,12 +20,19 @@
|
|
|
19
20
|
"compilation",
|
|
20
21
|
"bun"
|
|
21
22
|
],
|
|
22
|
-
"homepage": "https://github.com/
|
|
23
|
-
"
|
|
23
|
+
"homepage": "https://github.com/na2axl/elysiumjs/tree/main/@elysiumjs/hephaestus#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/na2axl/elysiumjs/issues"
|
|
26
|
+
},
|
|
27
|
+
"module": "dist/index.js",
|
|
24
28
|
"type": "module",
|
|
25
29
|
"sideEffects": false,
|
|
26
30
|
"main": "dist/index.js",
|
|
27
31
|
"types": "dist/index.d.ts",
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"CHANGELOG.md"
|
|
35
|
+
],
|
|
28
36
|
"scripts": {
|
|
29
37
|
"format": "prettier --write \"./src/**/*.ts\"",
|
|
30
38
|
"clean": "rimraf dist",
|
|
@@ -40,9 +48,9 @@
|
|
|
40
48
|
"zod": "^4.6.7"
|
|
41
49
|
},
|
|
42
50
|
"devDependencies": {
|
|
43
|
-
"@elysiumjs/core": "0.
|
|
51
|
+
"@elysiumjs/core": "0.10.0"
|
|
44
52
|
},
|
|
45
53
|
"peerDependencies": {
|
|
46
|
-
"@elysiumjs/core": "^0.
|
|
54
|
+
"@elysiumjs/core": "^0.10.0"
|
|
47
55
|
}
|
|
48
56
|
}
|