@vixt/core 0.1.29 → 0.1.30
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.mjs +32 -29
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -200,17 +200,7 @@ const config = defineVixtModule({
|
|
|
200
200
|
function generateTsConfig(options, vixt) {
|
|
201
201
|
const { buildDir } = vixt.options;
|
|
202
202
|
const codePath = path.resolve(buildDir, "tsconfig.json");
|
|
203
|
-
const
|
|
204
|
-
const layersAlias = {};
|
|
205
|
-
for (const layer of vixt._layers) {
|
|
206
|
-
layersDirs.push(layer.cwd);
|
|
207
|
-
if (layer.meta?.alias) {
|
|
208
|
-
const layerRelativePath = `./${path.relative(buildDir, layer.cwd)}/*`;
|
|
209
|
-
layersAlias[`${layer.meta.alias}/*`] = [layerRelativePath];
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
const tsConfig = defu(options.tsConfig, { compilerOptions: { paths: layersAlias }, include: layersDirs });
|
|
213
|
-
const code = JSON.stringify(tsConfig, null, 2);
|
|
203
|
+
const code = JSON.stringify(options.tsConfig, null, 2);
|
|
214
204
|
fs.outputFileSync(codePath, code);
|
|
215
205
|
}
|
|
216
206
|
function generateVixtDts(options, vixt) {
|
|
@@ -271,26 +261,39 @@ interface ImportMetaEnv {
|
|
|
271
261
|
fs.outputFileSync(codePath, code);
|
|
272
262
|
}
|
|
273
263
|
const name = "vixt:typescript";
|
|
274
|
-
const defaults = {
|
|
275
|
-
tsConfig: {
|
|
276
|
-
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
277
|
-
compilerOptions: {
|
|
278
|
-
paths: {
|
|
279
|
-
"@/*": ["../src/*"],
|
|
280
|
-
"~/*": ["../src/*"],
|
|
281
|
-
"#/*": ["./*"]
|
|
282
|
-
},
|
|
283
|
-
types: ["vite/client"]
|
|
284
|
-
},
|
|
285
|
-
include: [
|
|
286
|
-
"./**/*"
|
|
287
|
-
]
|
|
288
|
-
},
|
|
289
|
-
typeCheck: { enableBuild: false, overlay: { initialIsOpen: false } }
|
|
290
|
-
};
|
|
291
264
|
const typescript = defineVixtModule({
|
|
292
265
|
meta: { name, configKey: "typescript" },
|
|
293
|
-
defaults
|
|
266
|
+
defaults(vixt) {
|
|
267
|
+
const { rootDir, srcDir } = vixt.options;
|
|
268
|
+
const rootAlias = {};
|
|
269
|
+
if (rootDir)
|
|
270
|
+
rootAlias["@@/*"] = rootAlias["~~/*"] = [`${rootDir}/*`];
|
|
271
|
+
const srcAlias = {};
|
|
272
|
+
if (srcDir)
|
|
273
|
+
srcAlias["@/*"] = srcAlias["~/*"] = [`${srcDir}/*`];
|
|
274
|
+
const layersDirs = [];
|
|
275
|
+
const layersAlias = {};
|
|
276
|
+
for (const layer of vixt._layers) {
|
|
277
|
+
layersDirs.push(layer.cwd);
|
|
278
|
+
if (layer.meta?.alias)
|
|
279
|
+
layersAlias[`${layer.meta.alias}/*`] = [`${layer.cwd}/*`];
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
tsConfig: {
|
|
283
|
+
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
284
|
+
compilerOptions: {
|
|
285
|
+
baseUrl: rootDir,
|
|
286
|
+
paths: { "#/*": ["./*"], ...layersAlias, ...rootAlias, ...srcAlias },
|
|
287
|
+
types: ["vite/client"]
|
|
288
|
+
},
|
|
289
|
+
include: ["./**/*", ...layersDirs]
|
|
290
|
+
},
|
|
291
|
+
typeCheck: {
|
|
292
|
+
enableBuild: false,
|
|
293
|
+
overlay: { initialIsOpen: false }
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
},
|
|
294
297
|
setup(options, vixt) {
|
|
295
298
|
return [
|
|
296
299
|
{
|