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 +13 -7
- package/dist/index.mjs +13 -7
- package/package.json +1 -1
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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