@marko/vite 5.3.6 → 5.3.8
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/dist/index.mjs +19 -15
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -851,15 +851,19 @@ function markoPlugin(opts = {}) {
|
|
|
851
851
|
let hydrateConfig;
|
|
852
852
|
const resolveVirtualDependency = (from, dep) => {
|
|
853
853
|
const normalizedFrom = normalizePath(from);
|
|
854
|
-
const query = `${virtualFileQuery}&id=${
|
|
854
|
+
const query = `${virtualFileQuery}&id=${dep.virtualPath.replace(/^\.\//, "").replace(/[^a-z0-9_.-]+/gi, "_")}`;
|
|
855
855
|
const id = normalizedFrom + query;
|
|
856
|
+
const virtualFile = {
|
|
857
|
+
code: dep.code,
|
|
858
|
+
map: stripSourceRoot(dep.map)
|
|
859
|
+
};
|
|
856
860
|
if (devServer) {
|
|
857
861
|
const prev = virtualFiles.get(id);
|
|
858
862
|
if (isDeferredPromise(prev)) {
|
|
859
|
-
prev.resolve(
|
|
863
|
+
prev.resolve(virtualFile);
|
|
860
864
|
}
|
|
861
865
|
}
|
|
862
|
-
virtualFiles.set(id,
|
|
866
|
+
virtualFiles.set(id, virtualFile);
|
|
863
867
|
return `./${path6.posix.basename(normalizedFrom) + query}`;
|
|
864
868
|
};
|
|
865
869
|
let root;
|
|
@@ -1257,7 +1261,7 @@ function markoPlugin(opts = {}) {
|
|
|
1257
1261
|
)
|
|
1258
1262
|
} : await this.resolve(importee, importer, resolveOpts);
|
|
1259
1263
|
if (resolved) {
|
|
1260
|
-
resolved.id =
|
|
1264
|
+
resolved.id = stripViteQueries(resolved.id) + importeeQuery;
|
|
1261
1265
|
}
|
|
1262
1266
|
return resolved;
|
|
1263
1267
|
}
|
|
@@ -1277,7 +1281,7 @@ function markoPlugin(opts = {}) {
|
|
|
1277
1281
|
return null;
|
|
1278
1282
|
},
|
|
1279
1283
|
async load(rawId) {
|
|
1280
|
-
const id =
|
|
1284
|
+
const id = stripViteQueries(rawId);
|
|
1281
1285
|
if (id === renderAssetsRuntimeId) {
|
|
1282
1286
|
return renderAssetsRuntimeCode;
|
|
1283
1287
|
}
|
|
@@ -1310,7 +1314,7 @@ function markoPlugin(opts = {}) {
|
|
|
1310
1314
|
return virtualFiles.get(id) || null;
|
|
1311
1315
|
},
|
|
1312
1316
|
async transform(source, rawId, ssr) {
|
|
1313
|
-
let id =
|
|
1317
|
+
let id = stripViteQueries(rawId);
|
|
1314
1318
|
const info = isBuild ? this.getModuleInfo(id) : void 0;
|
|
1315
1319
|
const arcSourceId = info?.meta.arcSourceId;
|
|
1316
1320
|
if (arcSourceId) {
|
|
@@ -1401,7 +1405,7 @@ function markoPlugin(opts = {}) {
|
|
|
1401
1405
|
);
|
|
1402
1406
|
return {
|
|
1403
1407
|
code: code2,
|
|
1404
|
-
map:
|
|
1408
|
+
map: stripSourceRoot(map),
|
|
1405
1409
|
meta: { arcSourceCode: source, arcScanIds: meta2.analyzedTags }
|
|
1406
1410
|
};
|
|
1407
1411
|
}
|
|
@@ -1437,7 +1441,7 @@ if (import.meta.hot) import.meta.hot.accept(() => {});`;
|
|
|
1437
1441
|
}
|
|
1438
1442
|
return {
|
|
1439
1443
|
code,
|
|
1440
|
-
map:
|
|
1444
|
+
map: stripSourceRoot(compiled.map),
|
|
1441
1445
|
meta: isBuild ? { arcSourceCode: source, arcScanIds: meta.analyzedTags } : void 0
|
|
1442
1446
|
};
|
|
1443
1447
|
}
|
|
@@ -1600,11 +1604,11 @@ function isEmpty(obj) {
|
|
|
1600
1604
|
}
|
|
1601
1605
|
return true;
|
|
1602
1606
|
}
|
|
1603
|
-
function
|
|
1607
|
+
function stripViteQueries(id) {
|
|
1604
1608
|
const queryStart = id.indexOf("?");
|
|
1605
1609
|
if (queryStart === -1) return id;
|
|
1606
1610
|
const url = id.slice(0, queryStart);
|
|
1607
|
-
const query = id.slice(queryStart + 1).replace(/(?:^|[&])[vt]=[^&]+/g, "");
|
|
1611
|
+
const query = id.slice(queryStart + 1).replace(/(?:^|[&])(?:cache|[vt])=[^&]+/g, "");
|
|
1608
1612
|
if (query) return `${url}?${query}`;
|
|
1609
1613
|
return url;
|
|
1610
1614
|
}
|
|
@@ -1654,11 +1658,11 @@ function getKnownTemplates(cwd) {
|
|
|
1654
1658
|
}
|
|
1655
1659
|
return knownTemplates;
|
|
1656
1660
|
}
|
|
1657
|
-
function
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1661
|
+
function stripSourceRoot(map) {
|
|
1662
|
+
if (map && map.sourceRoot) {
|
|
1663
|
+
map.sourceRoot = void 0;
|
|
1664
|
+
}
|
|
1665
|
+
return map;
|
|
1662
1666
|
}
|
|
1663
1667
|
export {
|
|
1664
1668
|
markoPlugin as default
|