@figma/code-connect 1.5.0 → 1.5.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
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Code Connect
|
|
2
2
|
|
|
3
3
|
> [!WARNING]
|
|
4
|
-
>
|
|
4
|
+
> Framework-specific parsers will no longer receive updates or support from August 17th, 2026. Template files will be the only actively maintained way of using Code Connect. See our migration guide for more information and instructions on migrating parser-based Code Connect:
|
|
5
|
+
> https://developers.figma.com/docs/code-connect/templates-migration-guide/
|
|
5
6
|
|
|
6
7
|
Code Connect is a tool for connecting your design system components in code with your design system in Figma. When using Code Connect, Figma's Dev Mode will display true-to-production code snippets from your design system instead of autogenerated code examples. In addition to connecting component definitions, Code Connect also supports mapping properties from code to Figma enabling dynamic and correct examples. This can be useful for when you have an existing design system and are looking to drive consistent and correct adoption of that design system across design and engineering.
|
|
7
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../../src/common/updates.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAWnC,wBAAgB,0BAA0B,SAEzC;AAID,KAAK,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAA;AAIhE,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,WAAW,EAGvD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC5C,EAAE,sBAA8B,EAAE,GAAE;IAAE,sBAAsB,CAAC,EAAE,OAAO,CAAA;CAAO,IAErE,GAAG,MAAM,WAAW,CAAC,CAAC,CAAC,0BAsBhC;AAyCD,wBAAgB,mBAAmB,CAAC,SAAS,SAAI,GAAG,KAAK,CAKxD;
|
|
1
|
+
{"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../../src/common/updates.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAWnC,wBAAgB,0BAA0B,SAEzC;AAID,KAAK,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAA;AAIhE,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,WAAW,EAGvD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC5C,EAAE,sBAA8B,EAAE,GAAE;IAAE,sBAAsB,CAAC,EAAE,OAAO,CAAA;CAAO,IAErE,GAAG,MAAM,WAAW,CAAC,CAAC,CAAC,0BAsBhC;AAyCD,wBAAgB,mBAAmB,CAAC,SAAS,SAAI,GAAG,KAAK,CAKxD;AA0BD,wBAAgB,SAAS,SAGxB"}
|
package/dist/common/updates.js
CHANGED
|
@@ -92,11 +92,9 @@ function exitWithUpdateCheck(errorCode = 1) {
|
|
|
92
92
|
function getUpdateCommand() {
|
|
93
93
|
return 'npm update -g @figma/code-connect';
|
|
94
94
|
}
|
|
95
|
-
// Keep in sync with the deprecation notices in figmadoc/README.md and
|
|
96
|
-
// figmadoc/CHANGELOG.md, which repeat this date.
|
|
97
|
-
const PARSER_DEPRECATION_DATE = 'August 17th, 2026';
|
|
98
95
|
const DEPRECATION_NOTICE = `
|
|
99
|
-
|
|
96
|
+
Framework-specific parsers will no longer receive updates or support from August 17th, 2026. Template files will be the only actively maintained way of using Code Connect. See our migration guide for more information and instructions on migrating parser-based Code Connect:
|
|
97
|
+
https://developers.figma.com/docs/code-connect/templates-migration-guide/`;
|
|
100
98
|
function maybeShowUpdateMessage() {
|
|
101
99
|
if (parserBasedCodeConnectFound && !deprecationWarningHidden) {
|
|
102
100
|
logging_1.logger.warn(DEPRECATION_NOTICE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../../src/common/updates.ts"],"names":[],"mappings":";;;;;AAeA,gEAEC;AAQD,kDA4BC;AAyCD,kDAKC;
|
|
1
|
+
{"version":3,"file":"updates.js","sourceRoot":"","sources":["../../src/common/updates.ts"],"names":[],"mappings":";;;;;AAeA,gEAEC;AAQD,kDA4BC;AAyCD,kDAKC;AA0BD,8BAGC;AAhID,kDAAyB;AACzB,uCAAkC;AAClC,uDAAkD;AAGlD,mCAAiC;AAEjC,IAAI,uBAAuB,GAA+B,SAAS,CAAA;AACnE,IAAI,OAAO,GAAuB,SAAS,CAAA;AAC3C,IAAI,2BAA2B,GAAG,KAAK,CAAA;AACvC,IAAI,wBAAwB,GAAG,KAAK,CAAA;AACpC,IAAI,eAAe,GAAG,KAAK,CAAA;AAE3B,+EAA+E;AAC/E,8EAA8E;AAC9E,SAAgB,0BAA0B;IACxC,2BAA2B,GAAG,IAAI,CAAA;AACpC,CAAC;AAMD,+EAA+E;AAC/E,wCAAwC;AACxC,SAAgB,mBAAmB;AACjC,8EAA8E;AAC9E,6CAA6C;AAC7C,EAA4C,EAC5C,EAAE,sBAAsB,GAAG,KAAK,KAA2C,EAAE;IAE7E,OAAO,CAAC,GAAG,IAAoB,EAAE,EAAE;QACjC,wEAAwE;QACxE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QACzC,wCAAwC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAElC,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,eAAe,CAAA;QAC/C,wBAAwB,GAAG,sBAAsB,CAAA;QAEjD,IAAI,eAAe,EAAE,CAAC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versions'\nimport { BaseCommand } from '../commands/connect'\nimport { Command } from 'commander'\nimport { request } from './fetch'\n\nlet updatedVersionAvailable: string | false | undefined = undefined\nlet message: string | undefined = undefined\nlet parserBasedCodeConnectFound = false\nlet deprecationWarningHidden = false\nlet skipUpdateCheck = false\n\n// Called when the native parser has actually produced Code Connect docs, which\n// is the only definitive signal that a project still uses the legacy parsers.\nexport function flagParserBasedCodeConnect() {\n parserBasedCodeConnectFound = true\n}\n\n// The type of the arguments passed to a command handler:\n// any arguments, then the command arguments, then the Command object\ntype CommandArgs<T extends BaseCommand> = [...any[], T, Command]\n\n// Wrap action handlers to check for updates or a message, and output a message\n// after the action if any are available\nexport function withVersionWarnings<T extends BaseCommand>(\n // The second to last argument is always the command args, but I couldn't work\n // out how to model this with Typescript here\n fn: (...args: any[]) => void | Promise<void>,\n { hideDeprecationWarning = false }: { hideDeprecationWarning?: boolean } = {},\n) {\n return (...args: CommandArgs<T>) => {\n // Get the args passed at the command line (the second to last argument)\n const commandArgs = args[args.length - 2]\n // Anything before that is a regular arg\n const restArgs = args.slice(0, -2)\n\n skipUpdateCheck = !!commandArgs.skipUpdateCheck\n deprecationWarningHidden = hideDeprecationWarning\n\n if (skipUpdateCheck) {\n return fn(...restArgs, commandArgs)\n }\n\n startUpdateCheck()\n\n const result = fn(...restArgs, commandArgs)\n if (result instanceof Promise) {\n result.finally(waitAndCheckForUpdates)\n } else {\n waitAndCheckForUpdates()\n }\n }\n}\n\n// Start checking for updates in the background. We don't wait for this before\n// running the action, as we will show the result at the end\nfunction startUpdateCheck() {\n request\n .get<{ tag_name: string }>('https://api.github.com/repos/figma/code-connect/releases/latest')\n .then((response) => {\n const latestVersion = response.data.tag_name.replace(/^v/, '')\n const currentVersion = require('../../package.json').version\n\n if (compareVersions(latestVersion, currentVersion) === 1) {\n updatedVersionAvailable = latestVersion\n } else {\n updatedVersionAvailable = false\n }\n })\n .catch(() => {\n // Silently fail if we can't check for updates\n updatedVersionAvailable = false\n })\n}\n\n// Wait for up to 1 second for the result of update checking to be available,\n// and output a message if there is an update or a message. If there is no\n// result after the timeout, the app will exit.\nasync function waitAndCheckForUpdates() {\n for (let i = 0; i < 10; i++) {\n if (updatedVersionAvailable !== undefined) {\n break\n }\n await new Promise((resolve) => setTimeout(resolve, 100))\n }\n\n maybeShowUpdateMessage()\n}\n\n// Exit the process, first checking if there is an update or message available.\n// Unlike waitAndCheckForUpdates, this will not wait for the update check to\n// complete, so if the request has not completed yet, nothing will be shown.\n// This is to avoid confusion about when the process _actually_ exits.\nexport function exitWithUpdateCheck(errorCode = 1): never {\n if (!skipUpdateCheck) {\n maybeShowUpdateMessage()\n }\n process.exit(errorCode)\n}\n\nfunction getUpdateCommand() {\n return 'npm update -g @figma/code-connect'\n}\n\nconst DEPRECATION_NOTICE = `\nFramework-specific parsers will no longer receive updates or support from August 17th, 2026. Template files will be the only actively maintained way of using Code Connect. See our migration guide for more information and instructions on migrating parser-based Code Connect:\nhttps://developers.figma.com/docs/code-connect/templates-migration-guide/`\n\nfunction maybeShowUpdateMessage() {\n if (parserBasedCodeConnectFound && !deprecationWarningHidden) {\n logger.warn(DEPRECATION_NOTICE)\n }\n\n if (updatedVersionAvailable) {\n logger.warn(`\\nA new version of the Figma CLI is available. v${require('../../package.json').version} is currently installed, and the latest version available is v${updatedVersionAvailable}.\n\nTo update, run ${chalk.whiteBright('npm install @figma/code-connect@latest')} for React or HTML, or ${chalk.whiteBright('npm install -g @figma/code-connect@latest')} for other targets (or if you have Code Connect installed globally).`)\n }\n\n if (message) {\n logger.warn(`\\n${message}`)\n }\n}\n\nexport function updateCli() {\n const { execSync } = require('child_process')\n execSync(getUpdateCommand(), { stdio: 'inherit' })\n}\n"]}
|