@figma/code-connect 0.1.2 → 0.2.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/README.md +123 -25
- package/dist/cli.js +7 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/connect.d.ts +15 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +137 -76
- package/dist/commands/connect.js.map +1 -1
- package/dist/common/__test__/project.test.d.ts +2 -0
- package/dist/common/__test__/project.test.d.ts.map +1 -0
- package/dist/common/__test__/project.test.js +14 -0
- package/dist/common/__test__/project.test.js.map +1 -0
- package/dist/common/api.d.ts +56 -2
- package/dist/common/api.d.ts.map +1 -1
- package/dist/common/external.d.ts +6 -3
- package/dist/common/external.d.ts.map +1 -1
- package/dist/common/external.js +13 -1
- package/dist/common/external.js.map +1 -1
- package/dist/common/figma_connect.d.ts +10 -8
- package/dist/common/figma_connect.d.ts.map +1 -1
- package/dist/common/intrinsics.d.ts +38 -6
- package/dist/common/intrinsics.d.ts.map +1 -1
- package/dist/common/intrinsics.js +160 -26
- package/dist/common/intrinsics.js.map +1 -1
- package/dist/common/logging.d.ts +9 -0
- package/dist/common/logging.d.ts.map +1 -1
- package/dist/common/logging.js +21 -1
- package/dist/common/logging.js.map +1 -1
- package/dist/common/updates.d.ts +4 -0
- package/dist/common/updates.d.ts.map +1 -0
- package/dist/common/updates.js +87 -0
- package/dist/common/updates.js.map +1 -0
- package/dist/connect/create.d.ts +5 -1
- package/dist/connect/create.d.ts.map +1 -1
- package/dist/connect/create.js +55 -69
- package/dist/connect/create.js.map +1 -1
- package/dist/connect/delete_docs.d.ts.map +1 -1
- package/dist/connect/delete_docs.js +1 -4
- package/dist/connect/delete_docs.js.map +1 -1
- package/dist/connect/figma_rest_api.d.ts +5 -0
- package/dist/connect/figma_rest_api.d.ts.map +1 -1
- package/dist/connect/figma_rest_api.js +10 -1
- package/dist/connect/figma_rest_api.js.map +1 -1
- package/dist/connect/helpers.d.ts +1 -1
- package/dist/connect/helpers.d.ts.map +1 -1
- package/dist/connect/helpers.js +6 -5
- package/dist/connect/helpers.js.map +1 -1
- package/dist/connect/parser_executable_types.d.ts +297 -0
- package/dist/connect/parser_executable_types.d.ts.map +1 -0
- package/dist/connect/parser_executable_types.js +108 -0
- package/dist/connect/parser_executable_types.js.map +1 -0
- package/dist/connect/parser_executables.d.ts +8 -0
- package/dist/connect/parser_executables.d.ts.map +1 -0
- package/dist/connect/parser_executables.js +132 -0
- package/dist/connect/parser_executables.js.map +1 -0
- package/dist/connect/project.d.ts +137 -0
- package/dist/connect/project.d.ts.map +1 -0
- package/dist/connect/project.js +411 -0
- package/dist/connect/project.js.map +1 -0
- package/dist/connect/upload.d.ts.map +1 -1
- package/dist/connect/upload.js +1 -4
- package/dist/connect/upload.js.map +1 -1
- package/dist/connect/validation.d.ts +6 -1
- package/dist/connect/validation.d.ts.map +1 -1
- package/dist/connect/validation.js +23 -18
- package/dist/connect/validation.js.map +1 -1
- package/dist/connect/wizard/helpers.d.ts +7 -0
- package/dist/connect/wizard/helpers.d.ts.map +1 -0
- package/dist/connect/wizard/helpers.js +55 -0
- package/dist/connect/wizard/helpers.js.map +1 -0
- package/dist/connect/wizard/run_wizard.d.ts +3 -0
- package/dist/connect/wizard/run_wizard.d.ts.map +1 -0
- package/dist/connect/wizard/run_wizard.js +480 -0
- package/dist/connect/wizard/run_wizard.js.map +1 -0
- package/dist/parser_scripts/get_file_if_exists.d.ts +2 -0
- package/dist/parser_scripts/get_file_if_exists.d.ts.map +1 -0
- package/dist/parser_scripts/get_file_if_exists.js +10 -0
- package/dist/parser_scripts/get_file_if_exists.js.map +1 -0
- package/dist/parser_scripts/get_gradlew_path.d.ts +3 -0
- package/dist/parser_scripts/get_gradlew_path.d.ts.map +1 -0
- package/dist/parser_scripts/get_gradlew_path.js +24 -0
- package/dist/parser_scripts/get_gradlew_path.js.map +1 -0
- package/dist/parser_scripts/get_swift_parser_dir.d.ts +2 -0
- package/dist/parser_scripts/get_swift_parser_dir.d.ts.map +1 -0
- package/dist/parser_scripts/get_swift_parser_dir.js +93 -0
- package/dist/parser_scripts/get_swift_parser_dir.js.map +1 -0
- package/dist/react/create.d.ts +4 -0
- package/dist/react/create.d.ts.map +1 -0
- package/dist/react/create.js +132 -0
- package/dist/react/create.js.map +1 -0
- package/dist/react/parser.d.ts +6 -15
- package/dist/react/parser.d.ts.map +1 -1
- package/dist/react/parser.js +55 -62
- package/dist/react/parser.js.map +1 -1
- package/dist/react/parser_template_helpers.d.ts +21 -0
- package/dist/react/parser_template_helpers.d.ts.map +1 -1
- package/dist/react/parser_template_helpers.js +107 -43
- package/dist/react/parser_template_helpers.js.map +1 -1
- package/dist/storybook/convert.d.ts +2 -2
- package/dist/storybook/convert.d.ts.map +1 -1
- package/dist/storybook/convert.js +6 -4
- package/dist/storybook/convert.js.map +1 -1
- package/package.json +36 -11
- package/dist/common/project.d.ts +0 -94
- package/dist/common/project.d.ts.map +0 -1
- package/dist/common/project.js +0 -198
- package/dist/common/project.js.map +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
export declare const DEFAULT_INCLUDE_GLOBS_BY_PARSER: {
|
|
3
|
+
react: string[];
|
|
4
|
+
swift: string[];
|
|
5
|
+
compose: string[];
|
|
6
|
+
__unit_test__: string[];
|
|
7
|
+
};
|
|
8
|
+
export type FirstPartyExecutableParser = 'swift' | 'compose' | '__unit_test__';
|
|
9
|
+
export type FirstPartyParser = 'react' | FirstPartyExecutableParser;
|
|
10
|
+
type BaseCodeConnectConfig = {
|
|
11
|
+
/**
|
|
12
|
+
* Specify glob patterns for files (relative to the project root) to be
|
|
13
|
+
* included when looking for source files. If not specified, all files
|
|
14
|
+
* (except any specified in `exclude`) will be included.
|
|
15
|
+
*/
|
|
16
|
+
include?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Specify glob patterns for files (relative to the project root) to be
|
|
19
|
+
* excluded when looking for source files. If not specified, only
|
|
20
|
+
* `node_modules` will be excluded.
|
|
21
|
+
*/
|
|
22
|
+
exclude?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Optional object of substitutions applied to document URLs (in the format {
|
|
25
|
+
* fromString, toString }) for testing (e.g. remapping a production URL to a
|
|
26
|
+
* staging URL). Not publicly documented.
|
|
27
|
+
*/
|
|
28
|
+
documentUrlSubstitutions?: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* The parser name, if using an internal parser.
|
|
31
|
+
*/
|
|
32
|
+
parser: FirstPartyParser;
|
|
33
|
+
};
|
|
34
|
+
export type CodeConnectExecutableParserConfig = BaseCodeConnectConfig & {
|
|
35
|
+
parser: FirstPartyExecutableParser;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* React specific configuration
|
|
39
|
+
*/
|
|
40
|
+
export type CodeConnectReactConfig = BaseCodeConnectConfig & {
|
|
41
|
+
parser: 'react';
|
|
42
|
+
/**
|
|
43
|
+
* Maps imports from their path on disk to the specified path.
|
|
44
|
+
* This will rewrite the imports in generated code examples, so it works with
|
|
45
|
+
* relative imports such as `import { Button } from "./"`.
|
|
46
|
+
*
|
|
47
|
+
* Example: { "src/components/*": "@ui/components" }
|
|
48
|
+
* Would rewrite imports for components located in `src/components` to `@ui/components` in
|
|
49
|
+
* generated code examples.
|
|
50
|
+
* `import { Button } from "./"` -> `import { Button } from "@ui/components/Button"`
|
|
51
|
+
*/
|
|
52
|
+
importPaths?: Record<string, string>;
|
|
53
|
+
/**
|
|
54
|
+
* For import resolution - this is a temporary solution to support projects that use
|
|
55
|
+
* pnpm workspaces, as the compiler doesn't seem to be able to resolve imports when
|
|
56
|
+
* the package in node_modules is a symlink. Need to look into this more and find a
|
|
57
|
+
* better solution.
|
|
58
|
+
*/
|
|
59
|
+
paths?: Record<string, string[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Storybook specific configuration
|
|
62
|
+
*/
|
|
63
|
+
storybook?: {
|
|
64
|
+
/**
|
|
65
|
+
* The URL of the Storybook instance for the project
|
|
66
|
+
*/
|
|
67
|
+
url: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export type CodeConnectConfig = CodeConnectReactConfig | CodeConnectExecutableParserConfig | BaseCodeConnectConfig;
|
|
71
|
+
export declare function determineParserFromProject(dir: string): FirstPartyParser | undefined;
|
|
72
|
+
export declare function getGitRemoteURL(repoPath: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Uses `git rev-parse` to find absolute path to the root of the git repository
|
|
75
|
+
*/
|
|
76
|
+
export declare function getGitRepoAbsolutePath(filePath: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Find the default branch name (master or main) for the git repository
|
|
79
|
+
*/
|
|
80
|
+
export declare function getGitRepoDefaultBranchName(repoPath: string): "master" | "main";
|
|
81
|
+
/**
|
|
82
|
+
* Finds the URL of a remote file
|
|
83
|
+
* @param filePath absolute file path on disk
|
|
84
|
+
* @param repoURL remote URL
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
export declare function getRemoteFileUrl(filePath: string, repoURL?: string): string;
|
|
88
|
+
export declare function getStorybookUrl(filePath: string, storybookUrl: string): string;
|
|
89
|
+
export type ProjectInfo<ConfigT = CodeConnectConfig> = {
|
|
90
|
+
/**
|
|
91
|
+
* Absolute path of the project directory
|
|
92
|
+
*/
|
|
93
|
+
absPath: string;
|
|
94
|
+
/**
|
|
95
|
+
* An array of all tsx files in the project
|
|
96
|
+
*/
|
|
97
|
+
files: string[];
|
|
98
|
+
/**
|
|
99
|
+
* The git remote URL of the project
|
|
100
|
+
*/
|
|
101
|
+
remoteUrl: string;
|
|
102
|
+
/**
|
|
103
|
+
* The parsed Code Connect config file
|
|
104
|
+
*/
|
|
105
|
+
config: ConfigT;
|
|
106
|
+
};
|
|
107
|
+
export type ReactProjectInfo = ProjectInfo<CodeConnectReactConfig> & {
|
|
108
|
+
/**
|
|
109
|
+
* TS program containing all tsx files in the project
|
|
110
|
+
*/
|
|
111
|
+
tsProgram: ts.Program;
|
|
112
|
+
};
|
|
113
|
+
export declare function getDefaultConfigPath(dir: string): string;
|
|
114
|
+
export declare function parseOrDetermineConfig(dir: string, configPath: string): Promise<{
|
|
115
|
+
config: CodeConnectConfig;
|
|
116
|
+
hasConfigFile: boolean;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Gets information about a project from config.
|
|
120
|
+
*
|
|
121
|
+
* @param dir Directory containing the project
|
|
122
|
+
* @param config Code Connect config
|
|
123
|
+
* @returns Object containing information about the project
|
|
124
|
+
*/
|
|
125
|
+
export declare function getProjectInfoFromConfig(dir: string, config: CodeConnectConfig): Promise<ProjectInfo>;
|
|
126
|
+
/**
|
|
127
|
+
* Gets information about a project from a directory.
|
|
128
|
+
*
|
|
129
|
+
* @param dir Directory containing the project
|
|
130
|
+
* @param configPath Optional path to Code Connect config file
|
|
131
|
+
* @returns Object containing information about the project
|
|
132
|
+
*/
|
|
133
|
+
export declare function getProjectInfo(dir: string, configPath: string): Promise<ProjectInfo>;
|
|
134
|
+
export declare function getReactProjectInfo(projectInfo: ProjectInfo<CodeConnectReactConfig>): ReactProjectInfo;
|
|
135
|
+
export declare function resolveImportPath(filePath: string, config: CodeConnectReactConfig): string | null;
|
|
136
|
+
export {};
|
|
137
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/connect/project.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,YAAY,CAAA;AAS3B,eAAO,MAAM,+BAA+B;;;;;CAK3C,CAAA;AAGD,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,SAAS,GAAG,eAAe,CAAA;AAK9E,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,0BAA0B,CAAA;AAEnE,KAAK,qBAAqB,GAAG;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB;;;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EG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IACf;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,sBAAsB,CAAC,GAAG;IACnE;;OAEG;IACH,SAAS,EAAE,EAAE,CAAC,OAAO,CAAA;CACtB,CAAA;AAOD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,UAE/C;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;;;GAiC3E;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,WAAW,CAAC,CAqCtB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAI1F;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,CAAC,sBAAsB,CAAC,GAC/C,gBAAgB,CAkBlB;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI,CA0BjG"}
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveImportPath = exports.getReactProjectInfo = exports.getProjectInfo = exports.getProjectInfoFromConfig = exports.parseOrDetermineConfig = exports.getDefaultConfigPath = exports.getStorybookUrl = exports.getRemoteFileUrl = exports.getGitRepoDefaultBranchName = exports.getGitRepoAbsolutePath = exports.getGitRemoteURL = exports.determineParserFromProject = exports.DEFAULT_INCLUDE_GLOBS_BY_PARSER = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const glob_1 = require("glob");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
12
|
+
const logging_1 = require("../common/logging");
|
|
13
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
14
|
+
const readline_1 = __importDefault(require("readline"));
|
|
15
|
+
// We use an old version of this dep as I couldn't get ES modules working
|
|
16
|
+
const find_up_1 = __importDefault(require("find-up"));
|
|
17
|
+
const DEFAULT_CONFIG_FILE_NAME = 'figma.config.json';
|
|
18
|
+
exports.DEFAULT_INCLUDE_GLOBS_BY_PARSER = {
|
|
19
|
+
react: [`**/*.{tsx,jsx}`],
|
|
20
|
+
swift: ['**/*.swift'],
|
|
21
|
+
compose: ['**/*.kt'],
|
|
22
|
+
__unit_test__: [''],
|
|
23
|
+
};
|
|
24
|
+
function determineConfigFromProject(dir) {
|
|
25
|
+
logging_1.logger.info('No config found, attempting to determine project type');
|
|
26
|
+
const parser = determineParserFromProject(dir);
|
|
27
|
+
if (parser) {
|
|
28
|
+
return { codeConnect: { parser } };
|
|
29
|
+
}
|
|
30
|
+
// TODO detect other project types here
|
|
31
|
+
(0, logging_1.exitWithError)(`Code Connect was not able to determine your project type, and no config file was found. Please ensure you are running Code Connect from your project root. You may need to create a config file specifying which parser to use. See https://github.com/figma/code-connect/ for instructions.`);
|
|
32
|
+
}
|
|
33
|
+
function showParserMessage(message) {
|
|
34
|
+
logging_1.logger.info(message +
|
|
35
|
+
'. If this is incorrect, please check you are running Code Connect from your project root, or add a `parser` key to your config file. See https://github.com/figma/code-connect for more information.');
|
|
36
|
+
}
|
|
37
|
+
// Walk up from the given directory looking for the first directory which
|
|
38
|
+
// matches heuristics for the platforms we support. This means that e.g. if you
|
|
39
|
+
// have a Swift project inside a React project, we'll detect Swift. This enables
|
|
40
|
+
// users to run commands from anywhere inside their project, rather than having
|
|
41
|
+
// to run from the root (the same way npm works).
|
|
42
|
+
function determineParserFromProject(dir) {
|
|
43
|
+
let parser;
|
|
44
|
+
find_up_1.default.sync((currentDir) => {
|
|
45
|
+
const packageJsonPath = path_1.default.join(currentDir, 'package.json');
|
|
46
|
+
if (fs_1.default.existsSync(packageJsonPath)) {
|
|
47
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'));
|
|
48
|
+
if (packageJson.dependencies && packageJson.dependencies['react']) {
|
|
49
|
+
showParserMessage(`Using "react" parser as package.json containing a "react" dependency was found in ${currentDir}`);
|
|
50
|
+
parser = 'react';
|
|
51
|
+
return find_up_1.default.stop;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
if ((0, glob_1.globSync)([`${currentDir}/*.xcodeproj`, `${currentDir}/Package.swift`]).length > 0) {
|
|
56
|
+
showParserMessage(`Using "swift" parser as a file matching *.xcodeproj or Package.swift was found in ${currentDir}`);
|
|
57
|
+
parser = 'swift';
|
|
58
|
+
return find_up_1.default.stop;
|
|
59
|
+
}
|
|
60
|
+
else if ((0, glob_1.globSync)([`${currentDir}/build.gradle.kts`]).length > 0) {
|
|
61
|
+
showParserMessage(`Using "compose" parser as a file matching build.gradle.kts was found in ${currentDir}`);
|
|
62
|
+
parser = 'compose';
|
|
63
|
+
return find_up_1.default.stop;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, { cwd: dir });
|
|
67
|
+
return parser;
|
|
68
|
+
}
|
|
69
|
+
exports.determineParserFromProject = determineParserFromProject;
|
|
70
|
+
async function checkForLegacyConfig(config, configFilePath) {
|
|
71
|
+
const maybeNewReactConfig = { codeConnect: { parser: 'react', ...config.codeConnect.react } };
|
|
72
|
+
const maybeNewSwiftConfig = { codeConnect: { parser: 'swift', ...config.codeConnect.swift } };
|
|
73
|
+
if (config.codeConnect.react && config.codeConnect.swift) {
|
|
74
|
+
logging_1.logger.error(`${chalk_1.default.bold('⚠️ Your Code Connect configuration needs to be updated\n')}`);
|
|
75
|
+
logging_1.logger.infoForce(`Code Connect is migrating from a single configuration file for all supported languages, to individual configuration files for each language.
|
|
76
|
+
|
|
77
|
+
As part of this change, your Code Connect configuration file needs to be split into two configuration files, one for React and one for Swift.
|
|
78
|
+
|
|
79
|
+
The React ${chalk_1.default.bold('figma.config.json')} should be located in your React project root and contain:
|
|
80
|
+
|
|
81
|
+
${JSON.stringify(maybeNewReactConfig, null, 2)}
|
|
82
|
+
|
|
83
|
+
The Swift ${chalk_1.default.bold('figma.config.json')} should be located in your Swift project root and contain:
|
|
84
|
+
|
|
85
|
+
${JSON.stringify(maybeNewSwiftConfig, null, 2)}
|
|
86
|
+
|
|
87
|
+
You will need to check any include/exclude paths are correct relative to the new locations.
|
|
88
|
+
|
|
89
|
+
Please raise an issue at https://github.com/figma/code-connect/issues if you have any problems.`);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
if (config.codeConnect.react || config.codeConnect.swift) {
|
|
93
|
+
const platform = config.codeConnect.react ? 'React' : 'Swift';
|
|
94
|
+
const newConfig = config.codeConnect.react ? maybeNewReactConfig : maybeNewSwiftConfig;
|
|
95
|
+
logging_1.logger.infoForce(`${chalk_1.default.bold('⚠️ Your Code Connect configuration needs to be updated')}
|
|
96
|
+
|
|
97
|
+
Code Connect is migrating from a single configuration file for all supported languages, to individual configuration files for each language.
|
|
98
|
+
|
|
99
|
+
As part of this change, your Code Connect configuration file needs to be updated to remove the ${chalk_1.default.bold(platform.toLowerCase())} key and add ${chalk_1.default.bold(`{ parser: "${platform.toLowerCase()}" }`)}:
|
|
100
|
+
|
|
101
|
+
${JSON.stringify(newConfig, null, 2)}
|
|
102
|
+
|
|
103
|
+
Code Connect can make this change for you automatically, or you can do it manually.
|
|
104
|
+
|
|
105
|
+
Please also ensure your configuration file is located in your ${platform} project root. If you move the configuration file, you will need to check any include/exclude paths are correct relative to the new location.
|
|
106
|
+
|
|
107
|
+
Please raise an issue at https://github.com/figma/code-connect/issues if you have any problems.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
`);
|
|
111
|
+
const rl = readline_1.default.createInterface({
|
|
112
|
+
input: process.stdin,
|
|
113
|
+
output: process.stderr,
|
|
114
|
+
});
|
|
115
|
+
const updateConfig = await new Promise((resolve) => {
|
|
116
|
+
rl.question('Would you like Code Connect to update your configuration file for you? (y/n) ', (answer) => {
|
|
117
|
+
resolve(answer);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
rl.close();
|
|
121
|
+
if (updateConfig.toLowerCase() === 'y') {
|
|
122
|
+
fs_1.default.writeFileSync(configFilePath, JSON.stringify(newConfig, null, 2));
|
|
123
|
+
logging_1.logger.infoForce(`\nConfiguration file updated`);
|
|
124
|
+
return newConfig;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
(0, logging_1.exitWithError)(`\nPlease update your configuration file manually`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return config;
|
|
131
|
+
}
|
|
132
|
+
async function parseConfig(configFilePath, dir) {
|
|
133
|
+
try {
|
|
134
|
+
const rawData = fs_1.default.readFileSync(configFilePath, 'utf-8');
|
|
135
|
+
const rawConfig = JSON.parse(rawData);
|
|
136
|
+
const config = await checkForLegacyConfig(rawConfig, configFilePath);
|
|
137
|
+
if (!config.codeConnect?.parser) {
|
|
138
|
+
const parser = determineParserFromProject(dir);
|
|
139
|
+
if (!parser) {
|
|
140
|
+
logging_1.logger.error(`Code Connect was not able to determine your project type, and no \`parser\` was specified. Please ensure you are running Code Connect from your project root. You may need to add a \`parser\` key to your config file, specifying which parser to use. See https://github.com/figma/code-connect/ for instructions.`);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
if (!config.codeConnect) {
|
|
144
|
+
config.codeConnect = { parser };
|
|
145
|
+
}
|
|
146
|
+
// TS errors if this is in an else
|
|
147
|
+
config.codeConnect.parser = parser;
|
|
148
|
+
}
|
|
149
|
+
return config;
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
console.error('Error parsing config file:', error);
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function getGitRemoteURL(repoPath) {
|
|
157
|
+
try {
|
|
158
|
+
const spawn = (0, child_process_1.spawnSync)('git', ['config', '--get', 'remote.origin.url'], {
|
|
159
|
+
cwd: repoPath,
|
|
160
|
+
});
|
|
161
|
+
const output = spawn.stdout;
|
|
162
|
+
return (output || '').toString().trim();
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
console.error('Error getting git remote URL:', error);
|
|
166
|
+
return '';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.getGitRemoteURL = getGitRemoteURL;
|
|
170
|
+
/**
|
|
171
|
+
* Uses `git rev-parse` to find absolute path to the root of the git repository
|
|
172
|
+
*/
|
|
173
|
+
function getGitRepoAbsolutePath(filePath) {
|
|
174
|
+
try {
|
|
175
|
+
const dirPath = fs_1.default.statSync(filePath).isDirectory() ? filePath : path_1.default.dirname(filePath);
|
|
176
|
+
const spawn = (0, child_process_1.spawnSync)('git', ['rev-parse', '--show-toplevel'], {
|
|
177
|
+
cwd: dirPath,
|
|
178
|
+
});
|
|
179
|
+
const output = spawn.stdout;
|
|
180
|
+
return ((output || '')
|
|
181
|
+
.toString()
|
|
182
|
+
// git always uses /, but other Node API use \ on Windows
|
|
183
|
+
.replaceAll('/', path_1.default.sep)
|
|
184
|
+
.trim());
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
console.error('Error running `git rev-parse`:', error.toString().split('\n')[0]);
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
exports.getGitRepoAbsolutePath = getGitRepoAbsolutePath;
|
|
192
|
+
/**
|
|
193
|
+
* Find the default branch name (master or main) for the git repository
|
|
194
|
+
*/
|
|
195
|
+
function getGitRepoDefaultBranchName(repoPath) {
|
|
196
|
+
const DEFAULT_BRANCH_NAME = 'master';
|
|
197
|
+
try {
|
|
198
|
+
// Get all git branches
|
|
199
|
+
const gitBranchResult = (0, child_process_1.spawnSync)('git', ['branch', '-r'], {
|
|
200
|
+
cwd: repoPath,
|
|
201
|
+
});
|
|
202
|
+
if (!gitBranchResult.stdout) {
|
|
203
|
+
return DEFAULT_BRANCH_NAME;
|
|
204
|
+
}
|
|
205
|
+
const branches = gitBranchResult.stdout
|
|
206
|
+
.toString()
|
|
207
|
+
.trim()
|
|
208
|
+
.split('\n')
|
|
209
|
+
.map((s) => s.trim());
|
|
210
|
+
// Check if origin/main exists, otherwise assume master
|
|
211
|
+
if (branches.includes('origin/main')) {
|
|
212
|
+
return 'main';
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
return DEFAULT_BRANCH_NAME;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
console.error('Error getting git default branch name:', error.toString().split('\n')[0]);
|
|
220
|
+
return DEFAULT_BRANCH_NAME;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.getGitRepoDefaultBranchName = getGitRepoDefaultBranchName;
|
|
224
|
+
/**
|
|
225
|
+
* Finds the URL of a remote file
|
|
226
|
+
* @param filePath absolute file path on disk
|
|
227
|
+
* @param repoURL remote URL
|
|
228
|
+
* @returns
|
|
229
|
+
*/
|
|
230
|
+
function getRemoteFileUrl(filePath, repoURL) {
|
|
231
|
+
if (!repoURL) {
|
|
232
|
+
return '';
|
|
233
|
+
}
|
|
234
|
+
filePath = filePath.replaceAll(path_1.default.sep, '/');
|
|
235
|
+
let url = repoURL.trim();
|
|
236
|
+
if (url.startsWith('git@')) {
|
|
237
|
+
url = url.replace(':', '/');
|
|
238
|
+
url = url.replace('git@', 'https://');
|
|
239
|
+
}
|
|
240
|
+
url = url.replace(/\.git$/, '');
|
|
241
|
+
// the folder of the git repo on disk could be named differently,
|
|
242
|
+
// so we need to find the relative path of the file to the root of the repo
|
|
243
|
+
// and append that to the remote URL
|
|
244
|
+
const repoAbsPath = getGitRepoAbsolutePath(filePath)
|
|
245
|
+
// Windows uses \ as the path separator, so replace with /
|
|
246
|
+
.replaceAll(path_1.default.sep, '/');
|
|
247
|
+
const defaultBranch = getGitRepoDefaultBranchName(repoAbsPath);
|
|
248
|
+
const index = filePath.indexOf(repoAbsPath);
|
|
249
|
+
if (index === -1) {
|
|
250
|
+
return '';
|
|
251
|
+
}
|
|
252
|
+
const relativeFilePath = filePath.substring(index + repoAbsPath.length);
|
|
253
|
+
return `${url}/blob/${defaultBranch}${relativeFilePath}`;
|
|
254
|
+
}
|
|
255
|
+
exports.getRemoteFileUrl = getRemoteFileUrl;
|
|
256
|
+
function getStorybookUrl(filePath, storybookUrl) {
|
|
257
|
+
// the folder of the git repo on disk could be named differently,
|
|
258
|
+
// so we need to find the relative path of the file to the root of the repo
|
|
259
|
+
// and append that to the remote URL
|
|
260
|
+
const repoAbsPath = getGitRepoAbsolutePath(filePath).replaceAll(path_1.default.sep, '/');
|
|
261
|
+
const index = filePath.indexOf(repoAbsPath);
|
|
262
|
+
if (index === -1) {
|
|
263
|
+
return '';
|
|
264
|
+
}
|
|
265
|
+
const relativeFilePath = filePath.substring(index + repoAbsPath.length + 1); // +1 to remove the leading slash
|
|
266
|
+
const storybookComponentPath = relativeFilePath
|
|
267
|
+
.trim()
|
|
268
|
+
.replace(/[\s|_]/g, '-')
|
|
269
|
+
.replace(/\.[jt]sx?$/, '')
|
|
270
|
+
.replaceAll('\\', '/')
|
|
271
|
+
.split('/')
|
|
272
|
+
.join('-');
|
|
273
|
+
return `${storybookUrl}/?path=/docs/${storybookComponentPath}`;
|
|
274
|
+
}
|
|
275
|
+
exports.getStorybookUrl = getStorybookUrl;
|
|
276
|
+
function mapToAbsolutePaths(globPaths, absPath) {
|
|
277
|
+
// glob doesn't like Windows paths so convert to *nix format
|
|
278
|
+
return globPaths.map((globPath) => `${absPath.replaceAll(path_1.default.sep, '/')}/${globPath}`);
|
|
279
|
+
}
|
|
280
|
+
function getDefaultConfigPath(dir) {
|
|
281
|
+
return path_1.default.resolve(path_1.default.join(dir, DEFAULT_CONFIG_FILE_NAME));
|
|
282
|
+
}
|
|
283
|
+
exports.getDefaultConfigPath = getDefaultConfigPath;
|
|
284
|
+
async function parseOrDetermineConfig(dir, configPath) {
|
|
285
|
+
const configFilePath = configPath ? path_1.default.resolve(configPath) : getDefaultConfigPath(dir);
|
|
286
|
+
const hasConfigFile = fs_1.default.existsSync(configFilePath);
|
|
287
|
+
const globalConfig = hasConfigFile
|
|
288
|
+
? await parseConfig(configFilePath, dir)
|
|
289
|
+
: determineConfigFromProject(dir);
|
|
290
|
+
if (!globalConfig) {
|
|
291
|
+
throw new Error(`Error parsing config file: ${configFilePath}`);
|
|
292
|
+
}
|
|
293
|
+
if (!globalConfig.codeConnect) {
|
|
294
|
+
throw new Error(`No options specified under 'codeConnect' in config file: ${configFilePath}`);
|
|
295
|
+
}
|
|
296
|
+
const config = globalConfig.codeConnect;
|
|
297
|
+
if (!hasConfigFile) {
|
|
298
|
+
logging_1.logger.info(`No config file found in ${dir}, proceeding with default options`);
|
|
299
|
+
}
|
|
300
|
+
else if (hasConfigFile && !config) {
|
|
301
|
+
logging_1.logger.info(`Config file found, but no options specified under 'codeConnect'. Parsing ${dir}`);
|
|
302
|
+
}
|
|
303
|
+
else if (config && !config.include) {
|
|
304
|
+
logging_1.logger.info(`Config file found, but no include globs specified. Parsing ${dir}`);
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
logging_1.logger.info(`Config file found, parsing ${dir} using specified include globs`);
|
|
308
|
+
}
|
|
309
|
+
return {
|
|
310
|
+
config,
|
|
311
|
+
hasConfigFile,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
exports.parseOrDetermineConfig = parseOrDetermineConfig;
|
|
315
|
+
/**
|
|
316
|
+
* Gets information about a project from config.
|
|
317
|
+
*
|
|
318
|
+
* @param dir Directory containing the project
|
|
319
|
+
* @param config Code Connect config
|
|
320
|
+
* @returns Object containing information about the project
|
|
321
|
+
*/
|
|
322
|
+
async function getProjectInfoFromConfig(dir, config) {
|
|
323
|
+
const absPath = path_1.default.resolve(dir);
|
|
324
|
+
const remoteUrl = getGitRemoteURL(absPath);
|
|
325
|
+
const defaultIncludeGlobs = config.parser
|
|
326
|
+
? exports.DEFAULT_INCLUDE_GLOBS_BY_PARSER[config.parser]
|
|
327
|
+
: undefined;
|
|
328
|
+
const defaultExcludeGlobs = config.parser
|
|
329
|
+
? {
|
|
330
|
+
react: [`${absPath}/node_modules/**`],
|
|
331
|
+
swift: [''],
|
|
332
|
+
compose: [''],
|
|
333
|
+
__unit_test__: [''],
|
|
334
|
+
}[config.parser]
|
|
335
|
+
: '';
|
|
336
|
+
const includeGlobs = config.include || defaultIncludeGlobs;
|
|
337
|
+
const excludeGlobs = config.exclude || defaultExcludeGlobs || [];
|
|
338
|
+
if (!includeGlobs) {
|
|
339
|
+
(0, logging_1.exitWithError)('No include globs specified in config file');
|
|
340
|
+
}
|
|
341
|
+
const files = (0, glob_1.globSync)(mapToAbsolutePaths(includeGlobs, absPath), {
|
|
342
|
+
nodir: true,
|
|
343
|
+
ignore: mapToAbsolutePaths(excludeGlobs, absPath),
|
|
344
|
+
// Otherwise this is true on *nix and false on Windows
|
|
345
|
+
absolute: true,
|
|
346
|
+
});
|
|
347
|
+
return {
|
|
348
|
+
absPath,
|
|
349
|
+
remoteUrl,
|
|
350
|
+
config,
|
|
351
|
+
files,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
exports.getProjectInfoFromConfig = getProjectInfoFromConfig;
|
|
355
|
+
/**
|
|
356
|
+
* Gets information about a project from a directory.
|
|
357
|
+
*
|
|
358
|
+
* @param dir Directory containing the project
|
|
359
|
+
* @param configPath Optional path to Code Connect config file
|
|
360
|
+
* @returns Object containing information about the project
|
|
361
|
+
*/
|
|
362
|
+
async function getProjectInfo(dir, configPath) {
|
|
363
|
+
const { config } = await parseOrDetermineConfig(dir, configPath);
|
|
364
|
+
return getProjectInfoFromConfig(dir, config);
|
|
365
|
+
}
|
|
366
|
+
exports.getProjectInfo = getProjectInfo;
|
|
367
|
+
function getReactProjectInfo(projectInfo) {
|
|
368
|
+
const compilerOptions = {
|
|
369
|
+
// This ensures the compiler can resolve imports such as "ui/button" when a
|
|
370
|
+
// baseUrl is configured in the tsconfig of the project. We probably want a more
|
|
371
|
+
// sophisticated way to parse the users tsconfig and pass it to the compiler eventually.
|
|
372
|
+
baseUrl: projectInfo.absPath,
|
|
373
|
+
// TODO: not sure why Node10 is needed her, but otherwise module resolution for
|
|
374
|
+
// pnpm workspaces won't work
|
|
375
|
+
moduleResolution: typescript_1.default.ModuleResolutionKind.Node10,
|
|
376
|
+
paths: projectInfo.config.paths ?? {},
|
|
377
|
+
allowJs: true,
|
|
378
|
+
};
|
|
379
|
+
const tsProgram = typescript_1.default.createProgram(projectInfo.files, compilerOptions);
|
|
380
|
+
return {
|
|
381
|
+
...projectInfo,
|
|
382
|
+
tsProgram,
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
exports.getReactProjectInfo = getReactProjectInfo;
|
|
386
|
+
function resolveImportPath(filePath, config) {
|
|
387
|
+
function isMatch(patternParts, pathParts) {
|
|
388
|
+
for (let i = 0; i < patternParts.length; i++) {
|
|
389
|
+
if (patternParts[i] !== '*' && patternParts[i] !== pathParts[i]) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
for (const [key, value] of Object.entries(config.importPaths || {})) {
|
|
396
|
+
// Do a partial match from the end of the path
|
|
397
|
+
const patternParts = key.split('/').reverse();
|
|
398
|
+
const pathParts = filePath.split('/').reverse();
|
|
399
|
+
if (pathParts.length < patternParts.length) {
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
// If the mapped path ends with a wildcard we want to keep the filename in
|
|
403
|
+
// the final path (for non-index imports)
|
|
404
|
+
if (isMatch(patternParts, pathParts)) {
|
|
405
|
+
return value.endsWith('*') ? `${value.slice(0, -1)}${pathParts[0].split('.')[0]}` : value;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
exports.resolveImportPath = resolveImportPath;
|
|
411
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/connect/project.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAyC;AACzC,+BAA+B;AAC/B,gDAAuB;AACvB,4CAAmB;AACnB,4DAA2B;AAC3B,+CAAyD;AACzD,kDAAyB;AACzB,wDAA+B;AAC/B,yEAAyE;AACzE,sDAA4B;AAE5B,MAAM,wBAAwB,GAAG,mBAAmB,CAAA;AAEvC,QAAA,+BAA+B,GAAG;IAC7C,KAAK,EAAE,CAAC,gBAAgB,CAAC;IACzB,KAAK,EAAE,CAAC,YAAY,CAAC;IACrB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,aAAa,EAAE,CAAC,EAAE,CAAC;CACpB,CAAA;AAmFD,SAAS,0BAA0B,CAAC,GAAW;IAC7C,gBAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAA;IAEpE,MAAM,MAAM,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAA;IAC9C,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,CAAA;IACpC,CAAC;IAED,uCAAuC;IAEvC,IAAA,uBAAa,EACX,8RAA8R,CAC/R,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAe;IACxC,gBAAM,CAAC,IAAI,CACT,OAAO;QACL,sMAAsM,CACzM,CAAA;AACH,CAAC;AAED,y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E,eAAe,EAAE,CAAA;CACxB;AAMD,wBAAsB,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/connect/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAKzD,UAAU,IAAI;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,eAAe,EAAE,CAAA;CACxB;AAMD,wBAAsB,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,IAAI,iBA4BvD"}
|
package/dist/connect/upload.js
CHANGED
|
@@ -35,10 +35,7 @@ async function upload({ accessToken, docs }) {
|
|
|
35
35
|
try {
|
|
36
36
|
logging_1.logger.info(`Uploading to Figma...`);
|
|
37
37
|
const response = await axios_1.default.post(apiUrl, docs, {
|
|
38
|
-
headers:
|
|
39
|
-
'X-Figma-Token': accessToken,
|
|
40
|
-
'Content-Type': 'application/json',
|
|
41
|
-
},
|
|
38
|
+
headers: (0, figma_rest_api_1.getHeaders)(accessToken),
|
|
42
39
|
});
|
|
43
40
|
logging_1.logger.info(`Successfully uploaded to Figma:\n${docs.map((doc) => `-> ${codeConnectStr(doc)}`).join('\n')}`);
|
|
44
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/connect/upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAgE;AAChE,+CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/connect/upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAgE;AAChE,+CAA2C;AAC3C,qDAAwD;AAOxD,SAAS,cAAc,CAAC,GAAoB;IAC1C,OAAO,GAAG,IAAA,mBAAS,EAAC,GAAG,CAAC,SAAS,IAAI,EAA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gBAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;YAC3D,CAAC;YACD,gBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;QAClD,CAAC;aAAM,CAAC;YACN,gBAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAA;QACnD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AA5BD,wBA4BC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { CodeConnectJSON } from '../common/figma_connect';
|
|
2
|
-
|
|
2
|
+
import { BaseCommand } from '../commands/connect';
|
|
3
|
+
export declare function parseFigmaNode(cmd: BaseCommand, doc: CodeConnectJSON, silent?: boolean): {
|
|
4
|
+
fileKey: string;
|
|
5
|
+
nodeId: string;
|
|
6
|
+
} | null;
|
|
7
|
+
export declare function validateDocs(cmd: BaseCommand, accessToken: string, docs: CodeConnectJSON[]): Promise<boolean>;
|
|
3
8
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/connect/validation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/connect/validation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAIzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,eAAe,EACpB,MAAM,GAAE,OAAe,GACtB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAoB5C;AAuMD,wBAAsB,YAAY,CAChC,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,eAAe,EAAE,GACtB,OAAO,CAAC,OAAO,CAAC,CAoDlB"}
|