@voidzero-dev/vite-plus-core 0.2.5 → 0.2.7
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/LICENSE +31 -7
- package/dist/rolldown/cli.d.mts +1 -1
- package/dist/rolldown/cli.mjs +6 -6
- package/dist/rolldown/config.d.mts +16 -17
- package/dist/rolldown/config.mjs +2 -2
- package/dist/rolldown/experimental-index.d.mts +164 -155
- package/dist/rolldown/experimental-index.mjs +23 -14
- package/dist/rolldown/experimental-runtime-types.d.ts +111 -41
- package/dist/rolldown/filter-index.d.mts +6 -5
- package/dist/rolldown/get-log-filter.d.mts +2 -2
- package/dist/rolldown/index.d.mts +3 -3
- package/dist/rolldown/index.mjs +4 -4
- package/dist/rolldown/parallel-plugin-worker.d.mts +1 -1
- package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
- package/dist/rolldown/parallel-plugin.d.mts +3 -4
- package/dist/rolldown/parse-ast-index.d.mts +19 -20
- package/dist/rolldown/parse-ast-index.mjs +1 -1
- package/dist/rolldown/plugins-index.d.mts +27 -28
- package/dist/rolldown/plugins-index.mjs +2 -2
- package/dist/rolldown/shared/{binding-D26QphWG.d.mts → binding-Dbbi0RbO.d.mts} +37 -25
- package/dist/rolldown/shared/{binding-TuFFIE_J.mjs → binding-Dby9rwGk.mjs} +26 -26
- package/dist/rolldown/shared/{bindingify-input-options-CwbcQL6W.mjs → bindingify-input-options-DVQ4K-zY.mjs} +5 -5
- package/dist/rolldown/shared/{constructors-BbWPse2X.d.mts → constructors-CSWbNgBZ.d.mts} +9 -10
- package/dist/rolldown/shared/{constructors-D_3i7dpX.mjs → constructors-CuGa75s-.mjs} +1 -1
- package/dist/rolldown/shared/define-config-B-IDOhDz.d.mts +4003 -0
- package/dist/rolldown/shared/{error-BHRSI0R7.mjs → error-DFGNOCle.mjs} +1 -1
- package/dist/rolldown/shared/get-log-filter-AjBknEEO.d.mts +34 -0
- package/dist/rolldown/shared/{load-config-Bd7MgqCK.mjs → load-config-R0z2olkB.mjs} +1 -1
- package/dist/rolldown/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
- package/dist/rolldown/shared/{normalize-string-or-regex-dnh67V_w.mjs → normalize-string-or-regex-SiXbePVH.mjs} +1 -1
- package/dist/rolldown/shared/{parse-B6_waszz.mjs → parse-D5dkElpf.mjs} +2 -2
- package/dist/rolldown/shared/{resolve-tsconfig-DxqIJB3x.mjs → resolve-tsconfig-2TXRF_zr.mjs} +2 -2
- package/dist/rolldown/shared/{rolldown-CACDGVWV.mjs → rolldown-BnV7isAX.mjs} +1 -1
- package/dist/rolldown/shared/{rolldown-build-BV22mk7t.mjs → rolldown-build-BGXNOfvH.mjs} +4 -4
- package/dist/rolldown/shared/transform-Cs2bUDRH.d.mts +148 -0
- package/dist/rolldown/shared/{watch-CS_JygCu.mjs → watch-DVucf-VG.mjs} +4 -4
- package/dist/rolldown/utils-index.d.mts +29 -30
- package/dist/rolldown/utils-index.mjs +6 -8
- package/dist/tsdown/{build-BlM3pDGJ-C8Uovnt4.js → build-D_enfyvD-DX5mX46j.js} +149 -1255
- package/dist/tsdown/debug-CKcBYQLP-GQrJ--dM.js +159 -0
- package/dist/tsdown/{detect-BNXt7gkp-DKAC9Z7n.js → detect-DGhJGEqb-Cz6qOZuP.js} +7 -1
- package/dist/tsdown/{dist-Pjag7IPt.js → dist-CWolxbYK.js} +1939 -2529
- package/dist/tsdown/dist-DCMiHFrJ.js +1061 -0
- package/dist/tsdown/index-types.d.ts +740 -554
- package/dist/tsdown/index.js +4 -4
- package/dist/tsdown/internal-DAh_SWnB.js +3 -0
- package/dist/tsdown/load-tsc-BKULZsrs-Bha6Vsu1.js +18 -0
- package/dist/tsdown/{main-BlTcyuFi.js → main-DI8qthUB.js} +222 -9
- package/dist/tsdown/{resolver-DtsKFXi2-B8Z3WwZh.js → resolver-cwLsPb2o-DvUqSYux.js} +4 -3
- package/dist/tsdown/run.js +5 -5
- package/dist/tsdown/{src-CK50m8R_.js → src-CPDzmpAq.js} +5 -5
- package/dist/tsdown/target-Bab3CUeB-Di6tCARH.js +582 -0
- package/dist/tsdown/{tsc-CilQvmj4.js → tsc-BQoNcjeB.js} +49 -116
- package/dist/tsdown/tsc-context-BhMGQ9Qr.js +23 -0
- package/dist/tsdown/tsdown-css.js +11 -12
- package/dist/tsdown/tsdown-exe.js +129 -877
- package/dist/vite/client/client.mjs +5 -5
- package/dist/vite/node/chunks/build.js +19 -19
- package/dist/vite/node/chunks/moduleRunnerTransport.d.ts +25 -26
- package/dist/vite/node/chunks/node.js +73 -38
- package/dist/vite/node/chunks/postcss-import.js +10 -10
- package/dist/vite/node/index.d.ts +1282 -1283
- package/dist/vite/node/module-runner.d.ts +76 -77
- package/dist/vite/node/module-runner.js +6 -7
- package/package.json +16 -16
- package/dist/rolldown/shared/define-config-BhJ90aEv.d.mts +0 -3978
- package/dist/rolldown/shared/get-log-filter-BpNVNJ5-.d.mts +0 -35
- package/dist/rolldown/shared/transform-BPrUvqEZ.d.mts +0 -149
- package/dist/tsdown/debug-B1wUEHkd-DhRzGJTf.js +0 -265
- package/dist/tsdown/fs-qxJxxoCE-B_amenYz.js +0 -46
- package/dist/tsdown/general-Cp4NiJNK-xAqmPhMP.js +0 -97
- package/dist/tsdown/internal-Bn6NGoha.js +0 -3
- package/dist/tsdown/npm_cjs_chunk_range.cjs +0 -475
- package/dist/tsdown/npm_cjs_chunk_semver.cjs +0 -357
- package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +0 -52
- package/dist/tsdown/npm_entry_semver_functions_satisfies.cjs +0 -19
- package/dist/tsdown/npm_entry_semver_ranges_min-version.cjs +0 -46
- package/dist/tsdown/target-CqeSqtms-CIvlAiuG.js +0 -35
- package/dist/tsdown/tsc-context-BusiAGCd.js +0 -27
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { r as createDebug } from "./main-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { r as createDebug } from "./main-DI8qthUB.js";
|
|
2
|
+
import { h as RE_DTS_MAP, m as RE_DTS } from "./target-Bab3CUeB-Di6tCARH.js";
|
|
3
|
+
import { n as globalContext } from "./tsc-context-BhMGQ9Qr.js";
|
|
4
|
+
import { t as requireTS } from "./load-tsc-BKULZsrs-Bha6Vsu1.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
|
-
|
|
8
|
-
const debug$
|
|
7
|
+
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.27.13_@typescript+native-preview@7.0.0-dev.20260605.1_oxc-resolve_bb5be7aebc807a8d600edaae098a2d6b/node_modules/rolldown-plugin-dts/dist/tsc-KtFHcISk.mjs
|
|
8
|
+
const debug$3 = createDebug("rolldown-plugin-dts:tsc-system");
|
|
9
|
+
const ts$3 = requireTS();
|
|
9
10
|
/**
|
|
10
11
|
* A system that writes files to both memory and disk. It will try read files
|
|
11
12
|
* from memory firstly and fallback to disk if not found.
|
|
12
13
|
*/
|
|
13
14
|
function createFsSystem(files) {
|
|
14
15
|
return {
|
|
15
|
-
...ts.sys,
|
|
16
|
+
...ts$3.sys,
|
|
16
17
|
write(message) {
|
|
17
|
-
debug$
|
|
18
|
+
debug$3(message);
|
|
18
19
|
},
|
|
19
20
|
resolvePath(path) {
|
|
20
21
|
if (files.has(path)) return path;
|
|
21
|
-
return ts.sys.resolvePath(path);
|
|
22
|
+
return ts$3.sys.resolvePath(path);
|
|
22
23
|
},
|
|
23
24
|
directoryExists(directory) {
|
|
24
25
|
if (Array.from(files.keys()).some((path) => path.startsWith(directory))) return true;
|
|
25
|
-
return ts.sys.directoryExists(directory);
|
|
26
|
+
return ts$3.sys.directoryExists(directory);
|
|
26
27
|
},
|
|
27
28
|
fileExists(fileName) {
|
|
28
29
|
if (files.has(fileName)) return true;
|
|
29
|
-
return ts.sys.fileExists(fileName);
|
|
30
|
+
return ts$3.sys.fileExists(fileName);
|
|
30
31
|
},
|
|
31
32
|
readFile(fileName, ...args) {
|
|
32
33
|
if (files.has(fileName)) return files.get(fileName);
|
|
33
|
-
return ts.sys.readFile(fileName, ...args);
|
|
34
|
+
return ts$3.sys.readFile(fileName, ...args);
|
|
34
35
|
},
|
|
35
36
|
writeFile(path, data, ...args) {
|
|
36
37
|
files.set(path, data);
|
|
37
|
-
ts.sys.writeFile(path, data, ...args);
|
|
38
|
+
ts$3.sys.writeFile(path, data, ...args);
|
|
38
39
|
},
|
|
39
40
|
deleteFile(fileName, ...args) {
|
|
40
41
|
files.delete(fileName);
|
|
41
|
-
ts.sys.deleteFile?.(fileName, ...args);
|
|
42
|
+
ts$3.sys.deleteFile?.(fileName, ...args);
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
}
|
|
@@ -53,10 +54,11 @@ function createMemorySystem(files) {
|
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
}
|
|
57
|
+
const ts$2 = requireTS();
|
|
56
58
|
const formatHost = {
|
|
57
|
-
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
|
58
|
-
getNewLine: () => ts.sys.newLine,
|
|
59
|
-
getCanonicalFileName: ts.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
|
|
59
|
+
getCurrentDirectory: () => ts$2.sys.getCurrentDirectory(),
|
|
60
|
+
getNewLine: () => ts$2.sys.newLine,
|
|
61
|
+
getCanonicalFileName: ts$2.sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
|
|
60
62
|
};
|
|
61
63
|
const stripPrivateFields = (ctx) => {
|
|
62
64
|
const recurseCtx = {
|
|
@@ -67,10 +69,10 @@ const stripPrivateFields = (ctx) => {
|
|
|
67
69
|
endLexicalEnvironment: () => void 0
|
|
68
70
|
};
|
|
69
71
|
const visitor = (node) => {
|
|
70
|
-
if (ts.isPropertySignature(node) && ts.isPrivateIdentifier(node.name)) return ctx.factory.updatePropertySignature(node, node.modifiers, ctx.factory.createStringLiteral(node.name.text), node.questionToken, node.type);
|
|
71
|
-
return ts.visitEachChild(node, visitor, recurseCtx);
|
|
72
|
+
if (ts$2.isPropertySignature(node) && ts$2.isPrivateIdentifier(node.name)) return ctx.factory.updatePropertySignature(node, node.modifiers, ctx.factory.createStringLiteral(node.name.text), node.questionToken, node.type);
|
|
73
|
+
return ts$2.visitEachChild(node, visitor, recurseCtx);
|
|
72
74
|
};
|
|
73
|
-
return (sourceFile) => ts.visitNode(sourceFile, visitor, ts.isSourceFile) ?? sourceFile;
|
|
75
|
+
return (sourceFile) => ts$2.visitNode(sourceFile, visitor, ts$2.isSourceFile) ?? sourceFile;
|
|
74
76
|
};
|
|
75
77
|
const customTransformers = { afterDeclarations: [stripPrivateFields] };
|
|
76
78
|
function setSourceMapRoot(map, originalFilePath, finalFilePath) {
|
|
@@ -80,22 +82,23 @@ function setSourceMapRoot(map, originalFilePath, finalFilePath) {
|
|
|
80
82
|
const finalDir = path.posix.dirname(pathToFileURL(finalFilePath).pathname);
|
|
81
83
|
if (originalDir !== finalDir) map.sourceRoot = path.posix.relative(finalDir, originalDir);
|
|
82
84
|
}
|
|
83
|
-
const
|
|
85
|
+
const ts$1 = requireTS();
|
|
86
|
+
const debug$2 = createDebug("rolldown-plugin-dts:tsc-build");
|
|
84
87
|
function tscEmitBuild(tscOptions) {
|
|
85
88
|
const { id, tsconfig, incremental, context = globalContext, sourcemap } = tscOptions;
|
|
86
|
-
debug$
|
|
89
|
+
debug$2(`running tscEmitBuild id: ${id}, tsconfig: ${tsconfig}, incremental: ${incremental}`);
|
|
87
90
|
if (!tsconfig) return { error: "[rolldown-plugin-dts] build mode requires a tsconfig path" };
|
|
88
91
|
const fsSystem = (incremental ? createFsSystem : createMemorySystem)(context.files);
|
|
89
92
|
const resolvedId = fsSystem.resolvePath(id);
|
|
90
|
-
if (resolvedId !== id) debug$
|
|
93
|
+
if (resolvedId !== id) debug$2(`resolved id from ${id} to ${resolvedId}`);
|
|
91
94
|
const project = getOrBuildProjects(context, fsSystem, tsconfig, !incremental, sourcemap).get(resolvedId);
|
|
92
95
|
if (!project) {
|
|
93
|
-
debug$
|
|
96
|
+
debug$2(`unable to locate a project containing ${resolvedId}`);
|
|
94
97
|
return { error: `Unable to locate ${id} from the given tsconfig file ${tsconfig}` };
|
|
95
98
|
}
|
|
96
|
-
debug$
|
|
99
|
+
debug$2(`loaded project ${project.tsconfigPath} for ${id}`);
|
|
97
100
|
const ignoreCase = !fsSystem.useCaseSensitiveFileNames;
|
|
98
|
-
const outputFiles = ts.getOutputFileNames(project.parsedConfig, resolvedId, ignoreCase);
|
|
101
|
+
const outputFiles = ts$1.getOutputFileNames(project.parsedConfig, resolvedId, ignoreCase);
|
|
99
102
|
let code;
|
|
100
103
|
let map;
|
|
101
104
|
for (const outputFile of outputFiles) {
|
|
@@ -123,20 +126,20 @@ function tscEmitBuild(tscOptions) {
|
|
|
123
126
|
map
|
|
124
127
|
};
|
|
125
128
|
if (incremental) {
|
|
126
|
-
debug$
|
|
129
|
+
debug$2(`incremental build failed`);
|
|
127
130
|
return tscEmitBuild({
|
|
128
131
|
...tscOptions,
|
|
129
132
|
incremental: false
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
|
-
debug$
|
|
135
|
+
debug$2(`unable to build .d.ts file for ${id}`);
|
|
133
136
|
if (project.parsedConfig.options.declaration !== true) return { error: `Unable to build .d.ts file for ${id}; Make sure the "declaration" option is set to true in ${project.tsconfigPath}` };
|
|
134
137
|
return { error: `Unable to build .d.ts file for ${id}; This seems like a bug of rolldown-plugin-dts. Please report this issue to https://github.com/sxzz/rolldown-plugin-dts/issues` };
|
|
135
138
|
}
|
|
136
139
|
function getOrBuildProjects(context, fsSystem, tsconfig, force, sourcemap) {
|
|
137
140
|
let projectMap = context.projects.get(tsconfig);
|
|
138
141
|
if (projectMap) {
|
|
139
|
-
debug$
|
|
142
|
+
debug$2(`skip building projects for ${tsconfig}`);
|
|
140
143
|
return projectMap;
|
|
141
144
|
}
|
|
142
145
|
projectMap = buildProjects(fsSystem, tsconfig, force, sourcemap);
|
|
@@ -147,18 +150,18 @@ function getOrBuildProjects(context, fsSystem, tsconfig, force, sourcemap) {
|
|
|
147
150
|
* Use TypeScript compiler to build all projects referenced
|
|
148
151
|
*/
|
|
149
152
|
function buildProjects(fsSystem, tsconfig, force, sourcemap) {
|
|
150
|
-
debug$
|
|
153
|
+
debug$2(`start building projects for ${tsconfig}`);
|
|
151
154
|
const projects = collectProjectGraph(tsconfig, fsSystem, force, sourcemap);
|
|
152
|
-
debug$
|
|
153
|
-
const host = ts.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions);
|
|
154
|
-
const exitStatus = ts.createSolutionBuilder(host, [tsconfig], {
|
|
155
|
+
debug$2("collected %d projects: %j", projects.length, projects.map((project) => project.tsconfigPath));
|
|
156
|
+
const host = ts$1.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions);
|
|
157
|
+
const exitStatus = ts$1.createSolutionBuilder(host, [tsconfig], {
|
|
155
158
|
force,
|
|
156
159
|
verbose: true
|
|
157
160
|
}).build(void 0, void 0, void 0, (project) => {
|
|
158
|
-
debug$
|
|
161
|
+
debug$2(`transforming project ${project}`);
|
|
159
162
|
return customTransformers;
|
|
160
163
|
});
|
|
161
|
-
debug$
|
|
164
|
+
debug$2(`built solution for ${tsconfig} with exit status ${exitStatus}`);
|
|
162
165
|
const sourceFileToProjectMap = /* @__PURE__ */ new Map();
|
|
163
166
|
for (const project of projects) for (const fileName of project.parsedConfig.fileNames) sourceFileToProjectMap.set(fsSystem.resolvePath(fileName), project);
|
|
164
167
|
return sourceFileToProjectMap;
|
|
@@ -186,19 +189,19 @@ function collectProjectGraph(rootTsconfigPath, fsSystem, force, sourcemap) {
|
|
|
186
189
|
tsconfigPath,
|
|
187
190
|
parsedConfig
|
|
188
191
|
});
|
|
189
|
-
for (const ref of parsedConfig.projectReferences ?? []) stack.push(ts.resolveProjectReferencePath(ref));
|
|
192
|
+
for (const ref of parsedConfig.projectReferences ?? []) stack.push(ts$1.resolveProjectReferencePath(ref));
|
|
190
193
|
}
|
|
191
194
|
return projects;
|
|
192
195
|
}
|
|
193
196
|
function parseTsconfig(tsconfigPath, fsSystem) {
|
|
194
197
|
const diagnostics = [];
|
|
195
|
-
const parsedConfig = ts.getParsedCommandLineOfConfigFile(tsconfigPath, void 0, {
|
|
198
|
+
const parsedConfig = ts$1.getParsedCommandLineOfConfigFile(tsconfigPath, void 0, {
|
|
196
199
|
...fsSystem,
|
|
197
200
|
onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
198
201
|
diagnostics.push(diagnostic);
|
|
199
202
|
}
|
|
200
203
|
});
|
|
201
|
-
if (diagnostics.length) throw new Error(`[rolldown-plugin-dts] Unable to read ${tsconfigPath}: ${ts.formatDiagnostics(diagnostics, formatHost)}`);
|
|
204
|
+
if (diagnostics.length) throw new Error(`[rolldown-plugin-dts] Unable to read ${tsconfigPath}: ${ts$1.formatDiagnostics(diagnostics, formatHost)}`);
|
|
202
205
|
return parsedConfig;
|
|
203
206
|
}
|
|
204
207
|
function patchCompilerOptions(options, extraOptions) {
|
|
@@ -230,71 +233,10 @@ function patchCompilerOptions(options, extraOptions) {
|
|
|
230
233
|
return options;
|
|
231
234
|
}
|
|
232
235
|
const createProgramWithPatchedCompilerOptions = (rootNames, options, ...args) => {
|
|
233
|
-
return ts.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
|
|
236
|
+
return ts$1.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
|
|
234
237
|
};
|
|
235
|
-
const debug$2 = createDebug("rolldown-plugin-dts:volar");
|
|
236
|
-
function loadVueLanguageTools() {
|
|
237
|
-
debug$2("loading vue language tools");
|
|
238
|
-
try {
|
|
239
|
-
const vueTscPath = __require.resolve("vue-tsc");
|
|
240
|
-
return {
|
|
241
|
-
volarTs: __require(__require.resolve("@volar/typescript", { paths: [vueTscPath] })),
|
|
242
|
-
vue: __require(__require.resolve("@vue/language-core", { paths: [vueTscPath] }))
|
|
243
|
-
};
|
|
244
|
-
} catch (error) {
|
|
245
|
-
debug$2("vue language tools not found", error);
|
|
246
|
-
throw new Error("Failed to load vue language tools. Please manually install vue-tsc.", { cause: error });
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
function initVueLanguageTools() {
|
|
250
|
-
const { vue, volarTs: { proxyCreateProgram } } = loadVueLanguageTools();
|
|
251
|
-
const getLanguagePlugin = (ts, options) => {
|
|
252
|
-
const $rootDir = options.options.$rootDir;
|
|
253
|
-
const $configRaw = options.options.$configRaw;
|
|
254
|
-
const resolver = new vue.CompilerOptionsResolver(ts, ts.sys.readFile);
|
|
255
|
-
resolver.addConfig($configRaw?.vueCompilerOptions ?? {}, $rootDir);
|
|
256
|
-
const vueOptions = resolver.build();
|
|
257
|
-
return vue.createVueLanguagePlugin(ts, options.options, vueOptions, (id) => id);
|
|
258
|
-
};
|
|
259
|
-
return {
|
|
260
|
-
proxyCreateProgram,
|
|
261
|
-
getLanguagePlugin
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
function initTsMacro() {
|
|
265
|
-
const debug = createDebug("rolldown-plugin-dts:ts-macro");
|
|
266
|
-
debug("loading ts-macro language tools");
|
|
267
|
-
try {
|
|
268
|
-
const tsMacroPath = __require.resolve("@ts-macro/tsc");
|
|
269
|
-
const { proxyCreateProgram } = __require(__require.resolve("@volar/typescript", { paths: [tsMacroPath] }));
|
|
270
|
-
const tsMacro = __require(__require.resolve("@ts-macro/language-plugin", { paths: [tsMacroPath] }));
|
|
271
|
-
const { getOptions } = __require(__require.resolve("@ts-macro/language-plugin/options", { paths: [tsMacroPath] }));
|
|
272
|
-
const getLanguagePlugin = (ts, options) => {
|
|
273
|
-
const $rootDir = options.options.$rootDir;
|
|
274
|
-
return tsMacro.getLanguagePlugins(ts, options.options, getOptions(ts, $rootDir))[0];
|
|
275
|
-
};
|
|
276
|
-
return {
|
|
277
|
-
proxyCreateProgram,
|
|
278
|
-
getLanguagePlugin
|
|
279
|
-
};
|
|
280
|
-
} catch (error) {
|
|
281
|
-
debug("ts-macro language tools not found", error);
|
|
282
|
-
throw new Error("Failed to load ts-macro language tools. Please manually install @ts-macro/tsc.", { cause: error });
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
function createProgramFactory(ts, options) {
|
|
286
|
-
const vueLanguageTools = options.vue ? initVueLanguageTools() : void 0;
|
|
287
|
-
const tsMacroLanguageTools = options.tsMacro ? initTsMacro() : void 0;
|
|
288
|
-
const proxyCreateProgram = vueLanguageTools?.proxyCreateProgram || tsMacroLanguageTools?.proxyCreateProgram;
|
|
289
|
-
if (!proxyCreateProgram) return ts.createProgram;
|
|
290
|
-
return proxyCreateProgram(ts, ts.createProgram, (ts, options) => {
|
|
291
|
-
const languagePlugins = [];
|
|
292
|
-
if (vueLanguageTools) languagePlugins.push(vueLanguageTools.getLanguagePlugin(ts, options));
|
|
293
|
-
if (tsMacroLanguageTools) languagePlugins.push(tsMacroLanguageTools.getLanguagePlugin(ts, options));
|
|
294
|
-
return { languagePlugins };
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
238
|
const debug$1 = createDebug("rolldown-plugin-dts:tsc-compiler");
|
|
239
|
+
const ts = requireTS();
|
|
298
240
|
const defaultCompilerOptions = {
|
|
299
241
|
declaration: true,
|
|
300
242
|
noEmit: false,
|
|
@@ -327,14 +269,10 @@ function createOrGetTsModule(options) {
|
|
|
327
269
|
context.programs.push(module.program);
|
|
328
270
|
return module;
|
|
329
271
|
}
|
|
330
|
-
function createTsProgram({ entries, id, tsconfig, tsconfigRaw,
|
|
272
|
+
function createTsProgram({ entries, id, tsconfig, tsconfigRaw, volarContext, cwd, context = globalContext }) {
|
|
331
273
|
const fsSystem = createFsSystem(context.files);
|
|
332
274
|
const baseDir = tsconfig ? path.dirname(tsconfig) : cwd;
|
|
333
|
-
const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir, void 0, void 0, void 0,
|
|
334
|
-
extension: "vue",
|
|
335
|
-
isMixedContent: true,
|
|
336
|
-
scriptKind: ts.ScriptKind.Deferred
|
|
337
|
-
}] : void 0);
|
|
275
|
+
const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir, void 0, void 0, void 0, volarContext.getExtraFileExtensions());
|
|
338
276
|
debug$1(`creating program for root project: ${baseDir}`);
|
|
339
277
|
return createTsProgramFromParsedConfig({
|
|
340
278
|
parsedConfig,
|
|
@@ -342,24 +280,20 @@ function createTsProgram({ entries, id, tsconfig, tsconfigRaw, vue, tsMacro, cwd
|
|
|
342
280
|
baseDir,
|
|
343
281
|
id,
|
|
344
282
|
entries,
|
|
345
|
-
|
|
346
|
-
tsMacro
|
|
283
|
+
volarContext
|
|
347
284
|
});
|
|
348
285
|
}
|
|
349
|
-
function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id, entries,
|
|
286
|
+
function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id, entries, volarContext }) {
|
|
350
287
|
const compilerOptions = {
|
|
351
288
|
...defaultCompilerOptions,
|
|
352
289
|
...parsedConfig.options,
|
|
353
290
|
$configRaw: parsedConfig.raw,
|
|
354
291
|
$rootDir: baseDir,
|
|
355
|
-
...
|
|
292
|
+
...volarContext.plugins.length ? { allowNonTsExtensions: true } : void 0
|
|
356
293
|
};
|
|
357
294
|
const rootNames = [...new Set([id, ...entries || parsedConfig.fileNames].map((f) => fsSystem.resolvePath(f)))];
|
|
358
295
|
const host = ts.createCompilerHost(compilerOptions, true);
|
|
359
|
-
const program =
|
|
360
|
-
vue,
|
|
361
|
-
tsMacro
|
|
362
|
-
})({
|
|
296
|
+
const program = volarContext.getCreateProgram(ts)({
|
|
363
297
|
rootNames,
|
|
364
298
|
options: compilerOptions,
|
|
365
299
|
host,
|
|
@@ -412,7 +346,6 @@ function tscEmitCompiler(tscOptions) {
|
|
|
412
346
|
};
|
|
413
347
|
}
|
|
414
348
|
const debug = createDebug("rolldown-plugin-dts:tsc");
|
|
415
|
-
debug(`loaded typescript: ${ts.version}`);
|
|
416
349
|
function tscEmit(tscOptions) {
|
|
417
350
|
debug(`running tscEmit ${tscOptions.id}`);
|
|
418
351
|
if (tscOptions.build) return tscEmitBuild(tscOptions);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { r as createDebug } from "./main-DI8qthUB.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.27.13_@typescript+native-preview@7.0.0-dev.20260605.1_oxc-resolve_bb5be7aebc807a8d600edaae098a2d6b/node_modules/rolldown-plugin-dts/dist/tsc-context.mjs
|
|
4
|
+
const debug = createDebug("rolldown-plugin-dts:tsc-context");
|
|
5
|
+
function createContext() {
|
|
6
|
+
return {
|
|
7
|
+
programs: [],
|
|
8
|
+
files: /* @__PURE__ */ new Map(),
|
|
9
|
+
projects: /* @__PURE__ */ new Map()
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function invalidateContextFile(context, file) {
|
|
13
|
+
file = path.resolve(file).replaceAll("\\", "/");
|
|
14
|
+
debug(`invalidating context file: ${file}`);
|
|
15
|
+
context.files.delete(file);
|
|
16
|
+
context.programs = context.programs.filter((program) => {
|
|
17
|
+
return !program.getSourceFiles().some((sourceFile) => sourceFile.fileName === file);
|
|
18
|
+
});
|
|
19
|
+
context.projects.clear();
|
|
20
|
+
}
|
|
21
|
+
const globalContext = createContext();
|
|
22
|
+
//#endregion
|
|
23
|
+
export { globalContext as n, invalidateContextFile as r, createContext as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./internal-
|
|
1
|
+
import { A as __toESM, C as resolveComma, E as toArray, y as importWithError } from "./main-DI8qthUB.js";
|
|
2
|
+
import { i as expandBaselineTarget } from "./target-Bab3CUeB-Di6tCARH.js";
|
|
3
|
+
import "./internal-DAh_SWnB.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
8
|
import { ResolverFactory } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
|
|
9
|
-
//#region ../../node_modules/.pnpm/@tsdown+css@0.22.
|
|
9
|
+
//#region ../../node_modules/.pnpm/@tsdown+css@0.22.14_jiti@2.7.0_postcss-import@16.1.1_postcss@8.5.20__postcss@8.5.20_sas_632d5c49f550383ec048d2a4b7116378/node_modules/@tsdown/css/dist/index.mjs
|
|
10
10
|
const defaultCssBundleName = "style.css";
|
|
11
11
|
function resolveCssOptions(options = {}, topLevelTarget, unbundle) {
|
|
12
12
|
let cssTarget;
|
|
@@ -141,8 +141,8 @@ function compilePreprocessor(lang, code, filename, options) {
|
|
|
141
141
|
case "stylus": return compileStylus(code, filename, options);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const cssUrlRE = /(?<!@import\s+)(?<=^|[^\w\-\
|
|
145
|
-
const cssDataUriRE = /(?<=^|[^\w\-\
|
|
144
|
+
const cssUrlRE = /(?<!@import\s+)(?<=^|[^\w\-\u{80}-\u{10FFFF}])url\((\s*('[^']+'|"[^"]+")\s*|(?:\\.|[^'")\\])+)\)/u;
|
|
145
|
+
const cssDataUriRE = /(?<=^|[^\w\-\u{80}-\u{10FFFF}])data-uri\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/u;
|
|
146
146
|
const importCssRE = /@import\s+(?:url\()?('[^']+\.css'|"[^"]+\.css"|[^'"\s)]+\.css)/;
|
|
147
147
|
async function rebaseUrls(file, rootFile, ignoreUrl) {
|
|
148
148
|
file = path.resolve(file);
|
|
@@ -372,7 +372,7 @@ async function compileStylus(code, filename, options) {
|
|
|
372
372
|
...stylusOptions,
|
|
373
373
|
filename
|
|
374
374
|
});
|
|
375
|
-
if (define) for (const key of Object.
|
|
375
|
+
if (define) for (const [key, value] of Object.entries(define)) ref.define(key, value);
|
|
376
376
|
return new Promise((resolve, reject) => {
|
|
377
377
|
ref.render((err, css) => {
|
|
378
378
|
if (err) reject(/* @__PURE__ */ new Error(`[stylus] ${err.message}`));
|
|
@@ -467,7 +467,7 @@ const ESBUILD_LIGHTNINGCSS_MAPPING = {
|
|
|
467
467
|
safari: "safari"
|
|
468
468
|
};
|
|
469
469
|
function parseVersion(version) {
|
|
470
|
-
const [major, minor = 0, patch = 0] = version.split("-", 1)[0].split(".").map((v) =>
|
|
470
|
+
const [major, minor = 0, patch = 0] = version.split("-", 1)[0].split(".").map((v) => +v);
|
|
471
471
|
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) return null;
|
|
472
472
|
return major << 16 | minor << 8 | patch;
|
|
473
473
|
}
|
|
@@ -606,7 +606,7 @@ async function loadFileConfig(searchPath) {
|
|
|
606
606
|
if (cached !== void 0) return cached;
|
|
607
607
|
const promise = (async () => {
|
|
608
608
|
try {
|
|
609
|
-
const postcssrc = (await import("./src-
|
|
609
|
+
const postcssrc = (await import("./src-CPDzmpAq.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1))).default;
|
|
610
610
|
const result = await postcssrc({}, searchPath);
|
|
611
611
|
return {
|
|
612
612
|
options: result.options,
|
|
@@ -770,15 +770,14 @@ function CssPlugin(config, { logger }) {
|
|
|
770
770
|
filter: { id: CSS_LANGS_RE },
|
|
771
771
|
handler(code, id) {
|
|
772
772
|
if (shouldSkipTransform(id, getCleanId(id))) return;
|
|
773
|
-
|
|
774
|
-
const modules = modulesMap.get(id);
|
|
775
|
-
if (isInline) return {
|
|
773
|
+
if (RE_INLINE.test(id)) return {
|
|
776
774
|
code: `export default ${JSON.stringify(code)};`,
|
|
777
775
|
map: null,
|
|
778
776
|
moduleSideEffects: false,
|
|
779
777
|
moduleType: "js"
|
|
780
778
|
};
|
|
781
779
|
if (code.length) styles.set(id, code);
|
|
780
|
+
const modules = modulesMap.get(id);
|
|
782
781
|
if (modules) return {
|
|
783
782
|
code: modulesToEsm(modules),
|
|
784
783
|
map: null,
|