Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
AsPulse committed Dec 17, 2023
1 parent 7dbeda1 commit c4c45df
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/core/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ async function pipeline(format: 'esm' | 'cjs') {
)}%)`
);

await writeFile(output, minified.code + `\n//# sourceMappingURL=${basename(sourcemap_output)}`);
await writeFile(
output,
minified.code + `\n//# sourceMappingURL=${basename(sourcemap_output)}`
);
consola.success(`[${format}] Done! (${output})`);

consola.start(`[${format}] Merging sourcemaps...`);
Expand All @@ -162,15 +165,16 @@ async function pipeline(format: 'esm' | 'cjs') {
const relative_sourcemap = JSON.parse(sourcemap) as RawSourceMap;
relative_sourcemap.sourcesContent = undefined;
relative_sourcemap.sourceRoot = '';
relative_sourcemap.sources = relative_sourcemap.sources.map(v => {
if(!v.startsWith('src')) {
consola.error(`[${format}] Source path ${v} is including out of ./src folder!`);
relative_sourcemap.sources = relative_sourcemap.sources.map((v) => {
if (!v.startsWith('src')) {
consola.error(
`[${format}] Source path ${v} is including out of ./src folder!`
);
process.exit(1);
}
return `../${v}`;
});


await writeFile(sourcemap_output, JSON.stringify(relative_sourcemap));
consola.success(`[${format}] Done! (${sourcemap_output})`);
}
Expand Down

0 comments on commit c4c45df

Please sign in to comment.