Merge pull request #328 from tokens-studio/fix-merge-issues

[WIP] Restore style-dictionary prerelease
This commit is contained in:
Florian Schrödl 2024-11-08 12:12:31 +01:00 committed by GitHub
commit a34207634b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 20 additions and 138 deletions

View file

@ -1,118 +0,0 @@
--- a/lib/utils/index.js
+++ b/lib/utils/index.js
@@ -18,7 +18,6 @@
import { outputReferencesTransformed } from './references/outputReferencesTransformed.js';
import flattenTokens from './flattenTokens.js';
import { typeDtcgDelegate } from './typeDtcgDelegate.js';
-import { convertToDTCG, convertJSONToDTCG, convertZIPToDTCG } from './convertToDTCG.js';
// Public style-dictionary/utils API
export {
@@ -29,8 +28,5 @@
outputReferencesTransformed,
flattenTokens,
typeDtcgDelegate,
- convertToDTCG,
- convertJSONToDTCG,
- convertZIPToDTCG,
};
export * from '../common/formatHelpers/index.js';
diff --git a/lib/StyleDictionary.js b/lib/StyleDictionary.js
index 150e81bdac15e505b74d7f1453c7b7c543fc2b35..c5c695cfb04abc835e457027291b1522bdbdb795 100644
--- a/lib/StyleDictionary.js
+++ b/lib/StyleDictionary.js
@@ -14,7 +14,7 @@
import JSON5 from 'json5';
import { extname } from 'path-unified';
import { fs } from 'style-dictionary/fs';
-import chalk from 'chalk';
+import { chalk } from './penpotPatches.js';
import { dirname } from 'path-unified';
import combineJSON from './utils/combineJSON.js';
@@ -36,9 +36,9 @@ import transformObject from './transform/object.js';
import transformConfig from './transform/config.js';
import performActions from './performActions.js';
import filterTokens from './filterTokens.js';
-import cleanFiles from './cleanFiles.js';
-import cleanDirs from './cleanDirs.js';
-import cleanActions from './cleanActions.js';
+const cleanFiles = {};
+const cleanDirs = {};
+const cleanActions = {};
/**
* @typedef {import('../types/Volume.d.ts').Volume} Volume
@@ -221,7 +221,6 @@ export default class StyleDictionary extends Register {
// Windows FS compatibility. If in browser, we use an FS shim which doesn't require this Windows workaround
_filePath = new URL(`file:///${_filePath}`).href;
}
- options = (await import(/* @vite-ignore */ /* webpackIgnore: true */ _filePath)).default;
}
} else {
options = config;
diff --git a/lib/chalk.js b/lib/chalk.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/lib/penpotPatches.js b/lib/penpotPatches.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7012e19f0ce98b0dfddee22244d40415e77146c
--- /dev/null
+++ b/lib/penpotPatches.js
@@ -0,0 +1,21 @@
+export const globSync = () => {};
+
+export const chalk = new Proxy(
+ {},
+ {
+ get: () => {
+ return new Proxy(() => {}, {
+ get: () => {
+ return (string) => string;
+ },
+ apply: () => {
+ return new Proxy(() => {}, {
+ get: () => {
+ return (string) => string;
+ },
+ });
+ },
+ });
+ },
+ },
+);
diff --git a/lib/transform/config.js b/lib/transform/config.js
index 44efa824d6633e05748ccad114512c612ecf32bd..59bc28f4dab48e533b507ad94d2b99005d7a22c5 100644
--- a/lib/transform/config.js
+++ b/lib/transform/config.js
@@ -15,7 +15,7 @@ import isPlainObject from 'is-plain-obj';
import deepExtend from '../utils/deepExtend.js';
import GroupMessages from '../utils/groupMessages.js';
import { deepmerge } from '../utils/deepmerge.js';
-import chalk from 'chalk';
+import { chalk } from '../penpotPatches.js';
/**
* @typedef {import('../StyleDictionary.js').default} StyleDictionary
diff --git a/lib/utils/combineJSON.js b/lib/utils/combineJSON.js
index f988886175b730a1a0db4855eaccbdd2add4115b..90e0a5e592701d3fc27324795a8bd90ca457814c 100644
--- a/lib/utils/combineJSON.js
+++ b/lib/utils/combineJSON.js
@@ -12,7 +12,7 @@
*/
import JSON5 from 'json5';
-import { globSync } from '@bundled-es-modules/glob';
+import { globSync } from '../penpotPatches.js';
import { extname } from 'path-unified';
import { fs } from 'style-dictionary/fs';
import { resolve } from '../resolve.js';
@@ -101,8 +101,6 @@ export default async function combineJSON(
// Windows FS compatibility. If in browser, we use an FS shim which doesn't require this Windows workaround
resolvedPath = new URL(`file:///${resolvedPath}`).href;
}
- file_content = (await import(/* @vite-ignore */ /* webpackIgnore: true */ resolvedPath))
- .default;
} else {
file_content = JSON5.parse(
/** @type {string} */ (volume.readFileSync(resolvedPath, 'utf-8')),

View file

@ -119,7 +119,7 @@
"rxjs": "8.0.0-alpha.14", "rxjs": "8.0.0-alpha.14",
"sax": "^1.4.1", "sax": "^1.4.1",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"style-dictionary": "^4.1.4", "style-dictionary": "4.0.0-prerelease.34",
"tdigest": "^0.1.2", "tdigest": "^0.1.2",
"tinycolor2": "npm:^1.6.0", "tinycolor2": "npm:^1.6.0",
"ua-parser-js": "2.0.0-rc.1", "ua-parser-js": "2.0.0-rc.1",

View file

@ -235,10 +235,10 @@ Token names should only contain letters and digits separated by . characters.")}
on-update-name-debounced on-update-name-debounced
(mf/use-fn (mf/use-fn
(uf/debounce (fn [e] (uf/debounce (fn [e]
(let [value (dom/get-target-val e) (let [value (dom/get-target-val e)
errors (validate-name value)] errors (validate-name value)]
(when touched-name? (when touched-name?
(reset! name-errors errors)))))) (reset! name-errors errors))))))
on-update-name on-update-name
(mf/use-fn (mf/use-fn
@ -388,7 +388,7 @@ Token names should only contain letters and digits separated by . characters.")}
:on-change on-update-value :on-change on-update-value
:ref value-input-ref} :ref value-input-ref}
:render-right (when color? :render-right (when color?
(mf/fnc color-bullet [] (mf/fnc []
[:div {:class (stl/css :color-bullet) [:div {:class (stl/css :color-bullet)
:on-click #(swap! color-ramp-open? not)} :on-click #(swap! color-ramp-open? not)}
(if-let [hex (some-> @color tinycolor/valid-color tinycolor/->hex)] (if-let [hex (some-> @color tinycolor/valid-color tinycolor/->hex)]

View file

@ -4,7 +4,7 @@
This library was chosen as it is already used by StyleDictionary, This library was chosen as it is already used by StyleDictionary,
so there is no extra dependency cost and there was no clojure alternatives with all the necessary features." so there is no extra dependency cost and there was no clojure alternatives with all the necessary features."
(:require (:require
["tinycolor2" :as tinycolor])) ["tinycolor2$default" :as tinycolor]))
(defn tinycolor? [^js x] (defn tinycolor? [^js x]
(and (instance? tinycolor x) (.isValid x))) (and (instance? tinycolor x) (.isValid x)))

View file

@ -218,7 +218,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@bundled-es-modules/glob@npm:^10.4.2": "@bundled-es-modules/glob@npm:^10.3.13":
version: 10.4.2 version: 10.4.2
resolution: "@bundled-es-modules/glob@npm:10.4.2" resolution: "@bundled-es-modules/glob@npm:10.4.2"
dependencies: dependencies:
@ -234,7 +234,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@bundled-es-modules/memfs@npm:^4.9.4": "@bundled-es-modules/memfs@npm:^4.8.1":
version: 4.9.4 version: 4.9.4
resolution: "@bundled-es-modules/memfs@npm:4.9.4" resolution: "@bundled-es-modules/memfs@npm:4.9.4"
dependencies: dependencies:
@ -948,10 +948,10 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@penpot/text-editor@penpot/penpot-text-editor#449e3322f3fa40b1318c9154afbbc7932a3cb766": "@penpot/text-editor@penpot/penpot-text-editor#a100aad8d0efcbb070bed9144dbd2782547e78ba":
version: 0.0.0 version: 0.0.0
resolution: "@penpot/text-editor@https://github.com/penpot/penpot-text-editor.git#commit=449e3322f3fa40b1318c9154afbbc7932a3cb766" resolution: "@penpot/text-editor@https://github.com/penpot/penpot-text-editor.git#commit=a100aad8d0efcbb070bed9144dbd2782547e78ba"
checksum: 10c0/377fbd1fccc91ce532356601a27fe11afe19f169748127884f39a6b231a037e7e1e8b401149062e39219715901933771b7d752accaa52682fb141889c22dd1d3 checksum: 10c0/328c827cd740c5e05df678083cfb1d2b6d006b56523daa0bd2a3c2936a0490a2ae4d0e69a3aec428674609a22a5fafdd5600aae1399cb3f4ed5b80e497c74a5c
languageName: node languageName: node
linkType: hard linkType: hard
@ -4300,7 +4300,7 @@ __metadata:
"@penpot/hljs": "portal:./vendor/hljs" "@penpot/hljs": "portal:./vendor/hljs"
"@penpot/mousetrap": "portal:./vendor/mousetrap" "@penpot/mousetrap": "portal:./vendor/mousetrap"
"@penpot/svgo": "penpot/svgo#c6fba7a4dcfbc27b643e7fc0c94fc98cf680b77b" "@penpot/svgo": "penpot/svgo#c6fba7a4dcfbc27b643e7fc0c94fc98cf680b77b"
"@penpot/text-editor": "penpot/penpot-text-editor#449e3322f3fa40b1318c9154afbbc7932a3cb766" "@penpot/text-editor": "penpot/penpot-text-editor#a100aad8d0efcbb070bed9144dbd2782547e78ba"
"@playwright/test": "npm:1.48.1" "@playwright/test": "npm:1.48.1"
"@storybook/addon-essentials": "npm:^8.3.6" "@storybook/addon-essentials": "npm:^8.3.6"
"@storybook/addon-themes": "npm:^8.3.6" "@storybook/addon-themes": "npm:^8.3.6"
@ -4360,7 +4360,7 @@ __metadata:
shadow-cljs: "npm:2.28.18" shadow-cljs: "npm:2.28.18"
source-map-support: "npm:^0.5.21" source-map-support: "npm:^0.5.21"
storybook: "npm:^8.3.6" storybook: "npm:^8.3.6"
style-dictionary: "npm:^4.1.4" style-dictionary: "npm:4.0.0-prerelease.34"
svg-sprite: "npm:^2.0.4" svg-sprite: "npm:^2.0.4"
tdigest: "npm:^0.1.2" tdigest: "npm:^0.1.2"
tinycolor2: "npm:^1.6.0" tinycolor2: "npm:^1.6.0"
@ -8496,13 +8496,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"style-dictionary@npm:^4.1.4": "style-dictionary@npm:4.0.0-prerelease.34":
version: 4.1.4 version: 4.0.0-prerelease.34
resolution: "style-dictionary@npm:4.1.4" resolution: "style-dictionary@npm:4.0.0-prerelease.34"
dependencies: dependencies:
"@bundled-es-modules/deepmerge": "npm:^4.3.1" "@bundled-es-modules/deepmerge": "npm:^4.3.1"
"@bundled-es-modules/glob": "npm:^10.4.2" "@bundled-es-modules/glob": "npm:^10.3.13"
"@bundled-es-modules/memfs": "npm:^4.9.4" "@bundled-es-modules/memfs": "npm:^4.8.1"
"@zip.js/zip.js": "npm:^2.7.44" "@zip.js/zip.js": "npm:^2.7.44"
chalk: "npm:^5.3.0" chalk: "npm:^5.3.0"
change-case: "npm:^5.3.0" change-case: "npm:^5.3.0"
@ -8514,7 +8514,7 @@ __metadata:
tinycolor2: "npm:^1.6.0" tinycolor2: "npm:^1.6.0"
bin: bin:
style-dictionary: bin/style-dictionary.js style-dictionary: bin/style-dictionary.js
checksum: 10c0/b88e2f94615bc851e2e797e685863911dbb875d312bf1571a3be6b6a9dde7e0b324d83495f153446eceefe93ec119c80e2ca032a600818dcecc72174d285e429 checksum: 10c0/775d00c0e6aec7749dd5554c448550bc0793aaff9ab028d61ba219476ffa827d3e11866d326c34a27d3e848156b885e476beaade0909fe6b174a50e857dd5009
languageName: node languageName: node
linkType: hard linkType: hard