builder.io 1.1.16 → 1.1.17-3
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/cli/index.cjs +840 -408
- package/cli/index.cjs.map +7 -0
- package/cli/main.cjs +2 -0
- package/core/index.cjs +186 -92
- package/core/index.mjs +186 -92
- package/figma/index.cjs +1 -1
- package/figma/index.mjs +1 -1
- package/node/index.cjs +3 -1
- package/node/index.mjs +3 -1
- package/package.json +10 -6
- package/remix/build.cjs +1 -1
- package/remix/index.mjs +1 -1
- package/server/index.cjs +32 -50
- package/server/index.mjs +32 -50
- package/types/cli/builder-add/interface.d.ts +5 -2
- package/types/cli/builder-add/options.d.ts +2 -7
- package/types/cli/constants.d.ts +1 -0
- package/types/cli/credentials.d.ts +2 -1
- package/types/cli/figma-publish.d.ts +20 -2
- package/types/cli/figma.d.ts +1 -0
- package/types/cli/generate.d.ts +2 -1
- package/types/cli/index.d.ts +0 -1
- package/types/cli/sync-utils.d.ts +10 -0
- package/types/client/client-api.d.ts +1 -1
- package/types/common/ast/component-info.d.ts +1 -0
- package/types/common/builder/builder-api.d.ts +2 -1
- package/types/common/constants.d.ts +1 -0
- package/types/common/utils.d.ts +2 -1
- package/types/core/adapters/angular/angular-app-module-imports.d.ts +2 -2
- package/types/core/adapters/angular/angular-ensure-builder-setup.d.ts +1 -1
- package/types/core/adapters/next/index.d.ts +1 -0
- package/types/core/adapters/next/next-registry-parse.d.ts +0 -1
- package/types/core/adapters/react/index.d.ts +1 -0
- package/types/core/adapters/react/react-ensure-builder-setup.d.ts +2 -2
- package/types/core/adapters/react/react-registry-parse.d.ts +2 -1
- package/types/core/adapters/react/react-registry.d.ts +1 -1
- package/types/core/adapters/react/react-test-utils.d.ts +3 -2
- package/types/core/adapters/remix/index.d.ts +1 -0
- package/types/core/adapters/remix/remix-ensure-builder-setup.d.ts +1 -1
- package/types/core/adapters/remix/remix-registry-parse.d.ts +1 -1
- package/types/core/adapters/remix/remix-registry.d.ts +1 -1
- package/types/core/adapters/remix/remix-test-utils.d.ts +3 -2
- package/types/core/find-dependencies.d.ts +7 -0
- package/types/figma/index.d.ts +1 -0
- package/types/node/node-sys.d.ts +1 -0
- package/types/server/builder-connect.d.ts +2 -2
- package/types/types.d.ts +83 -1
- package/vite/index.cjs +1 -1
- package/vite/index.mjs +1 -1
- package/webpack/index.cjs +14 -15
- package/webpack/index.mjs +14 -15
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function addCommand(opts:
|
|
1
|
+
import type { AddCliOptions, FileNode, FolderNode, Snippet, SyncInfo } from "../../types";
|
|
2
|
+
export declare function addCommand(opts: AddCliOptions): Promise<SyncInfo | undefined>;
|
|
3
|
+
export declare function fetchSnippet(id: string): Promise<Snippet | null>;
|
|
4
|
+
export declare function writeFiles(snippet: Snippet, files: Array<FileNode | FolderNode>, rootPath: string, addSessionLink: boolean): Promise<FileNode[]>;
|
|
5
|
+
export declare function suggestRootPath(framework: string): string;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
cwd: string;
|
|
4
|
-
command?: string;
|
|
5
|
-
snippetId?: string;
|
|
6
|
-
path?: string;
|
|
7
|
-
}
|
|
1
|
+
import type { AddCliOptions } from "packages/dev-tools/types";
|
|
2
|
+
export declare function getOptions(cwd: string, args: string[]): AddCliOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const apiAirV2Host = "https://air-layout-v2-tk43uighdq-uc.a.run.app";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DevToolsSys } from "../types";
|
|
2
2
|
import type { FigmaArgs } from "./figma";
|
|
3
3
|
export interface CredentialsOptions {
|
|
4
|
+
forceSpaceId?: string;
|
|
4
5
|
builderPublicKey?: boolean;
|
|
5
6
|
builderPrivateKey?: boolean;
|
|
6
7
|
figmaAuth?: boolean;
|
|
@@ -38,4 +39,4 @@ export declare const getCredentials: (sys: DevToolsSys, args: FigmaArgs, opts: C
|
|
|
38
39
|
userId: string | undefined;
|
|
39
40
|
}>;
|
|
40
41
|
export declare function getFigmaAuth(): Promise<FigmaAuth>;
|
|
41
|
-
export declare function getBuilderAuth(sys: DevToolsSys): Promise<BuilderAuth>;
|
|
42
|
+
export declare function getBuilderAuth(sys: DevToolsSys, preferSpaceId?: string): Promise<BuilderAuth>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { DevTools, DevToolsSys, ExportType } from "../types";
|
|
1
|
+
import type { DevTools, DevToolsSys, ExportType, RepoInfo } from "../types";
|
|
2
2
|
import type { FigmaArgs } from "./figma";
|
|
3
|
+
import { type FigmaAuth } from "./credentials";
|
|
3
4
|
export interface FigmaBuilderLink {
|
|
4
5
|
builderName: string;
|
|
5
6
|
figmaName: string;
|
|
@@ -19,4 +20,21 @@ export declare function findAllMappingFiles(sys: DevToolsSys): Promise<string[]>
|
|
|
19
20
|
export interface FigmaBuilderData {
|
|
20
21
|
figmaBuilderLinks: FigmaBuilderLink[];
|
|
21
22
|
}
|
|
22
|
-
export declare function setPublicKey(sys: DevToolsSys, publicKey: string, devTools: DevTools | undefined): Promise<boolean>;
|
|
23
|
+
export declare function setPublicKey(sys: DevToolsSys, publicKey: string, devTools: DevTools | undefined, ensureFigmaImportPage?: boolean): Promise<boolean>;
|
|
24
|
+
export interface PublishedMapping {
|
|
25
|
+
repoInfo: RepoInfo | undefined;
|
|
26
|
+
figmaBuilderLinks: FigmaBuilderLink[];
|
|
27
|
+
spaceId: string;
|
|
28
|
+
privateKey: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function findMappingsFromFiles({ figmaAuth, force, mappingFiles, print, sys, }: {
|
|
32
|
+
figmaAuth?: FigmaAuth;
|
|
33
|
+
force?: boolean;
|
|
34
|
+
mappingFiles: string[];
|
|
35
|
+
print: boolean;
|
|
36
|
+
sys: DevToolsSys;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
figmaBuilderLinks: FigmaBuilderLink[];
|
|
39
|
+
foundErrors: boolean;
|
|
40
|
+
}>;
|
package/types/cli/figma.d.ts
CHANGED
package/types/cli/generate.d.ts
CHANGED
|
@@ -47,7 +47,8 @@ export interface MappingCodeV2 {
|
|
|
47
47
|
previousCode?: string;
|
|
48
48
|
prompt?: string;
|
|
49
49
|
}
|
|
50
|
-
export declare function
|
|
50
|
+
export declare function generateReactInterface(registeredCmp: ComponentInfo, cmpRegistry: ComponentRegistry, addChildrenOptions: boolean): string;
|
|
51
|
+
export declare function getMappingData(figmaNode: FigmaComponentInfo, registeredCmp: ComponentInfo, cmpRegistry: ComponentRegistry, useJSX: boolean, addChildrenOptions: boolean): MappingCodeV2;
|
|
51
52
|
export declare const getTypeFromComponentInput: (input: ComponentInput) => string;
|
|
52
53
|
export declare const getPropertyAccessor: (name: string) => string;
|
|
53
54
|
export declare function getMappingPrompt(figmaNode: FigmaComponentInfo, registeredCmp: ComponentInfo, cmpRegistry: ComponentRegistry, useJSX?: boolean): string;
|
package/types/cli/index.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AddCliOptions, DevToolsSys, FileNode, SyncInfo } from "../types";
|
|
2
|
+
export declare function extractSignatureInfo(content: string): {
|
|
3
|
+
contentId?: string;
|
|
4
|
+
sessionKey?: string;
|
|
5
|
+
snippetId?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function findBuilderFiles(basePath: string, targetContentId: string, targetSessionKey: string): Promise<FileNode[]>;
|
|
8
|
+
export declare function watchDirectory(basePath: string, syncInfo: SyncInfo, onChange: (updatedSyncInfo: SyncInfo) => void): () => Promise<void>;
|
|
9
|
+
export declare function setupSyncServer(sys: DevToolsSys, initialSyncInfo?: SyncInfo): Promise<void>;
|
|
10
|
+
export declare function syncCommand(opts: AddCliOptions): Promise<SyncInfo | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentRegistry, ConnectedBuilder, GetRegistryOptions, LaunchEditorFile, LoadComponentOptions, RegisterComponentOptions, SetComponentInfoOptions, SetComponentInputOptions, UnregisterComponentOptions, ValidatedBuilder } from "../types";
|
|
2
|
-
export declare const apiConnectBuilder: (publicApiKey: string, privateAuthKey: string) => Promise<ConnectedBuilder>;
|
|
2
|
+
export declare const apiConnectBuilder: (publicApiKey: string, privateAuthKey: string, kind: string | null) => Promise<ConnectedBuilder>;
|
|
3
3
|
export declare const apiValidateBuilder: () => Promise<ValidatedBuilder>;
|
|
4
4
|
export declare const apiLaunchEditor: (file: LaunchEditorFile) => Promise<unknown>;
|
|
5
5
|
export declare const apiRegistry: (opts?: GetRegistryOptions) => Promise<ComponentRegistry>;
|
|
@@ -6,3 +6,4 @@ export declare function updateComponentInputsArrayLiteralExp(sys: DevToolsSys, a
|
|
|
6
6
|
export declare function mergeComponentInputs(cmp: ComponentInfo, inputs: ComponentInput[]): void;
|
|
7
7
|
export declare function componentAcceptsChildren(cmp: ComponentInfo): boolean;
|
|
8
8
|
export declare function normalizeComponentInput(input: ComponentInput): ComponentInput;
|
|
9
|
+
export declare function componentHasAcceptChildrenProp(sys: DevToolsSys, cmpObjLit: ts.ObjectLiteralExpression): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DevToolsSys, type SPACE_KIND_VALUES } from "packages/dev-tools/types";
|
|
2
2
|
export declare function hasBuilderContentViaQueryAPI(opts: {
|
|
3
3
|
publicApiKey: string;
|
|
4
4
|
privateAuthKey: string;
|
|
@@ -10,6 +10,7 @@ export declare function hasBuilderContentUrl(sys: DevToolsSys, opts: {
|
|
|
10
10
|
privateAuthKey: string;
|
|
11
11
|
model: string;
|
|
12
12
|
pageUrl: string;
|
|
13
|
+
kind: SPACE_KIND_VALUES;
|
|
13
14
|
}): Promise<boolean>;
|
|
14
15
|
export declare function getBuilderContent(sys: DevToolsSys, opts: {
|
|
15
16
|
publicApiKey: string;
|
|
@@ -12,3 +12,4 @@ export declare const DEV_TOOLS_API_PATH = "/~builder-dev-tools";
|
|
|
12
12
|
export declare const DEV_TOOLS_CLIENT_SCRIPT_PATH = "/~builder-dev-tools.js";
|
|
13
13
|
export declare const DEV_TOOLS_SERVER_CLOSE_PATH = "/~builder-dev-tools-close";
|
|
14
14
|
export declare const AMPLITUDE_PROXY_URL = "https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";
|
|
15
|
+
export declare const SPACE_KIND_QS = "kind";
|
package/types/common/utils.d.ts
CHANGED
|
@@ -8,10 +8,11 @@ export declare function getComponentImportPath(sys: DevToolsSys, absFilePath: st
|
|
|
8
8
|
export declare function getDisplayFilePath(sys: DevToolsSys, filePath: string): string;
|
|
9
9
|
export declare function getComponentDisplayName(str: string): string;
|
|
10
10
|
export declare function sortComponents(cmps: ComponentInfo[]): ComponentInfo[];
|
|
11
|
-
export declare function getComponentId(sys: DevToolsSys, filePath: string, exportName: string): Promise<string>;
|
|
11
|
+
export declare function getComponentId(sys: DevToolsSys, filePath: string, exportName: string, externalImportPath?: string): Promise<string>;
|
|
12
12
|
export declare function getLocalAppId(sys: DevToolsSys): Promise<string>;
|
|
13
13
|
export declare function isNumber(v: any): v is number;
|
|
14
14
|
export declare function isBoolean(v: any): v is boolean;
|
|
15
15
|
export declare function isString(v: any): v is string;
|
|
16
16
|
export declare function isValidJsxTag(tag: string): boolean;
|
|
17
17
|
export declare function clone<T>(obj: T): T;
|
|
18
|
+
export declare function shouldSkipFolder(sys: DevToolsSys, skipFolders: Set<string>, fileName: string): boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AngularDevToolsSys } from ".";
|
|
2
|
-
export declare function angularUpdateAppModule(sys: AngularDevToolsSys): Promise<string | undefined>;
|
|
3
|
-
export declare function angularEnsureAppModuleImports(sys: AngularDevToolsSys,
|
|
2
|
+
export declare function angularUpdateAppModule(sys: AngularDevToolsSys, cmpName: string, cmpPath: string): Promise<string | undefined>;
|
|
3
|
+
export declare function angularEnsureAppModuleImports(sys: AngularDevToolsSys, appModulePath: string, cmpName: string, cmpPath: string, code: string): Promise<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModifiedFile } from "../../../types";
|
|
2
2
|
import type { AngularDevToolsSys } from ".";
|
|
3
3
|
export declare function angularEnsureBuilderSetup(sys: AngularDevToolsSys): Promise<ModifiedFile[]>;
|
|
4
|
-
export declare function angularEnsureBuilderRegistry(sys: AngularDevToolsSys): Promise<ModifiedFile[]>;
|
|
5
4
|
export declare function angularEnsureFigmaImportSetup(sys: AngularDevToolsSys): Promise<ModifiedFile[]>;
|
|
5
|
+
export declare function angularEnsureBuilderRegistry(sys: AngularDevToolsSys): Promise<ModifiedFile[]>;
|
|
@@ -11,4 +11,3 @@ export declare function parseNextRegistryFromCode(sys: NextDevToolsSys, code: st
|
|
|
11
11
|
}>;
|
|
12
12
|
export declare function ensureBuilderIsInitialized(sys: NextDevToolsSys, sourceFile: ts.SourceFile, typescriptEnabled: boolean): ts.SourceFile;
|
|
13
13
|
export declare function parseNextRegisteredComponentSdkGen2(sys: NextDevToolsSys, sourceFile: ts.SourceFile, cmpObjLit: ts.Node): Promise<ComponentInfo | null>;
|
|
14
|
-
export declare function componentHasAcceptChildrenProp(sys: NextDevToolsSys, cmpObjLit: ts.ObjectLiteralExpression): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ModifiedFile } from "../../../types";
|
|
2
2
|
import type { ReactDevToolsSys } from ".";
|
|
3
3
|
export declare function reactEnsureBuilderSetup(sys: ReactDevToolsSys): Promise<ModifiedFile[]>;
|
|
4
|
-
export declare function reactEnsureFigmaImportSetup(
|
|
4
|
+
export declare function reactEnsureFigmaImportSetup(sys: ReactDevToolsSys): Promise<ModifiedFile[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type ts from "typescript";
|
|
2
|
-
import type
|
|
2
|
+
import { type ComponentInfo } from "../../../types";
|
|
3
3
|
import type { ReactDevToolsSys } from "./index";
|
|
4
4
|
export declare function parseReactRegistryFromFile(sys: ReactDevToolsSys): Promise<{
|
|
5
5
|
sourceFile: ts.SourceFile;
|
|
@@ -10,3 +10,4 @@ export declare function parseReactRegistryFromCode(sys: ReactDevToolsSys, code:
|
|
|
10
10
|
components: ComponentInfo[];
|
|
11
11
|
}>;
|
|
12
12
|
export declare function ensureBuilderIsInitialized(sys: ReactDevToolsSys, sourceFile: ts.SourceFile, typescriptEnabled: boolean): ts.SourceFile;
|
|
13
|
+
export declare function parseReactRegisteredComponentSdkGen2(sys: ReactDevToolsSys, sourceFile: ts.SourceFile, cmpObjLit: ts.Node): Promise<ComponentInfo | null>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentRegistry, type SetComponentInfoOptions, type SetComponentInputOptions } from "../../../types";
|
|
2
2
|
import type { ReactDevToolsSys } from "./index";
|
|
3
3
|
export declare function reactComponentRegistry(sys: ReactDevToolsSys, cmpId: string | string[] | null, registerCmp: boolean, unregisterCmp: boolean, setCmpInfo: SetComponentInfoOptions | null, setCmpInput: SetComponentInputOptions | null, writeRegistry: boolean, readAllInputTypes: boolean): Promise<ComponentRegistry>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { SDK_VERSION_VALUES } from "packages/dev-tools/types";
|
|
1
2
|
export declare function createReactTestMemSys(rootDir?: string): Promise<import("./index").ReactDevToolsSys>;
|
|
2
3
|
export declare function createReactAppTestFixturesSys(): Promise<import("./index").ReactDevToolsSys>;
|
|
3
|
-
export declare function createReactAppTestFixturesDevTools(): Promise<{
|
|
4
|
+
export declare function createReactAppTestFixturesDevTools(sdkVersion?: SDK_VERSION_VALUES): Promise<{
|
|
4
5
|
sys: import("./index").ReactDevToolsSys;
|
|
5
|
-
devTools: import("
|
|
6
|
+
devTools: import("packages/dev-tools/types").DevToolsAdapter;
|
|
6
7
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ModifiedFile } from "../../../types";
|
|
2
2
|
import type { RemixDevToolsSys } from ".";
|
|
3
3
|
export declare function remixEnsureBuilderSetup(sys: RemixDevToolsSys): Promise<ModifiedFile[]>;
|
|
4
4
|
export declare function remixEnsureFigmaImportSetup(sys: RemixDevToolsSys): Promise<ModifiedFile[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type ts from "typescript";
|
|
2
|
-
import type
|
|
2
|
+
import { type ComponentInfo } from "../../../types";
|
|
3
3
|
import type { RemixDevToolsSys } from "./index";
|
|
4
4
|
export declare function parseRemixRegistryFromFile(sys: RemixDevToolsSys): Promise<{
|
|
5
5
|
sourceFile: ts.SourceFile;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentRegistry, type SetComponentInfoOptions, type SetComponentInputOptions } from "../../../types";
|
|
2
2
|
import type { RemixDevToolsSys } from "./index";
|
|
3
3
|
export declare function remixComponentRegistry(sys: RemixDevToolsSys, cmpId: string | string[] | null, registerCmp: boolean, unregisterCmp: boolean, setCmpInfo: SetComponentInfoOptions | null, setCmpInput: SetComponentInputOptions | null, writeRegistry: boolean, readAllInputTypes: boolean): Promise<ComponentRegistry>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { SDK_VERSION_VALUES } from "packages/dev-tools/types";
|
|
1
2
|
export declare function createRemixTestFixturesSys(): Promise<import("./index").RemixDevToolsSys>;
|
|
2
3
|
export declare function createRemixTestMemSys(rootDir?: string): Promise<import("./index").RemixDevToolsSys>;
|
|
3
|
-
export declare function createRemixTestFixturesDevTools(): Promise<{
|
|
4
|
+
export declare function createRemixTestFixturesDevTools(sdkVersion?: SDK_VERSION_VALUES): Promise<{
|
|
4
5
|
sys: import("./index").RemixDevToolsSys;
|
|
5
|
-
devTools: import("
|
|
6
|
+
devTools: import("packages/dev-tools/types").DevToolsAdapter;
|
|
6
7
|
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DevToolsSys } from "../types";
|
|
2
|
+
export interface Package {
|
|
3
|
+
name: string;
|
|
4
|
+
subPackages: string[];
|
|
5
|
+
}
|
|
6
|
+
export type DependencyStructure = Package[];
|
|
7
|
+
export declare function findAllDependencies(sys: DevToolsSys, rootDir: string): Promise<DependencyStructure>;
|
package/types/figma/index.d.ts
CHANGED
|
@@ -73,4 +73,5 @@ export interface FigmaTokenMapper {
|
|
|
73
73
|
designTokenMapper: (token: string) => string | undefined | boolean;
|
|
74
74
|
}
|
|
75
75
|
export declare function figmaMapping<T extends BaseFigmaProps = FigmaProps>(_config: FigmaMappingWithKeyMapper<T> | FigmaMappingWithUrlMapper<T> | FigmaGenericMapper | FigmaTokenMapper): void;
|
|
76
|
+
export declare function explicitFalse(value: any): any;
|
|
76
77
|
export {};
|
package/types/node/node-sys.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export declare function createDevToolsNodeSys(opts: DevToolsNodeSysOptions): Pro
|
|
|
8
8
|
export declare function configHasProperty(contents: Record<string, any>, key: string): boolean;
|
|
9
9
|
export declare function readConfigFile(): Promise<any>;
|
|
10
10
|
export declare function writeConfigFile(contents: Record<string, any>): Promise<void>;
|
|
11
|
+
export declare function getGitRemoteURL(repoPath: string): string;
|
|
11
12
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare function connectBuilder(ctx: DevToolsServerContext, publicApiKey: string, privateAuthKey: string): Promise<ConnectedBuilder>;
|
|
1
|
+
import { type DevToolsServerContext, type ConnectedBuilder, type ValidatedBuilder, type SPACE_KIND_VALUES } from "../types";
|
|
2
|
+
export declare function connectBuilder(ctx: DevToolsServerContext, publicApiKey: string, privateAuthKey: string, kind: SPACE_KIND_VALUES): Promise<ConnectedBuilder>;
|
|
3
3
|
export declare function validateBuilder(ctx: DevToolsServerContext): Promise<ValidatedBuilder>;
|
package/types/types.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export interface DevToolsPath {
|
|
|
8
8
|
relative: (from: string, to: string) => string;
|
|
9
9
|
resolve: (...pathSegments: string[]) => string;
|
|
10
10
|
}
|
|
11
|
+
export interface RepoInfo {
|
|
12
|
+
remoteUrl: string;
|
|
13
|
+
defaultBranch: string;
|
|
14
|
+
currentBranch: string;
|
|
15
|
+
commit: string;
|
|
16
|
+
}
|
|
11
17
|
export interface DevToolsSys extends DevToolsPath {
|
|
12
18
|
cwd: () => string;
|
|
13
19
|
getRootDir: () => string;
|
|
@@ -35,10 +41,12 @@ export interface DevToolsSys extends DevToolsPath {
|
|
|
35
41
|
platform: () => DevtoolsPlatform;
|
|
36
42
|
getDeviceId: () => Promise<string>;
|
|
37
43
|
getFrameworks: () => Framework[];
|
|
44
|
+
getRepoInfo: () => Promise<RepoInfo>;
|
|
38
45
|
ts: typeof import("typescript");
|
|
39
46
|
version: string;
|
|
40
47
|
sdkVersion: SDK_VERSION_VALUES | null;
|
|
41
48
|
ignoreMissingConfig?: boolean;
|
|
49
|
+
kind: SPACE_KIND_VALUES;
|
|
42
50
|
}
|
|
43
51
|
export interface DevtoolsPlatform {
|
|
44
52
|
runtime: string;
|
|
@@ -85,6 +93,7 @@ export interface DevToolsAdapter {
|
|
|
85
93
|
getRegistry: (opts?: GetRegistryOptions) => Promise<ComponentRegistry>;
|
|
86
94
|
getRegistryPath: () => string;
|
|
87
95
|
loadComponent: (opts: LoadComponentOptions) => Promise<LoadComponent>;
|
|
96
|
+
addExternalPackage: (pkgName: string) => void;
|
|
88
97
|
registerComponent: (opts: RegisterComponentOptions) => Promise<ComponentRegistry>;
|
|
89
98
|
unregisterComponent: (opts: UnregisterComponentOptions) => Promise<ComponentRegistry>;
|
|
90
99
|
setRegisteredComponentInfo: (opts: SetComponentInfoOptions) => Promise<ComponentRegistry>;
|
|
@@ -98,9 +107,18 @@ export interface DevTools extends DevToolsAdapter {
|
|
|
98
107
|
exportRegistry: () => Promise<string>;
|
|
99
108
|
importRegistry: (exportedRegistry: string) => Promise<ComponentRegistry>;
|
|
100
109
|
framework: string;
|
|
110
|
+
findAllDependencies: () => Promise<DependencyTree>;
|
|
101
111
|
}
|
|
102
112
|
export interface DevToolsServerOptions extends DevToolsSys, DevTools {
|
|
103
113
|
getClientId: () => string;
|
|
114
|
+
getPastSyncInfo?: (data: {
|
|
115
|
+
sessionKey: string;
|
|
116
|
+
since: number;
|
|
117
|
+
}) => any;
|
|
118
|
+
resyncSnippet?: (data: {
|
|
119
|
+
syncInfo: SyncInfo;
|
|
120
|
+
snippet: Snippet;
|
|
121
|
+
}) => any;
|
|
104
122
|
enableAppWatch: (enabled: boolean) => Promise<boolean>;
|
|
105
123
|
closeAppServer: () => Promise<void>;
|
|
106
124
|
restartAppServer: () => Promise<void>;
|
|
@@ -132,7 +150,7 @@ export interface EnvInfo {
|
|
|
132
150
|
export interface DevToolsServer {
|
|
133
151
|
getUrl: () => string;
|
|
134
152
|
}
|
|
135
|
-
export type ApiRequest = ApiConnectBuilderRequest | ApiDevToolsEnabledRequest | ApiGetRegistryRequest | ApiLaunchEditorRequest | ApiRegisterComponentRequest | ApiRegisteredComponentInfoRequest | ApiRegisteredComponentInputRequest | ApiLoadComponentRequest | ApiUnregisterComponentRequest | ApiValidateBuilderRequest | ApiFrameworksRequest | ApiReadFileRequest | ApiWriteFileRequest | ApiReaddirRequest | ApiGetBuilderCacheRequest | ApiEnsureFigmaImportPageRequest | ApiSetBuilderCacheRequest | ApiTranspileModuleRequest | ApiTranspileFileRequest;
|
|
153
|
+
export type ApiRequest = ApiConnectBuilderRequest | ApiDevToolsEnabledRequest | ApiGetRegistryRequest | ApiLaunchEditorRequest | ApiRegisterComponentRequest | ApiRegisteredComponentInfoRequest | ApiRegisteredComponentInputRequest | ApiLoadComponentRequest | ApiUnregisterComponentRequest | ApiValidateBuilderRequest | ApiFrameworksRequest | ApiReadFileRequest | ApiWriteFileRequest | ApiReaddirRequest | ApiGetBuilderCacheRequest | ApiEnsureFigmaImportPageRequest | ApiSetBuilderCacheRequest | ApiTranspileModuleRequest | ApiTranspileFileRequest | ApiPastSyncInfoRequest | ApiResyncSnippetRequest;
|
|
136
154
|
export interface ApiTranspileModuleRequest extends TranspileModuleOptions {
|
|
137
155
|
type: "transileModule";
|
|
138
156
|
}
|
|
@@ -146,6 +164,20 @@ export interface ApiSetBuilderCacheRequest {
|
|
|
146
164
|
type: "setCache";
|
|
147
165
|
data: Record<string, any>;
|
|
148
166
|
}
|
|
167
|
+
export interface ApiPastSyncInfoRequest {
|
|
168
|
+
type: "getPastSyncInfo";
|
|
169
|
+
data: {
|
|
170
|
+
sessionKey: string;
|
|
171
|
+
since: number;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export interface ApiResyncSnippetRequest {
|
|
175
|
+
type: "resyncSnippet";
|
|
176
|
+
data: {
|
|
177
|
+
syncInfo: SyncInfo;
|
|
178
|
+
snippet: Snippet;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
149
181
|
export interface ApiEnsureFigmaImportPageRequest {
|
|
150
182
|
type: "ensureFigmaImportPage";
|
|
151
183
|
}
|
|
@@ -154,6 +186,7 @@ export interface ApiConnectBuilderRequest {
|
|
|
154
186
|
data: {
|
|
155
187
|
publicApiKey: string;
|
|
156
188
|
privateAuthKey: string;
|
|
189
|
+
kind: string | null;
|
|
157
190
|
};
|
|
158
191
|
}
|
|
159
192
|
export interface ApiDevToolsEnabledRequest {
|
|
@@ -227,6 +260,7 @@ export interface ConnectedBuilder {
|
|
|
227
260
|
pathname: string;
|
|
228
261
|
modifiedFiles: ModifiedFile[];
|
|
229
262
|
platform: DevtoolsPlatform;
|
|
263
|
+
kind: SPACE_KIND_VALUES;
|
|
230
264
|
}
|
|
231
265
|
export interface ModifiedFile {
|
|
232
266
|
filePath: string;
|
|
@@ -296,6 +330,7 @@ export interface ComponentInfo {
|
|
|
296
330
|
acceptsChildren?: boolean;
|
|
297
331
|
meta?: Record<string, any>;
|
|
298
332
|
dependencies?: AppDependency[];
|
|
333
|
+
externalImportPath?: string;
|
|
299
334
|
}
|
|
300
335
|
export interface MinimalComponentInfo {
|
|
301
336
|
filePath: string;
|
|
@@ -403,4 +438,51 @@ export interface UpdateRegistry {
|
|
|
403
438
|
nodeIndex: number;
|
|
404
439
|
components: ComponentInfo[];
|
|
405
440
|
}
|
|
441
|
+
export interface AddCliOptions {
|
|
442
|
+
cwd: string;
|
|
443
|
+
command?: string;
|
|
444
|
+
snippetId?: string;
|
|
445
|
+
snippet?: Snippet;
|
|
446
|
+
path?: string;
|
|
447
|
+
}
|
|
448
|
+
export interface FileNode {
|
|
449
|
+
name: string;
|
|
450
|
+
code: string;
|
|
451
|
+
path: string;
|
|
452
|
+
timestamp?: number;
|
|
453
|
+
snippetId?: string;
|
|
454
|
+
}
|
|
455
|
+
export interface FolderNode {
|
|
456
|
+
name: string;
|
|
457
|
+
path: string;
|
|
458
|
+
files: (FileNode | FolderNode)[];
|
|
459
|
+
}
|
|
460
|
+
export interface Snippet {
|
|
461
|
+
createdDate: number;
|
|
462
|
+
contentId: string;
|
|
463
|
+
code: string;
|
|
464
|
+
framework: string;
|
|
465
|
+
suggestedName: string;
|
|
466
|
+
id: string;
|
|
467
|
+
files: Array<FileNode | FolderNode>;
|
|
468
|
+
sessionKey: string;
|
|
469
|
+
}
|
|
470
|
+
export interface SyncInfo {
|
|
471
|
+
snippet: Snippet;
|
|
472
|
+
pathInput: string;
|
|
473
|
+
writtenFiles: Array<FileNode>;
|
|
474
|
+
timeStamp: number;
|
|
475
|
+
}
|
|
476
|
+
export interface Package {
|
|
477
|
+
name: string;
|
|
478
|
+
subPackages: string[];
|
|
479
|
+
}
|
|
480
|
+
export type DependencyTree = Package[];
|
|
481
|
+
export declare const SPACE_KIND: {
|
|
482
|
+
readonly CMS: "cms";
|
|
483
|
+
readonly VCP: "vcp";
|
|
484
|
+
readonly HYBRID: "hybrid";
|
|
485
|
+
};
|
|
486
|
+
type SPACE_KIND_KEYS = keyof typeof SPACE_KIND;
|
|
487
|
+
export type SPACE_KIND_VALUES = (typeof SPACE_KIND)[SPACE_KIND_KEYS] | null;
|
|
406
488
|
export {};
|
package/vite/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";var b=Object.create;var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var D=(n,e)=>{for(var t in e)u(n,t,{get:e[t],enumerable:!0})},g=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!x.call(n,s)&&s!==t&&u(n,s,{get:()=>e[s],enumerable:!(o=h(e,s))||o.enumerable});return n};var V=(n,e,t)=>(t=n!=null?b(y(n)):{},g(e||!n||!n.__esModule?u(t,"default",{value:n,enumerable:!0}):t,n)),I=n=>g(u({},"__esModule",{value:!0}),n);var v={};D(v,{builderDevTools:()=>j});module.exports=I(v);var p=require("../core/index.cjs"),d=require("../node/index.cjs"),w=require("../server/index.cjs");async function f(n,e){let t=await n.readFile(e);return typeof t=="string"?R(t):null}function R(n){let e={},t=n.replace(/\r\n?/gm,`
|
|
2
2
|
`),o;for(;(o=C.exec(t))!=null;){let s=o[1],r=o[2]||"";r=r.trim();let c=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),c==='"'&&(r=r.replace(/\\n/g,`
|
|
3
|
-
`),r=r.replace(/\\r/g,"\r")),e[s]=r}return e}var C=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;var m=V(require("path"),1);function j(n={}){return{name:"vite-plugin-builder-dev-tools",async configureServer(t){let o=await(0,d.createDevToolsNodeSys)({getRootDir:()=>m.default.normalize(t.config.root)}),s=await(0,p.createDevTools)(o),r=await(0,w.createDevToolsServer)({...s,getClientId:()=>"vite-builder-dev-tools",closeAppServer:async()=>{o.debug("close server"),await t?.close()},restartAppServer:async()=>{o.debug("restart server"),await t?.restart()},enableAppWatch:async c=>{if(c){o.debug("enable watch"),t?.watcher.add(t.config.root);let i=o.join(t.config.root,".git"),l=o.join(t.config.root,"node_modules");t?.watcher.unwatch([i,l])}else o.debug("disable watch"),t?.watcher.unwatch(t.config.root);return c},...o,...n});t.watcher.on("change",async c=>{if(c.includes(".env")){let i=await f(o,c);i&&Object.keys(i).forEach(a=>{process.env[a]=i[a]})}}),t.middlewares.use(async(c,i,l)=>{try{let a=i.end;i.end=function(...$){if((i.getHeader("Content-Type")||"").toString().includes("text/html")){let T=(0,p.getClientScript)(r.getUrl());i.write(`<script>${T}</script>`)}return a.apply(this,$)},l()}catch(a){l(a)}})}}}0&&(module.exports={builderDevTools});
|
|
3
|
+
`),r=r.replace(/\\r/g,"\r")),e[s]=r}return e}var C=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;var m=V(require("node:path"),1);function j(n={}){return{name:"vite-plugin-builder-dev-tools",async configureServer(t){let o=await(0,d.createDevToolsNodeSys)({getRootDir:()=>m.default.normalize(t.config.root)}),s=await(0,p.createDevTools)(o),r=await(0,w.createDevToolsServer)({...s,getClientId:()=>"vite-builder-dev-tools",closeAppServer:async()=>{o.debug("close server"),await t?.close()},restartAppServer:async()=>{o.debug("restart server"),await t?.restart()},enableAppWatch:async c=>{if(c){o.debug("enable watch"),t?.watcher.add(t.config.root);let i=o.join(t.config.root,".git"),l=o.join(t.config.root,"node_modules");t?.watcher.unwatch([i,l])}else o.debug("disable watch"),t?.watcher.unwatch(t.config.root);return c},...o,...n});t.watcher.on("change",async c=>{if(c.includes(".env")){let i=await f(o,c);i&&Object.keys(i).forEach(a=>{process.env[a]=i[a]})}}),t.middlewares.use(async(c,i,l)=>{try{let a=i.end;i.end=function(...$){if((i.getHeader("Content-Type")||"").toString().includes("text/html")){let T=(0,p.getClientScript)(r.getUrl());i.write(`<script>${T}</script>`)}return a.apply(this,$)},l()}catch(a){l(a)}})}}}0&&(module.exports={builderDevTools});
|
package/vite/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{createDevTools as w,getClientScript as m}from"../core/index.mjs";import{createDevToolsNodeSys as $}from"../node/index.mjs";import{createDevToolsServer as T}from"../server/index.mjs";async function u(s,c){let t=await s.readFile(c);return typeof t=="string"?f(t):null}function f(s){let c={},t=s.replace(/\r\n?/gm,`
|
|
2
2
|
`),n;for(;(n=d.exec(t))!=null;){let l=n[1],e=n[2]||"";e=e.trim();let r=e[0];e=e.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),r==='"'&&(e=e.replace(/\\n/g,`
|
|
3
|
-
`),e=e.replace(/\\r/g,"\r")),c[l]=e}return c}var d=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;import b from"path";function R(s={}){return{name:"vite-plugin-builder-dev-tools",async configureServer(t){let n=await $({getRootDir:()=>b.normalize(t.config.root)}),l=await w(n),e=await T({...l,getClientId:()=>"vite-builder-dev-tools",closeAppServer:async()=>{n.debug("close server"),await t?.close()},restartAppServer:async()=>{n.debug("restart server"),await t?.restart()},enableAppWatch:async r=>{if(r){n.debug("enable watch"),t?.watcher.add(t.config.root);let o=n.join(t.config.root,".git"),a=n.join(t.config.root,"node_modules");t?.watcher.unwatch([o,a])}else n.debug("disable watch"),t?.watcher.unwatch(t.config.root);return r},...n,...s});t.watcher.on("change",async r=>{if(r.includes(".env")){let o=await u(n,r);o&&Object.keys(o).forEach(i=>{process.env[i]=o[i]})}}),t.middlewares.use(async(r,o,a)=>{try{let i=o.end;o.end=function(...p){if((o.getHeader("Content-Type")||"").toString().includes("text/html")){let g=m(e.getUrl());o.write(`<script>${g}</script>`)}return i.apply(this,p)},a()}catch(i){a(i)}})}}}export{R as builderDevTools};
|
|
3
|
+
`),e=e.replace(/\\r/g,"\r")),c[l]=e}return c}var d=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;import b from"node:path";function R(s={}){return{name:"vite-plugin-builder-dev-tools",async configureServer(t){let n=await $({getRootDir:()=>b.normalize(t.config.root)}),l=await w(n),e=await T({...l,getClientId:()=>"vite-builder-dev-tools",closeAppServer:async()=>{n.debug("close server"),await t?.close()},restartAppServer:async()=>{n.debug("restart server"),await t?.restart()},enableAppWatch:async r=>{if(r){n.debug("enable watch"),t?.watcher.add(t.config.root);let o=n.join(t.config.root,".git"),a=n.join(t.config.root,"node_modules");t?.watcher.unwatch([o,a])}else n.debug("disable watch"),t?.watcher.unwatch(t.config.root);return r},...n,...s});t.watcher.on("change",async r=>{if(r.includes(".env")){let o=await u(n,r);o&&Object.keys(o).forEach(i=>{process.env[i]=o[i]})}}),t.middlewares.use(async(r,o,a)=>{try{let i=o.end;o.end=function(...p){if((o.getHeader("Content-Type")||"").toString().includes("text/html")){let g=m(e.getUrl());o.write(`<script>${g}</script>`)}return i.apply(this,p)},a()}catch(i){a(i)}})}}}export{R as builderDevTools};
|