@marko/vite 2.2.8 → 2.2.11

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.js CHANGED
@@ -134,30 +134,28 @@ function markoPlugin(opts = {}) {
134
134
  "<body>": { transformer }
135
135
  });
136
136
  }
137
- if (!isBuild) {
138
- const lookup = compiler.taglib.buildLookup(root);
139
- const domRuntimeDeps = compiler.getRuntimeEntryFiles("dom", opts.translator);
140
- const htmlRuntimeDeps = compiler.getRuntimeEntryFiles("html", opts.translator);
141
- const taglibDeps = [];
142
- for (const name in lookup.taglibsById) {
143
- const taglib = lookup.taglibsById[name];
144
- if (/[\\/]node_modules[\\/](?!@marko[\\/])/.test(taglib.dirname)) {
145
- for (const tagName in taglib.tags) {
146
- const tag = taglib.tags[tagName];
147
- const entry = tag.template || tag.renderer;
148
- if (entry) {
149
- taglibDeps.push(entry.replace(/^.*?[\\/]node_modules[\\/]/, ""));
150
- }
137
+ const lookup = compiler.taglib.buildLookup(root);
138
+ const taglibDeps = [];
139
+ for (const name in lookup.taglibsById) {
140
+ const taglib = lookup.taglibsById[name];
141
+ if (/[\\/]node_modules[\\/](?!@marko[\\/])/.test(taglib.dirname)) {
142
+ for (const tagName in taglib.tags) {
143
+ const tag = taglib.tags[tagName];
144
+ const entry = tag.template || tag.renderer;
145
+ if (entry) {
146
+ taglibDeps.push(entry.replace(/^.*?[\\/]node_modules[\\/]/, ""));
151
147
  }
152
148
  }
153
149
  }
154
- const domDeps = Array.from(new Set(domRuntimeDeps.concat(taglibDeps)));
155
- const serverDeps = Array.from(new Set(htmlRuntimeDeps.concat(taglibDeps)));
156
- const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
157
- optimizeDeps.include ?? (optimizeDeps.include = []);
158
- optimizeDeps.include = optimizeDeps.include.concat(domDeps.filter((dep) => import_path.default.extname(dep) !== markoExt));
159
- optimizeDeps.exclude ?? (optimizeDeps.exclude = []);
160
- optimizeDeps.exclude = optimizeDeps.exclude.concat(domDeps.filter((dep) => import_path.default.extname(dep) === markoExt));
150
+ }
151
+ const domDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("dom", opts.translator).concat(taglibDeps)));
152
+ const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
153
+ optimizeDeps.include ?? (optimizeDeps.include = []);
154
+ optimizeDeps.include = optimizeDeps.include.concat(domDeps.filter((dep) => import_path.default.extname(dep) !== markoExt));
155
+ optimizeDeps.exclude ?? (optimizeDeps.exclude = []);
156
+ optimizeDeps.exclude = optimizeDeps.exclude.concat(domDeps.filter((dep) => import_path.default.extname(dep) === markoExt));
157
+ if (!isBuild) {
158
+ const serverDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("html", opts.translator).concat(taglibDeps)));
161
159
  const ssr = config.ssr ?? (config.ssr = {});
162
160
  ssr.external ?? (ssr.external = []);
163
161
  ssr.external = ssr.external.concat(serverDeps);
@@ -261,7 +259,7 @@ function markoPlugin(opts = {}) {
261
259
  if (isBuild) {
262
260
  return html;
263
261
  }
264
- 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);
265
263
  },
266
264
  async transform(source, id, ssr) {
267
265
  const query = getMarkoQuery(id);
@@ -330,8 +328,12 @@ if (import.meta.hot) import.meta.hot.accept();`;
330
328
  const browserManifest = {};
331
329
  for (const entryId in serverManifest.entries) {
332
330
  const fileName = serverManifest.entries[entryId];
333
- const chunkId = fileName + htmlExt;
334
- 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
+ }
335
337
  if ((chunk == null ? void 0 : chunk.type) === "asset") {
336
338
  browserManifest[entryId] = await (0, import_manifest_generator.generateDocManifest)(chunk.source.toString());
337
339
  delete bundle[chunkId];
package/dist/index.mjs CHANGED
@@ -97,30 +97,28 @@ function markoPlugin(opts = {}) {
97
97
  "<body>": { transformer }
98
98
  });
99
99
  }
100
- if (!isBuild) {
101
- const lookup = compiler.taglib.buildLookup(root);
102
- const domRuntimeDeps = compiler.getRuntimeEntryFiles("dom", opts.translator);
103
- const htmlRuntimeDeps = compiler.getRuntimeEntryFiles("html", opts.translator);
104
- const taglibDeps = [];
105
- for (const name in lookup.taglibsById) {
106
- const taglib = lookup.taglibsById[name];
107
- if (/[\\/]node_modules[\\/](?!@marko[\\/])/.test(taglib.dirname)) {
108
- for (const tagName in taglib.tags) {
109
- const tag = taglib.tags[tagName];
110
- const entry = tag.template || tag.renderer;
111
- if (entry) {
112
- taglibDeps.push(entry.replace(/^.*?[\\/]node_modules[\\/]/, ""));
113
- }
100
+ const lookup = compiler.taglib.buildLookup(root);
101
+ const taglibDeps = [];
102
+ for (const name in lookup.taglibsById) {
103
+ const taglib = lookup.taglibsById[name];
104
+ if (/[\\/]node_modules[\\/](?!@marko[\\/])/.test(taglib.dirname)) {
105
+ for (const tagName in taglib.tags) {
106
+ const tag = taglib.tags[tagName];
107
+ const entry = tag.template || tag.renderer;
108
+ if (entry) {
109
+ taglibDeps.push(entry.replace(/^.*?[\\/]node_modules[\\/]/, ""));
114
110
  }
115
111
  }
116
112
  }
117
- const domDeps = Array.from(new Set(domRuntimeDeps.concat(taglibDeps)));
118
- const serverDeps = Array.from(new Set(htmlRuntimeDeps.concat(taglibDeps)));
119
- const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
120
- optimizeDeps.include ?? (optimizeDeps.include = []);
121
- optimizeDeps.include = optimizeDeps.include.concat(domDeps.filter((dep) => path.extname(dep) !== markoExt));
122
- optimizeDeps.exclude ?? (optimizeDeps.exclude = []);
123
- optimizeDeps.exclude = optimizeDeps.exclude.concat(domDeps.filter((dep) => path.extname(dep) === markoExt));
113
+ }
114
+ const domDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("dom", opts.translator).concat(taglibDeps)));
115
+ const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
116
+ optimizeDeps.include ?? (optimizeDeps.include = []);
117
+ optimizeDeps.include = optimizeDeps.include.concat(domDeps.filter((dep) => path.extname(dep) !== markoExt));
118
+ optimizeDeps.exclude ?? (optimizeDeps.exclude = []);
119
+ optimizeDeps.exclude = optimizeDeps.exclude.concat(domDeps.filter((dep) => path.extname(dep) === markoExt));
120
+ if (!isBuild) {
121
+ const serverDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("html", opts.translator).concat(taglibDeps)));
124
122
  const ssr = config.ssr ?? (config.ssr = {});
125
123
  ssr.external ?? (ssr.external = []);
126
124
  ssr.external = ssr.external.concat(serverDeps);
@@ -224,7 +222,7 @@ function markoPlugin(opts = {}) {
224
222
  if (isBuild) {
225
223
  return html;
226
224
  }
227
- 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);
228
226
  },
229
227
  async transform(source, id, ssr) {
230
228
  const query = getMarkoQuery(id);
@@ -293,8 +291,12 @@ if (import.meta.hot) import.meta.hot.accept();`;
293
291
  const browserManifest = {};
294
292
  for (const entryId in serverManifest.entries) {
295
293
  const fileName = serverManifest.entries[entryId];
296
- const chunkId = fileName + htmlExt;
297
- 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
+ }
298
300
  if ((chunk == null ? void 0 : chunk.type) === "asset") {
299
301
  browserManifest[entryId] = await generateDocManifest(chunk.source.toString());
300
302
  delete bundle[chunkId];
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.8",
4
+ "version": "2.2.11",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {