@nooeh/cli 0.2.3 → 0.2.5
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/dist/init.js +12 -8
- package/package.json +2 -2
package/dist/init.js
CHANGED
|
@@ -38,7 +38,6 @@ function getStylexPlugin(stylesAlias, tokenDirectory, projectDirectory) {
|
|
|
38
38
|
const aliasPattern = `${stylesAlias}/*`;
|
|
39
39
|
const aliasTarget = `/ROOT/${tokenPath}/*`;
|
|
40
40
|
return `stylex.vite({
|
|
41
|
-
useCSSLayers: true,
|
|
42
41
|
aliases: { ${JSON.stringify(aliasPattern)}: [${JSON.stringify(aliasTarget)}] },
|
|
43
42
|
unstable_moduleResolution: {
|
|
44
43
|
type: "commonJS",
|
|
@@ -54,11 +53,11 @@ function configureVite(source, stylesAlias, tokenDirectory, projectDirectory) {
|
|
|
54
53
|
const legacyStylexPluginPattern = /stylex\.vite\(\{\s*useCSSLayers:\s*true\s*\}\)/;
|
|
55
54
|
const emptyStylexPluginPattern = /stylex\.vite\(\)/;
|
|
56
55
|
if (!source.includes("stylex.vite(") && !pluginPattern.test(source)) {
|
|
57
|
-
throw new Error("Could not safely update the Vite plugins array. Add stylex.vite(
|
|
56
|
+
throw new Error("Could not safely update the Vite plugins array. Add stylex.vite() manually.");
|
|
58
57
|
}
|
|
59
58
|
let withStylex = source;
|
|
60
59
|
if (source.includes("unstable_moduleResolution")) {
|
|
61
|
-
withStylex = source;
|
|
60
|
+
withStylex = source.replace(/\s*useCSSLayers:\s*true,?/, "");
|
|
62
61
|
}
|
|
63
62
|
else if (legacyStylexPluginPattern.test(source)) {
|
|
64
63
|
withStylex = source.replace(legacyStylexPluginPattern, stylexPlugin);
|
|
@@ -92,16 +91,21 @@ async function writeViteFiles(projectDirectory, tokenDirectory, stylesAlias, ref
|
|
|
92
91
|
async function writeNooehFiles(projectDirectory, tokenDirectory, refreshLegacyTokens = false) {
|
|
93
92
|
await mkdir(tokenDirectory, { recursive: true });
|
|
94
93
|
for (const file of await getTokenFiles()) {
|
|
95
|
-
await writeTokenFile(join(tokenDirectory, file.name), file.content, refreshLegacyTokens
|
|
94
|
+
await writeTokenFile(join(tokenDirectory, file.name), file.content, refreshLegacyTokens, file.name);
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
97
|
+
function isLegacyNooehSource(fileName, source) {
|
|
98
|
+
if (fileName === "semantic.stylex.ts") {
|
|
99
|
+
return source.includes('bgCanvas: "initial"') && source.includes('overlay: "initial"');
|
|
100
|
+
}
|
|
101
|
+
return (fileName === "theme-provider.tsx" &&
|
|
102
|
+
source.includes("const styles = stylex.create({") &&
|
|
103
|
+
source.includes("data-theme={resolvedTheme}"));
|
|
100
104
|
}
|
|
101
|
-
async function writeTokenFile(path, source,
|
|
105
|
+
async function writeTokenFile(path, source, shouldRefreshLegacySources, fileName) {
|
|
102
106
|
try {
|
|
103
107
|
const currentSource = await readFile(path, "utf8");
|
|
104
|
-
if (
|
|
108
|
+
if (shouldRefreshLegacySources && isLegacyNooehSource(fileName, currentSource)) {
|
|
105
109
|
await writeFile(path, source, "utf8");
|
|
106
110
|
}
|
|
107
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nooeh/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"bin": {
|
|
6
6
|
"nooeh": "./dist/cli.js"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@nooeh/registry": "0.1.
|
|
22
|
+
"@nooeh/registry": "0.1.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.20.1",
|