vite-plugin-dts 0.9.8 → 0.9.9
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.js +26 -6
- package/dist/index.mjs +26 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -141214,21 +141214,36 @@ init_cjs_shims();
|
|
|
141214
141214
|
var exportDefaultRE = /export\s+default/;
|
|
141215
141215
|
var exportDefaultClassRE = /(?:(?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
|
|
141216
141216
|
var index = 1;
|
|
141217
|
+
var compileRoot = null;
|
|
141217
141218
|
var compiler;
|
|
141218
141219
|
function requireCompiler() {
|
|
141219
141220
|
if (!compiler) {
|
|
141220
|
-
|
|
141221
|
-
|
|
141222
|
-
|
|
141221
|
+
if (compileRoot) {
|
|
141222
|
+
try {
|
|
141223
|
+
compiler = require(require.resolve("vue/compiler-sfc", { paths: [compileRoot] }));
|
|
141224
|
+
} catch (e) {
|
|
141225
|
+
}
|
|
141226
|
+
}
|
|
141227
|
+
if (!compiler) {
|
|
141223
141228
|
try {
|
|
141224
|
-
compiler =
|
|
141225
|
-
} catch (
|
|
141226
|
-
|
|
141229
|
+
compiler = require_compiler_sfc();
|
|
141230
|
+
} catch (e) {
|
|
141231
|
+
try {
|
|
141232
|
+
compiler = require("@vue/compiler-sfc");
|
|
141233
|
+
} catch (e2) {
|
|
141234
|
+
throw new Error("@vue/compiler-sfc is not present in the dependency tree.\n");
|
|
141235
|
+
}
|
|
141227
141236
|
}
|
|
141228
141237
|
}
|
|
141229
141238
|
}
|
|
141230
141239
|
return compiler;
|
|
141231
141240
|
}
|
|
141241
|
+
function setCompileRoot(root) {
|
|
141242
|
+
if (root && root !== compileRoot) {
|
|
141243
|
+
compileRoot = root;
|
|
141244
|
+
compiler = null;
|
|
141245
|
+
}
|
|
141246
|
+
}
|
|
141232
141247
|
function compileVueCode(code) {
|
|
141233
141248
|
const { parse, compileScript, rewriteDefault } = requireCompiler();
|
|
141234
141249
|
const { descriptor } = parse(code);
|
|
@@ -141263,6 +141278,7 @@ const _sfc_main = ${classMatch[1]}`;
|
|
|
141263
141278
|
|
|
141264
141279
|
// src/plugin.ts
|
|
141265
141280
|
var noneExport = "export {};\n";
|
|
141281
|
+
var virtualPrefix = "\0";
|
|
141266
141282
|
var vueRE = /\.vue$/;
|
|
141267
141283
|
var tsRE = /\.tsx?$/;
|
|
141268
141284
|
var jsRE = /\.jsx?$/;
|
|
@@ -141336,6 +141352,7 @@ ${import_chalk.default.cyan("[vite:dts]")} Can not resolve declaration directory
|
|
|
141336
141352
|
`));
|
|
141337
141353
|
return;
|
|
141338
141354
|
}
|
|
141355
|
+
setCompileRoot(root);
|
|
141339
141356
|
compilerOptions.rootDir || (compilerOptions.rootDir = root);
|
|
141340
141357
|
project = new import_ts_morph.Project({
|
|
141341
141358
|
compilerOptions: mergeObjects(compilerOptions, {
|
|
@@ -141358,6 +141375,9 @@ ${import_chalk.default.cyan("[vite:dts]")} Can not resolve declaration directory
|
|
|
141358
141375
|
}
|
|
141359
141376
|
},
|
|
141360
141377
|
transform(code, id) {
|
|
141378
|
+
if (id.startsWith(virtualPrefix)) {
|
|
141379
|
+
return null;
|
|
141380
|
+
}
|
|
141361
141381
|
if (vueRE.test(id)) {
|
|
141362
141382
|
const { content, ext } = compileVueCode(code);
|
|
141363
141383
|
if (content) {
|
package/dist/index.mjs
CHANGED
|
@@ -141165,21 +141165,36 @@ function transferSetupPosition(content) {
|
|
|
141165
141165
|
var exportDefaultRE = /export\s+default/;
|
|
141166
141166
|
var exportDefaultClassRE = /(?:(?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/;
|
|
141167
141167
|
var index = 1;
|
|
141168
|
+
var compileRoot = null;
|
|
141168
141169
|
var compiler;
|
|
141169
141170
|
function requireCompiler() {
|
|
141170
141171
|
if (!compiler) {
|
|
141171
|
-
|
|
141172
|
-
|
|
141173
|
-
|
|
141172
|
+
if (compileRoot) {
|
|
141173
|
+
try {
|
|
141174
|
+
compiler = __require(__require.resolve("vue/compiler-sfc", { paths: [compileRoot] }));
|
|
141175
|
+
} catch (e) {
|
|
141176
|
+
}
|
|
141177
|
+
}
|
|
141178
|
+
if (!compiler) {
|
|
141174
141179
|
try {
|
|
141175
|
-
compiler =
|
|
141176
|
-
} catch (
|
|
141177
|
-
|
|
141180
|
+
compiler = require_compiler_sfc();
|
|
141181
|
+
} catch (e) {
|
|
141182
|
+
try {
|
|
141183
|
+
compiler = __require("@vue/compiler-sfc");
|
|
141184
|
+
} catch (e2) {
|
|
141185
|
+
throw new Error("@vue/compiler-sfc is not present in the dependency tree.\n");
|
|
141186
|
+
}
|
|
141178
141187
|
}
|
|
141179
141188
|
}
|
|
141180
141189
|
}
|
|
141181
141190
|
return compiler;
|
|
141182
141191
|
}
|
|
141192
|
+
function setCompileRoot(root) {
|
|
141193
|
+
if (root && root !== compileRoot) {
|
|
141194
|
+
compileRoot = root;
|
|
141195
|
+
compiler = null;
|
|
141196
|
+
}
|
|
141197
|
+
}
|
|
141183
141198
|
function compileVueCode(code) {
|
|
141184
141199
|
const { parse, compileScript, rewriteDefault } = requireCompiler();
|
|
141185
141200
|
const { descriptor } = parse(code);
|
|
@@ -141214,6 +141229,7 @@ const _sfc_main = ${classMatch[1]}`;
|
|
|
141214
141229
|
|
|
141215
141230
|
// src/plugin.ts
|
|
141216
141231
|
var noneExport = "export {};\n";
|
|
141232
|
+
var virtualPrefix = "\0";
|
|
141217
141233
|
var vueRE = /\.vue$/;
|
|
141218
141234
|
var tsRE = /\.tsx?$/;
|
|
141219
141235
|
var jsRE = /\.jsx?$/;
|
|
@@ -141287,6 +141303,7 @@ ${import_chalk.default.cyan("[vite:dts]")} Can not resolve declaration directory
|
|
|
141287
141303
|
`));
|
|
141288
141304
|
return;
|
|
141289
141305
|
}
|
|
141306
|
+
setCompileRoot(root);
|
|
141290
141307
|
compilerOptions.rootDir || (compilerOptions.rootDir = root);
|
|
141291
141308
|
project = new Project({
|
|
141292
141309
|
compilerOptions: mergeObjects(compilerOptions, {
|
|
@@ -141309,6 +141326,9 @@ ${import_chalk.default.cyan("[vite:dts]")} Can not resolve declaration directory
|
|
|
141309
141326
|
}
|
|
141310
141327
|
},
|
|
141311
141328
|
transform(code, id) {
|
|
141329
|
+
if (id.startsWith(virtualPrefix)) {
|
|
141330
|
+
return null;
|
|
141331
|
+
}
|
|
141312
141332
|
if (vueRE.test(id)) {
|
|
141313
141333
|
const { content, ext } = compileVueCode(code);
|
|
141314
141334
|
if (content) {
|
package/package.json
CHANGED