Skip to content

Commit b3ebc21

Browse files
author
Tajudeen
committed
Fix React build issues: CSS syntax, tsup path resolution, and decorator support
- Fix CSS syntax error: change // comment to /* */ in styles.css - Fix tsup module resolution: find root node_modules directory in build.js - Fix JSON syntax: add missing comma in tsconfig.json - Enable experimentalDecorators in tsconfig.json for decorator support - Fix tsup config: remove duplicate tsconfigRaw, add esbuild plugin to mark VS Code code as external - Update external dependencies handling to prevent bundling VS Code internal code - Fix code hygiene: add unicode suppression comments and fix indentation
1 parent 0ff450d commit b3ebc21

File tree

11 files changed

+95
-114
lines changed

11 files changed

+95
-114
lines changed

src/vs/workbench/contrib/cortexide/browser/react/build.js

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ This function finds `globalDesiredPath` given `localDesiredPath` and `currentPat
3232
3333
Diagram:
3434
35+
// allow-any-unicode-next-line
3536
...basePath/
37+
// allow-any-unicode-next-line
3638
└── void/
39+
// allow-any-unicode-next-line
3740
├── ...currentPath/ (defined globally)
41+
// allow-any-unicode-next-line
3842
└── ...localDesiredPath/ (defined locally)
3943
4044
*/
@@ -77,6 +81,32 @@ function saveStylesFile() {
7781
}, 6000);
7882
}
7983

84+
// Find root node_modules directory
85+
function findRootNodeModules(currentPath) {
86+
while (currentPath !== path.dirname(currentPath)) {
87+
const nodeModulesPath = path.join(currentPath, 'node_modules');
88+
if (fs.existsSync(nodeModulesPath)) {
89+
return nodeModulesPath;
90+
}
91+
currentPath = path.dirname(currentPath);
92+
}
93+
return undefined;
94+
}
95+
96+
const rootNodeModules = findRootNodeModules(__dirname);
97+
if (!rootNodeModules) {
98+
// allow-any-unicode-next-line
99+
console.error('❌ Could not find root node_modules directory');
100+
process.exit(1);
101+
}
102+
103+
const tsupPath = path.join(rootNodeModules, '.bin', 'tsup');
104+
if (!fs.existsSync(tsupPath)) {
105+
// allow-any-unicode-next-line
106+
console.error(`❌ tsup not found at ${tsupPath}`);
107+
process.exit(1);
108+
}
109+
80110
const args = process.argv.slice(2);
81111
const isWatch = args.includes('--watch') || args.includes('-w');
82112

@@ -85,13 +115,16 @@ if (isWatch) {
85115
// Check if src2/ exists; if not, do an initial scope-tailwind build
86116
if (!fs.existsSync('src2')) {
87117
try {
118+
// allow-any-unicode-next-line
88119
console.log('🔨 Running initial scope-tailwind build to create src2 folder...');
89120
execSync(
90121
'npx scope-tailwind ./src -o src2/ -s void-scope -c styles.css -p "void-"',
91122
{ stdio: 'inherit' }
92123
);
124+
// allow-any-unicode-next-line
93125
console.log('✅ src2/ created successfully.');
94126
} catch (err) {
127+
// allow-any-unicode-next-line
95128
console.error('❌ Error running initial scope-tailwind build:', err);
96129
process.exit(1);
97130
}
@@ -108,7 +141,7 @@ if (isWatch) {
108141

109142
const tsupWatcher = spawn('node', [
110143
'--max-old-space-size=12288',
111-
'./node_modules/.bin/tsup',
144+
tsupPath,
112145
'--watch'
113146
], {
114147
cwd: __dirname
@@ -142,9 +175,11 @@ if (isWatch) {
142175
process.exit();
143176
});
144177

178+
// allow-any-unicode-next-line
145179
console.log('🔄 Watchers started! Press Ctrl+C to stop both watchers.');
146180
} else {
147181
// Build mode
182+
// allow-any-unicode-next-line
148183
console.log('📦 Building...');
149184

150185
// Run scope-tailwind once
@@ -153,7 +188,8 @@ if (isWatch) {
153188
// Run tsup once with increased memory limit
154189
// tsup uses esbuild which can be memory-intensive with large bundles
155190
// DTS generation requires significantly more memory (12GB recommended)
156-
execSync('node --max-old-space-size=12288 ./node_modules/.bin/tsup', { stdio: 'inherit' });
191+
execSync(`node --max-old-space-size=12288 ${tsupPath}`, { stdio: 'inherit' });
157192

193+
// allow-any-unicode-next-line
158194
console.log('✅ Build complete!');
159195
}

src/vs/workbench/contrib/cortexide/browser/react/out/diff/index.d.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/vs/workbench/contrib/cortexide/browser/react/out/quick-edit-tsx/index.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/vs/workbench/contrib/cortexide/browser/react/out/sidebar-tsx/index.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/vs/workbench/contrib/cortexide/browser/react/out/void-editor-widgets-tsx/index.d.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/vs/workbench/contrib/cortexide/browser/react/out/void-onboarding/index.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/vs/workbench/contrib/cortexide/browser/react/out/void-settings-tsx/index.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/vs/workbench/contrib/cortexide/browser/react/out/void-tooltip/index.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/vs/workbench/contrib/cortexide/browser/react/src/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
}
166166

167167
.monaco-editor .error-detection-glyph-error::before {
168-
// allow-any-unicode-next-line
168+
/* allow-any-unicode-next-line */
169169
content: '❌';
170170
font-size: 14px;
171171
color: var(--vscode-errorForeground);

src/vs/workbench/contrib/cortexide/browser/react/tsconfig.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
"compilerOptions": {
77
"strict": true,
88
"exactOptionalPropertyTypes": false,
9+
"experimentalDecorators": true,
910

1011
"jsx": "react-jsx",
1112
"moduleResolution": "NodeNext",
1213
"module": "NodeNext",
1314
"esModuleInterop": true,
14-
"skipLibCheck": true,
15+
"skipLibCheck": true
1516
},
1617
"include": [
1718
// this is just for type checking, so src/ is the correct dir
@@ -22,10 +23,10 @@
2223
"node_modules/**",
2324
"**/node_modules/**",
2425
"**/cac/deno/**"
25-
]
26+
],
2627
"plugins": [
27-
{
28-
"name": "next"
29-
}
30-
]
28+
{
29+
"name": "next"
30+
}
31+
]
3132
}

0 commit comments

Comments
 (0)