@voidzero-dev/vite-plus-core 0.2.4 → 0.2.6
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 +36 -120
- package/dist/rolldown/cli.d.mts +1 -1
- package/dist/rolldown/cli.mjs +11 -8
- package/dist/rolldown/config.d.mts +22 -10
- 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 +4 -4
- package/dist/rolldown/index.mjs +10 -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 +2 -2
- package/dist/rolldown/plugins-index.d.mts +27 -28
- package/dist/rolldown/plugins-index.mjs +2 -2
- package/dist/rolldown/shared/{binding-B1q9aYT-.d.mts → binding-Dbbi0RbO.d.mts} +49 -25
- package/dist/rolldown/shared/{binding-BmkJW3Wy.mjs → binding-Dby9rwGk.mjs} +26 -26
- package/dist/rolldown/shared/{bindingify-input-options-Cmm60vfj.mjs → bindingify-input-options-DVQ4K-zY.mjs} +11 -13
- package/dist/rolldown/shared/{constructors-2i1T9YcF.d.mts → constructors-CSWbNgBZ.d.mts} +9 -10
- package/dist/rolldown/shared/{constructors-CE6zZSUt.mjs → constructors-CuGa75s-.mjs} +1 -1
- package/dist/rolldown/shared/define-config-B-IDOhDz.d.mts +4003 -0
- package/dist/rolldown/shared/dist-DX3cAjHx.mjs +154 -0
- package/dist/rolldown/shared/{error-BlQ0-ek7.mjs → error-DFGNOCle.mjs} +1 -1
- package/dist/rolldown/shared/get-log-filter-AjBknEEO.d.mts +34 -0
- package/dist/rolldown/shared/{load-config-CVVMWSlg.mjs → load-config-R0z2olkB.mjs} +19 -2
- package/dist/rolldown/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
- package/dist/rolldown/shared/{logs-aMKUxRpj.mjs → logs-ZGEh6uhb.mjs} +6 -1
- package/dist/rolldown/shared/{normalize-string-or-regex-BYkbbGqQ.mjs → normalize-string-or-regex-SiXbePVH.mjs} +2 -2
- package/dist/rolldown/shared/{parse-Dphnedsw.mjs → parse-D5dkElpf.mjs} +2 -2
- package/dist/rolldown/shared/{prompt-Bgj-uEyc.mjs → prompt-pZFoa1TT.mjs} +59 -17
- package/dist/rolldown/shared/{resolve-tsconfig-CdIAR1Eb.mjs → resolve-tsconfig-2TXRF_zr.mjs} +2 -2
- package/dist/rolldown/shared/{rolldown-Bnp916iM.mjs → rolldown-BnV7isAX.mjs} +1 -1
- package/dist/rolldown/shared/{rolldown-build-Cs2iVJuw.mjs → rolldown-build-BGXNOfvH.mjs} +33 -13
- package/dist/rolldown/shared/transform-Cs2bUDRH.d.mts +148 -0
- package/dist/rolldown/shared/{watch-ECGr-_QS.mjs → watch-DVucf-VG.mjs} +5 -5
- package/dist/rolldown/utils-index.d.mts +29 -30
- package/dist/rolldown/utils-index.mjs +9 -9
- package/dist/tsdown/{build-B_nvJe4A-CvbtVBxy.js → build-oq13wECG-Bymq3jT5.js} +210 -1229
- package/dist/tsdown/debug-BntVTkRq-BGIoAiTa.js +159 -0
- package/dist/tsdown/{detect-B97OSl92-BJPZyIKJ.js → detect-DGhJGEqb-S-tkSzpt.js} +13 -2
- package/dist/tsdown/dist-CxIM8o7n.js +2613 -0
- package/dist/tsdown/dist-DCMiHFrJ.js +1061 -0
- package/dist/tsdown/index-types.d.ts +2106 -1895
- package/dist/tsdown/index.js +7 -4
- package/dist/tsdown/internal-C7ewSPAZ.js +3 -0
- package/dist/tsdown/load-tsc-BKULZsrs-BFmeD6Bu.js +18 -0
- package/dist/tsdown/{main-BlTcyuFi.js → main-BdzlWPt6.js} +214 -9
- package/dist/tsdown/npm_entry_picomatch.cjs +44 -15
- package/dist/tsdown/{resolver-DtsKFXi2-B8Z3WwZh.js → resolver-cwLsPb2o-oj1hqxK6.js} +4 -3
- package/dist/tsdown/run.js +4 -4
- package/dist/tsdown/{src-CISfE_A0.js → src-BV-UJr_R.js} +5 -5
- package/dist/tsdown/target-CNxIDvSz-eoHNdJNs.js +576 -0
- package/dist/tsdown/{tsc-context-CX_GXdyS.js → tsc-context-CA76SkkZ.js} +2 -2
- package/dist/tsdown/{tsc-CdZE7QwS.js → tsc-zcbB6ZVY.js} +58 -117
- package/dist/tsdown/tsdown-css.js +74 -23
- package/dist/tsdown/tsdown-exe.js +129 -876
- package/dist/vite/client/client.mjs +5 -5
- package/dist/vite/node/chunks/build.js +204 -94
- package/dist/vite/node/chunks/dist2.js +1 -1
- package/dist/vite/node/chunks/lib.js +1 -1
- package/dist/vite/node/chunks/moduleRunnerTransport.d.ts +25 -26
- package/dist/vite/node/chunks/node.js +552 -104
- package/dist/vite/node/chunks/postcss-import.js +11 -11
- package/dist/vite/node/cli.js +3 -4
- package/dist/vite/node/index.d.ts +1284 -1285
- package/dist/vite/node/index.js +1 -2
- package/dist/vite/node/module-runner.d.ts +76 -77
- package/dist/vite/node/module-runner.js +6 -7
- package/package.json +20 -18
- package/dist/rolldown/shared/define-config-BBz954-q.d.mts +0 -3901
- package/dist/rolldown/shared/get-log-filter-BpNVNJ5-.d.mts +0 -35
- package/dist/rolldown/shared/transform-CEmFsvJW.d.mts +0 -149
- package/dist/tsdown/debug-DLdR-9XB-DQZ6QLC0.js +0 -250
- package/dist/tsdown/dist-CZtGyfn3.js +0 -200
- package/dist/tsdown/dist-CqbVlnVq.js +0 -32057
- package/dist/tsdown/general-Cp4NiJNK-CbyrS9q1.js +0 -97
- package/dist/tsdown/internal-bfoxcI4F.js +0 -3
- package/dist/tsdown/npm_cjs_chunk_range.cjs +0 -474
- 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-FAqYuGyB.js +0 -79
- package/dist/vite/node/chunks/logger.js +0 -361
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { r as createDebug } from "./main-
|
|
2
|
-
import {
|
|
3
|
-
import { n as globalContext } from "./tsc-context-
|
|
4
|
-
import {
|
|
1
|
+
import { r as createDebug } from "./main-BdzlWPt6.js";
|
|
2
|
+
import { h as RE_DTS_MAP, m as RE_DTS } from "./target-CNxIDvSz-eoHNdJNs.js";
|
|
3
|
+
import { n as globalContext } from "./tsc-context-CA76SkkZ.js";
|
|
4
|
+
import { t as requireTS } from "./load-tsc-BKULZsrs-BFmeD6Bu.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
7
|
+
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.27.12_@typescript+native-preview@7.0.0-dev.20260605.1_oxc-resolve_d94a4da753642eee691447f5bf042e95/node_modules/rolldown-plugin-dts/dist/tsc-KtFHcISk.mjs
|
|
8
|
+
const debug$3 = createDebug("rolldown-plugin-dts:tsc-system");
|
|
9
|
+
const ts$3 = requireTS();
|
|
10
10
|
/**
|
|
11
11
|
* A system that writes files to both memory and disk. It will try read files
|
|
12
12
|
* from memory firstly and fallback to disk if not found.
|
|
13
13
|
*/
|
|
14
14
|
function createFsSystem(files) {
|
|
15
15
|
return {
|
|
16
|
-
...ts.sys,
|
|
16
|
+
...ts$3.sys,
|
|
17
17
|
write(message) {
|
|
18
|
-
debug$
|
|
18
|
+
debug$3(message);
|
|
19
19
|
},
|
|
20
20
|
resolvePath(path) {
|
|
21
21
|
if (files.has(path)) return path;
|
|
22
|
-
return ts.sys.resolvePath(path);
|
|
22
|
+
return ts$3.sys.resolvePath(path);
|
|
23
23
|
},
|
|
24
24
|
directoryExists(directory) {
|
|
25
25
|
if (Array.from(files.keys()).some((path) => path.startsWith(directory))) return true;
|
|
26
|
-
return ts.sys.directoryExists(directory);
|
|
26
|
+
return ts$3.sys.directoryExists(directory);
|
|
27
27
|
},
|
|
28
28
|
fileExists(fileName) {
|
|
29
29
|
if (files.has(fileName)) return true;
|
|
30
|
-
return ts.sys.fileExists(fileName);
|
|
30
|
+
return ts$3.sys.fileExists(fileName);
|
|
31
31
|
},
|
|
32
32
|
readFile(fileName, ...args) {
|
|
33
33
|
if (files.has(fileName)) return files.get(fileName);
|
|
34
|
-
return ts.sys.readFile(fileName, ...args);
|
|
34
|
+
return ts$3.sys.readFile(fileName, ...args);
|
|
35
35
|
},
|
|
36
36
|
writeFile(path, data, ...args) {
|
|
37
37
|
files.set(path, data);
|
|
38
|
-
ts.sys.writeFile(path, data, ...args);
|
|
38
|
+
ts$3.sys.writeFile(path, data, ...args);
|
|
39
39
|
},
|
|
40
40
|
deleteFile(fileName, ...args) {
|
|
41
41
|
files.delete(fileName);
|
|
42
|
-
ts.sys.deleteFile?.(fileName, ...args);
|
|
42
|
+
ts$3.sys.deleteFile?.(fileName, ...args);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
}
|
|
@@ -54,17 +54,25 @@ function createMemorySystem(files) {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
+
const ts$2 = requireTS();
|
|
57
58
|
const formatHost = {
|
|
58
|
-
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
|
59
|
-
getNewLine: () => ts.sys.newLine,
|
|
60
|
-
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()
|
|
61
62
|
};
|
|
62
63
|
const stripPrivateFields = (ctx) => {
|
|
64
|
+
const recurseCtx = {
|
|
65
|
+
...ctx,
|
|
66
|
+
startLexicalEnvironment: () => {},
|
|
67
|
+
suspendLexicalEnvironment: () => {},
|
|
68
|
+
resumeLexicalEnvironment: () => {},
|
|
69
|
+
endLexicalEnvironment: () => void 0
|
|
70
|
+
};
|
|
63
71
|
const visitor = (node) => {
|
|
64
|
-
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);
|
|
65
|
-
return ts.visitEachChild(node, visitor,
|
|
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);
|
|
66
74
|
};
|
|
67
|
-
return (sourceFile) => ts.visitNode(sourceFile, visitor, ts.isSourceFile) ?? sourceFile;
|
|
75
|
+
return (sourceFile) => ts$2.visitNode(sourceFile, visitor, ts$2.isSourceFile) ?? sourceFile;
|
|
68
76
|
};
|
|
69
77
|
const customTransformers = { afterDeclarations: [stripPrivateFields] };
|
|
70
78
|
function setSourceMapRoot(map, originalFilePath, finalFilePath) {
|
|
@@ -74,22 +82,23 @@ function setSourceMapRoot(map, originalFilePath, finalFilePath) {
|
|
|
74
82
|
const finalDir = path.posix.dirname(pathToFileURL(finalFilePath).pathname);
|
|
75
83
|
if (originalDir !== finalDir) map.sourceRoot = path.posix.relative(finalDir, originalDir);
|
|
76
84
|
}
|
|
77
|
-
const
|
|
85
|
+
const ts$1 = requireTS();
|
|
86
|
+
const debug$2 = createDebug("rolldown-plugin-dts:tsc-build");
|
|
78
87
|
function tscEmitBuild(tscOptions) {
|
|
79
88
|
const { id, tsconfig, incremental, context = globalContext, sourcemap } = tscOptions;
|
|
80
|
-
debug$
|
|
89
|
+
debug$2(`running tscEmitBuild id: ${id}, tsconfig: ${tsconfig}, incremental: ${incremental}`);
|
|
81
90
|
if (!tsconfig) return { error: "[rolldown-plugin-dts] build mode requires a tsconfig path" };
|
|
82
91
|
const fsSystem = (incremental ? createFsSystem : createMemorySystem)(context.files);
|
|
83
92
|
const resolvedId = fsSystem.resolvePath(id);
|
|
84
|
-
if (resolvedId !== id) debug$
|
|
93
|
+
if (resolvedId !== id) debug$2(`resolved id from ${id} to ${resolvedId}`);
|
|
85
94
|
const project = getOrBuildProjects(context, fsSystem, tsconfig, !incremental, sourcemap).get(resolvedId);
|
|
86
95
|
if (!project) {
|
|
87
|
-
debug$
|
|
96
|
+
debug$2(`unable to locate a project containing ${resolvedId}`);
|
|
88
97
|
return { error: `Unable to locate ${id} from the given tsconfig file ${tsconfig}` };
|
|
89
98
|
}
|
|
90
|
-
debug$
|
|
99
|
+
debug$2(`loaded project ${project.tsconfigPath} for ${id}`);
|
|
91
100
|
const ignoreCase = !fsSystem.useCaseSensitiveFileNames;
|
|
92
|
-
const outputFiles = ts.getOutputFileNames(project.parsedConfig, resolvedId, ignoreCase);
|
|
101
|
+
const outputFiles = ts$1.getOutputFileNames(project.parsedConfig, resolvedId, ignoreCase);
|
|
93
102
|
let code;
|
|
94
103
|
let map;
|
|
95
104
|
for (const outputFile of outputFiles) {
|
|
@@ -117,20 +126,20 @@ function tscEmitBuild(tscOptions) {
|
|
|
117
126
|
map
|
|
118
127
|
};
|
|
119
128
|
if (incremental) {
|
|
120
|
-
debug$
|
|
129
|
+
debug$2(`incremental build failed`);
|
|
121
130
|
return tscEmitBuild({
|
|
122
131
|
...tscOptions,
|
|
123
132
|
incremental: false
|
|
124
133
|
});
|
|
125
134
|
}
|
|
126
|
-
debug$
|
|
135
|
+
debug$2(`unable to build .d.ts file for ${id}`);
|
|
127
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}` };
|
|
128
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` };
|
|
129
138
|
}
|
|
130
139
|
function getOrBuildProjects(context, fsSystem, tsconfig, force, sourcemap) {
|
|
131
140
|
let projectMap = context.projects.get(tsconfig);
|
|
132
141
|
if (projectMap) {
|
|
133
|
-
debug$
|
|
142
|
+
debug$2(`skip building projects for ${tsconfig}`);
|
|
134
143
|
return projectMap;
|
|
135
144
|
}
|
|
136
145
|
projectMap = buildProjects(fsSystem, tsconfig, force, sourcemap);
|
|
@@ -141,17 +150,18 @@ function getOrBuildProjects(context, fsSystem, tsconfig, force, sourcemap) {
|
|
|
141
150
|
* Use TypeScript compiler to build all projects referenced
|
|
142
151
|
*/
|
|
143
152
|
function buildProjects(fsSystem, tsconfig, force, sourcemap) {
|
|
144
|
-
debug$
|
|
153
|
+
debug$2(`start building projects for ${tsconfig}`);
|
|
145
154
|
const projects = collectProjectGraph(tsconfig, fsSystem, force, sourcemap);
|
|
146
|
-
debug$
|
|
147
|
-
const host = ts.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions);
|
|
148
|
-
|
|
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], {
|
|
149
158
|
force,
|
|
150
159
|
verbose: true
|
|
151
160
|
}).build(void 0, void 0, void 0, (project) => {
|
|
152
|
-
debug$
|
|
161
|
+
debug$2(`transforming project ${project}`);
|
|
153
162
|
return customTransformers;
|
|
154
|
-
})
|
|
163
|
+
});
|
|
164
|
+
debug$2(`built solution for ${tsconfig} with exit status ${exitStatus}`);
|
|
155
165
|
const sourceFileToProjectMap = /* @__PURE__ */ new Map();
|
|
156
166
|
for (const project of projects) for (const fileName of project.parsedConfig.fileNames) sourceFileToProjectMap.set(fsSystem.resolvePath(fileName), project);
|
|
157
167
|
return sourceFileToProjectMap;
|
|
@@ -179,19 +189,19 @@ function collectProjectGraph(rootTsconfigPath, fsSystem, force, sourcemap) {
|
|
|
179
189
|
tsconfigPath,
|
|
180
190
|
parsedConfig
|
|
181
191
|
});
|
|
182
|
-
for (const ref of parsedConfig.projectReferences ?? []) stack.push(ts.resolveProjectReferencePath(ref));
|
|
192
|
+
for (const ref of parsedConfig.projectReferences ?? []) stack.push(ts$1.resolveProjectReferencePath(ref));
|
|
183
193
|
}
|
|
184
194
|
return projects;
|
|
185
195
|
}
|
|
186
196
|
function parseTsconfig(tsconfigPath, fsSystem) {
|
|
187
197
|
const diagnostics = [];
|
|
188
|
-
const parsedConfig = ts.getParsedCommandLineOfConfigFile(tsconfigPath, void 0, {
|
|
198
|
+
const parsedConfig = ts$1.getParsedCommandLineOfConfigFile(tsconfigPath, void 0, {
|
|
189
199
|
...fsSystem,
|
|
190
200
|
onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
191
201
|
diagnostics.push(diagnostic);
|
|
192
202
|
}
|
|
193
203
|
});
|
|
194
|
-
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)}`);
|
|
195
205
|
return parsedConfig;
|
|
196
206
|
}
|
|
197
207
|
function patchCompilerOptions(options, extraOptions) {
|
|
@@ -223,71 +233,10 @@ function patchCompilerOptions(options, extraOptions) {
|
|
|
223
233
|
return options;
|
|
224
234
|
}
|
|
225
235
|
const createProgramWithPatchedCompilerOptions = (rootNames, options, ...args) => {
|
|
226
|
-
return ts.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
|
|
236
|
+
return ts$1.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, null), ...args);
|
|
227
237
|
};
|
|
228
|
-
const debug$2 = createDebug("rolldown-plugin-dts:volar");
|
|
229
|
-
function loadVueLanguageTools() {
|
|
230
|
-
debug$2("loading vue language tools");
|
|
231
|
-
try {
|
|
232
|
-
const vueTscPath = __require.resolve("vue-tsc");
|
|
233
|
-
return {
|
|
234
|
-
volarTs: __require(__require.resolve("@volar/typescript", { paths: [vueTscPath] })),
|
|
235
|
-
vue: __require(__require.resolve("@vue/language-core", { paths: [vueTscPath] }))
|
|
236
|
-
};
|
|
237
|
-
} catch (error) {
|
|
238
|
-
debug$2("vue language tools not found", error);
|
|
239
|
-
throw new Error("Failed to load vue language tools. Please manually install vue-tsc.", { cause: error });
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
function initVueLanguageTools() {
|
|
243
|
-
const { vue, volarTs: { proxyCreateProgram } } = loadVueLanguageTools();
|
|
244
|
-
const getLanguagePlugin = (ts, options) => {
|
|
245
|
-
const $rootDir = options.options.$rootDir;
|
|
246
|
-
const $configRaw = options.options.$configRaw;
|
|
247
|
-
const resolver = new vue.CompilerOptionsResolver(ts, ts.sys.readFile);
|
|
248
|
-
resolver.addConfig($configRaw?.vueCompilerOptions ?? {}, $rootDir);
|
|
249
|
-
const vueOptions = resolver.build();
|
|
250
|
-
return vue.createVueLanguagePlugin(ts, options.options, vueOptions, (id) => id);
|
|
251
|
-
};
|
|
252
|
-
return {
|
|
253
|
-
proxyCreateProgram,
|
|
254
|
-
getLanguagePlugin
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
function initTsMacro() {
|
|
258
|
-
const debug = createDebug("rolldown-plugin-dts:ts-macro");
|
|
259
|
-
debug("loading ts-macro language tools");
|
|
260
|
-
try {
|
|
261
|
-
const tsMacroPath = __require.resolve("@ts-macro/tsc");
|
|
262
|
-
const { proxyCreateProgram } = __require(__require.resolve("@volar/typescript", { paths: [tsMacroPath] }));
|
|
263
|
-
const tsMacro = __require(__require.resolve("@ts-macro/language-plugin", { paths: [tsMacroPath] }));
|
|
264
|
-
const { getOptions } = __require(__require.resolve("@ts-macro/language-plugin/options", { paths: [tsMacroPath] }));
|
|
265
|
-
const getLanguagePlugin = (ts, options) => {
|
|
266
|
-
const $rootDir = options.options.$rootDir;
|
|
267
|
-
return tsMacro.getLanguagePlugins(ts, options.options, getOptions(ts, $rootDir))[0];
|
|
268
|
-
};
|
|
269
|
-
return {
|
|
270
|
-
proxyCreateProgram,
|
|
271
|
-
getLanguagePlugin
|
|
272
|
-
};
|
|
273
|
-
} catch (error) {
|
|
274
|
-
debug("ts-macro language tools not found", error);
|
|
275
|
-
throw new Error("Failed to load ts-macro language tools. Please manually install @ts-macro/tsc.", { cause: error });
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
function createProgramFactory(ts, options) {
|
|
279
|
-
const vueLanguageTools = options.vue ? initVueLanguageTools() : void 0;
|
|
280
|
-
const tsMacroLanguageTools = options.tsMacro ? initTsMacro() : void 0;
|
|
281
|
-
const proxyCreateProgram = vueLanguageTools?.proxyCreateProgram || tsMacroLanguageTools?.proxyCreateProgram;
|
|
282
|
-
if (!proxyCreateProgram) return ts.createProgram;
|
|
283
|
-
return proxyCreateProgram(ts, ts.createProgram, (ts, options) => {
|
|
284
|
-
const languagePlugins = [];
|
|
285
|
-
if (vueLanguageTools) languagePlugins.push(vueLanguageTools.getLanguagePlugin(ts, options));
|
|
286
|
-
if (tsMacroLanguageTools) languagePlugins.push(tsMacroLanguageTools.getLanguagePlugin(ts, options));
|
|
287
|
-
return { languagePlugins };
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
238
|
const debug$1 = createDebug("rolldown-plugin-dts:tsc-compiler");
|
|
239
|
+
const ts = requireTS();
|
|
291
240
|
const defaultCompilerOptions = {
|
|
292
241
|
declaration: true,
|
|
293
242
|
noEmit: false,
|
|
@@ -320,14 +269,10 @@ function createOrGetTsModule(options) {
|
|
|
320
269
|
context.programs.push(module.program);
|
|
321
270
|
return module;
|
|
322
271
|
}
|
|
323
|
-
function createTsProgram({ entries, id, tsconfig, tsconfigRaw,
|
|
272
|
+
function createTsProgram({ entries, id, tsconfig, tsconfigRaw, volarContext, cwd, context = globalContext }) {
|
|
324
273
|
const fsSystem = createFsSystem(context.files);
|
|
325
274
|
const baseDir = tsconfig ? path.dirname(tsconfig) : cwd;
|
|
326
|
-
const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir, void 0, void 0, void 0,
|
|
327
|
-
extension: "vue",
|
|
328
|
-
isMixedContent: true,
|
|
329
|
-
scriptKind: ts.ScriptKind.Deferred
|
|
330
|
-
}] : void 0);
|
|
275
|
+
const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir, void 0, void 0, void 0, volarContext.getExtraFileExtensions());
|
|
331
276
|
debug$1(`creating program for root project: ${baseDir}`);
|
|
332
277
|
return createTsProgramFromParsedConfig({
|
|
333
278
|
parsedConfig,
|
|
@@ -335,23 +280,20 @@ function createTsProgram({ entries, id, tsconfig, tsconfigRaw, vue, tsMacro, cwd
|
|
|
335
280
|
baseDir,
|
|
336
281
|
id,
|
|
337
282
|
entries,
|
|
338
|
-
|
|
339
|
-
tsMacro
|
|
283
|
+
volarContext
|
|
340
284
|
});
|
|
341
285
|
}
|
|
342
|
-
function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id, entries,
|
|
286
|
+
function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id, entries, volarContext }) {
|
|
343
287
|
const compilerOptions = {
|
|
344
288
|
...defaultCompilerOptions,
|
|
345
289
|
...parsedConfig.options,
|
|
346
290
|
$configRaw: parsedConfig.raw,
|
|
347
|
-
$rootDir: baseDir
|
|
291
|
+
$rootDir: baseDir,
|
|
292
|
+
...volarContext.plugins.length ? { allowNonTsExtensions: true } : void 0
|
|
348
293
|
};
|
|
349
294
|
const rootNames = [...new Set([id, ...entries || parsedConfig.fileNames].map((f) => fsSystem.resolvePath(f)))];
|
|
350
295
|
const host = ts.createCompilerHost(compilerOptions, true);
|
|
351
|
-
const program =
|
|
352
|
-
vue,
|
|
353
|
-
tsMacro
|
|
354
|
-
})({
|
|
296
|
+
const program = volarContext.getCreateProgram(ts)({
|
|
355
297
|
rootNames,
|
|
356
298
|
options: compilerOptions,
|
|
357
299
|
host,
|
|
@@ -404,7 +346,6 @@ function tscEmitCompiler(tscOptions) {
|
|
|
404
346
|
};
|
|
405
347
|
}
|
|
406
348
|
const debug = createDebug("rolldown-plugin-dts:tsc");
|
|
407
|
-
debug(`loaded typescript: ${ts.version}`);
|
|
408
349
|
function tscEmit(tscOptions) {
|
|
409
350
|
debug(`running tscEmit ${tscOptions.id}`);
|
|
410
351
|
if (tscOptions.build) return tscEmitBuild(tscOptions);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./internal-
|
|
1
|
+
import { A as __toESM, C as resolveComma, E as toArray, v as importWithError } from "./main-BdzlWPt6.js";
|
|
2
|
+
import { i as expandBaselineTarget } from "./target-CNxIDvSz-eoHNdJNs.js";
|
|
3
|
+
import "./internal-C7ewSPAZ.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.13_jiti@2.7.0_postcss-import@16.1.1_postcss@8.5.20__postcss@8.5.20_sas_3e4d0025e048aeda9bd895926fc2faf1/node_modules/@tsdown/css/dist/index.mjs
|
|
10
10
|
const defaultCssBundleName = "style.css";
|
|
11
11
|
function resolveCssOptions(options = {}, topLevelTarget, unbundle) {
|
|
12
12
|
let cssTarget;
|
|
@@ -124,7 +124,8 @@ const PREPROCESSOR_LANGS = {
|
|
|
124
124
|
stylus: "stylus"
|
|
125
125
|
};
|
|
126
126
|
function getPreprocessorLang(filename) {
|
|
127
|
-
|
|
127
|
+
const ext = path.extname(filename).slice(1);
|
|
128
|
+
return PREPROCESSOR_LANGS[ext];
|
|
128
129
|
}
|
|
129
130
|
function getPreprocessorLangFromId(id) {
|
|
130
131
|
const match = CSS_LANGS_RE.exec(id);
|
|
@@ -269,7 +270,7 @@ async function compileSass(lang, code, filename, options) {
|
|
|
269
270
|
};
|
|
270
271
|
}
|
|
271
272
|
};
|
|
272
|
-
const result = await sass.compileStringAsync(data, {
|
|
273
|
+
const result = await (await loadSassCompiler(sass)).compileStringAsync(data, {
|
|
273
274
|
url: pathToFileURL(filename),
|
|
274
275
|
sourceMap: false,
|
|
275
276
|
syntax: lang === "sass" ? "indented" : "scss",
|
|
@@ -307,6 +308,20 @@ async function tryResolveScss(url, importer) {
|
|
|
307
308
|
return resolveWithResolver(getSassResolver(), url, importer);
|
|
308
309
|
}
|
|
309
310
|
let _sass;
|
|
311
|
+
let _sassCompiler;
|
|
312
|
+
function loadSassCompiler(sass) {
|
|
313
|
+
if (!sass.initAsyncCompiler) return Promise.resolve(sass);
|
|
314
|
+
_sassCompiler ??= sass.initAsyncCompiler().catch((error) => {
|
|
315
|
+
_sassCompiler = void 0;
|
|
316
|
+
throw error;
|
|
317
|
+
});
|
|
318
|
+
return _sassCompiler;
|
|
319
|
+
}
|
|
320
|
+
async function disposeSassCompiler() {
|
|
321
|
+
const compilerPromise = _sassCompiler;
|
|
322
|
+
_sassCompiler = void 0;
|
|
323
|
+
await (await compilerPromise?.catch(() => void 0))?.dispose?.();
|
|
324
|
+
}
|
|
310
325
|
async function loadSass() {
|
|
311
326
|
if (_sass) return _sass;
|
|
312
327
|
try {
|
|
@@ -390,10 +405,13 @@ async function transformWithLightningCSS(code, filename, options) {
|
|
|
390
405
|
...options.lightningcss,
|
|
391
406
|
targets,
|
|
392
407
|
minify: options.minify,
|
|
393
|
-
cssModules: options.cssModules
|
|
408
|
+
cssModules: options.cssModules,
|
|
409
|
+
sourceMap: options.sourceMap,
|
|
410
|
+
inputSourceMap: options.inputSourceMap
|
|
394
411
|
});
|
|
395
412
|
return {
|
|
396
413
|
code: decoder.decode(result.code),
|
|
414
|
+
map: result.map ? decoder.decode(result.map) : void 0,
|
|
397
415
|
modules: result.exports ? extractLightningCssModuleExports(result.exports) : void 0
|
|
398
416
|
};
|
|
399
417
|
}
|
|
@@ -407,6 +425,7 @@ async function bundleWithLightningCSS(filename, options, code) {
|
|
|
407
425
|
targets,
|
|
408
426
|
minify: options.minify,
|
|
409
427
|
cssModules: options.cssModules,
|
|
428
|
+
sourceMap: options.sourceMap,
|
|
410
429
|
resolver: {
|
|
411
430
|
async read(filePath) {
|
|
412
431
|
let fileCode;
|
|
@@ -431,8 +450,9 @@ async function bundleWithLightningCSS(filename, options, code) {
|
|
|
431
450
|
}
|
|
432
451
|
});
|
|
433
452
|
return {
|
|
434
|
-
code:
|
|
453
|
+
code: decoder.decode(result.code),
|
|
435
454
|
deps,
|
|
455
|
+
map: result.map ? decoder.decode(result.map) : void 0,
|
|
436
456
|
modules: result.exports ? extractLightningCssModuleExports(result.exports) : void 0
|
|
437
457
|
};
|
|
438
458
|
}
|
|
@@ -447,7 +467,7 @@ const ESBUILD_LIGHTNINGCSS_MAPPING = {
|
|
|
447
467
|
safari: "safari"
|
|
448
468
|
};
|
|
449
469
|
function parseVersion(version) {
|
|
450
|
-
const [major, minor = 0, patch = 0] = version.split("-")[0].split(".").map((v) => Number.parseInt(v, 10));
|
|
470
|
+
const [major, minor = 0, patch = 0] = version.split("-", 1)[0].split(".").map((v) => Number.parseInt(v, 10));
|
|
451
471
|
if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) return null;
|
|
452
472
|
return major << 16 | minor << 8 | patch;
|
|
453
473
|
}
|
|
@@ -455,7 +475,8 @@ function esbuildTargetToLightningCSS(target) {
|
|
|
455
475
|
let targets;
|
|
456
476
|
const matches = [...target.join(" ").toLowerCase().matchAll(TARGET_REGEX)];
|
|
457
477
|
for (const match of matches) {
|
|
458
|
-
const
|
|
478
|
+
const name = match[1];
|
|
479
|
+
const browser = ESBUILD_LIGHTNINGCSS_MAPPING[name];
|
|
459
480
|
if (!browser) continue;
|
|
460
481
|
const version = match[2];
|
|
461
482
|
const versionInt = parseVersion(version);
|
|
@@ -585,7 +606,7 @@ async function loadFileConfig(searchPath) {
|
|
|
585
606
|
if (cached !== void 0) return cached;
|
|
586
607
|
const promise = (async () => {
|
|
587
608
|
try {
|
|
588
|
-
const postcssrc = (await import("./src-
|
|
609
|
+
const postcssrc = (await import("./src-BV-UJr_R.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1))).default;
|
|
589
610
|
const result = await postcssrc({}, searchPath);
|
|
590
611
|
return {
|
|
591
612
|
options: result.options,
|
|
@@ -611,7 +632,7 @@ function resolvePostCSSConfig(postcssOption, cwd) {
|
|
|
611
632
|
}
|
|
612
633
|
return loadFileConfig(typeof postcssOption === "string" ? postcssOption : cwd);
|
|
613
634
|
}
|
|
614
|
-
async function processWithPostCSS$1(code, filename, postcssOption, cwd, injectImport, modulesOptions) {
|
|
635
|
+
async function processWithPostCSS$1(code, filename, postcssOption, cwd, injectImport, modulesOptions, sourceMap) {
|
|
615
636
|
const config = await resolvePostCSSConfig(postcssOption, cwd);
|
|
616
637
|
const plugins = [];
|
|
617
638
|
let modules;
|
|
@@ -638,7 +659,12 @@ async function processWithPostCSS$1(code, filename, postcssOption, cwd, injectIm
|
|
|
638
659
|
const result = await (await importWithError("postcss")).default(plugins).process(code, {
|
|
639
660
|
...config?.options,
|
|
640
661
|
from: filename,
|
|
641
|
-
to: filename
|
|
662
|
+
to: filename,
|
|
663
|
+
map: sourceMap ? {
|
|
664
|
+
inline: false,
|
|
665
|
+
annotation: false,
|
|
666
|
+
prev: false
|
|
667
|
+
} : void 0
|
|
642
668
|
});
|
|
643
669
|
const deps = [];
|
|
644
670
|
for (const message of result.messages) if (message.type === "dependency") deps.push(message.file);
|
|
@@ -649,6 +675,7 @@ async function processWithPostCSS$1(code, filename, postcssOption, cwd, injectIm
|
|
|
649
675
|
return {
|
|
650
676
|
code: result.css,
|
|
651
677
|
deps,
|
|
678
|
+
map: result.map?.toString(),
|
|
652
679
|
modules
|
|
653
680
|
};
|
|
654
681
|
}
|
|
@@ -660,7 +687,8 @@ function CssPlugin(config, { logger }) {
|
|
|
660
687
|
const cssConfig = {
|
|
661
688
|
css: resolveCssOptions(config.css, config.target, config.unbundle),
|
|
662
689
|
cwd: config.cwd,
|
|
663
|
-
target: config.target
|
|
690
|
+
target: config.target,
|
|
691
|
+
sourceMap: Boolean(config.sourcemap)
|
|
664
692
|
};
|
|
665
693
|
const styles = /* @__PURE__ */ new Map();
|
|
666
694
|
const modulesMap = /* @__PURE__ */ new Map();
|
|
@@ -670,6 +698,12 @@ function CssPlugin(config, { logger }) {
|
|
|
670
698
|
styles.clear();
|
|
671
699
|
modulesMap.clear();
|
|
672
700
|
},
|
|
701
|
+
closeBundle() {
|
|
702
|
+
if (!this.meta.watchMode) return disposeSassCompiler();
|
|
703
|
+
},
|
|
704
|
+
closeWatcher() {
|
|
705
|
+
return disposeSassCompiler();
|
|
706
|
+
},
|
|
673
707
|
resolveId: {
|
|
674
708
|
filter: { id: RE_CSS_INLINE },
|
|
675
709
|
async handler(source, ...args) {
|
|
@@ -703,14 +737,17 @@ function CssPlugin(config, { logger }) {
|
|
|
703
737
|
const isModule = !RE_INLINE.test(id) && cssConfig.css.modules !== false && CSS_MODULE_RE.test(id);
|
|
704
738
|
const deps = [];
|
|
705
739
|
let modules;
|
|
740
|
+
let map;
|
|
706
741
|
if (cssConfig.css.transformer === "lightningcss") {
|
|
707
742
|
const result = await processWithLightningCSS(code, id, cleanId, deps, cssConfig, logger, isModule);
|
|
708
743
|
code = result.code;
|
|
709
744
|
modules = result.modules;
|
|
745
|
+
map = result.map;
|
|
710
746
|
} else {
|
|
711
747
|
const result = await processWithPostCSS(code, id, cleanId, deps, cssConfig, isModule);
|
|
712
748
|
code = result.code;
|
|
713
749
|
modules = result.modules;
|
|
750
|
+
map = result.map;
|
|
714
751
|
}
|
|
715
752
|
for (const dep of deps) this.addWatchFile(dep);
|
|
716
753
|
if (code.length && !code.endsWith("\n")) code += "\n";
|
|
@@ -720,7 +757,10 @@ function CssPlugin(config, { logger }) {
|
|
|
720
757
|
modulesConfig?.getJSON?.(cleanId, modules, cleanId);
|
|
721
758
|
modulesMap.set(id, modules);
|
|
722
759
|
}
|
|
723
|
-
return {
|
|
760
|
+
return {
|
|
761
|
+
code,
|
|
762
|
+
map: map ?? null
|
|
763
|
+
};
|
|
724
764
|
}
|
|
725
765
|
}
|
|
726
766
|
};
|
|
@@ -734,17 +774,20 @@ function CssPlugin(config, { logger }) {
|
|
|
734
774
|
const modules = modulesMap.get(id);
|
|
735
775
|
if (isInline) return {
|
|
736
776
|
code: `export default ${JSON.stringify(code)};`,
|
|
777
|
+
map: null,
|
|
737
778
|
moduleSideEffects: false,
|
|
738
779
|
moduleType: "js"
|
|
739
780
|
};
|
|
740
781
|
if (code.length) styles.set(id, code);
|
|
741
782
|
if (modules) return {
|
|
742
783
|
code: modulesToEsm(modules),
|
|
784
|
+
map: null,
|
|
743
785
|
moduleSideEffects: false,
|
|
744
786
|
moduleType: "js"
|
|
745
787
|
};
|
|
746
788
|
return {
|
|
747
789
|
code: "",
|
|
790
|
+
map: null,
|
|
748
791
|
moduleSideEffects: "no-treeshake",
|
|
749
792
|
moduleType: "js"
|
|
750
793
|
};
|
|
@@ -817,14 +860,16 @@ async function processWithLightningCSS(code, id, cleanId, deps, config, logger,
|
|
|
817
860
|
target: config.css.target,
|
|
818
861
|
lightningcss: config.css.lightningcss,
|
|
819
862
|
minify: config.css.minify,
|
|
820
|
-
cssModules
|
|
863
|
+
cssModules,
|
|
864
|
+
sourceMap: config.sourceMap
|
|
821
865
|
});
|
|
822
866
|
}
|
|
823
867
|
if (id !== cleanId && !RE_INLINE.test(id)) return transformWithLightningCSS(code, cleanId, {
|
|
824
868
|
target: config.css.target,
|
|
825
869
|
lightningcss: config.css.lightningcss,
|
|
826
870
|
minify: config.css.minify,
|
|
827
|
-
cssModules
|
|
871
|
+
cssModules,
|
|
872
|
+
sourceMap: config.sourceMap
|
|
828
873
|
});
|
|
829
874
|
if (RE_CSS.test(cleanId)) {
|
|
830
875
|
const bundleResult = await bundleWithLightningCSS(cleanId, {
|
|
@@ -833,11 +878,13 @@ async function processWithLightningCSS(code, id, cleanId, deps, config, logger,
|
|
|
833
878
|
minify: config.css.minify,
|
|
834
879
|
cssModules,
|
|
835
880
|
preprocessorOptions: config.css.preprocessorOptions,
|
|
881
|
+
sourceMap: config.sourceMap,
|
|
836
882
|
logger
|
|
837
883
|
}, code);
|
|
838
884
|
deps.push(...bundleResult.deps);
|
|
839
885
|
return {
|
|
840
886
|
code: bundleResult.code,
|
|
887
|
+
map: bundleResult.map,
|
|
841
888
|
modules: bundleResult.modules
|
|
842
889
|
};
|
|
843
890
|
}
|
|
@@ -855,15 +902,19 @@ async function processWithPostCSS(code, id, cleanId, deps, config, isModule) {
|
|
|
855
902
|
const postcssResult = await processWithPostCSS$1(code, cleanId, config.css.postcss, config.cwd, needInlineImport, isModule ? {
|
|
856
903
|
isModule: true,
|
|
857
904
|
config: modulesConfig
|
|
858
|
-
} : void 0);
|
|
905
|
+
} : void 0, config.sourceMap);
|
|
859
906
|
code = postcssResult.code;
|
|
860
907
|
deps.push(...postcssResult.deps);
|
|
908
|
+
const transformResult = await transformWithLightningCSS(code, cleanId, {
|
|
909
|
+
target: config.css.target,
|
|
910
|
+
lightningcss: config.css.lightningcss,
|
|
911
|
+
minify: config.css.minify,
|
|
912
|
+
sourceMap: config.sourceMap,
|
|
913
|
+
inputSourceMap: postcssResult.map
|
|
914
|
+
});
|
|
861
915
|
return {
|
|
862
|
-
code:
|
|
863
|
-
|
|
864
|
-
lightningcss: config.css.lightningcss,
|
|
865
|
-
minify: config.css.minify
|
|
866
|
-
})).code,
|
|
916
|
+
code: transformResult.code,
|
|
917
|
+
map: transformResult.map ?? postcssResult.map,
|
|
867
918
|
modules: postcssResult.modules
|
|
868
919
|
};
|
|
869
920
|
}
|