vite-plugin-lib 1.4.0 → 1.5.0

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.cjs CHANGED
@@ -66,15 +66,21 @@ async function createMTSImports(file) {
66
66
  await promises.writeFile(targetFile, modified.join("\n"));
67
67
  }
68
68
  function transformLine(line) {
69
- const isStaticImport = line.includes("import ") && line.includes(`from '.`);
70
- if (isStaticImport) {
71
- return `${line.substring(0, line.length - 2)}.d.mts';`;
69
+ return transformStaticImport(line, "'") ?? transformStaticImport(line, '"') ?? transformExport(line, "'") ?? transformExport(line, '"') ?? line;
70
+ }
71
+ function transformStaticImport(line, quote) {
72
+ const isStaticImport = line.includes("import ") && line.includes(`from ${quote}.`);
73
+ if (!isStaticImport) {
74
+ return void 0;
72
75
  }
73
- const isStaticExport = line.includes("export ") && line.includes(` from '.`);
74
- if (isStaticExport) {
75
- return `${line.substring(0, line.length - 2)}.mjs';`;
76
+ return `${line.substring(0, line.length - 2)}.mjs${quote};`;
77
+ }
78
+ function transformExport(line, quote) {
79
+ const isStaticExport = line.includes("export ") && line.includes(` from ${quote}.`);
80
+ if (!isStaticExport) {
81
+ return void 0;
76
82
  }
77
- return line;
83
+ return `${line.substring(0, line.length - 2)}.mjs${quote};`;
78
84
  }
79
85
 
80
86
  const typesDir = "dist/types";
package/dist/index.mjs CHANGED
@@ -46,15 +46,21 @@ async function createMTSImports(file) {
46
46
  await writeFile(targetFile, modified.join("\n"));
47
47
  }
48
48
  function transformLine(line) {
49
- const isStaticImport = line.includes("import ") && line.includes(`from '.`);
50
- if (isStaticImport) {
51
- return `${line.substring(0, line.length - 2)}.d.mts';`;
49
+ return transformStaticImport(line, "'") ?? transformStaticImport(line, '"') ?? transformExport(line, "'") ?? transformExport(line, '"') ?? line;
50
+ }
51
+ function transformStaticImport(line, quote) {
52
+ const isStaticImport = line.includes("import ") && line.includes(`from ${quote}.`);
53
+ if (!isStaticImport) {
54
+ return void 0;
52
55
  }
53
- const isStaticExport = line.includes("export ") && line.includes(` from '.`);
54
- if (isStaticExport) {
55
- return `${line.substring(0, line.length - 2)}.mjs';`;
56
+ return `${line.substring(0, line.length - 2)}.mjs${quote};`;
57
+ }
58
+ function transformExport(line, quote) {
59
+ const isStaticExport = line.includes("export ") && line.includes(` from ${quote}.`);
60
+ if (!isStaticExport) {
61
+ return void 0;
56
62
  }
57
- return line;
63
+ return `${line.substring(0, line.length - 2)}.mjs${quote};`;
58
64
  }
59
65
 
60
66
  const typesDir = "dist/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-lib",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Vite plugin for build configuration, automatic aliases, and type declarations.",
5
5
  "author": "Jan Müller <janmueller3698@gmail.com>",
6
6
  "license": "MIT",