@figma/code-connect 1.0.6 → 1.1.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 +48 -541
- package/dist/client/figma_client.d.ts +1 -1
- package/dist/client/figma_client.js +9 -7
- package/dist/client/figma_client.js.map +1 -1
- package/dist/commands/connect.d.ts +4 -2
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +97 -49
- package/dist/commands/connect.js.map +1 -1
- package/dist/{common → connect}/api.d.ts +6 -87
- package/dist/connect/api.d.ts.map +1 -0
- package/dist/{common → connect}/api.js.map +1 -1
- package/dist/connect/create.d.ts.map +1 -1
- package/dist/connect/create.js +4 -0
- package/dist/connect/create.js.map +1 -1
- package/dist/connect/create_common.d.ts +7 -0
- package/dist/connect/create_common.d.ts.map +1 -0
- package/dist/connect/create_common.js +19 -0
- package/dist/connect/create_common.js.map +1 -0
- package/dist/connect/external_types.d.ts +8 -0
- package/dist/connect/external_types.d.ts.map +1 -0
- package/dist/connect/external_types.js +31 -0
- package/dist/connect/external_types.js.map +1 -0
- package/dist/connect/figma_connect.d.ts.map +1 -0
- package/dist/connect/figma_connect.js.map +1 -0
- package/dist/connect/figma_rest_api.d.ts +7 -0
- package/dist/connect/figma_rest_api.d.ts.map +1 -1
- package/dist/connect/figma_rest_api.js.map +1 -1
- package/dist/connect/index_common.d.ts +3 -0
- package/dist/connect/index_common.d.ts.map +1 -0
- package/dist/connect/index_common.js +23 -0
- package/dist/connect/index_common.js.map +1 -0
- package/dist/{common → connect}/intrinsics.d.ts +4 -3
- package/dist/connect/intrinsics.d.ts.map +1 -0
- package/dist/{common → connect}/intrinsics.js +48 -24
- package/dist/connect/intrinsics.js.map +1 -0
- package/dist/connect/parser_common.d.ts +144 -0
- package/dist/connect/parser_common.d.ts.map +1 -0
- package/dist/connect/parser_common.js +297 -0
- package/dist/connect/parser_common.js.map +1 -0
- package/dist/connect/parser_executable_types.d.ts +20 -23
- package/dist/connect/parser_executable_types.d.ts.map +1 -1
- package/dist/connect/parser_executable_types.js.map +1 -1
- package/dist/connect/parser_executables.js +1 -1
- package/dist/connect/parser_executables.js.map +1 -1
- package/dist/connect/project.d.ts +20 -5
- package/dist/connect/project.d.ts.map +1 -1
- package/dist/connect/project.js +79 -16
- package/dist/connect/project.js.map +1 -1
- package/dist/connect/upload.d.ts +1 -1
- package/dist/connect/upload.d.ts.map +1 -1
- package/dist/connect/validation.d.ts +1 -1
- package/dist/connect/validation.d.ts.map +1 -1
- package/dist/connect/wizard/helpers.d.ts.map +1 -1
- package/dist/connect/wizard/helpers.js +18 -14
- package/dist/connect/wizard/helpers.js.map +1 -1
- package/dist/connect/wizard/prop_mapping.d.ts +12 -7
- package/dist/connect/wizard/prop_mapping.d.ts.map +1 -1
- package/dist/connect/wizard/prop_mapping.js +88 -89
- package/dist/connect/wizard/prop_mapping.js.map +1 -1
- package/dist/connect/wizard/run_wizard.d.ts.map +1 -1
- package/dist/connect/wizard/run_wizard.js +8 -3
- package/dist/connect/wizard/run_wizard.js.map +1 -1
- package/dist/connect/wizard/signature_extraction.d.ts +7 -0
- package/dist/connect/wizard/signature_extraction.d.ts.map +1 -0
- package/dist/connect/wizard/signature_extraction.js +46 -0
- package/dist/connect/wizard/signature_extraction.js.map +1 -0
- package/dist/html/__test__/parser/examples/NoConfigObject.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/NoConfigObject.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/NoConfigObject.figma.js +9 -0
- package/dist/html/__test__/parser/examples/NoConfigObject.figma.js.map +1 -0
- package/dist/html/__test__/parser/examples/NoExample.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/NoExample.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/NoExample.figma.js +9 -0
- package/dist/html/__test__/parser/examples/NoExample.figma.js.map +1 -0
- package/dist/html/__test__/parser/examples/RegularFunctionExampleWithExtraCode.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/RegularFunctionExampleWithExtraCode.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/RegularFunctionExampleWithExtraCode.figma.js +33 -0
- package/dist/html/__test__/parser/examples/RegularFunctionExampleWithExtraCode.figma.js.map +1 -0
- package/dist/html/__test__/parser/examples/WrongSignatureJsx.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/WrongSignatureJsx.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/WrongSignatureJsx.figma.js +15 -0
- package/dist/html/__test__/parser/examples/WrongSignatureJsx.figma.js.map +1 -0
- package/dist/html/__test__/parser/examples/WrongSignatureNoHtmlTag.figma.d.ts +2 -0
- package/dist/html/__test__/parser/examples/WrongSignatureNoHtmlTag.figma.d.ts.map +1 -0
- package/dist/html/__test__/parser/examples/WrongSignatureNoHtmlTag.figma.js +15 -0
- package/dist/html/__test__/parser/examples/WrongSignatureNoHtmlTag.figma.js.map +1 -0
- package/dist/html/__test__/parser/parser.test.d.ts +2 -0
- package/dist/html/__test__/parser/parser.test.d.ts.map +1 -0
- package/dist/html/__test__/parser/parser.test.js +50 -0
- package/dist/html/__test__/parser/parser.test.js.map +1 -0
- package/dist/html/create.d.ts +4 -0
- package/dist/html/create.d.ts.map +1 -0
- package/dist/html/create.js +81 -0
- package/dist/html/create.js.map +1 -0
- package/dist/html/external.d.ts +8 -0
- package/dist/html/external.d.ts.map +1 -0
- package/dist/html/external.js +25 -0
- package/dist/html/external.js.map +1 -0
- package/dist/html/index_html.d.ts +77 -0
- package/dist/html/index_html.d.ts.map +1 -0
- package/dist/html/index_html.js +42 -0
- package/dist/html/index_html.js.map +1 -0
- package/dist/html/parser.d.ts +19 -0
- package/dist/html/parser.d.ts.map +1 -0
- package/dist/html/parser.js +487 -0
- package/dist/html/parser.js.map +1 -0
- package/dist/html/parser_template_helpers.d.ts +2 -0
- package/dist/html/parser_template_helpers.d.ts.map +1 -0
- package/dist/html/parser_template_helpers.js +68 -0
- package/dist/html/parser_template_helpers.js.map +1 -0
- package/dist/html/template_literal.d.ts +5 -0
- package/dist/html/template_literal.d.ts.map +1 -0
- package/dist/html/template_literal.js +8 -0
- package/dist/html/template_literal.js.map +1 -0
- package/dist/parser_scripts/get_swift_parser_dir.d.ts +1 -1
- package/dist/parser_scripts/get_swift_parser_dir.d.ts.map +1 -1
- package/dist/parser_scripts/get_swift_parser_dir.js +38 -10
- package/dist/parser_scripts/get_swift_parser_dir.js.map +1 -1
- package/dist/react/create.d.ts +5 -0
- package/dist/react/create.d.ts.map +1 -1
- package/dist/react/create.js +144 -42
- package/dist/react/create.js.map +1 -1
- package/dist/react/external.d.ts +9 -0
- package/dist/react/external.d.ts.map +1 -0
- package/dist/{common → react}/external.js +8 -28
- package/dist/react/external.js.map +1 -0
- package/dist/react/index_react.d.ts +94 -0
- package/dist/react/index_react.d.ts.map +1 -0
- package/dist/{index.js → react/index_react.js} +5 -19
- package/dist/react/index_react.js.map +1 -0
- package/dist/react/parser.d.ts +6 -38
- package/dist/react/parser.d.ts.map +1 -1
- package/dist/react/parser.js +137 -295
- package/dist/react/parser.js.map +1 -1
- package/dist/react/parser_template_helpers.d.ts +15 -15
- package/dist/react/parser_template_helpers.d.ts.map +1 -1
- package/dist/react/parser_template_helpers.js +51 -35
- package/dist/react/parser_template_helpers.js.map +1 -1
- package/dist/storybook/convert.d.ts +1 -1
- 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/dist/storybook/external.d.ts +1 -1
- package/dist/storybook/external.d.ts.map +1 -1
- package/dist/typescript/compiler.d.ts +2 -2
- package/dist/typescript/compiler.d.ts.map +1 -1
- package/dist/typescript/compiler.js +50 -23
- package/dist/typescript/compiler.js.map +1 -1
- package/package.json +28 -8
- package/dist/common/__test__/project.test.d.ts +0 -2
- package/dist/common/__test__/project.test.d.ts.map +0 -1
- package/dist/common/__test__/project.test.js +0 -14
- package/dist/common/__test__/project.test.js.map +0 -1
- package/dist/common/api.d.ts.map +0 -1
- package/dist/common/external.d.ts +0 -14
- package/dist/common/external.d.ts.map +0 -1
- package/dist/common/external.js.map +0 -1
- package/dist/common/figma_connect.d.ts.map +0 -1
- package/dist/common/figma_connect.js.map +0 -1
- package/dist/common/intrinsics.d.ts.map +0 -1
- package/dist/common/intrinsics.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- /package/dist/{common → connect}/api.js +0 -0
- /package/dist/{common → connect}/figma_connect.d.ts +0 -0
- /package/dist/{common → connect}/figma_connect.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../src/react/external.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6CAA8B;AAC9B,8DAOkC;AAmBjB,wFAzBf,4BAAW,OAyBW;AACV,qFAzBZ,yBAAQ,OAyBQ;AACF,uFAzBd,2BAAU,OAyBU;AACD,4FAzBnB,gCAAe,OAyBe;AACb,0FAzBjB,8BAAa,OAyBa;AACP,4FAzBnB,gCAAe,OAyBe;AAhBhC,SAAS,WAAW,CAAC,UAAmB,EAAE,aAAsB,EAAE,KAAe,IAAS,CAAC;AAiB1E,8BAAO;AAfxB,SAAS,YAAY,CAAC,cAAsB;IAC1C,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC;AAciB,gCAAQ;AAZ1B,SAAS,YAAY,CAAC,OAA0B;IAC9C,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC;AAWiB,gCAAQ"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { EnumValue, FigmaConnectAPI, FigmaConnectMeta, ValueOf } from '../connect/api';
|
|
3
|
+
import * as StorybookTypes from '../storybook/external';
|
|
4
|
+
import { FigmaConnectClient } from '../client/figma_client';
|
|
5
|
+
declare const _client: FigmaConnectClient;
|
|
6
|
+
declare const _figma: FigmaConnectAPI<JSX.Element> & {
|
|
7
|
+
/**
|
|
8
|
+
* Defines a code snippet that displays in Figma when a component is selected. This function has two signatures:
|
|
9
|
+
* - When called with a component reference as the first argument, it will infer metadata such as the import statement
|
|
10
|
+
* and location in source file from the component reference
|
|
11
|
+
* - When called only with a Figma node URL, this metadata will not be included. This is useful when you want to display a code snippet
|
|
12
|
+
* for something that isn't a React component, such as a `<button>` element
|
|
13
|
+
*
|
|
14
|
+
* @param component A reference to the React component
|
|
15
|
+
* @param figmaNodeUrl A link to the node in Figma, for example:`https://www.figma.com/file/123abc/My-Component?node-id=123:456`
|
|
16
|
+
* @param meta {@link FigmaConnectMeta}
|
|
17
|
+
*/
|
|
18
|
+
connect<P = {}>(component: any, figmaNodeUrl: string, meta?: FigmaConnectMeta<P, React.Component | JSX.Element>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Defines a code snippet that displays in Figma when a component is selected. This function has two signatures:
|
|
21
|
+
* - When called with a component reference as the first argument, it will infer metadata such as the import statement
|
|
22
|
+
* and location in source file from the component reference
|
|
23
|
+
* - When called only with a Figma node URL, this metadata will not be included. This is useful when you want to display a code snippet
|
|
24
|
+
* for something that isn't a React component, such as a `<button>` element
|
|
25
|
+
*
|
|
26
|
+
* @param figmaNodeUrl A link to the node in Figma, for example:`https://www.figma.com/file/123abc/My-Component?node-id=123:456`
|
|
27
|
+
* @param meta {@link FigmaConnectMeta}
|
|
28
|
+
*/
|
|
29
|
+
connect<P = {}>(figmaNodeUrl: string, meta?: FigmaConnectMeta<P, React.Component | JSX.Element>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Maps a Figma property to a boolean value for the connected component. This prop is replaced
|
|
32
|
+
* with values from the Figma instance when viewed in Dev Mode. For example:
|
|
33
|
+
* ```ts
|
|
34
|
+
* props: {
|
|
35
|
+
* disabled: figma.boolean('Disabled'),
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
* Would show the `disabled` property if the Figma property "Disabled" is true.
|
|
39
|
+
*
|
|
40
|
+
* @param figmaPropName The name of the property on the Figma component
|
|
41
|
+
*/
|
|
42
|
+
boolean(figmaPropName: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Maps a Figma boolean property to a set of values for the connected component, providing
|
|
45
|
+
* a value mapping for `true` and `false`. This prop is replaced with values from the
|
|
46
|
+
* Figma instance when viewed in Dev Mode. Example:
|
|
47
|
+
* ```ts
|
|
48
|
+
* props: {
|
|
49
|
+
* label: figma.boolean('Disabled', {
|
|
50
|
+
* true: <Label />,
|
|
51
|
+
* false: <HiddenLabel />
|
|
52
|
+
* }),
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
* Would replace `label` with `<Label />` if the Figma property "Disabled" is true.
|
|
56
|
+
*
|
|
57
|
+
* @param figmaPropName The name of the property on the Figma component
|
|
58
|
+
* @param valueMapping A mapping of values for `true` and `false`
|
|
59
|
+
*/
|
|
60
|
+
boolean<TrueT extends EnumValue, FalseT extends EnumValue>(figmaPropName: string, valueMapping?: {
|
|
61
|
+
true?: TrueT;
|
|
62
|
+
false?: FalseT;
|
|
63
|
+
}): ValueOf<Record<'true' | 'false', TrueT | FalseT>>;
|
|
64
|
+
/**
|
|
65
|
+
* Maps nested properties from a Figma instance layer. The first argument
|
|
66
|
+
* should be the layer name of the nested instance. The mapping object passed
|
|
67
|
+
* in is in the same format as the `props` object in the `connect` function.
|
|
68
|
+
* For example:
|
|
69
|
+
* ```ts
|
|
70
|
+
* props: {
|
|
71
|
+
* nested: figma.nestedProps('Nested', {
|
|
72
|
+
* label: figma.string('Text'),
|
|
73
|
+
* icon: figma.instance('Icon'),
|
|
74
|
+
* }),
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* Which would then allow you to access the nested properties in the `example` function like so:
|
|
79
|
+
* ```ts
|
|
80
|
+
* (props) => <Button label={props.nested.label} icon={props.nested.icon} />
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
nestedProps<V>(layer: string, input: V): V;
|
|
84
|
+
/**
|
|
85
|
+
* A list of import statements that will render in the Code Snippet in Figma.
|
|
86
|
+
* This overrides the auto-generated imports for the component. When this is specified,
|
|
87
|
+
* the `importPaths` option in the config file is also ignored.
|
|
88
|
+
*/
|
|
89
|
+
imports?: string[];
|
|
90
|
+
};
|
|
91
|
+
export { _figma as figma, _client as client };
|
|
92
|
+
export default _figma;
|
|
93
|
+
export type StoryParameters<T = {}> = StorybookTypes.StoryParameters<T>;
|
|
94
|
+
//# sourceMappingURL=index_react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index_react.d.ts","sourceRoot":"","sources":["../../src/react/index_react.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAEtF,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAG3D,QAAA,MAAM,OAAO,EAAE,kBAAgC,CAAA;AAC/C,QAAA,MAAM,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG;IAC3C;;;;;;;;;;OAUG;IACH,OAAO,CAAC,CAAC,GAAG,EAAE,EACZ,SAAS,EAAE,GAAG,EACd,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,GACxD,IAAI,CAAA;IAEP;;;;;;;;;OASG;IACH,OAAO,CAAC,CAAC,GAAG,EAAE,EACZ,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,GACxD,IAAI,CAAA;IAEP;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAA;IAEvC;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,KAAK,SAAS,SAAS,EAAE,MAAM,SAAS,SAAS,EACvD,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE;QACb,IAAI,CAAC,EAAE,KAAK,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,GACA,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC,CAAA;IAEpD;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAA;IAE1C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACX,CAAA;AAET,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,OAAO,IAAI,MAAM,EAAE,CAAA;AAC7C,eAAe,MAAM,CAAA;AAErB,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,EAAE,IAAI,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// IMPORTANT: be careful to ensure you don't accidentally add code which has a
|
|
3
|
-
// dependency on Node.js-only modules here, as it will break co
|
|
3
|
+
// dependency on Node.js-only modules here, as it will break co-located
|
|
4
4
|
// components. We don't have a test for this yet. Any such code should be
|
|
5
5
|
// conditionally required - see `client` for an example. Reach out in
|
|
6
6
|
// #feat-code-connect if you're unsure.
|
|
@@ -29,25 +29,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.client = exports.figma = void 0;
|
|
32
|
-
const figma = __importStar(require("./
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// co-locate your Code Connect with React components, your app will be broken in
|
|
36
|
-
// a browser, because of this import chain.
|
|
37
|
-
//
|
|
38
|
-
// To get around this, we only import `client/external` if you are in a Node
|
|
39
|
-
// context – it is only used for the icon script, so none of the code which runs
|
|
40
|
-
// in the browser should touch it.
|
|
41
|
-
//
|
|
42
|
-
// Note that you may still see messages from the JS bundler about Node modules,
|
|
43
|
-
// but these won't be included at runtime.
|
|
44
|
-
let client = {};
|
|
45
|
-
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
|
|
46
|
-
client = require('./client/external');
|
|
47
|
-
}
|
|
48
|
-
const _client = client;
|
|
32
|
+
const figma = __importStar(require("./external"));
|
|
33
|
+
const index_common_1 = require("../connect/index_common");
|
|
34
|
+
const _client = (0, index_common_1.getClient)();
|
|
49
35
|
exports.client = _client;
|
|
50
36
|
const _figma = figma;
|
|
51
37
|
exports.figma = _figma;
|
|
52
38
|
exports.default = _figma;
|
|
53
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=index_react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index_react.js","sourceRoot":"","sources":["../../src/react/index_react.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,uEAAuE;AACvE,yEAAyE;AACzE,qEAAqE;AACrE,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;AAGvC,kDAAmC;AAGnC,0DAAmD;AAEnD,MAAM,OAAO,GAAuB,IAAA,wBAAS,GAAE,CAAA;AAsGV,yBAAM;AArG3C,MAAM,MAAM,GAmGR,KAAK,CAAA;AAEU,uBAAK;AACxB,kBAAe,MAAM,CAAA"}
|
package/dist/react/parser.d.ts
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
node: ts.Node | undefined;
|
|
7
|
-
}
|
|
8
|
-
export declare class ParserError extends Error {
|
|
9
|
-
sourceFilePosition: ts.LineAndCharacter | null;
|
|
10
|
-
sourceFileName: string;
|
|
11
|
-
constructor(message: string, context?: ParserErrorContext);
|
|
12
|
-
toString(): string;
|
|
13
|
-
toDebugString(): string;
|
|
14
|
-
}
|
|
15
|
-
export declare class InternalError extends ParserError {
|
|
16
|
-
constructor(message: string);
|
|
17
|
-
}
|
|
18
|
-
export interface ParserContext {
|
|
19
|
-
checker: ts.TypeChecker;
|
|
20
|
-
sourceFile: ts.SourceFile;
|
|
21
|
-
config: CodeConnectReactConfig;
|
|
22
|
-
absPath: string;
|
|
23
|
-
}
|
|
2
|
+
import { PropMappings } from '../connect/intrinsics';
|
|
3
|
+
import { CodeConnectJSON } from '../connect/figma_connect';
|
|
4
|
+
import { ParserContext, ParseOptions } from '../connect/parser_common';
|
|
5
|
+
export declare function findAndResolveImports(program: ts.Program, sourceFile: ts.SourceFile): Record<string, string>;
|
|
24
6
|
export type ComponentTypeSignature = Record<string, string>;
|
|
25
7
|
/**
|
|
26
8
|
* Extracts the type signature from the interface of a React component as a map of
|
|
@@ -46,19 +28,11 @@ export declare function extractComponentTypeSignature(symbol: ts.Symbol, checker
|
|
|
46
28
|
* @param node The node being parsed. Used for error logging.
|
|
47
29
|
* @returns Metadata object
|
|
48
30
|
*/
|
|
49
|
-
export declare function parseComponentMetadata(node: ts.PropertyAccessExpression | ts.Identifier | ts.Expression,
|
|
31
|
+
export declare function parseComponentMetadata(node: ts.PropertyAccessExpression | ts.Identifier | ts.Expression, parserContext: ParserContext, silent?: boolean): Promise<{
|
|
50
32
|
source: string;
|
|
51
33
|
line: number;
|
|
52
34
|
component: string;
|
|
53
35
|
}>;
|
|
54
|
-
/**
|
|
55
|
-
* Checks if a file contains Code Connect by looking for the `figma.connect()` function call
|
|
56
|
-
*
|
|
57
|
-
* @param program
|
|
58
|
-
* @param file
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
export declare function isFigmaConnectFile(program: ts.Program, file: string): boolean;
|
|
62
36
|
/**
|
|
63
37
|
* Parses the render function passed to `figma.connect()`, extracting the code and
|
|
64
38
|
* any import statements matching the JSX elements used in the function body
|
|
@@ -78,11 +52,5 @@ export declare function parseRenderFunction(exp: ts.ArrowFunction | ts.FunctionE
|
|
|
78
52
|
nestable: boolean;
|
|
79
53
|
};
|
|
80
54
|
export declare function getDefaultTemplate(componentMetadata: Awaited<ReturnType<typeof parseComponentMetadata>>): string;
|
|
81
|
-
|
|
82
|
-
repoUrl?: string;
|
|
83
|
-
debug?: boolean;
|
|
84
|
-
silent?: boolean;
|
|
85
|
-
};
|
|
86
|
-
export declare function parse(program: ts.Program, file: string, config: CodeConnectReactConfig, absPath: string, parseOptions?: ParseOptions): Promise<any[]>;
|
|
87
|
-
export {};
|
|
55
|
+
export declare function parseReactDoc(node: ts.CallExpression, parserContext: ParserContext, { repoUrl, silent }: ParseOptions): Promise<CodeConnectJSON>;
|
|
88
56
|
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/react/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/react/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAW3B,OAAO,EAAsB,YAAY,EAAoB,MAAM,uBAAuB,CAAA;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EAIL,aAAa,EASb,YAAY,EACb,MAAM,0BAA0B,CAAA;AAgFjC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,UAAU,0BAanF;AAsMD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE3D;;;;;;;;;;;;GAYG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,EAAE,CAAC,MAAM,EACjB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,UAAU,EAAE,EAAE,CAAC,UAAU,0BA0E1B;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,EAAE,CAAC,wBAAwB,GAAG,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,UAAU,EACjE,aAAa,EAAE,aAAa,EAC5B,MAAM,CAAC,EAAE,OAAO;;;;GA4GjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,EAAE,CAAC,aAAa,GAAG,EAAE,CAAC,kBAAkB,GAAG,EAAE,CAAC,mBAAmB,EACtE,aAAa,EAAE,aAAa,EAC5B,YAAY,CAAC,EAAE,YAAY;;;;;;;EA8O5B;AA+LD,wBAAgB,kBAAkB,CAChC,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,UAItE;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,EAAE,CAAC,cAAc,EACvB,aAAa,EAAE,aAAa,EAC5B,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,GAChC,OAAO,CAAC,eAAe,CAAC,CAyG1B"}
|