ziex 0.1.0-dev.1377 → 0.1.0-dev.1382
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/build.zig +2 -118
- package/build.zig.zon +2 -13
- package/package.json +2 -2
package/build.zig
CHANGED
|
@@ -1,121 +1,5 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
|
-
const esbuild = @import("esbuild");
|
|
3
2
|
|
|
4
|
-
pub fn build(b: *std.Build)
|
|
5
|
-
|
|
6
|
-
const target = b.standardTargetOptions(.{});
|
|
7
|
-
_ = target;
|
|
8
|
-
const type_decl = b.option(bool, "type-decl", "Generate type declarations") orelse true;
|
|
9
|
-
const is_release = optimize != .Debug;
|
|
10
|
-
|
|
11
|
-
// --- JS bundles (esbuild) --- //
|
|
12
|
-
const packages = esbuild.addBuild(b, .{
|
|
13
|
-
.name = "ziex",
|
|
14
|
-
.config = .{
|
|
15
|
-
.entrypoints = &.{
|
|
16
|
-
b.path("src/index.ts"),
|
|
17
|
-
b.path("src/jsx/index.ts"),
|
|
18
|
-
b.path("src/wasm/index.ts"),
|
|
19
|
-
b.path("src/cloudflare/index.ts"),
|
|
20
|
-
b.path("src/aws-lambda/index.ts"),
|
|
21
|
-
b.path("src/vercel/index.ts"),
|
|
22
|
-
},
|
|
23
|
-
.format = .esm,
|
|
24
|
-
.platform = .neutral,
|
|
25
|
-
.minify = is_release,
|
|
26
|
-
.define = &.{
|
|
27
|
-
.{ .key = "__DEV__", .value = if (is_release) "false" else "true" },
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const wasm_init = esbuild.addBuild(b, .{
|
|
33
|
-
.name = "wasm_init",
|
|
34
|
-
.config = .{
|
|
35
|
-
.entrypoints = &.{b.path("src/wasm/init.ts")},
|
|
36
|
-
.format = .esm,
|
|
37
|
-
.platform = .browser,
|
|
38
|
-
.minify = true,
|
|
39
|
-
.define = &.{
|
|
40
|
-
.{ .key = "__DEV__", .value = "false" },
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const wasm_init_dev = esbuild.addBuild(b, .{
|
|
46
|
-
.name = "wasm_init_dev",
|
|
47
|
-
.config = .{
|
|
48
|
-
.entrypoints = &.{b.path("src/wasm/init.ts")},
|
|
49
|
-
.format = .esm,
|
|
50
|
-
.platform = .browser,
|
|
51
|
-
.minify = false,
|
|
52
|
-
.define = &.{
|
|
53
|
-
.{ .key = "__DEV__", .value = "true" },
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const dist_files = b.addNamedWriteFiles("ziex_js");
|
|
59
|
-
|
|
60
|
-
// --- App init files --- //
|
|
61
|
-
{
|
|
62
|
-
_ = dist_files.addCopyFile(wasm_init.dir.path(b, "init.js"), "wasm/init.js");
|
|
63
|
-
_ = dist_files.addCopyFile(wasm_init_dev.dir.path(b, "init.js"), "wasm/init.dev.js");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// --- Static package files --- //
|
|
67
|
-
{
|
|
68
|
-
_ = dist_files.addCopyFile(try makePublishPackageJson(b), "package.json");
|
|
69
|
-
_ = dist_files.addCopyFile(b.path("../../README.md"), "README.md");
|
|
70
|
-
_ = dist_files.addCopyFile(b.path("bin/ziex"), "bin/ziex");
|
|
71
|
-
_ = dist_files.addCopyFile(b.path("build.zig"), "build.zig");
|
|
72
|
-
_ = dist_files.addCopyFile(b.path("build.zig.zon"), "build.zig.zon");
|
|
73
|
-
|
|
74
|
-
// --- Other bindings --- //
|
|
75
|
-
_ = dist_files.addCopyDirectory(packages.dir, "", .{});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// --- TypeScript declarations --- //
|
|
79
|
-
if (type_decl) {
|
|
80
|
-
const typescript = @import("typescript");
|
|
81
|
-
const dts = typescript.addBuild(b, .{
|
|
82
|
-
.name = "ziex.d.ts",
|
|
83
|
-
.config = .{
|
|
84
|
-
.project = b.path("tsconfig.json"),
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
_ = dist_files.addCopyDirectory(dts.dir.path(b, "pkg/ziex/src"), "", .{});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
b.getInstallStep().dependOn(&b.addInstallDirectory(.{
|
|
91
|
-
.source_dir = dist_files.getDirectory(),
|
|
92
|
-
.install_dir = .prefix,
|
|
93
|
-
.install_subdir = "",
|
|
94
|
-
}).step);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
fn makePublishPackageJson(b: *std.Build) !std.Build.LazyPath {
|
|
98
|
-
const src = try b.root.root_dir.handle.readFileAlloc(b.graph.io, "package.json", b.allocator, .unlimited);
|
|
99
|
-
defer b.allocator.free(src);
|
|
100
|
-
|
|
101
|
-
var parsed = try std.json.parseFromSlice(std.json.Value, b.allocator, src, .{});
|
|
102
|
-
defer parsed.deinit();
|
|
103
|
-
|
|
104
|
-
const obj = &parsed.value.object;
|
|
105
|
-
try obj.put(b.allocator, "main", .{ .string = "index.js" });
|
|
106
|
-
try obj.put(b.allocator, "module", .{ .string = "index.js" });
|
|
107
|
-
try obj.put(b.allocator, "types", .{ .string = "index.d.ts" });
|
|
108
|
-
try obj.put(b.allocator, "scripts", .{ .object = .empty });
|
|
109
|
-
_ = obj.swapRemove("private");
|
|
110
|
-
_ = obj.swapRemove("devDependencies");
|
|
111
|
-
_ = obj.swapRemove("peerDependencies");
|
|
112
|
-
_ = obj.swapRemove("release");
|
|
113
|
-
_ = obj.swapRemove("prettier");
|
|
114
|
-
|
|
115
|
-
const json = try std.json.Stringify.valueAlloc(b.allocator, parsed.value, .{ .whitespace = .indent_2 });
|
|
116
|
-
defer b.allocator.free(json);
|
|
117
|
-
const out = try std.mem.concat(b.allocator, u8, &.{ json, "\n" });
|
|
118
|
-
defer b.allocator.free(out);
|
|
119
|
-
|
|
120
|
-
return b.addWriteFiles().add("package.json", out);
|
|
3
|
+
pub fn build(b: *std.Build) void {
|
|
4
|
+
_ = b; // stub
|
|
121
5
|
}
|
package/build.zig.zon
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
.{
|
|
2
2
|
.name = .ziex_js,
|
|
3
|
-
.fingerprint =
|
|
3
|
+
.fingerprint = 3758452767932569023,
|
|
4
4
|
.version = "0.1.0-dev",
|
|
5
5
|
.minimum_zig_version = "0.17.0-dev.1158+1d1193aa7",
|
|
6
|
-
.
|
|
7
|
-
.esbuild = .{ .path = "../plugin-esbuild" },
|
|
8
|
-
.typescript = .{ .path = "../plugin-typescript", .lazy = true },
|
|
9
|
-
},
|
|
10
|
-
.paths = .{
|
|
11
|
-
"build.zig",
|
|
12
|
-
"build.zig.zon",
|
|
13
|
-
"src",
|
|
14
|
-
"bin",
|
|
15
|
-
"package.json",
|
|
16
|
-
"tsconfig.json",
|
|
17
|
-
},
|
|
6
|
+
.paths = .{""},
|
|
18
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ziex",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.1382",
|
|
4
4
|
"types": "index.d.ts",
|
|
5
5
|
"description": "Ziex is a framework for building web applications with Zig.",
|
|
6
6
|
"main": "index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"scripts": {},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@ziex/cli": "0.1.0-dev.
|
|
41
|
+
"@ziex/cli": "0.1.0-dev.1382"
|
|
42
42
|
},
|
|
43
43
|
"module": "index.js"
|
|
44
44
|
}
|