evolit 0.4.1 → 0.4.2
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/package.json +1 -1
- package/src/compiler.js +26 -2
package/package.json
CHANGED
package/src/compiler.js
CHANGED
|
@@ -237,6 +237,30 @@ async function transformModuleSource(source, {
|
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
function stabilizeIntegrationSourceMap(result, litsxPipeline) {
|
|
241
|
+
if (!result?.map || !Array.isArray(result.map.sources) || !litsxPipeline) {
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
let didChange = false;
|
|
246
|
+
const sources = result.map.sources.map((sourcePath) => {
|
|
247
|
+
if (typeof sourcePath !== "string" || !path.isAbsolute(sourcePath)) return sourcePath;
|
|
248
|
+
const outputRelativePath = litsxPipeline.getOutputRelativePath(sourcePath);
|
|
249
|
+
if (!outputRelativePath) return sourcePath;
|
|
250
|
+
didChange = true;
|
|
251
|
+
return `/${outputRelativePath.split(path.sep).join("/")}`;
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
if (!didChange) return result;
|
|
255
|
+
return {
|
|
256
|
+
...result,
|
|
257
|
+
map: {
|
|
258
|
+
...result.map,
|
|
259
|
+
sources,
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
|
|
240
264
|
function isStaticAssetPath(filePath) {
|
|
241
265
|
return STATIC_ASSET_EXTENSIONS.some((extension) => filePath.endsWith(extension));
|
|
242
266
|
}
|
|
@@ -1422,14 +1446,14 @@ async function compileModuleGraphUncached(entryPath, options = {}) {
|
|
|
1422
1446
|
|
|
1423
1447
|
await ensureDirectory(path.dirname(outputPath));
|
|
1424
1448
|
const source = await fs.readFile(sourcePath, "utf8");
|
|
1425
|
-
const transformed = await transformModuleSource(source, {
|
|
1449
|
+
const transformed = stabilizeIntegrationSourceMap(await transformModuleSource(source, {
|
|
1426
1450
|
projectRoot,
|
|
1427
1451
|
sourcePath,
|
|
1428
1452
|
sourceMaps,
|
|
1429
1453
|
ssr,
|
|
1430
1454
|
target,
|
|
1431
1455
|
litsxPipeline,
|
|
1432
|
-
});
|
|
1456
|
+
}), litsxPipeline);
|
|
1433
1457
|
const isServerComponentModule = isCompiledServerComponentModule(transformed.code);
|
|
1434
1458
|
const isMixedComponentModule = isServerComponentModule
|
|
1435
1459
|
&& isCompiledClientBoundaryModule(transformed.code);
|