Fix compile

This commit is contained in:
Matt Bierner
2025-10-12 22:21:14 -07:00
parent 1eee7ae230
commit 51d83e06c3
3 changed files with 12 additions and 16 deletions
+6 -7
View File
@@ -90,19 +90,19 @@ function extractEditor(options) {
}
}
const copied = {};
const copyFile = (fileName) => {
const copyFile = (fileName, toFileName) => {
if (copied[fileName]) {
return;
}
copied[fileName] = true;
if (path_1.default.isAbsolute(fileName)) {
const relativePath = path_1.default.relative(options.sourcesRoot, fileName);
const dstPath = path_1.default.join(options.destRoot, relativePath);
const dstPath = path_1.default.join(options.destRoot, toFileName ?? relativePath);
writeFile(dstPath, fs_1.default.readFileSync(fileName));
}
else {
const srcPath = path_1.default.join(options.sourcesRoot, fileName);
const dstPath = path_1.default.join(options.destRoot, fileName);
const dstPath = path_1.default.join(options.destRoot, toFileName ?? fileName);
writeFile(dstPath, fs_1.default.readFileSync(srcPath));
}
};
@@ -134,10 +134,9 @@ function extractEditor(options) {
}
delete tsConfig.compilerOptions.moduleResolution;
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
[
'vs/loader.js',
'typings/css.d.ts'
].forEach(copyFile);
copyFile('vs/loader.js');
copyFile('typings/css.d.ts');
copyFile('../node_modules/@vscode/tree-sitter-wasm/wasm/web-tree-sitter.d.ts', '@vscode/tree-sitter-wasm.d.ts');
}
function transportCSS(module, enqueue, write) {
if (!/\.css/.test(module)) {
+6 -7
View File
@@ -62,7 +62,7 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
}
}
const copied: { [fileName: string]: boolean } = {};
const copyFile = (fileName: string) => {
const copyFile = (fileName: string, toFileName?: string) => {
if (copied[fileName]) {
return;
}
@@ -70,11 +70,11 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
if (path.isAbsolute(fileName)) {
const relativePath = path.relative(options.sourcesRoot, fileName);
const dstPath = path.join(options.destRoot, relativePath);
const dstPath = path.join(options.destRoot, toFileName ?? relativePath);
writeFile(dstPath, fs.readFileSync(fileName));
} else {
const srcPath = path.join(options.sourcesRoot, fileName);
const dstPath = path.join(options.destRoot, fileName);
const dstPath = path.join(options.destRoot, toFileName ?? fileName);
writeFile(dstPath, fs.readFileSync(srcPath));
}
};
@@ -110,10 +110,9 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
delete tsConfig.compilerOptions.moduleResolution;
writeOutputFile('tsconfig.json', JSON.stringify(tsConfig, null, '\t'));
[
'vs/loader.js',
'typings/css.d.ts'
].forEach(copyFile);
copyFile('vs/loader.js');
copyFile('typings/css.d.ts');
copyFile('../node_modules/@vscode/tree-sitter-wasm/wasm/web-tree-sitter.d.ts', '@vscode/tree-sitter-wasm.d.ts');
}
function transportCSS(module: string, enqueue: (module: string) => void, write: (path: string, contents: string | Buffer) => void): boolean {
-2
View File
@@ -55,8 +55,6 @@ export interface ITreeShakingOptions {
* regex pattern to ignore certain imports e.g. `.css` imports
*/
importIgnorePattern: RegExp;
// redirects: { [module: string]: string };
}
export interface ITreeShakingResult {