vite-plugin-inline-multipage 1.0.16 → 1.0.18

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
@@ -8,6 +8,5 @@ export interface InlineEverythingOptions {
8
8
  * If the plugin should remove the _app directory after inlining (default: true)
9
9
  */
10
10
  cleanUp?: boolean;
11
- remap?: Record<string, string>;
12
11
  }
13
12
  export default function inlineEverythingPlugin(options?: InlineEverythingOptions): Plugin;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import path from 'path';
3
3
  import fs from 'fs';
4
4
  import * as cheerio from 'cheerio';
5
5
  export default function inlineEverythingPlugin(options) {
6
- const { buildDir = 'build', cleanUp = false, remap = {} } = options || {};
6
+ const { buildDir = 'build', cleanUp = false } = options || {};
7
7
  return {
8
8
  name: 'inline-everything',
9
9
  apply: 'build',
@@ -24,7 +24,7 @@ export default function inlineEverythingPlugin(options) {
24
24
  for (const htmlFile of htmlFiles) {
25
25
  let html = fs.readFileSync(htmlFile, 'utf8');
26
26
  const load_html = cheerio.load(html);
27
- load_html('link[rel="stylesheet"]').each((_, el) => {
27
+ load_html('link[rel="stylesheet"]').each((i, el) => {
28
28
  const href = load_html(el).attr('href');
29
29
  if (href) {
30
30
  const filename = path.basename(href);
@@ -39,7 +39,7 @@ export default function inlineEverythingPlugin(options) {
39
39
  }
40
40
  }
41
41
  });
42
- load_html('script[type="module"][src]').each((_, el) => {
42
+ load_html('script[type="module"][src]').each((i, el) => {
43
43
  const src = load_html(el).attr('src');
44
44
  if (src) {
45
45
  const filename = path.basename(src);
@@ -57,16 +57,7 @@ export default function inlineEverythingPlugin(options) {
57
57
  load_html('link[rel="modulepreload"]').remove();
58
58
  load_html('link[rel="preload"]').remove();
59
59
  load_html('script[data-sveltekit-hydrate]').remove();
60
- const originalName = path.basename(htmlFile, '.html');
61
- const targetName = remap[originalName];
62
- if (targetName) {
63
- const newPath = path.join(path.dirname(htmlFile), targetName);
64
- fs.writeFileSync(newPath, load_html.html());
65
- fs.rmSync(htmlFile);
66
- }
67
- else {
68
- fs.writeFileSync(htmlFile, load_html.html());
69
- }
60
+ fs.writeFileSync(htmlFile, load_html.html());
70
61
  }
71
62
  if (cleanUp) {
72
63
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-inline-multipage",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "A Vite plugin that inlines multi-paged applications (like in svelte) to multiple html files",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",