@marko/vite 2.4.0 → 2.4.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.
@@ -9,7 +9,11 @@ ${opts.basePathVar ? `
9
9
  static if (typeof ${opts.basePathVar} !== "string") throw new Error("${opts.basePathVar} must be defined when using basePathVar.");
10
10
  static if (!${opts.basePathVar}.endsWith("/")) throw new Error("${opts.basePathVar} must end with a '/' when using basePathVar.");
11
11
  ` : ""}${opts.runtimeId ? `$ out.global.runtimeId = ${JSON.stringify(opts.runtimeId)};
12
- ` : ""}$ (out.global.___viteEntries || (out.global.___viteEntries = [])).push(${opts.entryData});
12
+ $ out.global.___viteBaseVar = ${JSON.stringify(
13
+ "$mbp_" + opts.runtimeId
14
+ )};
15
+ ` : `$ out.global.___viteBaseVar = "$mbp";
16
+ `}$ (out.global.___viteEntries || (out.global.___viteEntries = [])).push(${opts.entryData});
13
17
  <_vite${base} slot="head-prepend"/>
14
18
  <_vite${base} slot="head"/>
15
19
  <_vite${base} slot="body-prepend"/>
@@ -39,8 +39,8 @@ function serialize(basePath, nodes, parts) {
39
39
  curString = "";
40
40
  break;
41
41
  case "link":
42
- if (tag.attribs.rel === "stylesheet") {
43
- urlAttr = "href";
42
+ urlAttr = "href";
43
+ if (tag.attribs.rel === "stylesheet" || tag.attribs.rel === "modulepreload" || tag.attribs.as === "style" || tag.attribs.as === "script") {
44
44
  parts.push(curString, 0 /* AssetAttrs */);
45
45
  curString = "";
46
46
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serialize
3
- } from "./chunk-SELVH7LO.mjs";
3
+ } from "./chunk-BV667Z5U.mjs";
4
4
 
5
5
  // src/manifest-generator.ts
6
6
  import { Parser } from "htmlparser2";
@@ -34,15 +34,13 @@ $ if (!out.global.___viteRenderAssets) {
34
34
  ? ` nonce="${out.global.cspNonce.replace(/"/g, "&#39;")}"`
35
35
  : "";
36
36
  out.global.___viteRenderAssets = renderAssets;
37
-
38
- if (input.base) {
39
- out.global.___viteBasePath = input.base;
40
- out.script(`$mbp${out.global.runtimeId ? `_${out.global.runtimeId}` : ""}=${JSON.stringify(input.base)}`);
41
- } else {
42
- out.global.___viteBasePath = import.meta.env.BASE_URL;
43
- }
37
+ out.global.___viteBasePath = input.base || import.meta.env.BASE_URL;
44
38
  }
45
39
 
46
40
  <__flush_here_and_after__>
41
+ <if(input.base && !out.global.___flushedMBP)>
42
+ $ out.global.___flushedMBP = true;
43
+ $!{`<script${out.global.___viteInjectAttrs}>${out.global.___viteBaseVar}=${JSON.stringify(input.base)}</script>`}
44
+ </if>
47
45
  $!{out.global.___viteRenderAssets(input.slot)}
48
46
  </__flush_here_and_after__>
package/dist/index.mjs CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  import {
5
5
  generateDocManifest,
6
6
  generateInputDoc
7
- } from "./chunk-FHYNYHDA.mjs";
8
- import "./chunk-SELVH7LO.mjs";
7
+ } from "./chunk-ZCKVZIQN.mjs";
8
+ import "./chunk-BV667Z5U.mjs";
9
9
  import {
10
10
  server_entry_template_default
11
- } from "./chunk-U7T7RXXE.mjs";
11
+ } from "./chunk-6IJ5UJ3N.mjs";
12
12
  import "./chunk-KIYHBIE6.mjs";
13
13
  import {
14
14
  MemoryStore
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generateDocManifest,
3
3
  generateInputDoc
4
- } from "./chunk-FHYNYHDA.mjs";
5
- import "./chunk-SELVH7LO.mjs";
4
+ } from "./chunk-ZCKVZIQN.mjs";
5
+ import "./chunk-BV667Z5U.mjs";
6
6
  export {
7
7
  generateDocManifest,
8
8
  generateInputDoc
@@ -66,8 +66,8 @@ function serialize(basePath, nodes, parts) {
66
66
  curString = "";
67
67
  break;
68
68
  case "link":
69
- if (tag.attribs.rel === "stylesheet") {
70
- urlAttr = "href";
69
+ urlAttr = "href";
70
+ if (tag.attribs.rel === "stylesheet" || tag.attribs.rel === "modulepreload" || tag.attribs.as === "style" || tag.attribs.as === "script") {
71
71
  parts.push(curString, 0 /* AssetAttrs */);
72
72
  curString = "";
73
73
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  serialize
3
- } from "./chunk-SELVH7LO.mjs";
3
+ } from "./chunk-BV667Z5U.mjs";
4
4
  export {
5
5
  serialize as default
6
6
  };
@@ -41,7 +41,11 @@ ${opts.basePathVar ? `
41
41
  static if (typeof ${opts.basePathVar} !== "string") throw new Error("${opts.basePathVar} must be defined when using basePathVar.");
42
42
  static if (!${opts.basePathVar}.endsWith("/")) throw new Error("${opts.basePathVar} must end with a '/' when using basePathVar.");
43
43
  ` : ""}${opts.runtimeId ? `$ out.global.runtimeId = ${JSON.stringify(opts.runtimeId)};
44
- ` : ""}$ (out.global.___viteEntries || (out.global.___viteEntries = [])).push(${opts.entryData});
44
+ $ out.global.___viteBaseVar = ${JSON.stringify(
45
+ "$mbp_" + opts.runtimeId
46
+ )};
47
+ ` : `$ out.global.___viteBaseVar = "$mbp";
48
+ `}$ (out.global.___viteEntries || (out.global.___viteEntries = [])).push(${opts.entryData});
45
49
  <_vite${base} slot="head-prepend"/>
46
50
  <_vite${base} slot="head"/>
47
51
  <_vite${base} slot="body-prepend"/>
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  server_entry_template_default
3
- } from "./chunk-U7T7RXXE.mjs";
3
+ } from "./chunk-6IJ5UJ3N.mjs";
4
4
  export {
5
5
  server_entry_template_default as default
6
6
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
3
  "description": "A Marko plugin for Vite",
4
- "version": "2.4.0",
4
+ "version": "2.4.1",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {
@@ -34,7 +34,7 @@
34
34
  "lint-staged": "^13.1.0",
35
35
  "marko": "^5.22.0",
36
36
  "mocha": "^10.2.0",
37
- "mocha-snap": "^4.3.0",
37
+ "mocha-snap": "^5.0.0",
38
38
  "nyc": "^15.1.0",
39
39
  "playwright": "^1.29.1",
40
40
  "prettier": "^2.8.1",