vite-plugin-lib 1.0.0 → 1.0.1
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 +17 -8
- package/dist/index.mjs +17 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,9 @@ const dts__namespace = /*#__PURE__*/_interopNamespaceDefault(dts);
|
|
|
23
23
|
function log(text) {
|
|
24
24
|
console.log(`${c.cyan("[vite:lib]")} ${text}`);
|
|
25
25
|
}
|
|
26
|
+
function logError(text) {
|
|
27
|
+
console.error(`${c.red("[vite:lib]")} ${text}`);
|
|
28
|
+
}
|
|
26
29
|
const tsconfigPaths = ({ verbose } = {}) => {
|
|
27
30
|
return {
|
|
28
31
|
name: "vite-plugin-lib:alias",
|
|
@@ -136,14 +139,20 @@ function transformExistingAlias(alias) {
|
|
|
136
139
|
}));
|
|
137
140
|
}
|
|
138
141
|
async function readConfig(configPath) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
try {
|
|
143
|
+
const configFileText = await promises.readFile(configPath, { encoding: "utf-8" });
|
|
144
|
+
const { config } = typescript.parseConfigFileTextToJson(configPath, configFileText);
|
|
145
|
+
const { options } = typescript.parseJsonConfigFileContent(
|
|
146
|
+
config,
|
|
147
|
+
typescript.sys,
|
|
148
|
+
path.dirname(configPath)
|
|
149
|
+
);
|
|
150
|
+
return options;
|
|
151
|
+
} catch (error) {
|
|
152
|
+
const message = "message" in error ? error.message : error;
|
|
153
|
+
logError(`Could not read tsconfig.json: ${message}.`);
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
147
156
|
}
|
|
148
157
|
|
|
149
158
|
exports.dts = dts__namespace;
|
package/dist/index.mjs
CHANGED
|
@@ -10,6 +10,9 @@ export { dts };
|
|
|
10
10
|
function log(text) {
|
|
11
11
|
console.log(`${c.cyan("[vite:lib]")} ${text}`);
|
|
12
12
|
}
|
|
13
|
+
function logError(text) {
|
|
14
|
+
console.error(`${c.red("[vite:lib]")} ${text}`);
|
|
15
|
+
}
|
|
13
16
|
const tsconfigPaths = ({ verbose } = {}) => {
|
|
14
17
|
return {
|
|
15
18
|
name: "vite-plugin-lib:alias",
|
|
@@ -123,14 +126,20 @@ function transformExistingAlias(alias) {
|
|
|
123
126
|
}));
|
|
124
127
|
}
|
|
125
128
|
async function readConfig(configPath) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
try {
|
|
130
|
+
const configFileText = await readFile(configPath, { encoding: "utf-8" });
|
|
131
|
+
const { config } = parseConfigFileTextToJson(configPath, configFileText);
|
|
132
|
+
const { options } = parseJsonConfigFileContent(
|
|
133
|
+
config,
|
|
134
|
+
sys,
|
|
135
|
+
path.dirname(configPath)
|
|
136
|
+
);
|
|
137
|
+
return options;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
const message = "message" in error ? error.message : error;
|
|
140
|
+
logError(`Could not read tsconfig.json: ${message}.`);
|
|
141
|
+
return {};
|
|
142
|
+
}
|
|
134
143
|
}
|
|
135
144
|
|
|
136
145
|
export { library, tsconfigPaths };
|
package/package.json
CHANGED