Skip to content

Commit

Permalink
chore: fix broken URL on Windows (#3304) (CP: 24.7) (#3305)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaadin-bot authored Feb 28, 2025
1 parent 4364521 commit 4bcc111
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dir from './utils/dir.js';
import injectRegister from './utils/injectRegister.js';
import loadTSConfig from './utils/loadTSConfig.js';
import redirectURLPart from './utils/redirectURLPart.js';
import { isAbsolute } from 'node:path';

if (!('fromAsync' in Array)) {
const { fromAsync } = await import('array-from-async');
Expand Down Expand Up @@ -61,7 +62,8 @@ const originalFiles = Object.fromEntries(await Array.fromAsync(loadFiles()));
function compileTypeScript({ options, fileNames }: ParsedCommandLine): ReadonlyArray<readonly [URL, string]> {
const createdFiles: Array<readonly [string, string]> = [];
const host = createCompilerHost(options);
host.readFile = (fileName) => originalFiles[fileURLToPath(new URL(fileName, cwd))] ?? sys.readFile(fileName);
host.readFile = (fileName) =>
originalFiles[isAbsolute(fileName) ? fileName : fileURLToPath(new URL(fileName, cwd))] ?? sys.readFile(fileName);
host.writeFile = (fileName, data) => {
createdFiles.push([fileName, data]);
};
Expand Down

0 comments on commit 4bcc111

Please sign in to comment.