@zenbujs/core 0.0.1
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/LICENSE +11 -0
- package/dist/advice-config-CjgkEf2E.mjs +135 -0
- package/dist/advice-config-Cy133IQP.mjs +2 -0
- package/dist/advice-runtime.d.mts +35 -0
- package/dist/advice-runtime.mjs +131 -0
- package/dist/advice.d.mts +36 -0
- package/dist/advice.mjs +2 -0
- package/dist/base-window-BUt8pwbw.mjs +94 -0
- package/dist/base-window-DEIAk618.mjs +2 -0
- package/dist/build-config-pbv0w4oN.mjs +17 -0
- package/dist/build-electron-B4Gd0Gi4.mjs +516 -0
- package/dist/build-source-_q1n1zTV.mjs +162 -0
- package/dist/chunk-Dm34NbLt.mjs +6 -0
- package/dist/cli/bin.d.mts +1 -0
- package/dist/cli/bin.mjs +88 -0
- package/dist/cli/build.d.mts +53 -0
- package/dist/cli/build.mjs +48 -0
- package/dist/cli-BLbQQIVB.mjs +8054 -0
- package/dist/config-CdVrW85P.mjs +59 -0
- package/dist/config-LK73dJmO.mjs +2 -0
- package/dist/db-ByKPbnP6.mjs +2 -0
- package/dist/db-DhuAJrye.mjs +531 -0
- package/dist/db.d.mts +16 -0
- package/dist/db.mjs +16 -0
- package/dist/dev-BuqklM0k.mjs +85 -0
- package/dist/env-bootstrap-BtVME-CU.d.mts +16 -0
- package/dist/env-bootstrap-rj7I-59x.mjs +53 -0
- package/dist/env-bootstrap.d.mts +2 -0
- package/dist/env-bootstrap.mjs +2 -0
- package/dist/http-IBcLzbYu.mjs +2 -0
- package/dist/index-Bhlbyrn7.d.mts +63 -0
- package/dist/index-CPZ5d6Hl.d.mts +442 -0
- package/dist/index-FtE8MXJ_.d.mts +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +5 -0
- package/dist/launcher.mjs +173 -0
- package/dist/link-6roQ7Cn6.mjs +580 -0
- package/dist/loaders/zenbu.d.mts +22 -0
- package/dist/loaders/zenbu.mjs +267 -0
- package/dist/log-CyKv8hQg.mjs +20 -0
- package/dist/mirror-sync-CodOnwkD.mjs +332 -0
- package/dist/monorepo-CmGPHsVm.mjs +119 -0
- package/dist/node-D4M19_mV.mjs +5 -0
- package/dist/node-loader.d.mts +17 -0
- package/dist/node-loader.mjs +33 -0
- package/dist/pause-DvAUNmKn.mjs +52 -0
- package/dist/publish-source-BVgB62Zj.mjs +131 -0
- package/dist/react.d.mts +76 -0
- package/dist/react.mjs +291 -0
- package/dist/registry-Dh_e7HU1.d.mts +61 -0
- package/dist/registry.d.mts +2 -0
- package/dist/registry.mjs +1 -0
- package/dist/reloader-BCkLjDhS.mjs +2 -0
- package/dist/reloader-lLAJ3lqg.mjs +164 -0
- package/dist/renderer-host-Bg8QdeeH.mjs +1508 -0
- package/dist/renderer-host-DpvBPTHJ.mjs +2 -0
- package/dist/rpc-BwwQK6hD.mjs +71 -0
- package/dist/rpc-CqitnyR4.mjs +2 -0
- package/dist/rpc.d.mts +2 -0
- package/dist/rpc.mjs +2 -0
- package/dist/runtime-CjqDr8Yf.d.mts +109 -0
- package/dist/runtime-DUFKDIe4.mjs +409 -0
- package/dist/runtime.d.mts +2 -0
- package/dist/runtime.mjs +2 -0
- package/dist/schema-CIg4GzHQ.mjs +100 -0
- package/dist/schema-DMoSkwUx.d.mts +62 -0
- package/dist/schema-dGK6qkfR.mjs +28 -0
- package/dist/schema.d.mts +2 -0
- package/dist/schema.mjs +2 -0
- package/dist/server-BXwZEQ-n.mjs +66 -0
- package/dist/server-DjrZUbbu.mjs +2 -0
- package/dist/services/default.d.mts +11 -0
- package/dist/services/default.mjs +22 -0
- package/dist/services/index.d.mts +276 -0
- package/dist/services/index.mjs +7 -0
- package/dist/setup-gate-BeD6WS6d.mjs +110 -0
- package/dist/setup-gate-BqOzm7zp.d.mts +4 -0
- package/dist/setup-gate.d.mts +2 -0
- package/dist/setup-gate.mjs +2 -0
- package/dist/src-pELM4_iH.mjs +376 -0
- package/dist/trace-DCB7qFzT.mjs +10 -0
- package/dist/transform-DJH3vN4b.mjs +84041 -0
- package/dist/transport-BMSzG2-F.mjs +1045 -0
- package/dist/view-registry-BualWgAf.mjs +2 -0
- package/dist/vite-plugins-Bh3SCOw-.mjs +331 -0
- package/dist/vite.d.mts +68 -0
- package/dist/vite.mjs +2 -0
- package/dist/window-CM2a9Kyc.mjs +2 -0
- package/dist/window-CmmpCVX6.mjs +156 -0
- package/dist/write-9dRFczGJ.mjs +1248 -0
- package/migrations/0000_migration.ts +34 -0
- package/migrations/meta/0000_snapshot.json +18 -0
- package/migrations/meta/_journal.json +10 -0
- package/package.json +124 -0
package/dist/cli/bin.mjs
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//#region src/cli/bin.ts
|
|
3
|
+
const PUBLIC_SUBCOMMANDS = new Set([
|
|
4
|
+
"dev",
|
|
5
|
+
"build:source",
|
|
6
|
+
"build:electron",
|
|
7
|
+
"publish:source",
|
|
8
|
+
"link"
|
|
9
|
+
]);
|
|
10
|
+
const INTERNAL_SUBCOMMANDS = new Set(["monorepo", "db"]);
|
|
11
|
+
function printUsage() {
|
|
12
|
+
console.log(`
|
|
13
|
+
zen — Zenbu CLI
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
zen dev Run the local app in Electron with HMR
|
|
17
|
+
zen build:source Transform user TS into a portable seed
|
|
18
|
+
tree (default: .zenbu/build/seed)
|
|
19
|
+
zen build:electron [-- <eb args>] Stage seed + bundled bun/pnpm + launcher,
|
|
20
|
+
then invoke electron-builder against
|
|
21
|
+
the project's electron-builder config.
|
|
22
|
+
Pass-through args after \`--\` go to
|
|
23
|
+
electron-builder (e.g. \`-- --publish always\`).
|
|
24
|
+
zen publish:source [init|push] Push staged source to the mirror repo
|
|
25
|
+
zen link Regenerate registry types
|
|
26
|
+
|
|
27
|
+
Hooks:
|
|
28
|
+
--config <zenbu.build.ts> Override the build config path
|
|
29
|
+
--no-source Skip running build:source (use stale seed)
|
|
30
|
+
`);
|
|
31
|
+
}
|
|
32
|
+
async function main() {
|
|
33
|
+
const argv = process.argv.slice(2);
|
|
34
|
+
const first = argv[0];
|
|
35
|
+
if (!first || first === "help" || first === "--help" || first === "-h") {
|
|
36
|
+
printUsage();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!PUBLIC_SUBCOMMANDS.has(first) && !INTERNAL_SUBCOMMANDS.has(first)) {
|
|
40
|
+
console.error(`zen: unknown command "${first}"`);
|
|
41
|
+
console.error(`run \`zen --help\` to see available commands`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const rest = argv.slice(1);
|
|
45
|
+
switch (first) {
|
|
46
|
+
case "dev": {
|
|
47
|
+
const { runDev } = await import("../dev-BuqklM0k.mjs");
|
|
48
|
+
await runDev(rest);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
case "build:source": {
|
|
52
|
+
const { runBuildSource } = await import("../build-source-_q1n1zTV.mjs");
|
|
53
|
+
await runBuildSource(rest);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
case "build:electron": {
|
|
57
|
+
const { runBuildElectron } = await import("../build-electron-B4Gd0Gi4.mjs");
|
|
58
|
+
await runBuildElectron(rest);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
case "publish:source": {
|
|
62
|
+
const { runPublishSource } = await import("../publish-source-BVgB62Zj.mjs");
|
|
63
|
+
await runPublishSource(rest);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
case "link": {
|
|
67
|
+
const { runLink } = await import("../link-6roQ7Cn6.mjs");
|
|
68
|
+
await runLink(rest);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
case "monorepo": {
|
|
72
|
+
const { runMonorepo } = await import("../monorepo-CmGPHsVm.mjs");
|
|
73
|
+
await runMonorepo(rest);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
case "db": {
|
|
77
|
+
const { runDb } = await import("../db-DhuAJrye.mjs");
|
|
78
|
+
await runDb(rest);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
main().catch((err) => {
|
|
84
|
+
console.error(err);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/cli/lib/build-config.d.ts
|
|
2
|
+
interface TransformInput {
|
|
3
|
+
path: string;
|
|
4
|
+
code: string;
|
|
5
|
+
}
|
|
6
|
+
interface TransformOutput {
|
|
7
|
+
code?: string;
|
|
8
|
+
drop?: boolean;
|
|
9
|
+
}
|
|
10
|
+
type Transform = (file: TransformInput) => TransformOutput | null | undefined | void;
|
|
11
|
+
interface MirrorConfig {
|
|
12
|
+
target: string;
|
|
13
|
+
branch?: string;
|
|
14
|
+
}
|
|
15
|
+
interface BundleConfig {
|
|
16
|
+
seed?: boolean;
|
|
17
|
+
extraResources?: string[];
|
|
18
|
+
}
|
|
19
|
+
interface BuildConfig {
|
|
20
|
+
source?: string;
|
|
21
|
+
out?: string;
|
|
22
|
+
include: string[];
|
|
23
|
+
ignore?: string[];
|
|
24
|
+
transforms?: Transform[];
|
|
25
|
+
mirror?: MirrorConfig;
|
|
26
|
+
bundle?: BundleConfig;
|
|
27
|
+
}
|
|
28
|
+
declare function defineBuildConfig(config: BuildConfig): BuildConfig;
|
|
29
|
+
type ResolvedBuildConfig = Required<Omit<BuildConfig, "mirror" | "bundle">> & {
|
|
30
|
+
mirror?: MirrorConfig;
|
|
31
|
+
bundle?: BundleConfig;
|
|
32
|
+
};
|
|
33
|
+
declare function resolveBuildConfig(config: BuildConfig): ResolvedBuildConfig;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/cli/lib/transforms.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* Marker-based feature-flag stripping. Removes lines between
|
|
38
|
+
* // @zenbu:strip-if FLAG (strip when FLAG is truthy)
|
|
39
|
+
* // @zenbu:strip-if !FLAG (strip when FLAG is falsy)
|
|
40
|
+
* ...
|
|
41
|
+
* // @zenbu:end
|
|
42
|
+
*
|
|
43
|
+
* Pure string/line ops — no AST, no compiler dep.
|
|
44
|
+
*/
|
|
45
|
+
declare function stripIfDisabled(flags: Record<string, boolean>): Transform;
|
|
46
|
+
/**
|
|
47
|
+
* Drop files whose path matches the given pattern (relative path from the
|
|
48
|
+
* source root, posix slashes). Also covered by `ignore` globs in the config;
|
|
49
|
+
* use this when a regex is more convenient than a glob.
|
|
50
|
+
*/
|
|
51
|
+
declare function dropFiles(pattern: RegExp | ((path: string) => boolean)): Transform;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { type BuildConfig, type BundleConfig, type MirrorConfig, type ResolvedBuildConfig, type Transform, type TransformInput, type TransformOutput, defineBuildConfig, dropFiles, resolveBuildConfig, stripIfDisabled };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { n as resolveBuildConfig, t as defineBuildConfig } from "../build-config-pbv0w4oN.mjs";
|
|
2
|
+
//#region src/cli/lib/transforms.ts
|
|
3
|
+
const STRIP_START = /^\s*\/\/\s*@zenbu:strip-if\s+(!?)([A-Za-z_][A-Za-z0-9_]*)\s*$/;
|
|
4
|
+
const STRIP_END = /^\s*\/\/\s*@zenbu:end\s*$/;
|
|
5
|
+
/**
|
|
6
|
+
* Marker-based feature-flag stripping. Removes lines between
|
|
7
|
+
* // @zenbu:strip-if FLAG (strip when FLAG is truthy)
|
|
8
|
+
* // @zenbu:strip-if !FLAG (strip when FLAG is falsy)
|
|
9
|
+
* ...
|
|
10
|
+
* // @zenbu:end
|
|
11
|
+
*
|
|
12
|
+
* Pure string/line ops — no AST, no compiler dep.
|
|
13
|
+
*/
|
|
14
|
+
function stripIfDisabled(flags) {
|
|
15
|
+
return (file) => {
|
|
16
|
+
const lines = file.code.split("\n");
|
|
17
|
+
const out = [];
|
|
18
|
+
let stripDepth = 0;
|
|
19
|
+
for (const line of lines) {
|
|
20
|
+
const startMatch = STRIP_START.exec(line);
|
|
21
|
+
if (startMatch) {
|
|
22
|
+
const negated = startMatch[1] === "!";
|
|
23
|
+
const flagValue = flags[startMatch[2]] ?? false;
|
|
24
|
+
if ((negated ? !flagValue : flagValue) || stripDepth > 0) stripDepth += 1;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (STRIP_END.test(line)) {
|
|
28
|
+
if (stripDepth > 0) stripDepth -= 1;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (stripDepth === 0) out.push(line);
|
|
32
|
+
}
|
|
33
|
+
return { code: out.join("\n") };
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Drop files whose path matches the given pattern (relative path from the
|
|
38
|
+
* source root, posix slashes). Also covered by `ignore` globs in the config;
|
|
39
|
+
* use this when a regex is more convenient than a glob.
|
|
40
|
+
*/
|
|
41
|
+
function dropFiles(pattern) {
|
|
42
|
+
const test = typeof pattern === "function" ? pattern : (p) => pattern.test(p);
|
|
43
|
+
return (file) => {
|
|
44
|
+
if (test(file.path)) return { drop: true };
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { defineBuildConfig, dropFiles, resolveBuildConfig, stripIfDisabled };
|