rolldown-plugin-dts 0.27.8 → 0.27.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.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as __require } from "./rolldown-runtime-CMgrfpPY.mjs";
|
|
1
2
|
import { a as RE_JSON, c as RE_TS, d as filename_js_to_dts, f as filename_to_dts, i as RE_JS, l as RE_VUE, m as resolveTemplateFn, n as RE_DTS, o as RE_NODE_MODULES, p as replaceTemplateName, r as RE_DTS_MAP, s as RE_ROLLDOWN_RUNTIME, t as RE_CSS, u as filename_dts_to } from "./filename-BR9JpwkC.mjs";
|
|
2
3
|
import { createContext, globalContext, invalidateContextFile } from "./tsc-context.mjs";
|
|
3
4
|
import { createRequire } from "node:module";
|
|
@@ -765,20 +766,14 @@ function getIdentifierIndex(identifierMap, name) {
|
|
|
765
766
|
}
|
|
766
767
|
//#endregion
|
|
767
768
|
//#region src/tsgo.ts
|
|
768
|
-
const require = createRequire(import.meta.url);
|
|
769
|
+
const require$1 = createRequire(import.meta.url);
|
|
769
770
|
const debug$4 = createDebug("rolldown-plugin-dts:tsgo");
|
|
770
|
-
function
|
|
771
|
+
function isTS70Installed() {
|
|
771
772
|
try {
|
|
772
|
-
const {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
function isTS7Installed() {
|
|
780
|
-
const major = getTypeScriptMajor();
|
|
781
|
-
return major != null && major >= 7;
|
|
773
|
+
const { versionMajorMinor } = require$1("typescript");
|
|
774
|
+
return versionMajorMinor === "7.0";
|
|
775
|
+
} catch {}
|
|
776
|
+
return false;
|
|
782
777
|
}
|
|
783
778
|
const spawnAsync = (...args) => new Promise((resolve, reject) => {
|
|
784
779
|
const child = spawn(...args);
|
|
@@ -788,7 +783,7 @@ const spawnAsync = (...args) => new Promise((resolve, reject) => {
|
|
|
788
783
|
let tsgoPathCache;
|
|
789
784
|
async function getTsgoPathFromNodeModules(logger) {
|
|
790
785
|
if (tsgoPathCache) return tsgoPathCache;
|
|
791
|
-
const pkgName =
|
|
786
|
+
const pkgName = isTS70Installed() ? "typescript" : "@typescript/native-preview";
|
|
792
787
|
const tsgoPkg = import.meta.resolve(`${pkgName}/package.json`);
|
|
793
788
|
const { default: { version } } = await import(tsgoPkg, { with: { type: "json" } });
|
|
794
789
|
logger.info(`Emit types with ${styleText("underline", `${pkgName}@${version}`)}`);
|
|
@@ -812,7 +807,8 @@ async function runTsgo(logger, rootDir, tsconfig, sourcemap, tsgoPath) {
|
|
|
812
807
|
"false",
|
|
813
808
|
"--declaration",
|
|
814
809
|
"--emitDeclarationOnly",
|
|
815
|
-
|
|
810
|
+
"-p",
|
|
811
|
+
tsconfig,
|
|
816
812
|
"--outDir",
|
|
817
813
|
tsgoDist,
|
|
818
814
|
"--rootDir",
|
|
@@ -1135,11 +1131,27 @@ function resolveOptions({ generator, entry, cwd = process.cwd(), dtsInput = fals
|
|
|
1135
1131
|
...overriddenTsconfigRaw,
|
|
1136
1132
|
compilerOptions
|
|
1137
1133
|
};
|
|
1138
|
-
if (
|
|
1139
|
-
|
|
1134
|
+
if (vue || tsMacro) {
|
|
1135
|
+
if (isTS70Installed()) throw new Error("TypeScript 7.0 does not yet have a stable API and is experimental. The `vue` and `tsMacro` options are not yet supported with TypeScript 7.0.");
|
|
1136
|
+
if (generator && generator !== "tsc") logger.warn("The `vue` and `tsMacro` options are enabled, which requires the `tsc` generator. The `generator` option is ignored.");
|
|
1137
|
+
generator = "tsc";
|
|
1138
|
+
}
|
|
1139
|
+
if (!generator) if (tsgo) generator = "tsgo";
|
|
1140
1140
|
else if (oxc || compilerOptions?.isolatedDeclarations) generator = "oxc";
|
|
1141
|
-
else if (
|
|
1141
|
+
else if (isTS70Installed()) generator = "tsgo";
|
|
1142
1142
|
else generator = "tsc";
|
|
1143
|
+
if (generator === "tsc") try {
|
|
1144
|
+
__require.resolve("typescript");
|
|
1145
|
+
} catch {
|
|
1146
|
+
throw new Error("TypeScript is not installed. You can install `typescript` package, or enable `isolatedDeclarations` in your `tsconfig.json` to use Oxc instead.");
|
|
1147
|
+
}
|
|
1148
|
+
else if (generator === "tsgo") {
|
|
1149
|
+
if (!tsconfig) throw new Error("tsgo generator requires a tsconfig file to be specified.");
|
|
1150
|
+
if (!warnedTsgo) {
|
|
1151
|
+
warnedTsgo = true;
|
|
1152
|
+
logger.warn("TypeScript 7.0 does not yet have a stable API and is experimental. Some options will be unavailable.");
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1143
1155
|
if (oxc === true || !oxc) oxc = {};
|
|
1144
1156
|
if (oxc) {
|
|
1145
1157
|
oxc.stripInternal ??= !!compilerOptions?.stripInternal;
|
|
@@ -1147,10 +1159,6 @@ function resolveOptions({ generator, entry, cwd = process.cwd(), dtsInput = fals
|
|
|
1147
1159
|
}
|
|
1148
1160
|
if (tsgo === true || !tsgo) tsgo = {};
|
|
1149
1161
|
emitJs ??= !!(compilerOptions.checkJs || compilerOptions.allowJs);
|
|
1150
|
-
if (generator === "tsgo" && !warnedTsgo) {
|
|
1151
|
-
logger.warn("TypeScript 7.0 does not yet have a stable API and is experimental. Some options will be unavailable.");
|
|
1152
|
-
warnedTsgo = true;
|
|
1153
|
-
}
|
|
1154
1162
|
const resolved = {
|
|
1155
1163
|
generator,
|
|
1156
1164
|
entry: entry ? Array.isArray(entry) ? entry : [entry] : void 0,
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
+
import { t as __require } from "./rolldown-runtime-CMgrfpPY.mjs";
|
|
3
4
|
import { n as RE_DTS, r as RE_DTS_MAP } from "./filename-BR9JpwkC.mjs";
|
|
4
5
|
import { globalContext } from "./tsc-context.mjs";
|
|
5
|
-
import { createRequire } from "node:module";
|
|
6
6
|
import { createDebug } from "obug";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
const ts = __cjs_require("typescript");
|
|
9
9
|
import { pathToFileURL } from "node:url";
|
|
10
|
-
//#region \0rolldown/runtime.js
|
|
11
|
-
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
12
|
-
//#endregion
|
|
13
10
|
//#region src/tsc/system.ts
|
|
14
11
|
const debug$4 = createDebug("rolldown-plugin-dts:tsc-system");
|
|
15
12
|
/**
|
package/dist/tsc-worker.mjs
CHANGED
package/dist/tsc.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as tscEmit } from "./tsc-
|
|
1
|
+
import { t as tscEmit } from "./tsc-BVghLPtc.mjs";
|
|
2
2
|
export { tscEmit };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-plugin-dts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.9",
|
|
5
5
|
"description": "A Rolldown plugin to generate and bundle dts files.",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@ts-macro/tsc": "^0.3.6",
|
|
45
|
-
"@typescript/native-preview": "
|
|
45
|
+
"@typescript/native-preview": "*",
|
|
46
46
|
"rolldown": "^1.0.0",
|
|
47
|
-
"typescript": "^5.0.0 || ^6.0.0 ||
|
|
47
|
+
"typescript": "^5.0.0 || ^6.0.0 || ~7.0.0",
|
|
48
48
|
"vue-tsc": "~3.2.0 || ~3.3.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|