figma-inspect-cli 0.1.0
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 +156 -0
- package/dist/bin/figma-inspect.d.ts +3 -0
- package/dist/bin/figma-inspect.d.ts.map +1 -0
- package/dist/bin/figma-inspect.js +19 -0
- package/dist/bin/figma-inspect.js.map +1 -0
- package/dist/cli/errors.d.ts +3 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +3 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/export-component-set.d.ts +21 -0
- package/dist/cli/export-component-set.d.ts.map +1 -0
- package/dist/cli/export-component-set.js +173 -0
- package/dist/cli/export-component-set.js.map +1 -0
- package/dist/cli/export-contract.d.ts +20 -0
- package/dist/cli/export-contract.d.ts.map +1 -0
- package/dist/cli/export-contract.js +48 -0
- package/dist/cli/export-contract.js.map +1 -0
- package/dist/cli/export-node-contract.d.ts +17 -0
- package/dist/cli/export-node-contract.d.ts.map +1 -0
- package/dist/cli/export-node-contract.js +93 -0
- package/dist/cli/export-node-contract.js.map +1 -0
- package/dist/cli/export-result.d.ts +17 -0
- package/dist/cli/export-result.d.ts.map +1 -0
- package/dist/cli/export-result.js +22 -0
- package/dist/cli/export-result.js.map +1 -0
- package/dist/cli/export-team-index.d.ts +18 -0
- package/dist/cli/export-team-index.d.ts.map +1 -0
- package/dist/cli/export-team-index.js +121 -0
- package/dist/cli/export-team-index.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/output.d.ts +13 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +26 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/parse-args.d.ts +3 -0
- package/dist/cli/parse-args.d.ts.map +1 -0
- package/dist/cli/parse-args.js +790 -0
- package/dist/cli/parse-args.js.map +1 -0
- package/dist/cli/run-cli.d.ts +3 -0
- package/dist/cli/run-cli.d.ts.map +1 -0
- package/dist/cli/run-cli.js +416 -0
- package/dist/cli/run-cli.js.map +1 -0
- package/dist/cli/types.d.ts +114 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/usage.d.ts +2 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +75 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/figma-api/cache/cached-request.d.ts +8 -0
- package/dist/figma-api/cache/cached-request.d.ts.map +1 -0
- package/dist/figma-api/cache/cached-request.js +100 -0
- package/dist/figma-api/cache/cached-request.js.map +1 -0
- package/dist/figma-api/cache/constants.d.ts +5 -0
- package/dist/figma-api/cache/constants.d.ts.map +1 -0
- package/dist/figma-api/cache/constants.js +5 -0
- package/dist/figma-api/cache/constants.js.map +1 -0
- package/dist/figma-api/cache/extract-metadata.d.ts +3 -0
- package/dist/figma-api/cache/extract-metadata.d.ts.map +1 -0
- package/dist/figma-api/cache/extract-metadata.js +13 -0
- package/dist/figma-api/cache/extract-metadata.js.map +1 -0
- package/dist/figma-api/cache/index.d.ts +3 -0
- package/dist/figma-api/cache/index.d.ts.map +1 -0
- package/dist/figma-api/cache/index.js +3 -0
- package/dist/figma-api/cache/index.js.map +1 -0
- package/dist/figma-api/cache/store.d.ts +10 -0
- package/dist/figma-api/cache/store.d.ts.map +1 -0
- package/dist/figma-api/cache/store.js +53 -0
- package/dist/figma-api/cache/store.js.map +1 -0
- package/dist/figma-api/cache/types.d.ts +20 -0
- package/dist/figma-api/cache/types.d.ts.map +1 -0
- package/dist/figma-api/cache/types.js +2 -0
- package/dist/figma-api/cache/types.js.map +1 -0
- package/dist/figma-api/cache/url.d.ts +5 -0
- package/dist/figma-api/cache/url.d.ts.map +1 -0
- package/dist/figma-api/cache/url.js +20 -0
- package/dist/figma-api/cache/url.js.map +1 -0
- package/dist/figma-api/constants.d.ts +2 -0
- package/dist/figma-api/constants.d.ts.map +1 -0
- package/dist/figma-api/constants.js +2 -0
- package/dist/figma-api/constants.js.map +1 -0
- package/dist/figma-api/fetch-with-retry.d.ts +2 -0
- package/dist/figma-api/fetch-with-retry.d.ts.map +1 -0
- package/dist/figma-api/fetch-with-retry.js +48 -0
- package/dist/figma-api/fetch-with-retry.js.map +1 -0
- package/dist/figma-api/figma-api-error.d.ts +4 -0
- package/dist/figma-api/figma-api-error.d.ts.map +1 -0
- package/dist/figma-api/figma-api-error.js +7 -0
- package/dist/figma-api/figma-api-error.js.map +1 -0
- package/dist/figma-api/figma-request.d.ts +2 -0
- package/dist/figma-api/figma-request.d.ts.map +1 -0
- package/dist/figma-api/figma-request.js +21 -0
- package/dist/figma-api/figma-request.js.map +1 -0
- package/dist/figma-api/format-figma-error.d.ts +2 -0
- package/dist/figma-api/format-figma-error.d.ts.map +1 -0
- package/dist/figma-api/format-figma-error.js +24 -0
- package/dist/figma-api/format-figma-error.js.map +1 -0
- package/dist/figma-api/get-component-set.d.ts +4 -0
- package/dist/figma-api/get-component-set.d.ts.map +1 -0
- package/dist/figma-api/get-component-set.js +8 -0
- package/dist/figma-api/get-component-set.js.map +1 -0
- package/dist/figma-api/get-file-images.d.ts +4 -0
- package/dist/figma-api/get-file-images.d.ts.map +1 -0
- package/dist/figma-api/get-file-images.js +45 -0
- package/dist/figma-api/get-file-images.js.map +1 -0
- package/dist/figma-api/get-file-node.d.ts +3 -0
- package/dist/figma-api/get-file-node.d.ts.map +1 -0
- package/dist/figma-api/get-file-node.js +8 -0
- package/dist/figma-api/get-file-node.js.map +1 -0
- package/dist/figma-api/get-file.d.ts +3 -0
- package/dist/figma-api/get-file.d.ts.map +1 -0
- package/dist/figma-api/get-file.js +6 -0
- package/dist/figma-api/get-file.js.map +1 -0
- package/dist/figma-api/index.d.ts +11 -0
- package/dist/figma-api/index.d.ts.map +1 -0
- package/dist/figma-api/index.js +11 -0
- package/dist/figma-api/index.js.map +1 -0
- package/dist/figma-api/list-file-component-sets.d.ts +4 -0
- package/dist/figma-api/list-file-component-sets.d.ts.map +1 -0
- package/dist/figma-api/list-file-component-sets.js +8 -0
- package/dist/figma-api/list-file-component-sets.js.map +1 -0
- package/dist/figma-api/list-file-components.d.ts +5 -0
- package/dist/figma-api/list-file-components.d.ts.map +1 -0
- package/dist/figma-api/list-file-components.js +13 -0
- package/dist/figma-api/list-file-components.js.map +1 -0
- package/dist/figma-api/list-file-pages.d.ts +4 -0
- package/dist/figma-api/list-file-pages.d.ts.map +1 -0
- package/dist/figma-api/list-file-pages.js +10 -0
- package/dist/figma-api/list-file-pages.js.map +1 -0
- package/dist/figma-api/list-project-files.d.ts +4 -0
- package/dist/figma-api/list-project-files.d.ts.map +1 -0
- package/dist/figma-api/list-project-files.js +8 -0
- package/dist/figma-api/list-project-files.js.map +1 -0
- package/dist/figma-api/list-team-component-sets.d.ts +4 -0
- package/dist/figma-api/list-team-component-sets.d.ts.map +1 -0
- package/dist/figma-api/list-team-component-sets.js +19 -0
- package/dist/figma-api/list-team-component-sets.js.map +1 -0
- package/dist/figma-api/list-team-project-files.d.ts +4 -0
- package/dist/figma-api/list-team-project-files.d.ts.map +1 -0
- package/dist/figma-api/list-team-project-files.js +19 -0
- package/dist/figma-api/list-team-project-files.js.map +1 -0
- package/dist/figma-api/list-team-projects.d.ts +4 -0
- package/dist/figma-api/list-team-projects.d.ts.map +1 -0
- package/dist/figma-api/list-team-projects.js +8 -0
- package/dist/figma-api/list-team-projects.js.map +1 -0
- package/dist/figma-api/schemas.d.ts +95 -0
- package/dist/figma-api/schemas.d.ts.map +1 -0
- package/dist/figma-api/schemas.js +154 -0
- package/dist/figma-api/schemas.js.map +1 -0
- package/dist/figma-api/types.d.ts +60 -0
- package/dist/figma-api/types.d.ts.map +1 -0
- package/dist/figma-api/types.js +2 -0
- package/dist/figma-api/types.js.map +1 -0
- package/dist/inspect/component-set-context.d.ts +11 -0
- package/dist/inspect/component-set-context.d.ts.map +1 -0
- package/dist/inspect/component-set-context.js +71 -0
- package/dist/inspect/component-set-context.js.map +1 -0
- package/dist/inspect/component-set-lookup.d.ts +6 -0
- package/dist/inspect/component-set-lookup.d.ts.map +1 -0
- package/dist/inspect/component-set-lookup.js +40 -0
- package/dist/inspect/component-set-lookup.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/asset-backed-contract.d.ts +3 -0
- package/dist/inspect/component-set-pseudocode/asset-backed-contract.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/asset-backed-contract.js +34 -0
- package/dist/inspect/component-set-pseudocode/asset-backed-contract.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/assets-contract.d.ts +9 -0
- package/dist/inspect/component-set-pseudocode/assets-contract.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/assets-contract.js +4 -0
- package/dist/inspect/component-set-pseudocode/assets-contract.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/baseline-contract.d.ts +17 -0
- package/dist/inspect/component-set-pseudocode/baseline-contract.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/baseline-contract.js +67 -0
- package/dist/inspect/component-set-pseudocode/baseline-contract.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/build-pseudocode.d.ts +24 -0
- package/dist/inspect/component-set-pseudocode/build-pseudocode.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/build-pseudocode.js +83 -0
- package/dist/inspect/component-set-pseudocode/build-pseudocode.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/index.d.ts +2 -0
- package/dist/inspect/component-set-pseudocode/index.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/index.js +2 -0
- package/dist/inspect/component-set-pseudocode/index.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/infer.d.ts +4 -0
- package/dist/inspect/component-set-pseudocode/infer.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/infer.js +426 -0
- package/dist/inspect/component-set-pseudocode/infer.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/meta-contract.d.ts +27 -0
- package/dist/inspect/component-set-pseudocode/meta-contract.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/meta-contract.js +136 -0
- package/dist/inspect/component-set-pseudocode/meta-contract.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/slim-node-guards.d.ts +14 -0
- package/dist/inspect/component-set-pseudocode/slim-node-guards.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/slim-node-guards.js +28 -0
- package/dist/inspect/component-set-pseudocode/slim-node-guards.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/structure-contract.d.ts +71 -0
- package/dist/inspect/component-set-pseudocode/structure-contract.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/structure-contract.js +281 -0
- package/dist/inspect/component-set-pseudocode/structure-contract.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/structure-dsl.d.ts +3 -0
- package/dist/inspect/component-set-pseudocode/structure-dsl.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/structure-dsl.js +170 -0
- package/dist/inspect/component-set-pseudocode/structure-dsl.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/types.d.ts +44 -0
- package/dist/inspect/component-set-pseudocode/types.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/types.js +2 -0
- package/dist/inspect/component-set-pseudocode/types.js.map +1 -0
- package/dist/inspect/component-set-pseudocode/universal.d.ts +14 -0
- package/dist/inspect/component-set-pseudocode/universal.d.ts.map +1 -0
- package/dist/inspect/component-set-pseudocode/universal.js +393 -0
- package/dist/inspect/component-set-pseudocode/universal.js.map +1 -0
- package/dist/inspect/component-set-spec/bound-variables.d.ts +14 -0
- package/dist/inspect/component-set-spec/bound-variables.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/bound-variables.js +53 -0
- package/dist/inspect/component-set-spec/bound-variables.js.map +1 -0
- package/dist/inspect/component-set-spec/build-spec.d.ts +9 -0
- package/dist/inspect/component-set-spec/build-spec.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/build-spec.js +102 -0
- package/dist/inspect/component-set-spec/build-spec.js.map +1 -0
- package/dist/inspect/component-set-spec/compact-spec.d.ts +3 -0
- package/dist/inspect/component-set-spec/compact-spec.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/compact-spec.js +357 -0
- package/dist/inspect/component-set-spec/compact-spec.js.map +1 -0
- package/dist/inspect/component-set-spec/extract-slots.d.ts +5 -0
- package/dist/inspect/component-set-spec/extract-slots.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/extract-slots.js +57 -0
- package/dist/inspect/component-set-spec/extract-slots.js.map +1 -0
- package/dist/inspect/component-set-spec/figma-node.d.ts +9 -0
- package/dist/inspect/component-set-spec/figma-node.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/figma-node.js +31 -0
- package/dist/inspect/component-set-spec/figma-node.js.map +1 -0
- package/dist/inspect/component-set-spec/index.d.ts +2 -0
- package/dist/inspect/component-set-spec/index.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/index.js +2 -0
- package/dist/inspect/component-set-spec/index.js.map +1 -0
- package/dist/inspect/component-set-spec/parse-props.d.ts +9 -0
- package/dist/inspect/component-set-spec/parse-props.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/parse-props.js +96 -0
- package/dist/inspect/component-set-spec/parse-props.js.map +1 -0
- package/dist/inspect/component-set-spec/prop-name.d.ts +5 -0
- package/dist/inspect/component-set-spec/prop-name.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/prop-name.js +26 -0
- package/dist/inspect/component-set-spec/prop-name.js.map +1 -0
- package/dist/inspect/component-set-spec/resolve-tokens.d.ts +4 -0
- package/dist/inspect/component-set-spec/resolve-tokens.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/resolve-tokens.js +42 -0
- package/dist/inspect/component-set-spec/resolve-tokens.js.map +1 -0
- package/dist/inspect/component-set-spec/slim-context.d.ts +6 -0
- package/dist/inspect/component-set-spec/slim-context.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/slim-context.js +2 -0
- package/dist/inspect/component-set-spec/slim-context.js.map +1 -0
- package/dist/inspect/component-set-spec/slim-node.d.ts +5 -0
- package/dist/inspect/component-set-spec/slim-node.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/slim-node.js +393 -0
- package/dist/inspect/component-set-spec/slim-node.js.map +1 -0
- package/dist/inspect/component-set-spec/slim-text-export.d.ts +8 -0
- package/dist/inspect/component-set-spec/slim-text-export.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/slim-text-export.js +74 -0
- package/dist/inspect/component-set-spec/slim-text-export.js.map +1 -0
- package/dist/inspect/component-set-spec/team-component-registry.d.ts +19 -0
- package/dist/inspect/component-set-spec/team-component-registry.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/team-component-registry.js +96 -0
- package/dist/inspect/component-set-spec/team-component-registry.js.map +1 -0
- package/dist/inspect/component-set-spec/types.d.ts +127 -0
- package/dist/inspect/component-set-spec/types.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/types.js +2 -0
- package/dist/inspect/component-set-spec/types.js.map +1 -0
- package/dist/inspect/component-set-spec/variable-registry.d.ts +8 -0
- package/dist/inspect/component-set-spec/variable-registry.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/variable-registry.js +74 -0
- package/dist/inspect/component-set-spec/variable-registry.js.map +1 -0
- package/dist/inspect/component-set-spec/variant-axes.d.ts +2 -0
- package/dist/inspect/component-set-spec/variant-axes.d.ts.map +1 -0
- package/dist/inspect/component-set-spec/variant-axes.js +14 -0
- package/dist/inspect/component-set-spec/variant-axes.js.map +1 -0
- package/dist/inspect/contract/contract-format.d.ts +5 -0
- package/dist/inspect/contract/contract-format.d.ts.map +1 -0
- package/dist/inspect/contract/contract-format.js +26 -0
- package/dist/inspect/contract/contract-format.js.map +1 -0
- package/dist/inspect/contract/contract-lock.d.ts +75 -0
- package/dist/inspect/contract/contract-lock.d.ts.map +1 -0
- package/dist/inspect/contract/contract-lock.js +326 -0
- package/dist/inspect/contract/contract-lock.js.map +1 -0
- package/dist/inspect/contract/contract-schema.d.ts +51 -0
- package/dist/inspect/contract/contract-schema.d.ts.map +1 -0
- package/dist/inspect/contract/contract-schema.js +130 -0
- package/dist/inspect/contract/contract-schema.js.map +1 -0
- package/dist/inspect/contract/fingerprint.d.ts +9 -0
- package/dist/inspect/contract/fingerprint.d.ts.map +1 -0
- package/dist/inspect/contract/fingerprint.js +301 -0
- package/dist/inspect/contract/fingerprint.js.map +1 -0
- package/dist/inspect/contract/lock-metadata.d.ts +30 -0
- package/dist/inspect/contract/lock-metadata.d.ts.map +1 -0
- package/dist/inspect/contract/lock-metadata.js +101 -0
- package/dist/inspect/contract/lock-metadata.js.map +1 -0
- package/dist/inspect/contract/stable-stringify.d.ts +2 -0
- package/dist/inspect/contract/stable-stringify.d.ts.map +1 -0
- package/dist/inspect/contract/stable-stringify.js +14 -0
- package/dist/inspect/contract/stable-stringify.js.map +1 -0
- package/dist/inspect/contract/verify-component-contract.d.ts +19 -0
- package/dist/inspect/contract/verify-component-contract.d.ts.map +1 -0
- package/dist/inspect/contract/verify-component-contract.js +126 -0
- package/dist/inspect/contract/verify-component-contract.js.map +1 -0
- package/dist/inspect/errors.d.ts +4 -0
- package/dist/inspect/errors.d.ts.map +1 -0
- package/dist/inspect/errors.js +7 -0
- package/dist/inspect/errors.js.map +1 -0
- package/dist/inspect/export/assert-asset-exportable.d.ts +3 -0
- package/dist/inspect/export/assert-asset-exportable.d.ts.map +1 -0
- package/dist/inspect/export/assert-asset-exportable.js +45 -0
- package/dist/inspect/export/assert-asset-exportable.js.map +1 -0
- package/dist/inspect/export/export-nested-assets.d.ts +94 -0
- package/dist/inspect/export/export-nested-assets.d.ts.map +1 -0
- package/dist/inspect/export/export-nested-assets.js +333 -0
- package/dist/inspect/export/export-nested-assets.js.map +1 -0
- package/dist/inspect/export/export-node-preview.d.ts +24 -0
- package/dist/inspect/export/export-node-preview.d.ts.map +1 -0
- package/dist/inspect/export/export-node-preview.js +34 -0
- package/dist/inspect/export/export-node-preview.js.map +1 -0
- package/dist/inspect/export/export-variant-assets.d.ts +18 -0
- package/dist/inspect/export/export-variant-assets.d.ts.map +1 -0
- package/dist/inspect/export/export-variant-assets.js +127 -0
- package/dist/inspect/export/export-variant-assets.js.map +1 -0
- package/dist/inspect/export/normalize-exported-svg.d.ts +2 -0
- package/dist/inspect/export/normalize-exported-svg.d.ts.map +1 -0
- package/dist/inspect/export/normalize-exported-svg.js +15 -0
- package/dist/inspect/export/normalize-exported-svg.js.map +1 -0
- package/dist/inspect/export/rendered-image-bytes.d.ts +4 -0
- package/dist/inspect/export/rendered-image-bytes.d.ts.map +1 -0
- package/dist/inspect/export/rendered-image-bytes.js +24 -0
- package/dist/inspect/export/rendered-image-bytes.js.map +1 -0
- package/dist/inspect/export-contract-target.d.ts +7 -0
- package/dist/inspect/export-contract-target.d.ts.map +1 -0
- package/dist/inspect/export-contract-target.js +33 -0
- package/dist/inspect/export-contract-target.js.map +1 -0
- package/dist/inspect/fetch-file-entry.d.ts +4 -0
- package/dist/inspect/fetch-file-entry.d.ts.map +1 -0
- package/dist/inspect/fetch-file-entry.js +7 -0
- package/dist/inspect/fetch-file-entry.js.map +1 -0
- package/dist/inspect/fetch-file-node-entry.d.ts +4 -0
- package/dist/inspect/fetch-file-node-entry.d.ts.map +1 -0
- package/dist/inspect/fetch-file-node-entry.js +7 -0
- package/dist/inspect/fetch-file-node-entry.js.map +1 -0
- package/dist/inspect/figma-node-url.d.ts +3 -0
- package/dist/inspect/figma-node-url.d.ts.map +1 -0
- package/dist/inspect/figma-node-url.js +30 -0
- package/dist/inspect/figma-node-url.js.map +1 -0
- package/dist/inspect/get-node-component-set.d.ts +5 -0
- package/dist/inspect/get-node-component-set.d.ts.map +1 -0
- package/dist/inspect/get-node-component-set.js +10 -0
- package/dist/inspect/get-node-component-set.js.map +1 -0
- package/dist/inspect/index.d.ts +17 -0
- package/dist/inspect/index.d.ts.map +1 -0
- package/dist/inspect/index.js +17 -0
- package/dist/inspect/index.js.map +1 -0
- package/dist/inspect/list-all-component-sets.d.ts +3 -0
- package/dist/inspect/list-all-component-sets.d.ts.map +1 -0
- package/dist/inspect/list-all-component-sets.js +27 -0
- package/dist/inspect/list-all-component-sets.js.map +1 -0
- package/dist/inspect/list-component-set-properties.d.ts +4 -0
- package/dist/inspect/list-component-set-properties.d.ts.map +1 -0
- package/dist/inspect/list-component-set-properties.js +73 -0
- package/dist/inspect/list-component-set-properties.js.map +1 -0
- package/dist/inspect/node-contract/build-node-contract.d.ts +12 -0
- package/dist/inspect/node-contract/build-node-contract.d.ts.map +1 -0
- package/dist/inspect/node-contract/build-node-contract.js +212 -0
- package/dist/inspect/node-contract/build-node-contract.js.map +1 -0
- package/dist/inspect/node-contract/dependencies.d.ts +5 -0
- package/dist/inspect/node-contract/dependencies.d.ts.map +1 -0
- package/dist/inspect/node-contract/dependencies.js +84 -0
- package/dist/inspect/node-contract/dependencies.js.map +1 -0
- package/dist/inspect/node-contract/index.d.ts +6 -0
- package/dist/inspect/node-contract/index.d.ts.map +1 -0
- package/dist/inspect/node-contract/index.js +6 -0
- package/dist/inspect/node-contract/index.js.map +1 -0
- package/dist/inspect/node-contract/node-kind.d.ts +9 -0
- package/dist/inspect/node-contract/node-kind.d.ts.map +1 -0
- package/dist/inspect/node-contract/node-kind.js +31 -0
- package/dist/inspect/node-contract/node-kind.js.map +1 -0
- package/dist/inspect/node-contract/node-lock.d.ts +6 -0
- package/dist/inspect/node-contract/node-lock.d.ts.map +1 -0
- package/dist/inspect/node-contract/node-lock.js +181 -0
- package/dist/inspect/node-contract/node-lock.js.map +1 -0
- package/dist/inspect/node-contract/node-schema.d.ts +14 -0
- package/dist/inspect/node-contract/node-schema.d.ts.map +1 -0
- package/dist/inspect/node-contract/node-schema.js +137 -0
- package/dist/inspect/node-contract/node-schema.js.map +1 -0
- package/dist/inspect/node-contract/paths.d.ts +10 -0
- package/dist/inspect/node-contract/paths.d.ts.map +1 -0
- package/dist/inspect/node-contract/paths.js +29 -0
- package/dist/inspect/node-contract/paths.js.map +1 -0
- package/dist/inspect/node-contract/tokens.d.ts +4 -0
- package/dist/inspect/node-contract/tokens.d.ts.map +1 -0
- package/dist/inspect/node-contract/tokens.js +30 -0
- package/dist/inspect/node-contract/tokens.js.map +1 -0
- package/dist/inspect/node-contract/types.d.ts +84 -0
- package/dist/inspect/node-contract/types.d.ts.map +1 -0
- package/dist/inspect/node-contract/types.js +2 -0
- package/dist/inspect/node-contract/types.js.map +1 -0
- package/dist/inspect/node-contract/verify-node-contract.d.ts +20 -0
- package/dist/inspect/node-contract/verify-node-contract.d.ts.map +1 -0
- package/dist/inspect/node-contract/verify-node-contract.js +131 -0
- package/dist/inspect/node-contract/verify-node-contract.js.map +1 -0
- package/dist/inspect/resolve-team-component-set.d.ts +14 -0
- package/dist/inspect/resolve-team-component-set.d.ts.map +1 -0
- package/dist/inspect/resolve-team-component-set.js +77 -0
- package/dist/inspect/resolve-team-component-set.js.map +1 -0
- package/dist/inspect/schemas.d.ts +37 -0
- package/dist/inspect/schemas.d.ts.map +1 -0
- package/dist/inspect/schemas.js +79 -0
- package/dist/inspect/schemas.js.map +1 -0
- package/dist/inspect/team-index.d.ts +76 -0
- package/dist/inspect/team-index.d.ts.map +1 -0
- package/dist/inspect/team-index.js +361 -0
- package/dist/inspect/team-index.js.map +1 -0
- package/dist/inspect/types.d.ts +46 -0
- package/dist/inspect/types.d.ts.map +1 -0
- package/dist/inspect/types.js +2 -0
- package/dist/inspect/types.js.map +1 -0
- package/dist/test/fixtures.d.ts +3 -0
- package/dist/test/fixtures.d.ts.map +1 -0
- package/dist/test/fixtures.js +6 -0
- package/dist/test/fixtures.js.map +1 -0
- package/dist/zod/parse-valid-entries.d.ts +4 -0
- package/dist/zod/parse-valid-entries.d.ts.map +1 -0
- package/dist/zod/parse-valid-entries.js +20 -0
- package/dist/zod/parse-valid-entries.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { extractGeometryFromNode, extractVisualsFromNode, } from "../component-set-pseudocode/universal.js";
|
|
2
|
+
import { readString } from "../component-set-spec/figma-node.js";
|
|
3
|
+
import { normalizePropName } from "../component-set-spec/prop-name.js";
|
|
4
|
+
import { slimNode } from "../component-set-spec/slim-node.js";
|
|
5
|
+
import { loadVariableRegistry } from "../component-set-spec/variable-registry.js";
|
|
6
|
+
import { fingerprintContractSurface, fingerprintContracts, fingerprintTree, } from "../contract/fingerprint.js";
|
|
7
|
+
import { FigmaInspectError } from "../errors.js";
|
|
8
|
+
import { fetchFileNodeEntry } from "../fetch-file-node-entry.js";
|
|
9
|
+
import { collectNodeContractDependencies, readComponentPropertyDefinitions, } from "./dependencies.js";
|
|
10
|
+
import { assertNodeContractRoot } from "./node-kind.js";
|
|
11
|
+
import { nodeContractArtifactFileName } from "./paths.js";
|
|
12
|
+
import { resolveSlimNodeTokens } from "./tokens.js";
|
|
13
|
+
function sanitizeFileName(name) {
|
|
14
|
+
return name.replace(/[/\\?%*:|"<>]/g, "_");
|
|
15
|
+
}
|
|
16
|
+
function nodeName(node, fallbackNodeId) {
|
|
17
|
+
return sanitizeFileName(readString(node, "name") ?? fallbackNodeId);
|
|
18
|
+
}
|
|
19
|
+
function childKeySegment(child, fallback) {
|
|
20
|
+
if (child.name && child.name.length > 0) {
|
|
21
|
+
return normalizePropName(child.name);
|
|
22
|
+
}
|
|
23
|
+
if (child.component && typeof child.component !== "string") {
|
|
24
|
+
return normalizePropName(child.component.name ?? fallback);
|
|
25
|
+
}
|
|
26
|
+
if (typeof child.component === "string") {
|
|
27
|
+
return normalizePropName(child.component);
|
|
28
|
+
}
|
|
29
|
+
return normalizePropName(child.type || fallback);
|
|
30
|
+
}
|
|
31
|
+
function scopedChildKey(parentKey, segment, siblingCounts) {
|
|
32
|
+
const nextCount = (siblingCounts.get(segment) ?? 0) + 1;
|
|
33
|
+
siblingCounts.set(segment, nextCount);
|
|
34
|
+
const uniqueSegment = nextCount === 1 ? segment : `${segment}${nextCount}`;
|
|
35
|
+
return parentKey === "root" ? uniqueSegment : `${parentKey}.${uniqueSegment}`;
|
|
36
|
+
}
|
|
37
|
+
function collectBundles(node, key = "root", visuals = {}, geometry = {}) {
|
|
38
|
+
const nodeVisuals = extractVisualsFromNode(node);
|
|
39
|
+
if (Object.keys(nodeVisuals).length > 0) {
|
|
40
|
+
visuals[key] = nodeVisuals;
|
|
41
|
+
}
|
|
42
|
+
const nodeGeometry = extractGeometryFromNode(node);
|
|
43
|
+
if (Object.keys(nodeGeometry).length > 0) {
|
|
44
|
+
geometry[key] = nodeGeometry;
|
|
45
|
+
}
|
|
46
|
+
const siblingCounts = new Map();
|
|
47
|
+
for (const [index, child] of (node.children ?? []).entries()) {
|
|
48
|
+
const childKey = scopedChildKey(key, childKeySegment(child, `child${index + 1}`), siblingCounts);
|
|
49
|
+
collectBundles(child, childKey, visuals, geometry);
|
|
50
|
+
}
|
|
51
|
+
return { visuals, geometry };
|
|
52
|
+
}
|
|
53
|
+
function formatComponentRef(node) {
|
|
54
|
+
if (!node.component) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (typeof node.component === "string") {
|
|
58
|
+
return ` component ${JSON.stringify(node.component)}`;
|
|
59
|
+
}
|
|
60
|
+
return ` component ${JSON.stringify(node.component.name ?? node.component.id ?? "instance")}`;
|
|
61
|
+
}
|
|
62
|
+
function renderTreeNode(lines, node, key, level) {
|
|
63
|
+
const indent = " ".repeat(level);
|
|
64
|
+
const name = node.name ? ` ${JSON.stringify(node.name)}` : "";
|
|
65
|
+
const component = formatComponentRef(node) ?? "";
|
|
66
|
+
const refs = [];
|
|
67
|
+
if (extractVisualsFromNode(node) &&
|
|
68
|
+
Object.keys(extractVisualsFromNode(node)).length > 0) {
|
|
69
|
+
refs.push(`style ${key}`);
|
|
70
|
+
}
|
|
71
|
+
if (extractGeometryFromNode(node) &&
|
|
72
|
+
Object.keys(extractGeometryFromNode(node)).length > 0) {
|
|
73
|
+
refs.push(`layout ${key}`);
|
|
74
|
+
}
|
|
75
|
+
const children = node.children ?? [];
|
|
76
|
+
if (children.length === 0 && refs.length === 0) {
|
|
77
|
+
lines.push(`${indent}${node.type} ${key}${name}${component}`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
lines.push(`${indent}${node.type} ${key}${name}${component} {`);
|
|
81
|
+
for (const ref of refs) {
|
|
82
|
+
lines.push(`${indent} ${ref}`);
|
|
83
|
+
}
|
|
84
|
+
const siblingCounts = new Map();
|
|
85
|
+
for (const [index, child] of children.entries()) {
|
|
86
|
+
const childKey = scopedChildKey(key, childKeySegment(child, `child${index + 1}`), siblingCounts);
|
|
87
|
+
renderTreeNode(lines, child, childKey, level + 1);
|
|
88
|
+
}
|
|
89
|
+
lines.push(`${indent}}`);
|
|
90
|
+
}
|
|
91
|
+
function renderNodeStructureDsl(options) {
|
|
92
|
+
const lines = [
|
|
93
|
+
`node ${options.kind} ${JSON.stringify(options.nodeName)}`,
|
|
94
|
+
"",
|
|
95
|
+
"contracts {",
|
|
96
|
+
` visuals ${nodeContractArtifactFileName(options.nodeName, options.kind, "visuals", options.format)}`,
|
|
97
|
+
` geometry ${nodeContractArtifactFileName(options.nodeName, options.kind, "geometry", options.format)}`,
|
|
98
|
+
` meta ${nodeContractArtifactFileName(options.nodeName, options.kind, "meta", options.format)}`,
|
|
99
|
+
"}",
|
|
100
|
+
"",
|
|
101
|
+
"resolve {",
|
|
102
|
+
" scheme = visuals",
|
|
103
|
+
" geometry = geometry",
|
|
104
|
+
"}",
|
|
105
|
+
"",
|
|
106
|
+
"tree {",
|
|
107
|
+
];
|
|
108
|
+
renderTreeNode(lines, options.root, "root", 1);
|
|
109
|
+
lines.push("}");
|
|
110
|
+
return `${lines.join("\n")}\n`;
|
|
111
|
+
}
|
|
112
|
+
function buildNodeContractLock(input) {
|
|
113
|
+
return {
|
|
114
|
+
version: 2,
|
|
115
|
+
kind: input.kind,
|
|
116
|
+
source: input.source,
|
|
117
|
+
fingerprints: {
|
|
118
|
+
tree: fingerprintTree(input.tree),
|
|
119
|
+
contractSurface: fingerprintContractSurface(input.tree),
|
|
120
|
+
contracts: fingerprintContracts(input.visuals, input.geometry, input.meta, input.structureDsl),
|
|
121
|
+
},
|
|
122
|
+
dependencies: input.meta.dependencies,
|
|
123
|
+
approval: {
|
|
124
|
+
status: "unverified",
|
|
125
|
+
verifiedAt: null,
|
|
126
|
+
verifiedBy: null,
|
|
127
|
+
baselineRevision: null,
|
|
128
|
+
},
|
|
129
|
+
drift: {
|
|
130
|
+
lastCheckedAt: null,
|
|
131
|
+
metadataChanged: false,
|
|
132
|
+
sourceChanged: false,
|
|
133
|
+
structureChanged: false,
|
|
134
|
+
visualsChanged: false,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export async function buildNodeContractFromEntry(options) {
|
|
139
|
+
const { node, kind } = assertNodeContractRoot(options.entry, options.nodeId);
|
|
140
|
+
const nodeContractName = nodeName(node, options.nodeId);
|
|
141
|
+
const registry = await loadVariableRegistry(options.variablesPath);
|
|
142
|
+
const slim = slimNode(node, { propIdToName: new Map() });
|
|
143
|
+
if (!slim) {
|
|
144
|
+
throw new FigmaInspectError(`Cannot build slim tree for node ${options.nodeId}.`);
|
|
145
|
+
}
|
|
146
|
+
const resolvedSlim = resolveSlimNodeTokens(slim, registry);
|
|
147
|
+
const { visuals, geometry } = collectBundles(resolvedSlim);
|
|
148
|
+
const dependencies = collectNodeContractDependencies(options.entry, node, options.fileKey);
|
|
149
|
+
const source = {
|
|
150
|
+
fileKey: options.fileKey,
|
|
151
|
+
nodeId: node.id ?? options.nodeId,
|
|
152
|
+
nodeType: node.type,
|
|
153
|
+
name: readString(node, "name") ?? options.nodeId,
|
|
154
|
+
...(options.sourceUrl ? { sourceUrl: options.sourceUrl } : {}),
|
|
155
|
+
};
|
|
156
|
+
const componentProperties = kind === "component" ? readComponentPropertyDefinitions(node) : undefined;
|
|
157
|
+
const meta = {
|
|
158
|
+
version: 1,
|
|
159
|
+
kind,
|
|
160
|
+
node: {
|
|
161
|
+
id: source.nodeId,
|
|
162
|
+
name: source.name,
|
|
163
|
+
type: source.nodeType,
|
|
164
|
+
},
|
|
165
|
+
...(componentProperties ? { componentProperties } : {}),
|
|
166
|
+
dependencies,
|
|
167
|
+
};
|
|
168
|
+
const format = options.format ?? "yaml";
|
|
169
|
+
const structureDsl = renderNodeStructureDsl({
|
|
170
|
+
nodeName: nodeContractName,
|
|
171
|
+
kind,
|
|
172
|
+
root: resolvedSlim,
|
|
173
|
+
format,
|
|
174
|
+
});
|
|
175
|
+
const lock = buildNodeContractLock({
|
|
176
|
+
kind,
|
|
177
|
+
source,
|
|
178
|
+
tree: node,
|
|
179
|
+
visuals,
|
|
180
|
+
geometry,
|
|
181
|
+
meta,
|
|
182
|
+
structureDsl,
|
|
183
|
+
});
|
|
184
|
+
return {
|
|
185
|
+
nodeName: nodeContractName,
|
|
186
|
+
kind,
|
|
187
|
+
source,
|
|
188
|
+
rawNode: node,
|
|
189
|
+
visuals,
|
|
190
|
+
geometry,
|
|
191
|
+
meta,
|
|
192
|
+
structureDsl,
|
|
193
|
+
lock,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
export async function buildNodeContractFromRef(options) {
|
|
197
|
+
const entry = await fetchFileNodeEntry({
|
|
198
|
+
token: options.token,
|
|
199
|
+
fileKey: options.fileKey,
|
|
200
|
+
nodeId: options.nodeId,
|
|
201
|
+
fetchImpl: options.fetchImpl,
|
|
202
|
+
});
|
|
203
|
+
return buildNodeContractFromEntry({
|
|
204
|
+
entry,
|
|
205
|
+
fileKey: options.fileKey,
|
|
206
|
+
nodeId: options.nodeId,
|
|
207
|
+
sourceUrl: options.sourceUrl,
|
|
208
|
+
variablesPath: options.variablesPath,
|
|
209
|
+
format: options.format,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=build-node-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-node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I,GAAG,qBAAqB,CAAC;QACjC,IAAI;QACJ,MAAM;QACN,IAAI,EAAE,IAAI;QACV,OAAO;QACP,QAAQ;QACR,IAAI;QACJ,YAAY;KACb,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,gBAAgB;QAC1B,IAAI;QACJ,MAAM;QACN,OAAO,EAAE,IAAI;QACb,OAAO;QACP,QAAQ;QACR,IAAI;QACJ,YAAY;QACZ,IAAI;KACL,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,OAAiC;IAEjC,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC;QACrC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC,CAAC;IAEH,OAAO,0BAA0B,CAAC;QAChC,KAAK;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DocumentNode, FileNodeEntry } from "../schemas.js";
|
|
2
|
+
import type { NodeContractDependencies, NodeContractMeta } from "./types.js";
|
|
3
|
+
export declare function collectNodeContractDependencies(entry: FileNodeEntry, root: DocumentNode, fileKey: string): NodeContractDependencies;
|
|
4
|
+
export declare function readComponentPropertyDefinitions(node: DocumentNode): NonNullable<NodeContractMeta["componentProperties"]> | undefined;
|
|
5
|
+
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../src/inspect/node-contract/dependencies.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EACV,wBAAwB,EAExB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAiCpB,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,GACd,wBAAwB,CAkD1B;AAED,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,YAAY,GACjB,WAAW,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,GAAG,SAAS,CA+BlE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { isRecord, readChildren, readRecord, readString, } from "../component-set-spec/figma-node.js";
|
|
2
|
+
function sortDependencyEntries(entries) {
|
|
3
|
+
return [...entries].sort((left, right) => {
|
|
4
|
+
const leftLabel = left.name ?? left.nodeId;
|
|
5
|
+
const rightLabel = right.name ?? right.nodeId;
|
|
6
|
+
const byLabel = leftLabel.localeCompare(rightLabel);
|
|
7
|
+
return byLabel === 0 ? left.nodeId.localeCompare(right.nodeId) : byLabel;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function compactDependency(dependency) {
|
|
11
|
+
return Object.fromEntries(Object.entries(dependency).filter(([, value]) => value !== undefined && value !== ""));
|
|
12
|
+
}
|
|
13
|
+
function walkNode(node, visit) {
|
|
14
|
+
visit(node);
|
|
15
|
+
for (const child of readChildren(node)) {
|
|
16
|
+
walkNode(child, visit);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function collectNodeContractDependencies(entry, root, fileKey) {
|
|
20
|
+
const componentsByNodeId = new Map();
|
|
21
|
+
const componentSetsByNodeId = new Map();
|
|
22
|
+
walkNode(root, (node) => {
|
|
23
|
+
if (node.type !== "INSTANCE") {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const componentId = readString(node, "componentId");
|
|
27
|
+
if (!componentId) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const componentEntry = entry.components[componentId];
|
|
31
|
+
const componentSetId = componentEntry?.componentSetId;
|
|
32
|
+
const componentSetEntry = componentSetId
|
|
33
|
+
? entry.componentSets[componentSetId]
|
|
34
|
+
: undefined;
|
|
35
|
+
componentsByNodeId.set(componentId, compactDependency({
|
|
36
|
+
nodeId: componentId,
|
|
37
|
+
key: componentEntry?.key,
|
|
38
|
+
name: componentEntry?.name ?? readString(node, "name"),
|
|
39
|
+
fileKey,
|
|
40
|
+
componentSetId,
|
|
41
|
+
componentSetName: componentSetEntry?.name,
|
|
42
|
+
componentSetKey: componentSetEntry?.key,
|
|
43
|
+
}));
|
|
44
|
+
if (componentSetId && componentSetEntry) {
|
|
45
|
+
componentSetsByNodeId.set(componentSetId, compactDependency({
|
|
46
|
+
nodeId: componentSetId,
|
|
47
|
+
key: componentSetEntry.key,
|
|
48
|
+
name: componentSetEntry.name,
|
|
49
|
+
fileKey,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
componentSets: sortDependencyEntries([...componentSetsByNodeId.values()]),
|
|
55
|
+
components: sortDependencyEntries([...componentsByNodeId.values()]),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export function readComponentPropertyDefinitions(node) {
|
|
59
|
+
const definitions = readRecord(node, "componentPropertyDefinitions");
|
|
60
|
+
if (!definitions) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const properties = {};
|
|
64
|
+
for (const [rawName, rawDefinition] of Object.entries(definitions)) {
|
|
65
|
+
if (!isRecord(rawDefinition)) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const type = readString(rawDefinition, "type");
|
|
69
|
+
const defaultValue = rawDefinition.defaultValue;
|
|
70
|
+
const variantOptions = rawDefinition.variantOptions;
|
|
71
|
+
const options = Array.isArray(variantOptions)
|
|
72
|
+
? variantOptions.filter((value) => typeof value === "string")
|
|
73
|
+
: undefined;
|
|
74
|
+
properties[rawName] = {
|
|
75
|
+
...(type ? { type } : {}),
|
|
76
|
+
...(typeof defaultValue === "string" || typeof defaultValue === "boolean"
|
|
77
|
+
? { default: defaultValue }
|
|
78
|
+
: {}),
|
|
79
|
+
...(options && options.length > 0 ? { options } : {}),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return Object.keys(properties).length > 0 ? properties : undefined;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../src/inspect/node-contract/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,qCAAqC,CAAC;AAQ7C,SAAS,qBAAqB,CAC5B,OAAiC;IAEjC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC;QAC3C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC;QAC9C,MAAM,OAAO,GAAG,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACpD,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CACxB,UAAkC;IAElC,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAC/B,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS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,CAAC,CAAC,SAAS,CAAC;QAEd,UAAU,CAAC,OAAO,CAAC,GAAG;YACpB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzB,GAAG,CAAC,OAAO,YAAY,KAAK,QAAQ,IAAI,OAAO,YAAY,KAAK,SAAS;gBACvE,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE;gBAC3B,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtD,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { buildNodeContractFromRef } from "./build-node-contract.js";
|
|
2
|
+
export { writeNodeContractLock } from "./node-lock.js";
|
|
3
|
+
export { readNodeContractArtifacts, validateNodeContractArtifacts, } from "./node-schema.js";
|
|
4
|
+
export { resolveNodeContractLockPath, resolveNodeGeometryContractPath, resolveNodeMetaContractPath, resolveNodeStructureDslPath, resolveNodeVisualsContractPath, } from "./paths.js";
|
|
5
|
+
export { verifyNodeContracts } from "./verify-node-contract.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inspect/node-contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { buildNodeContractFromRef } from "./build-node-contract.js";
|
|
2
|
+
export { writeNodeContractLock } from "./node-lock.js";
|
|
3
|
+
export { readNodeContractArtifacts, validateNodeContractArtifacts, } from "./node-schema.js";
|
|
4
|
+
export { resolveNodeContractLockPath, resolveNodeGeometryContractPath, resolveNodeMetaContractPath, resolveNodeStructureDslPath, resolveNodeVisualsContractPath, } from "./paths.js";
|
|
5
|
+
export { verifyNodeContracts } from "./verify-node-contract.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/inspect/node-contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DocumentNode, FileNodeEntry } from "../schemas.js";
|
|
2
|
+
import type { NodeContractFigmaType, NodeContractKind } from "./types.js";
|
|
3
|
+
export declare function assertNodeContractRoot(entry: FileNodeEntry, nodeId: string): {
|
|
4
|
+
node: DocumentNode & {
|
|
5
|
+
type: NodeContractFigmaType;
|
|
6
|
+
};
|
|
7
|
+
kind: NodeContractKind;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=node-kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-kind.d.ts","sourceRoot":"","sources":["../../../src/inspect/node-contract/node-kind.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAc1E,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,MAAM,GACb;IACD,IAAI,EAAE,YAAY,GAAG;QAAE,IAAI,EAAE,qBAAqB,CAAA;KAAE,CAAC;IACrD,IAAI,EAAE,gBAAgB,CAAC;CACxB,CA2BA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FigmaInspectError } from "../errors.js";
|
|
2
|
+
function nodeContractKindFromType(nodeType) {
|
|
3
|
+
if (nodeType === "FRAME") {
|
|
4
|
+
return "frame";
|
|
5
|
+
}
|
|
6
|
+
if (nodeType === "COMPONENT") {
|
|
7
|
+
return "component";
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
export function assertNodeContractRoot(entry, nodeId) {
|
|
12
|
+
const node = entry.document;
|
|
13
|
+
if (!node) {
|
|
14
|
+
throw new FigmaInspectError(`Node ${nodeId} has no document payload.`);
|
|
15
|
+
}
|
|
16
|
+
const kind = nodeContractKindFromType(node.type);
|
|
17
|
+
if (!kind) {
|
|
18
|
+
throw new FigmaInspectError(`Figma node ${nodeId} is ${node.type ?? "UNKNOWN"}; expected FRAME or standalone COMPONENT.`);
|
|
19
|
+
}
|
|
20
|
+
if (kind === "component") {
|
|
21
|
+
const componentEntry = entry.components[node.id ?? nodeId] ?? entry.components[nodeId];
|
|
22
|
+
if (componentEntry?.componentSetId) {
|
|
23
|
+
throw new FigmaInspectError(`Figma node ${nodeId} is a COMPONENT inside a component set; use --export-component-set for component sets.`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
node: node,
|
|
28
|
+
kind,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=node-kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-kind.js","sourceRoot":"","sources":["../../../src/inspect/node-contract/node-kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAIjD,SAAS,wBAAwB,CAC/B,QAA4B;IAE5B,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC7B,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAoB,EACpB,MAAc;IAKd,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,iBAAiB,CAAC,QAAQ,MAAM,2BAA2B,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,IAAI,GAAG,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,iBAAiB,CACzB,cAAc,MAAM,OAAO,IAAI,CAAC,IAAI,IAAI,SAAS,2CAA2C,CAC7F,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;QACzB,MAAM,cAAc,GAClB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAClE,IAAI,cAAc,EAAE,cAAc,EAAE,CAAC;YACnC,MAAM,IAAI,iBAAiB,CACzB,cAAc,MAAM,wFAAwF,CAC7G,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,IAAsD;QAC5D,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NodeContractLock, NodeContractLockDiff } from "./types.js";
|
|
2
|
+
export declare function readNodeContractLock(lockPath: string): Promise<NodeContractLock | undefined>;
|
|
3
|
+
export declare function writeNodeContractLock(lockPath: string, lock: NodeContractLock): Promise<void>;
|
|
4
|
+
export declare function diffNodeContractLock(locked: NodeContractLock, live: NodeContractLock): NodeContractLockDiff;
|
|
5
|
+
export declare function isNodeContractLockDiffEmpty(diff: NodeContractLockDiff): boolean;
|
|
6
|
+
//# sourceMappingURL=node-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-lock.d.ts","sourceRoot":"","sources":["../../../src/inspect/node-contract/node-lock.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAIV,gBAAgB,EAChB,oBAAoB,EAErB,MAAM,YAAY,CAAC;AA+JpB,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAuBvC;AAED,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,IAAI,CAAC,CAEf;AAcD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,gBAAgB,GACrB,oBAAoB,CAuBtB;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAET"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { parse } from "yaml";
|
|
3
|
+
import { serializeContractData } from "../contract/contract-format.js";
|
|
4
|
+
import { hasContractSurfaceFingerprint, normalizeLockVersion, normalizeVersionedLockMetadata, } from "../contract/lock-metadata.js";
|
|
5
|
+
import { FigmaInspectError } from "../errors.js";
|
|
6
|
+
function readRecord(value) {
|
|
7
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
8
|
+
? value
|
|
9
|
+
: undefined;
|
|
10
|
+
}
|
|
11
|
+
function readString(value, key) {
|
|
12
|
+
const field = value[key];
|
|
13
|
+
return typeof field === "string" ? field : undefined;
|
|
14
|
+
}
|
|
15
|
+
function normalizeKind(value) {
|
|
16
|
+
return value === "frame" || value === "component" ? value : undefined;
|
|
17
|
+
}
|
|
18
|
+
function normalizeNodeType(value) {
|
|
19
|
+
return value === "FRAME" || value === "COMPONENT" ? value : undefined;
|
|
20
|
+
}
|
|
21
|
+
function normalizeSource(value) {
|
|
22
|
+
const record = readRecord(value);
|
|
23
|
+
if (!record) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const fileKey = readString(record, "fileKey");
|
|
27
|
+
const nodeId = readString(record, "nodeId");
|
|
28
|
+
const nodeType = normalizeNodeType(record.nodeType);
|
|
29
|
+
const name = readString(record, "name");
|
|
30
|
+
if (!fileKey || !nodeId || !nodeType || !name) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const sourceUrl = readString(record, "sourceUrl");
|
|
34
|
+
return {
|
|
35
|
+
fileKey,
|
|
36
|
+
nodeId,
|
|
37
|
+
nodeType,
|
|
38
|
+
name,
|
|
39
|
+
...(sourceUrl ? { sourceUrl } : {}),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function normalizeDependency(value) {
|
|
43
|
+
const record = readRecord(value);
|
|
44
|
+
if (!record) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const nodeId = readString(record, "nodeId");
|
|
48
|
+
if (!nodeId) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
nodeId,
|
|
53
|
+
...(readString(record, "name") ? { name: readString(record, "name") } : {}),
|
|
54
|
+
...(readString(record, "key") ? { key: readString(record, "key") } : {}),
|
|
55
|
+
...(readString(record, "fileKey")
|
|
56
|
+
? { fileKey: readString(record, "fileKey") }
|
|
57
|
+
: {}),
|
|
58
|
+
...(readString(record, "componentSetId")
|
|
59
|
+
? { componentSetId: readString(record, "componentSetId") }
|
|
60
|
+
: {}),
|
|
61
|
+
...(readString(record, "componentSetName")
|
|
62
|
+
? { componentSetName: readString(record, "componentSetName") }
|
|
63
|
+
: {}),
|
|
64
|
+
...(readString(record, "componentSetKey")
|
|
65
|
+
? { componentSetKey: readString(record, "componentSetKey") }
|
|
66
|
+
: {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function normalizeDependencyList(value) {
|
|
70
|
+
if (!Array.isArray(value)) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const dependencies = value
|
|
74
|
+
.map((entry) => normalizeDependency(entry))
|
|
75
|
+
.filter((dependency) => dependency !== undefined);
|
|
76
|
+
return dependencies.length === value.length ? dependencies : undefined;
|
|
77
|
+
}
|
|
78
|
+
function normalizeLock(value) {
|
|
79
|
+
const record = readRecord(value);
|
|
80
|
+
if (!record) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const version = normalizeLockVersion(record);
|
|
84
|
+
if (!version) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
const kind = normalizeKind(record.kind);
|
|
88
|
+
const source = normalizeSource(record.source);
|
|
89
|
+
const fingerprints = readRecord(record.fingerprints);
|
|
90
|
+
const dependencies = readRecord(record.dependencies);
|
|
91
|
+
if (!kind || !source || !fingerprints || !dependencies) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
const tree = readString(fingerprints, "tree");
|
|
95
|
+
const contractSurface = readString(fingerprints, "contractSurface");
|
|
96
|
+
const contracts = readString(fingerprints, "contracts");
|
|
97
|
+
const componentSets = normalizeDependencyList(dependencies.componentSets);
|
|
98
|
+
const components = normalizeDependencyList(dependencies.components);
|
|
99
|
+
if (!tree || !contracts || !componentSets || !components) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
if (version === 2 && !contractSurface) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const metadata = normalizeVersionedLockMetadata(record, version);
|
|
106
|
+
if (!metadata) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
const base = {
|
|
110
|
+
kind,
|
|
111
|
+
source,
|
|
112
|
+
dependencies: { componentSets, components },
|
|
113
|
+
approval: metadata.approval,
|
|
114
|
+
drift: metadata.drift,
|
|
115
|
+
};
|
|
116
|
+
if (version === 2) {
|
|
117
|
+
if (!contractSurface) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
...base,
|
|
122
|
+
version,
|
|
123
|
+
fingerprints: { tree, contractSurface, contracts },
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
...base,
|
|
128
|
+
version,
|
|
129
|
+
fingerprints: { tree, contracts },
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export async function readNodeContractLock(lockPath) {
|
|
133
|
+
let raw;
|
|
134
|
+
try {
|
|
135
|
+
raw = await readFile(lockPath, "utf8");
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
if (typeof error === "object" &&
|
|
139
|
+
error !== null &&
|
|
140
|
+
"code" in error &&
|
|
141
|
+
error.code === "ENOENT") {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
const lock = normalizeLock(parse(raw));
|
|
147
|
+
if (!lock) {
|
|
148
|
+
throw new FigmaInspectError(`Invalid node contract lock file: ${lockPath}`);
|
|
149
|
+
}
|
|
150
|
+
return lock;
|
|
151
|
+
}
|
|
152
|
+
export async function writeNodeContractLock(lockPath, lock) {
|
|
153
|
+
await writeFile(lockPath, serializeContractData(lock, "yaml"), "utf8");
|
|
154
|
+
}
|
|
155
|
+
function sameSourceIdentity(left, right) {
|
|
156
|
+
return (left.fileKey === right.fileKey &&
|
|
157
|
+
left.nodeId === right.nodeId &&
|
|
158
|
+
left.nodeType === right.nodeType &&
|
|
159
|
+
left.name === right.name);
|
|
160
|
+
}
|
|
161
|
+
export function diffNodeContractLock(locked, live) {
|
|
162
|
+
const contractSurface = (() => {
|
|
163
|
+
if (hasContractSurfaceFingerprint(locked.fingerprints) &&
|
|
164
|
+
hasContractSurfaceFingerprint(live.fingerprints)) {
|
|
165
|
+
return (locked.fingerprints.contractSurface !==
|
|
166
|
+
live.fingerprints.contractSurface);
|
|
167
|
+
}
|
|
168
|
+
return locked.fingerprints.tree !== live.fingerprints.tree;
|
|
169
|
+
})();
|
|
170
|
+
return {
|
|
171
|
+
source: !sameSourceIdentity(locked.source, live.source),
|
|
172
|
+
tree: !hasContractSurfaceFingerprint(locked.fingerprints) &&
|
|
173
|
+
locked.fingerprints.tree !== live.fingerprints.tree,
|
|
174
|
+
contractSurface,
|
|
175
|
+
kind: locked.kind !== live.kind,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
export function isNodeContractLockDiffEmpty(diff) {
|
|
179
|
+
return !diff.source && !diff.tree && !diff.contractSurface && !diff.kind;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=node-lock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-lock.js","sourceRoot":"","sources":["../../../src/inspect/node-contract/node-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACL,6BAA6B,EAC7B,oBAAoB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eContractMeta } from "./types.js";
|
|
3
|
+
export interface NodeContractArtifacts {
|
|
4
|
+
nodeName: string;
|
|
5
|
+
kind: NodeContractKind;
|
|
6
|
+
meta: NodeContractMeta;
|
|
7
|
+
geometry: Record<string, unknown>;
|
|
8
|
+
visuals: Record<string, unknown>;
|
|
9
|
+
structureDsl: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function detectNodeContractFormat(contractDir: string, nodeName: string, kind: NodeContractKind): Promise<ContractFormat>;
|
|
12
|
+
export declare function readNodeContractArtifacts(contractDir: string, nodeName: string, kind: NodeContractKind, format?: ContractFormat): Promise<NodeContractArtifacts>;
|
|
13
|
+
export declare function validateNodeContractArtifacts(artifacts: NodeContractArtifacts, format?: ContractFormat): void;
|
|
14
|
+
//# sourceMappingURL=node-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-schema.d.ts","sourceRoot":"","sources":["../../../src/inspect/node-contract/node-schema.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AASrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAiDrE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB;AAuGD,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,cAAc,CAAC,CASzB;AAED,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,gBAAgB,EACtB,MAAM,GAAE,cAAuB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CA0ChC;AAED,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,qBAAqB,EAChC,MAAM,GAAE,cAAuB,GAC9B,IAAI,CAkBN"}
|