@marko/vite 5.4.2 → 5.4.3
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 +9 -26
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -796,6 +796,7 @@ var virtualFiles = /* @__PURE__ */ new Map();
|
|
|
796
796
|
var extReg = /\.[^.]+$/;
|
|
797
797
|
var queryReg = /\?marko-[^?]+$/;
|
|
798
798
|
var importTagReg2 = /^<([^>]+)>$/;
|
|
799
|
+
var optionalWatchFileReg = /[\\/](?:([^\\/]+)\.)?(?:marko-tag.json|(?:style|component|component-browser)\.\w+)$/;
|
|
799
800
|
var noClientAssetsRuntimeId = "\0no_client_bundles.mjs";
|
|
800
801
|
var browserEntryQuery = "?marko-browser-entry";
|
|
801
802
|
var serverEntryQuery = "?marko-server-entry";
|
|
@@ -861,7 +862,6 @@ function markoPlugin(opts = {}) {
|
|
|
861
862
|
const entryIds = /* @__PURE__ */ new Set();
|
|
862
863
|
const cachedSources = /* @__PURE__ */ new Map();
|
|
863
864
|
const transformWatchFiles = /* @__PURE__ */ new Map();
|
|
864
|
-
const transformOptionalFiles = /* @__PURE__ */ new Map();
|
|
865
865
|
const store = new ReadOncePersistedStore(
|
|
866
866
|
`vite-marko${runtimeId ? `-${runtimeId}` : ""}`
|
|
867
867
|
);
|
|
@@ -1170,17 +1170,18 @@ function markoPlugin(opts = {}) {
|
|
|
1170
1170
|
if (type === "unlink") {
|
|
1171
1171
|
entryIds.delete(fileName);
|
|
1172
1172
|
transformWatchFiles.delete(fileName);
|
|
1173
|
-
transformOptionalFiles.delete(fileName);
|
|
1174
1173
|
}
|
|
1175
1174
|
for (const [id, files] of transformWatchFiles) {
|
|
1176
1175
|
if (anyMatch(files, fileName)) {
|
|
1177
1176
|
devServer.watcher.emit("change", id);
|
|
1178
1177
|
}
|
|
1179
1178
|
}
|
|
1180
|
-
if (type === "
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1179
|
+
if (type === "unlink" || type === "add") {
|
|
1180
|
+
const optionalMatch = optionalWatchFileReg.exec(fileName);
|
|
1181
|
+
if (optionalMatch) {
|
|
1182
|
+
const markoFile = fileName.slice(0, optionalMatch.index + 1) + (optionalMatch[1] || "index") + ".marko";
|
|
1183
|
+
if (transformWatchFiles.has(markoFile)) {
|
|
1184
|
+
devServer.watcher.emit("change", markoFile);
|
|
1184
1185
|
}
|
|
1185
1186
|
}
|
|
1186
1187
|
}
|
|
@@ -1459,24 +1460,11 @@ function markoPlugin(opts = {}) {
|
|
|
1459
1460
|
if (import.meta.hot) import.meta.hot.accept(() => {});`;
|
|
1460
1461
|
}
|
|
1461
1462
|
if (devServer) {
|
|
1462
|
-
|
|
1463
|
-
|
|
1463
|
+
transformWatchFiles.set(id, meta.watchFiles);
|
|
1464
|
+
} else {
|
|
1464
1465
|
for (const file of meta.watchFiles) {
|
|
1465
1466
|
this.addWatchFile(file);
|
|
1466
1467
|
}
|
|
1467
|
-
transformOptionalFiles.set(
|
|
1468
|
-
id,
|
|
1469
|
-
meta.api === "tags" ? [`${optionalFilePrefix}style.*`] : [
|
|
1470
|
-
`${optionalFilePrefix}style.*`,
|
|
1471
|
-
`${optionalFilePrefix}marko-tag.json`,
|
|
1472
|
-
`${optionalFilePrefix}component.*`,
|
|
1473
|
-
`${optionalFilePrefix}component-browser.*`
|
|
1474
|
-
]
|
|
1475
|
-
);
|
|
1476
|
-
transformWatchFiles.set(
|
|
1477
|
-
id,
|
|
1478
|
-
meta.analyzedTags ? meta.analyzedTags.concat(meta.watchFiles) : meta.watchFiles
|
|
1479
|
-
);
|
|
1480
1468
|
}
|
|
1481
1469
|
return {
|
|
1482
1470
|
code,
|
|
@@ -1623,11 +1611,6 @@ function virtualPathToCacheFile(virtualPath, root, cacheDir) {
|
|
|
1623
1611
|
normalizePath(path6.relative(root, virtualPath)).replace(/[\\/]+/g, "_")
|
|
1624
1612
|
);
|
|
1625
1613
|
}
|
|
1626
|
-
function getPosixBasenameWithoutExt(file) {
|
|
1627
|
-
const baseStart = file.lastIndexOf(POSIX_SEP) + 1;
|
|
1628
|
-
const extStart = file.indexOf(".", baseStart + 1);
|
|
1629
|
-
return file.slice(baseStart, extStart);
|
|
1630
|
-
}
|
|
1631
1614
|
function createDeferredPromise() {
|
|
1632
1615
|
let resolve;
|
|
1633
1616
|
let reject;
|