@marko/vite 2.2.9 → 2.2.12

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.
@@ -1,11 +1,11 @@
1
- static function renderAssets(out, slot) {
1
+ static function renderAssets(slot) {
2
2
  const entries = this.___viteEntries;
3
+ let html = "";
3
4
 
4
5
  if (entries) {
5
6
  const slotWrittenEntriesKey = `___viteWrittenEntries-${slot}`;
6
7
  const lastWrittenEntry = this[slotWrittenEntriesKey] || 0;
7
8
  const writtenEntries = this[slotWrittenEntriesKey] = entries.length;
8
- let html = "";
9
9
 
10
10
  for (let i = lastWrittenEntry; i < writtenEntries; i++) {
11
11
  const slotParts = entries[i][slot];
@@ -15,9 +15,9 @@ static function renderAssets(out, slot) {
15
15
  html += slotHtml;
16
16
  }
17
17
  }
18
-
19
- out.write(html);
20
18
  }
19
+
20
+ return html;
21
21
  }
22
22
 
23
23
  $ const $global = out.global;
@@ -27,5 +27,5 @@ $ if (!$global.___viteRenderAssets) {
27
27
  }
28
28
 
29
29
  <__flush_here_and_after__>
30
- $ $global.___viteRenderAssets(out, input.slot);
30
+ $!{$global.___viteRenderAssets(input.slot)}
31
31
  </>
@@ -1,11 +1,11 @@
1
- static function renderAssets(out, slot) {
1
+ static function renderAssets(slot) {
2
2
  const entries = this.___viteEntries;
3
+ let html = "";
3
4
 
4
5
  if (entries) {
5
6
  const slotWrittenEntriesKey = `___viteWrittenEntries-${slot}`;
6
7
  const lastWrittenEntry = this[slotWrittenEntriesKey] || 0;
7
8
  const writtenEntries = this[slotWrittenEntriesKey] = entries.length;
8
- let html = "";
9
9
 
10
10
  for (let i = lastWrittenEntry; i < writtenEntries; i++) {
11
11
  const manifest = __MARKO_MANIFEST__[entries[i]];
@@ -15,9 +15,9 @@ static function renderAssets(out, slot) {
15
15
  html += slotHtml;
16
16
  }
17
17
  }
18
-
19
- out.write(html);
20
18
  }
19
+
20
+ return html;
21
21
  }
22
22
 
23
23
  $ const $global = out.global;
@@ -27,5 +27,5 @@ $ if (!$global.___viteRenderAssets) {
27
27
  }
28
28
 
29
29
  <__flush_here_and_after__>
30
- $ $global.___viteRenderAssets(out, input.slot);
30
+ $!{$global.___viteRenderAssets(input.slot)};
31
31
  </>
package/dist/index.js CHANGED
@@ -259,7 +259,7 @@ function markoPlugin(opts = {}) {
259
259
  if (isBuild) {
260
260
  return html;
261
261
  }
262
- return html.replace(/src\s*=\s*(['"])(\\.|(?!\1).)*\.marko\1/gim, (m) => m.slice(0, -1) + browserEntryQuery + m.slice(-1));
262
+ return html.replace(/(src\s*=\s*(['"])(?:(?!\2).)*\.marko)(?:\?((?:(?!\2).)*))?\2/gim, (_, prefix, quote, query) => prefix + browserEntryQuery + (query ? "&" + query : "") + quote);
263
263
  },
264
264
  async transform(source, id, ssr) {
265
265
  const query = getMarkoQuery(id);
@@ -328,8 +328,12 @@ if (import.meta.hot) import.meta.hot.accept();`;
328
328
  const browserManifest = {};
329
329
  for (const entryId in serverManifest.entries) {
330
330
  const fileName = serverManifest.entries[entryId];
331
- const chunkId = fileName + htmlExt;
332
- const chunk = bundle[chunkId];
331
+ let chunkId = fileName + htmlExt;
332
+ let chunk = bundle[chunkId];
333
+ if (!chunk) {
334
+ chunkId = chunkId.replace(/\//g, "\\");
335
+ chunk = bundle[chunkId];
336
+ }
333
337
  if ((chunk == null ? void 0 : chunk.type) === "asset") {
334
338
  browserManifest[entryId] = await (0, import_manifest_generator.generateDocManifest)(chunk.source.toString());
335
339
  delete bundle[chunkId];
package/dist/index.mjs CHANGED
@@ -222,7 +222,7 @@ function markoPlugin(opts = {}) {
222
222
  if (isBuild) {
223
223
  return html;
224
224
  }
225
- return html.replace(/src\s*=\s*(['"])(\\.|(?!\1).)*\.marko\1/gim, (m) => m.slice(0, -1) + browserEntryQuery + m.slice(-1));
225
+ return html.replace(/(src\s*=\s*(['"])(?:(?!\2).)*\.marko)(?:\?((?:(?!\2).)*))?\2/gim, (_, prefix, quote, query) => prefix + browserEntryQuery + (query ? "&" + query : "") + quote);
226
226
  },
227
227
  async transform(source, id, ssr) {
228
228
  const query = getMarkoQuery(id);
@@ -291,8 +291,12 @@ if (import.meta.hot) import.meta.hot.accept();`;
291
291
  const browserManifest = {};
292
292
  for (const entryId in serverManifest.entries) {
293
293
  const fileName = serverManifest.entries[entryId];
294
- const chunkId = fileName + htmlExt;
295
- const chunk = bundle[chunkId];
294
+ let chunkId = fileName + htmlExt;
295
+ let chunk = bundle[chunkId];
296
+ if (!chunk) {
297
+ chunkId = chunkId.replace(/\//g, "\\");
298
+ chunk = bundle[chunkId];
299
+ }
296
300
  if ((chunk == null ? void 0 : chunk.type) === "asset") {
297
301
  browserManifest[entryId] = await generateDocManifest(chunk.source.toString());
298
302
  delete bundle[chunkId];
@@ -31,7 +31,7 @@ var render_assets_transform_default = (tag, t) => {
31
31
  body.pushContainer("body", renderAssetsCall(t, tagName));
32
32
  };
33
33
  function renderAssetsCall(t, slot) {
34
- return t.expressionStatement(t.callExpression(t.memberExpression(t.memberExpression(t.identifier("out"), t.identifier("global")), t.identifier("___viteRenderAssets")), [t.identifier("out"), t.stringLiteral(slot)]));
34
+ return t.markoPlaceholder(t.callExpression(t.memberExpression(t.memberExpression(t.identifier("out"), t.identifier("global")), t.identifier("___viteRenderAssets")), [t.stringLiteral(slot)]), false);
35
35
  }
36
36
  module.exports = __toCommonJS(render_assets_transform_exports);
37
37
  // Annotate the CommonJS export names for ESM import in node:
@@ -8,7 +8,7 @@ var render_assets_transform_default = (tag, t) => {
8
8
  body.pushContainer("body", renderAssetsCall(t, tagName));
9
9
  };
10
10
  function renderAssetsCall(t, slot) {
11
- return t.expressionStatement(t.callExpression(t.memberExpression(t.memberExpression(t.identifier("out"), t.identifier("global")), t.identifier("___viteRenderAssets")), [t.identifier("out"), t.stringLiteral(slot)]));
11
+ return t.markoPlaceholder(t.callExpression(t.memberExpression(t.memberExpression(t.identifier("out"), t.identifier("global")), t.identifier("___viteRenderAssets")), [t.stringLiteral(slot)]), false);
12
12
  }
13
13
  export {
14
14
  render_assets_transform_default as default
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.2.9",
4
+ "version": "2.2.12",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {