everything-dev 1.16.0 → 1.16.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/dist/cli/upgrade.cjs +75 -7
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +74 -8
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli.cjs +2 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +2 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/config.cjs +2 -24
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +3 -25
- package/dist/config.mjs.map +1 -1
- package/dist/contract.cjs +2 -0
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +4 -0
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +4 -0
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +2 -2
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +2 -2
- package/dist/contract.meta.d.mts +2 -2
- package/dist/contract.meta.mjs +2 -2
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +2 -0
- package/dist/contract.mjs.map +1 -1
- package/dist/fastkv.cjs +0 -45
- package/dist/fastkv.cjs.map +1 -1
- package/dist/fastkv.d.cts +1 -19
- package/dist/fastkv.d.cts.map +1 -1
- package/dist/fastkv.d.mts +1 -19
- package/dist/fastkv.d.mts.map +1 -1
- package/dist/fastkv.mjs +1 -44
- package/dist/fastkv.mjs.map +1 -1
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/merge.cjs +4 -11
- package/dist/merge.cjs.map +1 -1
- package/dist/merge.d.cts.map +1 -1
- package/dist/merge.d.mts.map +1 -1
- package/dist/merge.mjs +4 -11
- package/dist/merge.mjs.map +1 -1
- package/dist/plugin.cjs +21 -31
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +2 -0
- package/dist/plugin.d.mts +2 -0
- package/dist/plugin.mjs +21 -31
- package/dist/plugin.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli/upgrade.ts +117 -6
- package/src/cli.ts +6 -0
- package/src/config.ts +5 -34
- package/src/contract.meta.ts +2 -2
- package/src/contract.ts +2 -0
- package/src/fastkv.ts +0 -72
- package/src/merge.ts +6 -19
- package/src/plugin.ts +15 -28
package/src/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
3
|
-
import { fetchBosConfigFromFastKv
|
|
3
|
+
import { fetchBosConfigFromFastKv } from "./fastkv";
|
|
4
4
|
import {
|
|
5
5
|
type BosEnv,
|
|
6
6
|
isPlainObject,
|
|
@@ -546,31 +546,6 @@ async function resolveRemotePluginRuntimeName(baseUrl: string, fallback: string)
|
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
interface ResolvedBosPlugin {
|
|
550
|
-
url: string;
|
|
551
|
-
integrity?: string;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
async function resolveBosPluginUrl(bosUrl: string): Promise<ResolvedBosPlugin | null> {
|
|
555
|
-
const parsed = parsePluginBosUrl(bosUrl);
|
|
556
|
-
if (!parsed) return null;
|
|
557
|
-
|
|
558
|
-
try {
|
|
559
|
-
const entry = await fetchPluginFromRegistry(parsed.accountId, parsed.pluginName);
|
|
560
|
-
if (!entry) return null;
|
|
561
|
-
|
|
562
|
-
const cdnUrl = entry.metadata.cdnUrl;
|
|
563
|
-
if (!cdnUrl) return null;
|
|
564
|
-
|
|
565
|
-
return {
|
|
566
|
-
url: cdnUrl,
|
|
567
|
-
integrity: entry.metadata.integrity ?? undefined,
|
|
568
|
-
};
|
|
569
|
-
} catch {
|
|
570
|
-
return null;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
|
|
574
549
|
async function buildRuntimePluginConfig(
|
|
575
550
|
pluginId: string,
|
|
576
551
|
config: BosConfigInput,
|
|
@@ -586,16 +561,12 @@ async function buildRuntimePluginConfig(
|
|
|
586
561
|
const sourceProduction = typeof source.production === "string" ? source.production : undefined;
|
|
587
562
|
const proxy = typeof apiConfig.proxy === "string" ? apiConfig.proxy : undefined;
|
|
588
563
|
const development = apiDevelopment ?? sourceDevelopment;
|
|
589
|
-
|
|
564
|
+
const production = apiProduction ?? sourceProduction;
|
|
590
565
|
|
|
591
566
|
if (production?.startsWith("bos://")) {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
if (resolved.integrity && env === "production") {
|
|
596
|
-
source.integrity = resolved.integrity;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
567
|
+
throw new Error(
|
|
568
|
+
`Plugin "${pluginId}" has unsupported production target "${production}". Use extends: "bos://account/domain" for plugin configs or a CDN URL for production.`,
|
|
569
|
+
);
|
|
599
570
|
}
|
|
600
571
|
|
|
601
572
|
const runtimeTarget =
|
package/src/contract.meta.ts
CHANGED
|
@@ -44,7 +44,7 @@ export const cliCommandMeta = {
|
|
|
44
44
|
fields: {
|
|
45
45
|
source: {
|
|
46
46
|
positional: true,
|
|
47
|
-
description: "Plugin source (local:path, bos://account/
|
|
47
|
+
description: "Plugin source (local:path, bos://account/domain, or URL)",
|
|
48
48
|
},
|
|
49
49
|
as: { description: "Plugin alias" },
|
|
50
50
|
production: { description: "Production URL override" },
|
|
@@ -113,7 +113,7 @@ export const cliCommandMeta = {
|
|
|
113
113
|
upgrade: {
|
|
114
114
|
commandPath: ["upgrade"],
|
|
115
115
|
summary: "Upgrade framework packages and sync template files",
|
|
116
|
-
interactive:
|
|
116
|
+
interactive: true,
|
|
117
117
|
fields: {
|
|
118
118
|
dryRun: { description: "Preview changes without writing" },
|
|
119
119
|
force: { description: "Overwrite user-modified files during sync" },
|
package/src/contract.ts
CHANGED
|
@@ -201,6 +201,8 @@ export const UpgradeResultSchema = z.object({
|
|
|
201
201
|
),
|
|
202
202
|
sync: SyncResultSchema.optional(),
|
|
203
203
|
migrated: z.array(z.string()).optional(),
|
|
204
|
+
availablePlugins: z.array(z.string()).optional(),
|
|
205
|
+
selectedPlugins: z.array(z.string()).optional(),
|
|
204
206
|
changelogUrl: z.string().optional(),
|
|
205
207
|
error: z.string().optional(),
|
|
206
208
|
});
|
package/src/fastkv.ts
CHANGED
|
@@ -139,78 +139,6 @@ export interface PluginManifest {
|
|
|
139
139
|
additionalExports?: Array<{ path: string; exports: string[]; sha256: string }>;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export interface PluginMetadata {
|
|
143
|
-
title: string | null;
|
|
144
|
-
description: string | null;
|
|
145
|
-
repoUrl: string | null;
|
|
146
|
-
version: string;
|
|
147
|
-
publishedAt: string;
|
|
148
|
-
cdnUrl: string;
|
|
149
|
-
integrity: string | null;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface PluginRegistryEntry {
|
|
153
|
-
manifest: PluginManifest;
|
|
154
|
-
metadata: PluginMetadata;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export function parsePluginBosUrl(
|
|
158
|
-
source: string,
|
|
159
|
-
): { accountId: string; pluginName: string } | null {
|
|
160
|
-
if (!source.startsWith("bos://")) return null;
|
|
161
|
-
const match = source.match(/^bos:\/\/([^/]+)\/plugins\/([^/]+)$/);
|
|
162
|
-
if (!match?.[1] || !match[2]) return null;
|
|
163
|
-
return { accountId: match[1], pluginName: match[2] };
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
async function fetchKvValue(accountId: string, key: string): Promise<unknown | null> {
|
|
167
|
-
const payload = await fetchJson<FastKvListResponse>(
|
|
168
|
-
`${getFastKvBaseUrlForAccount(accountId)}/v0/latest/${encodeURIComponent(getRegistryNamespaceForAccount(accountId))}/${encodeURIComponent(accountId)}`,
|
|
169
|
-
{
|
|
170
|
-
method: "POST",
|
|
171
|
-
body: JSON.stringify({ key, limit: 1 }),
|
|
172
|
-
},
|
|
173
|
-
);
|
|
174
|
-
const value = payload?.entries?.find(Boolean)?.value;
|
|
175
|
-
if (value == null) return null;
|
|
176
|
-
if (typeof value === "string") {
|
|
177
|
-
try {
|
|
178
|
-
return JSON.parse(value);
|
|
179
|
-
} catch {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return value;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export async function fetchPluginFromRegistry(
|
|
187
|
-
accountId: string,
|
|
188
|
-
pluginName: string,
|
|
189
|
-
): Promise<PluginRegistryEntry | null> {
|
|
190
|
-
const manifestKey = `plugins/${accountId}/${pluginName}/manifest.json`;
|
|
191
|
-
const metadataKey = `plugins/${accountId}/${pluginName}/metadata`;
|
|
192
|
-
|
|
193
|
-
const [rawManifest, rawMetadata] = await Promise.all([
|
|
194
|
-
fetchKvValue(accountId, manifestKey),
|
|
195
|
-
fetchKvValue(accountId, metadataKey),
|
|
196
|
-
]);
|
|
197
|
-
|
|
198
|
-
if (!rawManifest || typeof rawManifest !== "object") return null;
|
|
199
|
-
|
|
200
|
-
return {
|
|
201
|
-
manifest: rawManifest as PluginManifest,
|
|
202
|
-
metadata: (rawMetadata ?? {
|
|
203
|
-
title: null,
|
|
204
|
-
description: null,
|
|
205
|
-
repoUrl: null,
|
|
206
|
-
version: "",
|
|
207
|
-
publishedAt: "",
|
|
208
|
-
cdnUrl: "",
|
|
209
|
-
integrity: null,
|
|
210
|
-
}) as PluginMetadata,
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
142
|
export async function fetchRemotePluginManifest(cdnUrl: string): Promise<PluginManifest | null> {
|
|
215
143
|
try {
|
|
216
144
|
const baseUrl = cdnUrl.replace(/\/$/, "");
|
package/src/merge.ts
CHANGED
|
@@ -95,28 +95,15 @@ export function mergeBosConfigWithExtends(
|
|
|
95
95
|
parent: BosConfigInput,
|
|
96
96
|
child: BosConfigInput,
|
|
97
97
|
): BosConfigInput {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
for (const [key, rawValue] of Object.entries(child.plugins)) {
|
|
103
|
-
const value = rawValue as unknown;
|
|
104
|
-
if (value === null || value === false) {
|
|
105
|
-
delete plugins[key];
|
|
106
|
-
} else if (isPlainObject(plugins[key]) && isPlainObject(value)) {
|
|
107
|
-
plugins[key] = bosConfigMerger(
|
|
108
|
-
value as Record<string, unknown>,
|
|
109
|
-
plugins[key] as Record<string, unknown>,
|
|
110
|
-
);
|
|
111
|
-
} else {
|
|
112
|
-
plugins[key] = value;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
(merged as Record<string, unknown>).plugins = plugins;
|
|
116
|
-
} else if (child.plugins !== undefined) {
|
|
98
|
+
const { plugins: _ignoredParentPlugins, ...parentWithoutPlugins } = parent;
|
|
99
|
+
const merged = bosConfigMerger(child, parentWithoutPlugins) as BosConfigInput;
|
|
100
|
+
|
|
101
|
+
if (child.plugins !== undefined && isPlainObject(child.plugins)) {
|
|
117
102
|
(merged as Record<string, unknown>).plugins = cleanNullSentinels(
|
|
118
103
|
child.plugins as Record<string, unknown>,
|
|
119
104
|
);
|
|
105
|
+
} else {
|
|
106
|
+
delete (merged as Record<string, unknown>).plugins;
|
|
120
107
|
}
|
|
121
108
|
|
|
122
109
|
const mergedRecord = merged as Record<string, unknown>;
|
package/src/plugin.ts
CHANGED
|
@@ -711,32 +711,19 @@ export default createPlugin({
|
|
|
711
711
|
pluginDomain = `${input.key}.${deps.bosConfig.domain ?? "everything.dev"}`;
|
|
712
712
|
}
|
|
713
713
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
const registryEntries: Record<string, string> = {
|
|
717
|
-
[`plugins/${account}/${input.key}/manifest.json`]: JSON.stringify(manifest),
|
|
718
|
-
[`plugins/${account}/${input.key}/metadata`]: JSON.stringify({
|
|
719
|
-
title: null,
|
|
720
|
-
description: null,
|
|
721
|
-
repoUrl: deps.bosConfig.repository ?? null,
|
|
722
|
-
version,
|
|
723
|
-
publishedAt: new Date().toISOString(),
|
|
724
|
-
cdnUrl: publishedUrl,
|
|
725
|
-
integrity,
|
|
726
|
-
}),
|
|
727
|
-
[`plugins/${account}/${input.key}/versions/${version}/manifest.json`]:
|
|
728
|
-
JSON.stringify(manifest),
|
|
729
|
-
};
|
|
714
|
+
try {
|
|
715
|
+
const registryEntries: Record<string, string> = {};
|
|
730
716
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
717
|
+
if (existsSync(pluginConfigPath)) {
|
|
718
|
+
try {
|
|
719
|
+
const publishedPluginConfig = JSON.parse(readFileSync(pluginConfigPath, "utf-8"));
|
|
720
|
+
delete publishedPluginConfig.development;
|
|
721
|
+
registryEntries[`apps/${account}/${pluginDomain}/bos.config.json`] =
|
|
722
|
+
JSON.stringify(publishedPluginConfig);
|
|
723
|
+
} catch {}
|
|
724
|
+
}
|
|
739
725
|
|
|
726
|
+
if (Object.keys(registryEntries).length > 0) {
|
|
740
727
|
const payload = JSON.stringify(registryEntries);
|
|
741
728
|
const argsBase64 = Buffer.from(payload).toString("base64");
|
|
742
729
|
const privateKey = process.env.NEAR_PRIVATE_KEY || process.env.BOS_NEAR_PRIVATE_KEY;
|
|
@@ -763,11 +750,11 @@ export default createPlugin({
|
|
|
763
750
|
);
|
|
764
751
|
}
|
|
765
752
|
}
|
|
766
|
-
} catch (registryError) {
|
|
767
|
-
console.warn(
|
|
768
|
-
`[publish] Plugin registry write skipped: ${registryError instanceof Error ? registryError.message : registryError}`,
|
|
769
|
-
);
|
|
770
753
|
}
|
|
754
|
+
} catch (registryError) {
|
|
755
|
+
console.warn(
|
|
756
|
+
`[publish] Plugin registry write skipped: ${registryError instanceof Error ? registryError.message : registryError}`,
|
|
757
|
+
);
|
|
771
758
|
}
|
|
772
759
|
|
|
773
760
|
await generateCodeArtifacts(deps.configDir, deps.bosConfig);
|