everything-dev 1.27.0 → 1.28.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.
Files changed (114) hide show
  1. package/dist/cli/infra.cjs +1 -1
  2. package/dist/cli/infra.mjs +1 -1
  3. package/dist/cli/init.cjs +34 -9
  4. package/dist/cli/init.cjs.map +1 -1
  5. package/dist/cli/init.d.cts +2 -1
  6. package/dist/cli/init.d.cts.map +1 -1
  7. package/dist/cli/init.d.mts +2 -1
  8. package/dist/cli/init.d.mts.map +1 -1
  9. package/dist/cli/init.mjs +34 -9
  10. package/dist/cli/init.mjs.map +1 -1
  11. package/dist/cli/prompts.cjs +28 -24
  12. package/dist/cli/prompts.cjs.map +1 -1
  13. package/dist/cli/prompts.mjs +27 -24
  14. package/dist/cli/prompts.mjs.map +1 -1
  15. package/dist/cli/sync.cjs +40 -3
  16. package/dist/cli/sync.cjs.map +1 -1
  17. package/dist/cli/sync.mjs +40 -3
  18. package/dist/cli/sync.mjs.map +1 -1
  19. package/dist/cli.cjs +187 -12
  20. package/dist/cli.cjs.map +1 -1
  21. package/dist/cli.mjs +186 -11
  22. package/dist/cli.mjs.map +1 -1
  23. package/dist/config.cjs +1 -0
  24. package/dist/config.cjs.map +1 -1
  25. package/dist/config.d.cts.map +1 -1
  26. package/dist/config.d.mts.map +1 -1
  27. package/dist/config.mjs +1 -0
  28. package/dist/config.mjs.map +1 -1
  29. package/dist/contract.cjs +1 -1
  30. package/dist/contract.cjs.map +1 -1
  31. package/dist/contract.d.cts +38 -34
  32. package/dist/contract.d.cts.map +1 -1
  33. package/dist/contract.d.mts +38 -34
  34. package/dist/contract.d.mts.map +1 -1
  35. package/dist/contract.mjs +1 -0
  36. package/dist/contract.mjs.map +1 -1
  37. package/dist/dev-session.cjs +0 -1
  38. package/dist/dev-session.mjs +1 -1
  39. package/dist/index.cjs +0 -2
  40. package/dist/index.d.cts +2 -2
  41. package/dist/index.d.mts +2 -2
  42. package/dist/index.mjs +0 -1
  43. package/dist/near-cli.cjs +1 -1
  44. package/dist/near-cli.mjs +1 -1
  45. package/dist/orchestrator.cjs +1 -1
  46. package/dist/orchestrator.mjs +1 -1
  47. package/dist/plugin.cjs +183 -151
  48. package/dist/plugin.cjs.map +1 -1
  49. package/dist/plugin.d.cts +67 -34
  50. package/dist/plugin.d.cts.map +1 -1
  51. package/dist/plugin.d.mts +66 -34
  52. package/dist/plugin.d.mts.map +1 -1
  53. package/dist/plugin.mjs +173 -142
  54. package/dist/plugin.mjs.map +1 -1
  55. package/dist/service-descriptor.d.cts +34 -0
  56. package/dist/service-descriptor.d.cts.map +1 -0
  57. package/dist/service-descriptor.d.mts +36 -0
  58. package/dist/service-descriptor.d.mts.map +1 -0
  59. package/dist/types.d.cts +2 -2
  60. package/dist/types.d.mts +2 -2
  61. package/dist/utils/run.cjs +9 -20
  62. package/dist/utils/run.cjs.map +1 -1
  63. package/dist/utils/run.mjs +9 -20
  64. package/dist/utils/run.mjs.map +1 -1
  65. package/package.json +2 -2
  66. package/src/api-contract.ts +0 -623
  67. package/src/app.ts +0 -193
  68. package/src/cli/catalog.ts +0 -49
  69. package/src/cli/framework-version.ts +0 -61
  70. package/src/cli/help.ts +0 -13
  71. package/src/cli/infra.ts +0 -190
  72. package/src/cli/init.ts +0 -1145
  73. package/src/cli/parse.ts +0 -147
  74. package/src/cli/prompts.ts +0 -135
  75. package/src/cli/snapshot.ts +0 -46
  76. package/src/cli/status.ts +0 -99
  77. package/src/cli/sync.ts +0 -429
  78. package/src/cli/timing.ts +0 -63
  79. package/src/cli/upgrade.ts +0 -869
  80. package/src/cli.ts +0 -516
  81. package/src/components/dev-view.tsx +0 -352
  82. package/src/components/streaming-view.ts +0 -177
  83. package/src/config.ts +0 -893
  84. package/src/contract.meta.ts +0 -140
  85. package/src/contract.ts +0 -326
  86. package/src/dev-logs.ts +0 -92
  87. package/src/dev-session.ts +0 -283
  88. package/src/fastkv.ts +0 -181
  89. package/src/index.ts +0 -8
  90. package/src/integrity.ts +0 -138
  91. package/src/internal/manifest-normalizer.ts +0 -290
  92. package/src/merge.ts +0 -187
  93. package/src/mf.ts +0 -147
  94. package/src/near-cli.ts +0 -259
  95. package/src/network.ts +0 -3
  96. package/src/orchestrator.ts +0 -493
  97. package/src/plugin.ts +0 -1799
  98. package/src/sdk.ts +0 -14
  99. package/src/service-descriptor.ts +0 -281
  100. package/src/shared.ts +0 -249
  101. package/src/sidebar.ts +0 -140
  102. package/src/types.ts +0 -330
  103. package/src/ui/head.ts +0 -83
  104. package/src/ui/index.ts +0 -5
  105. package/src/ui/metadata.ts +0 -95
  106. package/src/ui/router.ts +0 -88
  107. package/src/ui/runtime.ts +0 -42
  108. package/src/ui/types.ts +0 -65
  109. package/src/utils/banner.ts +0 -21
  110. package/src/utils/linkify.ts +0 -11
  111. package/src/utils/path-match.ts +0 -16
  112. package/src/utils/run.ts +0 -31
  113. package/src/utils/save-config.ts +0 -20
  114. package/src/utils/theme.ts +0 -39
package/src/cli/parse.ts DELETED
@@ -1,147 +0,0 @@
1
- import type { CommandDescriptor } from "./catalog";
2
-
3
- type SchemaLike = {
4
- _def?: {
5
- type?: string;
6
- innerType?: SchemaLike;
7
- shape?: Record<string, SchemaLike>;
8
- values?: Record<string, string> | string[];
9
- };
10
- parse: (value: unknown) => unknown;
11
- };
12
-
13
- function unwrap(schema: SchemaLike): SchemaLike {
14
- let current = schema;
15
- while (true) {
16
- const type = current._def?.type;
17
- if (type === "default" || type === "optional" || type === "nullable" || type === "nullish") {
18
- const inner = current._def?.innerType;
19
- if (!inner) break;
20
- current = inner;
21
- continue;
22
- }
23
- return current;
24
- }
25
- return current;
26
- }
27
-
28
- function isBooleanSchema(schema: SchemaLike): boolean {
29
- return unwrap(schema)._def?.type === "boolean";
30
- }
31
-
32
- function isArraySchema(schema: SchemaLike): boolean {
33
- return unwrap(schema)._def?.type === "array";
34
- }
35
-
36
- function coerceValue(raw: string, schema: SchemaLike): unknown {
37
- const inner = unwrap(schema);
38
- switch (inner._def?.type) {
39
- case "boolean":
40
- return raw === "true" || raw === "1" || raw === "yes";
41
- case "number": {
42
- const value = Number(raw);
43
- if (Number.isNaN(value)) throw new Error(`Invalid number: ${raw}`);
44
- return value;
45
- }
46
- case "enum":
47
- return raw;
48
- default:
49
- return raw;
50
- }
51
- }
52
-
53
- function toFlagName(field: string): string {
54
- return `--${field.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
55
- }
56
-
57
- function getShape(schema: SchemaLike): Record<string, SchemaLike> {
58
- const inner = unwrap(schema);
59
- const shape = inner._def?.shape;
60
- if (!shape) return {};
61
- return shape;
62
- }
63
-
64
- export function parseCommandInput(descriptor: CommandDescriptor, argv: string[]): unknown {
65
- const schema = (descriptor.procedure as any)["~orpc"]?.inputSchema as SchemaLike | undefined;
66
- if (!schema) return {};
67
-
68
- const shape = getShape(schema);
69
- const fields = Object.entries(shape);
70
- const fieldByFlag = new Map<string, string>();
71
- const positionalFields: string[] = [];
72
-
73
- for (const [fieldName] of fields) {
74
- fieldByFlag.set(toFlagName(fieldName), fieldName);
75
- if (descriptor.meta.fields?.[fieldName]?.positional) {
76
- positionalFields.push(fieldName);
77
- }
78
- }
79
-
80
- const input: Record<string, unknown> = {};
81
- const positionals: string[] = [];
82
-
83
- for (let i = 0; i < argv.length; i += 1) {
84
- const token = argv[i];
85
- if (!token) continue;
86
-
87
- if (token.startsWith("--no-")) {
88
- const flagName = `--${token.slice(5)}`;
89
- const fieldName = fieldByFlag.get(flagName);
90
- if (!fieldName) throw new Error(`Unknown flag: ${token}`);
91
- input[fieldName] = false;
92
- continue;
93
- }
94
-
95
- if (token.startsWith("--")) {
96
- const [flag, inline] = token.split("=", 2);
97
- const fieldName = fieldByFlag.get(flag);
98
- if (!fieldName) throw new Error(`Unknown flag: ${token}`);
99
-
100
- const fieldSchema = shape[fieldName];
101
- if (isBooleanSchema(fieldSchema)) {
102
- input[fieldName] = inline ? coerceValue(inline, fieldSchema) : true;
103
- continue;
104
- }
105
-
106
- const next = inline ?? argv[i + 1];
107
-
108
- if (isArraySchema(fieldSchema)) {
109
- if (next === undefined || next.startsWith("--")) {
110
- throw new Error(`Missing value for ${flag}`);
111
- }
112
- input[fieldName] = next
113
- .split(",")
114
- .map((s: string) => s.trim())
115
- .filter(Boolean);
116
- if (!inline) i += 1;
117
- continue;
118
- }
119
-
120
- if (next === undefined || next.startsWith("--")) {
121
- throw new Error(`Missing value for ${flag}`);
122
- }
123
- input[fieldName] = coerceValue(next, fieldSchema);
124
- if (!inline) i += 1;
125
- continue;
126
- }
127
-
128
- positionals.push(token);
129
- }
130
-
131
- if (positionalFields.length > 0) {
132
- positionalFields.forEach((fieldName, index) => {
133
- const raw = positionals[index];
134
- if (raw !== undefined) {
135
- input[fieldName] = coerceValue(raw, shape[fieldName]);
136
- }
137
- });
138
- } else if (positionals.length > 0) {
139
- const candidate = fields.find(([, fieldSchema]) => !isBooleanSchema(fieldSchema));
140
- if (candidate) {
141
- const [fieldName, fieldSchema] = candidate;
142
- input[fieldName] = coerceValue(positionals[0], fieldSchema);
143
- }
144
- }
145
-
146
- return schema.parse(input);
147
- }
@@ -1,135 +0,0 @@
1
- import process from "node:process";
2
- import * as p from "@clack/prompts";
3
- import type { OverrideSection } from "../contract";
4
-
5
- function parseExtendsRef(ref: string): { account: string; gateway: string } | null {
6
- const normalized = ref.startsWith("bos://") ? ref : `bos://${ref}`;
7
- const match = normalized.match(/^bos:\/\/([^/]+)\/(.+)$/);
8
- if (!match) return null;
9
- return { account: match[1], gateway: match[2] };
10
- }
11
-
12
- function deriveAccountFromExtends(domain: string, extendsAccount: string): string {
13
- const firstSegment = domain.split(".")[0];
14
- if (!firstSegment) return "";
15
- const suffix = extendsAccount.includes(".")
16
- ? extendsAccount.substring(extendsAccount.indexOf(".") + 1)
17
- : extendsAccount;
18
- return `${firstSegment}.${suffix}`;
19
- }
20
-
21
- const OVERRIDE_OPTIONS: { value: OverrideSection; label: string; hint: string }[] = [
22
- { value: "ui", label: "ui", hint: "Override UI with local source" },
23
- { value: "api", label: "api", hint: "Override API with local source" },
24
- { value: "host", label: "host", hint: "Override host with local source" },
25
- { value: "plugins", label: "plugins", hint: "Override selected plugins with local source" },
26
- ];
27
-
28
- export async function promptInitOptions(input: {
29
- extends?: string;
30
- directory?: string;
31
- account?: string;
32
- domain?: string;
33
- plugins?: string[];
34
- overrides?: OverrideSection[];
35
- parentPluginKeys?: string[];
36
- }): Promise<{
37
- extendsAccount: string;
38
- extendsGateway: string;
39
- directory: string;
40
- account?: string;
41
- domain?: string;
42
- plugins: string[];
43
- overrides: OverrideSection[];
44
- }> {
45
- p.intro("Let's build an app...");
46
-
47
- const extendsInput =
48
- input.extends ??
49
- ((await p.text({
50
- message: "Extending an existing app?",
51
- placeholder: "bos://dev.everything.near/everything.dev",
52
- })) as string);
53
-
54
- if (p.isCancel(extendsInput)) process.exit(0);
55
-
56
- let extendsAccount = "dev.everything.near";
57
- let extendsGateway = "everything.dev";
58
-
59
- if (extendsInput) {
60
- const parsed = parseExtendsRef(extendsInput);
61
- if (parsed) {
62
- extendsAccount = parsed.account;
63
- extendsGateway = parsed.gateway;
64
- }
65
- }
66
-
67
- const domain =
68
- input.domain ??
69
- ((await p.text({
70
- message: "Starting with a domain?",
71
- placeholder: "no",
72
- })) as string);
73
-
74
- if (p.isCancel(domain)) process.exit(0);
75
-
76
- const accountDefault = domain ? deriveAccountFromExtends(domain, extendsAccount) : "";
77
- const account =
78
- input.account ??
79
- ((await p.text({
80
- message: "What NEAR account will you publish from?",
81
- placeholder: accountDefault || "skip",
82
- defaultValue: accountDefault,
83
- })) as string);
84
-
85
- if (p.isCancel(account)) process.exit(0);
86
-
87
- const directory = input.directory || domain || extendsGateway;
88
-
89
- const overrides =
90
- input.overrides ??
91
- ((await p.multiselect({
92
- message: "What do you want to customize?",
93
- options: OVERRIDE_OPTIONS,
94
- initialValues: ["ui", "api"] as OverrideSection[],
95
- required: false,
96
- })) as OverrideSection[]);
97
-
98
- if (p.isCancel(overrides)) process.exit(0);
99
-
100
- let plugins: string[] = [];
101
- if (overrides.includes("plugins")) {
102
- const parentPlugins = input.parentPluginKeys ?? [];
103
- const pluginOptions =
104
- parentPlugins.length > 0 ? parentPlugins.map((key) => ({ value: key, label: key })) : [];
105
-
106
- plugins =
107
- input.plugins ??
108
- (pluginOptions.length > 0
109
- ? ((await p.multiselect({
110
- message: "Select plugins to include:",
111
- options: pluginOptions,
112
- required: false,
113
- })) as string[])
114
- : []);
115
-
116
- if (p.isCancel(plugins)) process.exit(0);
117
- }
118
-
119
- const go = await p.confirm({
120
- message: "GO!",
121
- initialValue: true,
122
- });
123
-
124
- if (p.isCancel(go) || !go) process.exit(0);
125
-
126
- return {
127
- extendsAccount,
128
- extendsGateway,
129
- directory,
130
- account: account || undefined,
131
- domain: domain || undefined,
132
- plugins,
133
- overrides,
134
- };
135
- }
@@ -1,46 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
- import { join } from "node:path";
3
-
4
- export interface SyncSnapshot {
5
- parentRef: string;
6
- timestamp: string;
7
- files: Record<string, string>;
8
- }
9
-
10
- const SNAPSHOT_DIR = ".bos";
11
- const SNAPSHOT_FILE = "sync-snapshot.json";
12
-
13
- function snapshotPath(projectDir: string): string {
14
- return join(projectDir, SNAPSHOT_DIR, SNAPSHOT_FILE);
15
- }
16
-
17
- export async function readSnapshot(projectDir: string): Promise<SyncSnapshot | null> {
18
- const path = snapshotPath(projectDir);
19
- if (!existsSync(path)) {
20
- return null;
21
- }
22
- try {
23
- const content = readFileSync(path, "utf-8");
24
- return JSON.parse(content) as SyncSnapshot;
25
- } catch {
26
- return null;
27
- }
28
- }
29
-
30
- export async function writeSnapshot(
31
- projectDir: string,
32
- data: { parentRef: string; files: Record<string, string> },
33
- ): Promise<void> {
34
- const dir = join(projectDir, SNAPSHOT_DIR);
35
- if (!existsSync(dir)) {
36
- mkdirSync(dir, { recursive: true });
37
- }
38
-
39
- const snapshot: SyncSnapshot = {
40
- parentRef: data.parentRef,
41
- timestamp: new Date().toISOString(),
42
- files: data.files,
43
- };
44
-
45
- writeFileSync(snapshotPath(projectDir), `${JSON.stringify(snapshot, null, 2)}\n`);
46
- }
package/src/cli/status.ts DELETED
@@ -1,99 +0,0 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- import type { StatusResult } from "../contract";
4
- import { fetchBosConfigFromFastKv } from "../fastkv";
5
- import { readInstalledFrameworkVersion } from "./framework-version";
6
- import { readSnapshot } from "./snapshot";
7
-
8
- const FRAMEWORK_PACKAGES = ["everything-dev", "every-plugin"];
9
-
10
- const CATALOG_TOOL_PACKAGES = [
11
- "@rspack/core",
12
- "@rspack/cli",
13
- "@rsbuild/core",
14
- "@rsbuild/plugin-react",
15
- "@module-federation/enhanced",
16
- "@module-federation/node",
17
- "@module-federation/rsbuild-plugin",
18
- "@module-federation/runtime-core",
19
- "@module-federation/sdk",
20
- "@module-federation/dts-plugin",
21
- ] as const;
22
-
23
- async function fetchLatestNpmVersion(packageName: string): Promise<string | null> {
24
- try {
25
- const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`, {
26
- headers: { Accept: "application/json" },
27
- signal: AbortSignal.timeout(10_000),
28
- });
29
- if (!response.ok) return null;
30
- const data = (await response.json()) as { version: string };
31
- return data.version;
32
- } catch {
33
- return null;
34
- }
35
- }
36
-
37
- function readInstalledVersion(projectDir: string, packageName: string): string | undefined {
38
- return readInstalledFrameworkVersion(projectDir, packageName);
39
- }
40
-
41
- function checkEnvFile(projectDir: string): "found" | "missing" | "example-only" {
42
- if (existsSync(join(projectDir, ".env"))) return "found";
43
- if (existsSync(join(projectDir, ".env.example"))) return "example-only";
44
- return "missing";
45
- }
46
-
47
- async function checkParentReachable(extendsRef: string | undefined): Promise<boolean | undefined> {
48
- if (!extendsRef?.startsWith("bos://")) return undefined;
49
- try {
50
- const config = await fetchBosConfigFromFastKv(extendsRef);
51
- return config !== null;
52
- } catch {
53
- return false;
54
- }
55
- }
56
-
57
- export async function getStatus(projectDir: string): Promise<StatusResult> {
58
- const configPath = join(projectDir, "bos.config.json");
59
- if (!existsSync(configPath)) {
60
- return {
61
- status: "error",
62
- error: "No bos.config.json found in current directory",
63
- packages: [],
64
- envFile: "missing",
65
- };
66
- }
67
-
68
- const config = JSON.parse(readFileSync(configPath, "utf-8")) as Record<string, unknown>;
69
-
70
- const packages = [];
71
- for (const name of FRAMEWORK_PACKAGES) {
72
- const installed = readInstalledVersion(projectDir, name);
73
- const latest = await fetchLatestNpmVersion(name);
74
- packages.push({ name, installed, latest: latest ?? undefined });
75
- }
76
-
77
- for (const name of CATALOG_TOOL_PACKAGES) {
78
- const installed = readInstalledVersion(projectDir, name);
79
- if (!installed) continue;
80
- const latest = await fetchLatestNpmVersion(name);
81
- packages.push({ name, installed, latest: latest ?? undefined });
82
- }
83
-
84
- const snapshot = await readSnapshot(projectDir);
85
-
86
- const extendsRef = config.extends as string | undefined;
87
- const parentReachable = await checkParentReachable(extendsRef);
88
-
89
- return {
90
- status: "ok",
91
- extends: extendsRef,
92
- account: config.account as string | undefined,
93
- domain: config.domain as string | undefined,
94
- packages,
95
- lastSync: snapshot?.timestamp,
96
- envFile: checkEnvFile(projectDir),
97
- parentReachable,
98
- };
99
- }