@superblocksteam/sdk 2.0.141-next.0 → 2.0.141-next.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/.turbo/turbo-build.log +1 -1
- package/dist/cli-replacement/dependency-install-classifier.d.mts +2 -6
- package/dist/cli-replacement/dependency-install-classifier.d.mts.map +1 -1
- package/dist/cli-replacement/dependency-install-classifier.mjs +1 -1
- package/dist/cli-replacement/dependency-install-classifier.mjs.map +1 -1
- package/dist/cli-replacement/dev.d.mts.map +1 -1
- package/dist/cli-replacement/dev.mjs +74 -27
- package/dist/cli-replacement/dev.mjs.map +1 -1
- package/dist/cli-replacement/disk-space.d.mts +7 -19
- package/dist/cli-replacement/disk-space.d.mts.map +1 -1
- package/dist/cli-replacement/disk-space.mjs +2 -2
- package/dist/cli-replacement/disk-space.mjs.map +1 -1
- package/dist/cli-replacement/home-npmrc.d.mts +4 -3
- package/dist/cli-replacement/home-npmrc.d.mts.map +1 -1
- package/dist/cli-replacement/normalize-workspace-protocol.d.ts +1 -1
- package/dist/cli-replacement/normalize-workspace-protocol.d.ts.map +1 -1
- package/dist/cli-replacement/package-json-snapshot.d.mts +0 -1
- package/dist/cli-replacement/package-json-snapshot.d.mts.map +1 -1
- package/dist/cli-replacement/package-json-snapshot.mjs +1 -1
- package/dist/cli-replacement/package-json-snapshot.mjs.map +1 -1
- package/dist/cli-replacement/post-upgrade-lockfile-strip.d.mts +3 -2
- package/dist/cli-replacement/post-upgrade-lockfile-strip.d.mts.map +1 -1
- package/dist/cli-replacement/version-detection.d.ts +2 -1
- package/dist/cli-replacement/version-detection.d.ts.map +1 -1
- package/dist/client.d.ts +6 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/collect-sdk-apis.d.mts +4 -3
- package/dist/collect-sdk-apis.d.mts.map +1 -1
- package/dist/dev-utils/dedupe-async.d.ts +2 -1
- package/dist/dev-utils/dedupe-async.d.ts.map +1 -1
- package/dist/dev-utils/dev-server-metrics.d.mts +4 -3
- package/dist/dev-utils/dev-server-metrics.d.mts.map +1 -1
- package/dist/dev-utils/dev-server-metrics.mjs +3 -2
- package/dist/dev-utils/dev-server-metrics.mjs.map +1 -1
- package/dist/dev-utils/dev-server.d.mts +5 -1
- package/dist/dev-utils/dev-server.d.mts.map +1 -1
- package/dist/dev-utils/dev-server.mjs +12 -18
- package/dist/dev-utils/dev-server.mjs.map +1 -1
- package/dist/dev-utils/dev-server.optimize-deps.test.d.mts +2 -0
- package/dist/dev-utils/dev-server.optimize-deps.test.d.mts.map +1 -0
- package/dist/dev-utils/dev-server.optimize-deps.test.mjs +490 -0
- package/dist/dev-utils/dev-server.optimize-deps.test.mjs.map +1 -0
- package/dist/dev-utils/fatal-exit.d.mts +3 -2
- package/dist/dev-utils/fatal-exit.d.mts.map +1 -1
- package/dist/dev-utils/optimize-deps-config.d.mts +16 -0
- package/dist/dev-utils/optimize-deps-config.d.mts.map +1 -0
- package/dist/dev-utils/optimize-deps-config.mjs +95 -0
- package/dist/dev-utils/optimize-deps-config.mjs.map +1 -0
- package/dist/dev-utils/prepare-in-place-restart.d.mts +4 -3
- package/dist/dev-utils/prepare-in-place-restart.d.mts.map +1 -1
- package/dist/dev-utils/vite-dev-server-diagnostics.d.mts +1 -1
- package/dist/dev-utils/vite-dev-server-diagnostics.d.mts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/parse-sdk-registry.d.mts +2 -2
- package/dist/parse-sdk-registry.d.mts.map +1 -1
- package/dist/parse-sdk-registry.mjs.map +1 -1
- package/dist/sdk.d.ts +0 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +0 -1
- package/dist/sdk.js.map +1 -1
- package/dist/telemetry/attributes.d.ts +0 -1
- package/dist/telemetry/attributes.d.ts.map +1 -1
- package/dist/telemetry/attributes.js +0 -2
- package/dist/telemetry/attributes.js.map +1 -1
- package/dist/telemetry/local-obs.d.ts +0 -30
- package/dist/telemetry/local-obs.d.ts.map +1 -1
- package/dist/telemetry/local-obs.js +1 -1
- package/dist/telemetry/local-obs.js.map +1 -1
- package/dist/telemetry/logging.d.ts +2 -1
- package/dist/telemetry/logging.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/cli-replacement/dependency-install-classifier.mts +2 -2
- package/src/cli-replacement/dev.mts +118 -34
- package/src/cli-replacement/disk-space.mts +8 -9
- package/src/cli-replacement/home-npmrc.mts +3 -3
- package/src/cli-replacement/normalize-workspace-protocol.ts +1 -1
- package/src/cli-replacement/package-json-snapshot.mts +1 -1
- package/src/cli-replacement/post-upgrade-lockfile-strip.mts +2 -2
- package/src/cli-replacement/version-detection.ts +1 -1
- package/src/client.ts +6 -6
- package/src/collect-sdk-apis.mts +3 -3
- package/src/dev-utils/dedupe-async.ts +1 -1
- package/src/dev-utils/dev-server-metrics.mts +4 -2
- package/src/dev-utils/dev-server.mts +23 -17
- package/src/dev-utils/dev-server.optimize-deps.test.mts +671 -0
- package/src/dev-utils/fatal-exit.mts +2 -2
- package/src/dev-utils/optimize-deps-config.mts +96 -0
- package/src/dev-utils/prepare-in-place-restart.mts +3 -3
- package/src/dev-utils/vite-dev-server-diagnostics.mts +1 -1
- package/src/index.ts +0 -7
- package/src/parse-sdk-registry.mts +1 -2
- package/src/sdk.ts +0 -5
- package/src/telemetry/attributes.ts +0 -2
- package/src/telemetry/local-obs.ts +2 -2
- package/src/telemetry/logging.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { UserConfig } from "vite";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared `optimizeDeps` config for both the pre-warm and activation Vite
|
|
5
|
+
* servers (see `dev-server.mts`).
|
|
6
|
+
*
|
|
7
|
+
* Vite includes the stringified `optimizeDeps` config in its dep cache hash, so
|
|
8
|
+
* both servers must use identical config or activation will discard the
|
|
9
|
+
* pre-warmed cache and re-run full dependency optimization.
|
|
10
|
+
*
|
|
11
|
+
* Lives in its own module (rather than inline in `dev-server.mts`) so the
|
|
12
|
+
* dep-pre-bundling contract can be asserted in tests without importing the
|
|
13
|
+
* entire dev-server module graph (vite + express + file-sync + telemetry).
|
|
14
|
+
* See `dev-server.optimize-deps.test.mts`.
|
|
15
|
+
*/
|
|
16
|
+
export const OPTIMIZE_DEPS_CONFIG: UserConfig["optimizeDeps"] = {
|
|
17
|
+
// Crawl app source (not just the HTML entry graph) during the cold-start dep
|
|
18
|
+
// scan so lazily/dynamically imported deps (`@radix-ui/*`, `lucide-react/*`
|
|
19
|
+
// icons behind route/code-splits) are pre-bundled up front. Without this,
|
|
20
|
+
// Vite discovers them at runtime and forces an "optimized dependencies
|
|
21
|
+
// changed. reloading" full-page reload that drops the editor websocket
|
|
22
|
+
// (close 1001) mid Clark generation (APPS-4576).
|
|
23
|
+
//
|
|
24
|
+
// `entries` is NOT part of Vite's optimizeDeps config hash (verified against
|
|
25
|
+
// Vite 6.4.2: `getConfigHash` in `dist/node/chunks/dep-*.js` hashes only
|
|
26
|
+
// `optimizeDeps.{include,exclude,esbuildOptions}`, never `entries`), so adding
|
|
27
|
+
// it cannot desync the pre-warm vs activation dep cache. Re-verify after a
|
|
28
|
+
// Vite upgrade: if `entries` ever enters the hash, the pre-warm cache would be
|
|
29
|
+
// discarded on activation whenever the two servers scan different source trees.
|
|
30
|
+
// `node_modules`/`outDir` are always excluded by Vite.
|
|
31
|
+
//
|
|
32
|
+
// The source globs cover every extension a generated app can import a heavy
|
|
33
|
+
// dep from (`.ts` utilities, not just `.tsx`/`.jsx` components), so a future
|
|
34
|
+
// `.ts` module importing a tree-shakeable dep is still pre-bundled. `**/*.html`
|
|
35
|
+
// preserves the default HTML-entry discovery; the `!` patterns keep the scan
|
|
36
|
+
// off the externalized custom-component dir and the drafts dir (both
|
|
37
|
+
// watch-ignored elsewhere) so churny user content can't slow or fail the
|
|
38
|
+
// cold-start scan.
|
|
39
|
+
//
|
|
40
|
+
// Node-side files must never become browser dep-scan entries. A generated
|
|
41
|
+
// app's `vite.config.ts` imports `@tailwindcss/vite`, and a fullstack app's
|
|
42
|
+
// `server/**` imports Node/native packages; when those files are scan entries
|
|
43
|
+
// esbuild follows their imports into build-time-only packages and aborts the
|
|
44
|
+
// whole browser optimize — `@tailwindcss/oxide` has no `.node` loader (see
|
|
45
|
+
// esbuildOptions below) and `lightningcss` fails to resolve its generated
|
|
46
|
+
// `../pkg` binding ("Could not resolve \"../pkg\""). Either crashes cold-start
|
|
47
|
+
// pre-warm for *every* tailwind-v4 app, so exclude config files and the server
|
|
48
|
+
// tree up front rather than trying to make esbuild tolerate every native dep.
|
|
49
|
+
entries: [
|
|
50
|
+
"**/*.html",
|
|
51
|
+
"**/*.{js,ts,jsx,tsx}",
|
|
52
|
+
"!custom/**",
|
|
53
|
+
"!.superblocks/**",
|
|
54
|
+
"!**/*.config.{js,ts,mjs,mts,cjs,cts}",
|
|
55
|
+
"!server/**",
|
|
56
|
+
],
|
|
57
|
+
// Force-bundle deps the cold-start scan structurally cannot discover, so they
|
|
58
|
+
// aren't found at runtime and don't trigger their own reload (verified on an
|
|
59
|
+
// EE warm-pool box: without this, a freshly-generated app still reloads once
|
|
60
|
+
// on first render for the JSX runtime — APPS-4576).
|
|
61
|
+
//
|
|
62
|
+
// The scan's esbuild uses the DEFAULT (react) JSX runtime, so it emits
|
|
63
|
+
// `react/jsx-runtime` imports and pre-bundles those — but never
|
|
64
|
+
// `@superblocksteam/library/jsx-dev-runtime`, even though every generated app
|
|
65
|
+
// sets `jsxImportSource: "@superblocksteam/library"` and pulls that runtime in
|
|
66
|
+
// at serve time. Force-including it pre-bundles it up front. An unresolvable
|
|
67
|
+
// `include` entry is a no-op (Vite warns and skips), so an app that somehow
|
|
68
|
+
// lacks the library never fails cold-start over this.
|
|
69
|
+
include: ["@superblocksteam/library/jsx-dev-runtime"],
|
|
70
|
+
// `@superblocksteam/sdk-api` is a VIRTUAL module the `sb-sdk-api-entry-point`
|
|
71
|
+
// plugin serves (not a real package), imported by generated app code. Left to
|
|
72
|
+
// the optimizer it gets discovered as a "new dependency" on first import and
|
|
73
|
+
// forces a reload; excluding it keeps the dep optimizer from ever trying to
|
|
74
|
+
// pre-bundle or re-optimize it (the plugin serves it as-is). `include` cannot
|
|
75
|
+
// fix this one — there is no real file for esbuild to pre-bundle.
|
|
76
|
+
exclude: ["@superblocksteam/sdk-api"],
|
|
77
|
+
esbuildOptions: {
|
|
78
|
+
supported: {
|
|
79
|
+
destructuring: true,
|
|
80
|
+
},
|
|
81
|
+
// Tolerate native `.node` addons reached during the cold-start scan. The
|
|
82
|
+
// widened `entries` glob crawls Node-side app files too (a fullstack app's
|
|
83
|
+
// `vite.config.ts` imports `@tailwindcss/vite`, which pulls in the native
|
|
84
|
+
// `@tailwindcss/oxide` `tailwindcss-oxide.<platform>.node`). esbuild has no
|
|
85
|
+
// loader for `.node`, so bundling such a dep aborts the whole optimize with
|
|
86
|
+
// "Build failed ... No loader is configured for \".node\" files", which
|
|
87
|
+
// stops the dev server from serving and leaves the editor websocket stuck
|
|
88
|
+
// "released" after a respawn (APPS-4576, PR #19858 CI). A native addon
|
|
89
|
+
// reached during the *browser* dep optimize is always build-time-only and
|
|
90
|
+
// never executed in the browser, so emptying it is safe and keeps the
|
|
91
|
+
// cold-start scan from crashing on any native dependency, not just oxide.
|
|
92
|
+
loader: {
|
|
93
|
+
".node": "empty",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
@@ -3,11 +3,11 @@ import { RESTART_REASON_FLIP_RESTART } from "@superblocksteam/library-shared/res
|
|
|
3
3
|
/** Upper bound on the pre-exit IPC handshake to the parent supervisor. */
|
|
4
4
|
const RESTART_REASON_IPC_TIMEOUT_MS = 1000;
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface PrepareInPlaceRestartLogger {
|
|
7
7
|
warn(message: string, meta?: Record<string, unknown>): void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
interface PrepareInPlaceRestartServices {
|
|
11
11
|
aiService?: {
|
|
12
12
|
chatSessionStore: { invalidateCache(): void };
|
|
13
13
|
};
|
|
@@ -17,7 +17,7 @@ export interface PrepareInPlaceRestartServices {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
interface PrepareInPlaceRestartOptions {
|
|
21
21
|
flipRestart?: true;
|
|
22
22
|
logger?: PrepareInPlaceRestartLogger;
|
|
23
23
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/** Maximum characters of raw Vite/esbuild output stored on the error meta stack field. */
|
|
7
7
|
export const VITE_ERROR_RAW_LOG_MAX_CHARS = 12_000;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type ViteBuildErrorDiagnostic =
|
|
10
10
|
| {
|
|
11
11
|
category: "module_resolve";
|
|
12
12
|
/** Package specifier esbuild could not resolve, when detected. */
|
package/src/index.ts
CHANGED
|
@@ -70,13 +70,6 @@ export {
|
|
|
70
70
|
|
|
71
71
|
export { AUTO_UPGRADE_EXIT_CODE } from "./cli-replacement/automatic-upgrades.js";
|
|
72
72
|
export { RESTART_EXIT_CODE } from "./dev-utils/dev-server.mjs";
|
|
73
|
-
// Surfaces the canonical restart-contract markers alongside RESTART_EXIT_CODE so
|
|
74
|
-
// the builtins-only CLI parent copies can be drift-checked against it in tests.
|
|
75
|
-
export {
|
|
76
|
-
RESTART_REASON_ENV,
|
|
77
|
-
RESTART_REASON_FLIP_RESTART,
|
|
78
|
-
RESTART_SUPERVISED_ENV,
|
|
79
|
-
} from "@superblocksteam/library-shared/restart-contract";
|
|
80
73
|
|
|
81
74
|
export { createDevServer, preWarmViteCache } from "./dev-utils/dev-server.mjs";
|
|
82
75
|
export {
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
type RegistryKeyToEntry,
|
|
7
7
|
} from "@superblocksteam/vite-plugin-file-sync/parsing";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
export type { RegistryKeyToEntry };
|
|
9
|
+
type RegistryKeyToPath = Map<string, string>;
|
|
11
10
|
|
|
12
11
|
type PathExists = (p: string) => Promise<boolean>;
|
|
13
12
|
const RESOLUTION_EXTENSIONS = [".ts", ".tsx", ".js"] as const;
|
package/src/sdk.ts
CHANGED
|
@@ -110,11 +110,6 @@ import type { DeploymentHistoryEntryDto, UserMeDto } from "./types/index.js";
|
|
|
110
110
|
|
|
111
111
|
// Exporting here instead of index.ts because only sdk.ts is exposed outside in package.json
|
|
112
112
|
export * from "./errors.js";
|
|
113
|
-
export {
|
|
114
|
-
RESTART_REASON_ENV,
|
|
115
|
-
RESTART_REASON_FLIP_RESTART,
|
|
116
|
-
RESTART_SUPERVISED_ENV,
|
|
117
|
-
} from "@superblocksteam/library-shared/restart-contract";
|
|
118
113
|
|
|
119
114
|
export class SuperblocksSdk {
|
|
120
115
|
token = "";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// NOTE: @joeyagreco - this is how the "env" facet is determined in datadog: https://docs.datadoghq.com/opentelemetry/setup/collector_exporter/#3---configure-your-application
|
|
2
|
-
export const ATTR_DEPLOYMENT_ENVIRONMENT = "deployment.environment";
|
|
3
1
|
// NOTE: @joeyagreco - this can be used to determine if we are using mock-csb, staging-csb, prod-csb, etc
|
|
4
2
|
export const ATTR_SUPERBLOCKS_BASE_URL = "superblocks.base_url";
|
|
5
3
|
export const ATTR_SUPERBLOCKS_IS_CSB = "superblocks.is_csb";
|
|
@@ -34,7 +34,7 @@ import { DeploymentTypeEnum } from "@superblocksteam/shared";
|
|
|
34
34
|
const DEFAULT_LOCAL_OTEL_ENDPOINT = "http://localhost:4318";
|
|
35
35
|
const DEFAULT_ML_APP_NAME = "superblocks-ai-code-gen";
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
interface LocalObsConfig {
|
|
38
38
|
/** Whether local observability mode is enabled */
|
|
39
39
|
enabled: boolean;
|
|
40
40
|
/** OTEL endpoint for traces, metrics, logs */
|
|
@@ -85,7 +85,7 @@ export function isLocalObsEnabled(): boolean {
|
|
|
85
85
|
*
|
|
86
86
|
* @returns LocalObsConfig if local obs is enabled, null otherwise
|
|
87
87
|
*/
|
|
88
|
-
|
|
88
|
+
function getLocalObsConfig(): LocalObsConfig | null {
|
|
89
89
|
if (!isLocalObsEnabled()) {
|
|
90
90
|
return null;
|
|
91
91
|
}
|
package/src/telemetry/logging.ts
CHANGED
|
@@ -73,7 +73,7 @@ export interface ErrorMeta {
|
|
|
73
73
|
* facets), so values must stay low-cardinality-friendly (enums/ids/numbers),
|
|
74
74
|
* not free-form text.
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
type LogAttributes = Record<string, string | number | boolean>;
|
|
77
77
|
|
|
78
78
|
export interface Logger {
|
|
79
79
|
debug: (...messages: unknown[]) => void;
|