@marko/vite 5.0.15 → 5.1.1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +16 -15
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -637,13 +637,10 @@ function renderAssets(slot) {
637
637
  const slotWrittenEntriesKey = \`___viteWrittenEntries-\${slot}\`;
638
638
  const lastWrittenEntry = this[slotWrittenEntriesKey] || 0;
639
639
  const writtenEntries = (this[slotWrittenEntriesKey] = entries.length);
640
-
641
- if(!this.___flushedMBP && slot !== "head-prepend") {
642
- this.___flushedMBP = true;
643
-
644
- html += \`<script\${this.___viteInjectAttrs}>${opts.runtimeId ? `$mbp_${opts.runtimeId}` : "$mbp"}=\${JSON.stringify(base)}</script>\`
645
- }
646
-
640
+ ${opts.basePathVar ? `if (!this.___flushedMBP && slot !== "head-prepend") {
641
+ this.___flushedMBP = true;
642
+ html += \`<script\${this.___viteInjectAttrs}>${opts.runtimeId ? `$mbp_${opts.runtimeId}` : "$mbp"}=\${JSON.stringify(base)}</script>\`
643
+ }` : ""}
647
644
  for (let i = lastWrittenEntry; i < writtenEntries; i++) {
648
645
  let entry = entries[i];
649
646
 
@@ -805,7 +802,7 @@ function markoPlugin(opts = {}) {
805
802
  let hydrateConfig;
806
803
  const resolveVirtualDependency = (from, dep) => {
807
804
  const normalizedFrom = normalizePath(from);
808
- const query = `${virtualFileQuery}&id=${Buffer.from(dep.virtualPath).toString("base64url") + path6.extname(dep.virtualPath)}`;
805
+ const query = `${virtualFileQuery}&id=${encodeURIComponent(dep.virtualPath)}`;
809
806
  const id = normalizedFrom + query;
810
807
  if (devServer) {
811
808
  const prev = virtualFiles.get(id);
@@ -1101,7 +1098,7 @@ function markoPlugin(opts = {}) {
1101
1098
  }
1102
1099
  }
1103
1100
  },
1104
- async buildStart(inputOptions) {
1101
+ async options(inputOptions) {
1105
1102
  if (isBuild && linked && !isSSRBuild) {
1106
1103
  try {
1107
1104
  serverManifest = await store.read();
@@ -1111,12 +1108,6 @@ function markoPlugin(opts = {}) {
1111
1108
  entryIds.add(id);
1112
1109
  cachedSources.set(id, serverManifest.entrySources[entry]);
1113
1110
  }
1114
- for (const assetId of serverManifest.ssrAssetIds) {
1115
- this.load({
1116
- id: normalizePath(path6.resolve(root, assetId)),
1117
- resolveDependencies: false
1118
- }).catch(noop2);
1119
- }
1120
1111
  } catch (err) {
1121
1112
  this.error(
1122
1113
  `You must run the "ssr" build before the "browser" build.`
@@ -1127,6 +1118,16 @@ function markoPlugin(opts = {}) {
1127
1118
  }
1128
1119
  }
1129
1120
  },
1121
+ async buildStart() {
1122
+ if (isBuild && linked && !isSSRBuild) {
1123
+ for (const assetId of serverManifest.ssrAssetIds) {
1124
+ this.load({
1125
+ id: normalizePath(path6.resolve(root, assetId)),
1126
+ resolveDependencies: false
1127
+ }).catch(noop2);
1128
+ }
1129
+ }
1130
+ },
1130
1131
  async resolveId(importee, importer, importOpts, ssr = importOpts.ssr) {
1131
1132
  if (virtualFiles.has(importee)) {
1132
1133
  return importee;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
- "version": "5.0.15",
3
+ "version": "5.1.1",
4
4
  "description": "A Marko plugin for Vite",
5
5
  "keywords": [
6
6
  "loader",