@marko/vite 5.3.0 → 5.3.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/dist/index.d.ts CHANGED
@@ -9,5 +9,6 @@ export interface Options {
9
9
  translator?: string;
10
10
  basePathVar?: string;
11
11
  babelConfig?: compiler.Config["babelConfig"];
12
+ isEntry?: (importee: string, importer: string) => boolean;
12
13
  }
13
14
  export default function markoPlugin(opts?: Options): vite.Plugin[];
package/dist/index.mjs CHANGED
@@ -717,12 +717,13 @@ var render_assets_transform_default = (tag, t3) => {
717
717
  };
718
718
  function renderAssetsCall(t3, slot) {
719
719
  return t3.markoPlaceholder(
720
- t3.callExpression(
720
+ t3.optionalCallExpression(
721
721
  t3.memberExpression(
722
722
  t3.identifier("$global"),
723
723
  t3.identifier("___viteRenderAssets")
724
724
  ),
725
- [t3.stringLiteral(slot)]
725
+ [t3.stringLiteral(slot)],
726
+ true
726
727
  ),
727
728
  false
728
729
  );
@@ -831,6 +832,7 @@ function markoPlugin(opts = {}) {
831
832
  let serverManifest;
832
833
  let basePath = "/";
833
834
  let getMarkoAssetFns;
835
+ let checkIsEntry = () => true;
834
836
  const entryIds = /* @__PURE__ */ new Set();
835
837
  const cachedSources = /* @__PURE__ */ new Map();
836
838
  const transformWatchFiles = /* @__PURE__ */ new Map();
@@ -878,6 +880,9 @@ function markoPlugin(opts = {}) {
878
880
  }
879
881
  runtimeId = opts.runtimeId;
880
882
  basePathVar = opts.basePathVar;
883
+ if (opts.isEntry) {
884
+ checkIsEntry = opts.isEntry;
885
+ }
881
886
  if ("BASE_URL" in process.env && config.base == null) {
882
887
  config.base = process.env.BASE_URL;
883
888
  }
@@ -1168,7 +1173,10 @@ function markoPlugin(opts = {}) {
1168
1173
  importee = importee.slice(0, -importeeQuery.length);
1169
1174
  } else if (!importOpts.scan) {
1170
1175
  if (ssr && linked && importer && importer[0] !== "\0" && (importer !== devEntryFile || normalizePath(importer) !== devEntryFilePosix) && // Vite tries to resolve against an `index.html` in some cases, we ignore it here.
1171
- isMarkoFile(importee) && !isMarkoFile(importer.replace(queryReg, ""))) {
1176
+ isMarkoFile(importee) && !queryReg.test(importer) && !isMarkoFile(importer) && checkIsEntry(
1177
+ normalizePath(path6.resolve(importer, "..", importee)),
1178
+ importer
1179
+ )) {
1172
1180
  importeeQuery = serverEntryQuery;
1173
1181
  } else if (!ssr && isBuild && importer && isMarkoFile(importee) && this.getModuleInfo(importer)?.isEntry) {
1174
1182
  importeeQuery = browserEntryQuery;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "description": "A Marko plugin for Vite",
5
5
  "keywords": [
6
6
  "loader",