builder.io 1.6.9 → 1.6.12

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 (59) hide show
  1. package/cli/index.cjs +319 -321
  2. package/cli/index.cjs.map +4 -4
  3. package/cli/main.cjs +2 -2
  4. package/core/index.cjs +58 -58
  5. package/core/index.mjs +58 -58
  6. package/figma/jsx-runtime/index.d.ts +2 -2
  7. package/figma/jsx-runtime/prop-types.d.ts +9 -9
  8. package/figma/jsx-runtime/react.d.ts +101 -105
  9. package/node/index.cjs +46 -47
  10. package/node/index.mjs +46 -47
  11. package/package.json +1 -1
  12. package/remix/build.cjs +1 -1
  13. package/remix/index.mjs +1 -1
  14. package/remix/server-build/index.cjs +3 -3
  15. package/server/index.cjs +137 -137
  16. package/server/index.mjs +138 -138
  17. package/types/_tests_/code.e2e.d.ts +1 -0
  18. package/types/_tests_/create-builder.e2e.d.ts +1 -0
  19. package/types/_tests_/figma-generate.e2e.d.ts +1 -0
  20. package/types/_tests_/figma-publish.e2e.d.ts +1 -0
  21. package/types/_tests_/help.e2e.d.ts +1 -0
  22. package/types/_tests_/utils.d.ts +42 -0
  23. package/types/_tests_/vitest.config.d.ts +2 -0
  24. package/types/cli/builder-add/options.d.ts +1 -1
  25. package/types/cli/code-file-utils.d.ts +1 -1
  26. package/types/cli/code.d.ts +1 -1
  27. package/types/cli/credentials.d.ts +1 -1
  28. package/types/cli/figma-publish.d.ts +3 -1
  29. package/types/cli/generate.d.ts +2 -2
  30. package/types/cli/index.d.ts +2 -0
  31. package/types/cli/spinner.d.ts +0 -1
  32. package/types/cli/track.d.ts +1 -1
  33. package/types/common/ast/component-input-types.d.ts +1 -1
  34. package/types/common/builder/builder-api.d.ts +1 -1
  35. package/types/common/builder/content-generation.d.ts +1 -1
  36. package/types/common/test-utils.d.ts +1 -1
  37. package/types/core/adapters/next/next-test-utils.d.ts +5 -5
  38. package/types/core/adapters/react/react-test-utils.d.ts +2 -2
  39. package/types/core/adapters/remix/remix-test-utils.d.ts +2 -2
  40. package/types/figma/index.d.ts +0 -1
  41. package/types/server/request-handler.d.ts +0 -1
  42. package/types/tsconfig.tsbuildinfo +1 -0
  43. package/types/types.d.ts +1 -1
  44. package/types/vitest.config.d.ts +2 -0
  45. package/vite/index.cjs +3 -3
  46. package/vite/index.d.ts +1 -1
  47. package/vite/index.mjs +3 -3
  48. package/webpack/index.cjs +1 -1
  49. package/webpack/index.d.ts +1 -1
  50. package/webpack/index.mjs +1 -1
  51. package/types/cli/kv.d.ts +0 -20
  52. package/types/cli/main.d.cts +0 -2
  53. package/types/figma/jsx-runtime/index.d.cts +0 -2
  54. package/types/figma/jsx-runtime/index.d.ts +0 -2
  55. package/types/next/index.d.cts +0 -4
  56. package/types/next/index.d.mts +0 -4
  57. package/types/remix/index-shim.d.cts +0 -2
  58. /package/types/vite/{index.d.ts → main.d.ts} +0 -0
  59. /package/types/webpack/{index.d.ts → main.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ import { type ExpectStatic } from "vitest";
2
+ interface CLI {
3
+ output(): string;
4
+ consumeOutput(): string;
5
+ inputText(text: string): Promise<void>;
6
+ inputEnter(text?: string): Promise<void>;
7
+ inputArrowUp(): Promise<void>;
8
+ inputArrowDown(): Promise<void>;
9
+ inputArrowRight(): Promise<void>;
10
+ inputArrowLeft(): Promise<void>;
11
+ inputCtrlC(): Promise<void>;
12
+ inputSpace(): Promise<void>;
13
+ waitUntilText(text: string, timeout?: number): Promise<void>;
14
+ waitUntilExit(): Promise<number>;
15
+ wait(ms: number): Promise<void>;
16
+ writeFile(path: string, content: string): Promise<void>;
17
+ readFile(path: string): string;
18
+ exists(path: string): boolean;
19
+ readdir(path: string): string[];
20
+ fsSnapshot(path: string): Promise<Snapshot>;
21
+ fsDiff(oldSnap: Snapshot): Promise<{
22
+ added: string[];
23
+ removed: string[];
24
+ modified: string[];
25
+ }>;
26
+ npm(...args: string[]): Promise<number>;
27
+ }
28
+ export declare function testCLI(name: string, template: string | undefined, handler: (cli: Handler, expect: ExpectStatic) => Promise<void>, timeout?: number): void;
29
+ type Handler = (cmd: "builderio" | "create-builderio", args: string[], options?: {
30
+ debug?: boolean;
31
+ }) => CLI;
32
+ export declare function createCLI(template: string | undefined, handler: (cli: Handler) => Promise<void>): Promise<void>;
33
+ /**
34
+ * A snapshot maps a file's relative path to its hash.
35
+ */
36
+ type Snapshot = {
37
+ cwd: string;
38
+ hashes: {
39
+ [file: string]: string;
40
+ };
41
+ };
42
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vitest/config").UserConfigFnObject;
2
+ export default _default;
@@ -1,2 +1,2 @@
1
- import type { AddCliOptions } from "packages/dev-tools/types";
1
+ import type { AddCliOptions } from "../../types";
2
2
  export declare function getOptions(cwd: string, args: string[]): AddCliOptions;
@@ -32,7 +32,7 @@ export declare function calculateMaxFileTokens(fileImportance: number, highImpor
32
32
  /**
33
33
  * Get recently modified files using git commands with commit relationship tracking
34
34
  */
35
- export declare function getGitModifiedFiles(appRootDir: string, commitCount?: number): Promise<Map<string, GitFileInfo>>;
35
+ export declare function getGitModifiedFiles(sys: DevToolsSys, appRootDir: string, commitCount?: number): Promise<Map<string, GitFileInfo>>;
36
36
  /**
37
37
  * Update file relationships based on files modified in the same commit
38
38
  */
@@ -44,6 +44,6 @@ export declare const runCodeCommand: (sys: DevToolsSys, subCommand: string, args
44
44
  export declare const runCodeGen: (sys: DevToolsSys, args: CLIArgs) => Promise<undefined>;
45
45
  export declare function createApp(userId: string, spaceId: string, privateKey: string, body: any): Promise<void>;
46
46
  export declare function transformStream(body: ReadableStream<Uint8Array> | null): AsyncGenerator<string, void, unknown>;
47
- export declare function checkProjectRoot(sys: DevToolsSys): Promise<void>;
47
+ export declare function checkProjectRoot(sys: DevToolsSys, interactive: boolean): Promise<undefined>;
48
48
  export declare function getUserContext(sys: DevToolsSys): Promise<UserContext>;
49
49
  export {};
@@ -44,6 +44,6 @@ export interface Credentials {
44
44
  userId?: string;
45
45
  }
46
46
  export declare const getCredentials: (sys: DevToolsSys, args: CLIArgs, opts: CredentialsOptions) => Promise<Credentials>;
47
- export declare function getFigmaAuth(): Promise<FigmaAuth>;
47
+ export declare function getFigmaAuth(sys: DevToolsSys): Promise<FigmaAuth>;
48
48
  export declare function getBuilderCodegenUsage(builderPublicKey: string, builderPrivateKey: string): Promise<BuilderCodegenUsage>;
49
49
  export declare function getBuilderAuth(sys: DevToolsSys, preferSpaceId?: string): Promise<BuilderAuth>;
@@ -1,6 +1,7 @@
1
1
  import type { DevTools, DevToolsSys, RepoInfo } from "../types";
2
2
  import type { CLIArgs } from "./index";
3
3
  import { type FigmaBuilderLink } from "./figma-utils";
4
+ import { type UserContext } from "./code";
4
5
  export declare const runFigmaPublish: (sys: DevToolsSys, args: CLIArgs) => Promise<undefined>;
5
6
  export declare const FIGMA_CONNECT_CALL = "figmaMapping";
6
7
  export declare function findAllMappingFiles(sys: DevToolsSys): Promise<string[]>;
@@ -14,8 +15,9 @@ export interface PublishedMapping {
14
15
  spaceId: string;
15
16
  privateKey: string;
16
17
  userId: string;
18
+ userContext: UserContext;
17
19
  }
18
- export declare function findMappingsFromFiles({ force, mappingFiles, print, sys, }: {
20
+ export declare function findMappingsFromFiles({ sys, force, mappingFiles, print, }: {
19
21
  force?: boolean;
20
22
  mappingFiles: string[];
21
23
  print: boolean;
@@ -1,11 +1,11 @@
1
- import type { ComponentInfo, DevToolsSys } from "../types";
1
+ import type { ComponentInfo, ComponentRegistry, DevToolsSys } from "../types";
2
2
  import type { CLIArgs } from "./index";
3
3
  import { type UserContext } from "./code";
4
4
  import { type FigmaComponentInfo } from "./figma-utils";
5
5
  export declare const runFigmaGenerate: (sys: DevToolsSys, args: CLIArgs) => Promise<undefined>;
6
6
  export interface MappingCodeV3 {
7
7
  figmaNode: FigmaComponentInfo;
8
- componentNames: string[];
8
+ registry: ComponentRegistry;
9
9
  userContext?: UserContext;
10
10
  figmaUrl: string;
11
11
  docsUrl?: string;
@@ -31,6 +31,8 @@ export interface CLIArgs {
31
31
  mode?: "precise" | "creative";
32
32
  /** Working directory to run commands from */
33
33
  cwd?: string;
34
+ /** Debug mode */
35
+ debug?: boolean;
34
36
  /** Raw command line arguments */
35
37
  _: string[];
36
38
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare const spinner: () => {
3
2
  start: (msg?: string) => void;
4
3
  stop: (msg?: string, code?: number) => void;
@@ -1,4 +1,4 @@
1
1
  import * as Amplitude from "@amplitude/analytics-node";
2
- export declare function initTracking(): Promise<void>;
2
+ export declare function initTracking(verbose: boolean): Promise<void>;
3
3
  export declare function track(eventName: string, options: Record<string, any>): Promise<Amplitude.Types.Result>;
4
4
  export declare function setUserId(id: string): Promise<void>;
@@ -17,7 +17,7 @@ export declare const NUMBER_TYPES: string[];
17
17
  export declare const BOOLEAN_TYPES: string[];
18
18
  export declare const ARRAY_TYPES: string[];
19
19
  export declare const OBJECT_TYPES: string[];
20
- export declare function getPrimitiveType(t: string): "string" | "number" | "boolean" | "object" | "array";
20
+ export declare function getPrimitiveType(t: string): "number" | "string" | "boolean" | "object" | "array";
21
21
  export declare function removeQuotes(text: string): string;
22
22
  export declare const resolveType: (sys: DevToolsSys, checker: ts.TypeChecker, type: ts.Type) => string[] | undefined;
23
23
  export declare const typeToString: (sys: DevToolsSys, checker: ts.TypeChecker, type: ts.Type) => string;
@@ -1,4 +1,4 @@
1
- import { type DevToolsSys, type SPACE_KIND_VALUES } from "packages/dev-tools/types";
1
+ import { type DevToolsSys, type SPACE_KIND_VALUES } from "../../types";
2
2
  export declare function hasBuilderContentViaQueryAPI(opts: {
3
3
  publicApiKey: string;
4
4
  privateAuthKey: string;
@@ -1,4 +1,4 @@
1
- import type { DevToolsSys } from "packages/dev-tools/types";
1
+ import type { DevToolsSys } from "../../types";
2
2
  export declare function createBuilderPage(sys: DevToolsSys, opts: {
3
3
  templateContentId: string;
4
4
  publicApiKey: string;
@@ -1,6 +1,6 @@
1
1
  import type { DevToolsSys } from "../types";
2
2
  import ts from "typescript";
3
- export declare function codeEqual(sys: DevToolsSys, n: ts.Node | null | undefined | string, expectCode: string, removeComments?: boolean): void;
3
+ export declare function codeEqual(sys: DevToolsSys, n: ts.Node | null | undefined | string, expectCode: string, removeComments?: boolean): Promise<void>;
4
4
  export declare function createTestFsSys(rootDir: string): Promise<DevToolsSys>;
5
5
  export declare function createTestMemSys(rootDir?: string): Promise<DevToolsSys>;
6
6
  export declare function createRemixTestMemSys(rootDir?: string): Promise<DevToolsSys>;
@@ -1,16 +1,16 @@
1
- import type { SDK_VERSION_VALUES } from "packages/dev-tools/types";
1
+ import type { SDK_VERSION_VALUES } from "../../../types";
2
2
  export declare function createNextTestMemSys(rootDir?: string): Promise<import("./index").NextDevToolsSys>;
3
3
  export declare function createNextAppTestFixturesSys(): Promise<import("./index").NextDevToolsSys>;
4
4
  export declare function createNextAppTestFixturesDevTools(sdkVersion?: SDK_VERSION_VALUES): Promise<{
5
5
  sys: import("./index").NextDevToolsSys;
6
- devTools: import("packages/dev-tools/types").DevToolsAdapter;
6
+ devTools: import("../../../types").DevToolsAdapter;
7
7
  }>;
8
8
  export declare function createNextPagesTestFixturesSys(): Promise<import("./index").NextDevToolsSys>;
9
9
  export declare function createNextPagesTestFixturesDevTools(sdkVersion?: SDK_VERSION_VALUES): Promise<{
10
10
  sys: import("./index").NextDevToolsSys;
11
- devTools: import("packages/dev-tools/types").DevToolsAdapter;
11
+ devTools: import("../../../types").DevToolsAdapter;
12
12
  }>;
13
13
  export declare function createNextAppTestDevTools(): Promise<{
14
- sys: import("packages/dev-tools/types").DevToolsSys;
15
- devTools: import("packages/dev-tools/types").DevToolsAdapter;
14
+ sys: import("../../../types").DevToolsSys;
15
+ devTools: import("../../../types").DevToolsAdapter;
16
16
  }>;
@@ -1,7 +1,7 @@
1
- import type { SDK_VERSION_VALUES } from "packages/dev-tools/types";
1
+ import type { SDK_VERSION_VALUES } from "../../../types";
2
2
  export declare function createReactTestMemSys(rootDir?: string): Promise<import("./index").ReactDevToolsSys>;
3
3
  export declare function createReactAppTestFixturesSys(): Promise<import("./index").ReactDevToolsSys>;
4
4
  export declare function createReactAppTestFixturesDevTools(sdkVersion?: SDK_VERSION_VALUES): Promise<{
5
5
  sys: import("./index").ReactDevToolsSys;
6
- devTools: import("packages/dev-tools/types").DevToolsAdapter;
6
+ devTools: import("../../../types").DevToolsAdapter;
7
7
  }>;
@@ -1,7 +1,7 @@
1
- import type { SDK_VERSION_VALUES } from "packages/dev-tools/types";
1
+ import type { SDK_VERSION_VALUES } from "../../../types";
2
2
  export declare function createRemixTestFixturesSys(): Promise<import("./index").RemixDevToolsSys>;
3
3
  export declare function createRemixTestMemSys(rootDir?: string): Promise<import("./index").RemixDevToolsSys>;
4
4
  export declare function createRemixTestFixturesDevTools(sdkVersion?: SDK_VERSION_VALUES): Promise<{
5
5
  sys: import("./index").RemixDevToolsSys;
6
- devTools: import("packages/dev-tools/types").DevToolsAdapter;
6
+ devTools: import("../../../types").DevToolsAdapter;
7
7
  }>;
@@ -1,4 +1,3 @@
1
- /// <reference types="@figma/plugin-typings" />
2
1
  export type FigmaNodeType = "COMPONENT" | "ELLIPSE" | "FRAME" | "GROUP" | "INSTANCE" | "LINE" | "POLYGON" | "RECTANGLE" | "STAR" | "TEXT" | "VECTOR";
3
2
  export interface FigmaComponentInput {
4
3
  id: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { DevToolsServerContext } from "../types";
3
2
  import type { IncomingMessage, Server, ServerResponse } from "http";
4
3
  export declare function handleDevRequest(ctx: DevToolsServerContext | null, server: Server, req: IncomingMessage, res: ServerResponse): Promise<void>;