@marko/vite 5.1.7 → 5.2.0
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 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -160,6 +160,7 @@ function plugin(options) {
|
|
|
160
160
|
import * as compiler from "@marko/compiler";
|
|
161
161
|
import fs2 from "fs";
|
|
162
162
|
import path2 from "path";
|
|
163
|
+
var importTagReg = /<([^>]+)>/;
|
|
163
164
|
var markoErrorRegExp = /^(.+?)(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
|
|
164
165
|
function esbuildPlugin(config) {
|
|
165
166
|
return {
|
|
@@ -183,6 +184,16 @@ function esbuildPlugin(config) {
|
|
|
183
184
|
external: true
|
|
184
185
|
};
|
|
185
186
|
});
|
|
187
|
+
build.onResolve({ filter: importTagReg }, (args) => {
|
|
188
|
+
const tagName = importTagReg.exec(args.path)?.[1];
|
|
189
|
+
if (tagName) {
|
|
190
|
+
const tagDef = compiler.taglib.buildLookup(args.resolveDir).getTag(tagName);
|
|
191
|
+
const tagFile = tagDef && (tagDef.template || tagDef.renderer);
|
|
192
|
+
if (tagFile) {
|
|
193
|
+
return { path: tagFile };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
186
197
|
build.onLoad({ filter: /\.marko$/ }, async (args) => {
|
|
187
198
|
try {
|
|
188
199
|
const { code, meta } = await compiler.compileFile(
|
|
@@ -760,6 +771,7 @@ var normalizePath = path6.sep === WINDOWS_SEP ? (id) => id.replace(/\\/g, POSIX_
|
|
|
760
771
|
var virtualFiles = /* @__PURE__ */ new Map();
|
|
761
772
|
var extReg = /\.[^.]+$/;
|
|
762
773
|
var queryReg = /\?marko-[^?]+$/;
|
|
774
|
+
var importTagReg2 = /^<([^>]+)>$/;
|
|
763
775
|
var browserEntryQuery = "?marko-browser-entry";
|
|
764
776
|
var serverEntryQuery = "?marko-server-entry";
|
|
765
777
|
var virtualFileQuery = "?marko-virtual";
|
|
@@ -1127,6 +1139,13 @@ function markoPlugin(opts = {}) {
|
|
|
1127
1139
|
if (importee === renderAssetsRuntimeId) {
|
|
1128
1140
|
return { id: renderAssetsRuntimeId };
|
|
1129
1141
|
}
|
|
1142
|
+
if (importer) {
|
|
1143
|
+
const tagName = importTagReg2.exec(importee)?.[1];
|
|
1144
|
+
if (tagName) {
|
|
1145
|
+
const tagDef = compiler2.taglib.buildLookup(path6.dirname(importer)).getTag(tagName);
|
|
1146
|
+
return tagDef && (tagDef.template || tagDef.renderer);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1130
1149
|
let importeeQuery = getMarkoQuery(importee);
|
|
1131
1150
|
if (importeeQuery) {
|
|
1132
1151
|
importee = importee.slice(0, -importeeQuery.length);
|