vite-plugin-qingkuai 1.0.18 → 1.0.20
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.cjs +16 -20
- package/dist/index.js +16 -20
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -295,39 +295,35 @@ function qingkuai() {
|
|
|
295
295
|
})
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
|
-
const inputMap = sourcemap ? {
|
|
299
|
-
version: 3,
|
|
300
|
-
sources: [id],
|
|
301
|
-
sourcesContent: [src],
|
|
302
|
-
mappings: compileRes.mappings
|
|
303
|
-
} : void 0;
|
|
304
|
-
const transformWithEsbuild = vite__namespace.transformWithEsbuild;
|
|
305
298
|
const transformWithOxc = vite__namespace.transformWithOxc;
|
|
306
|
-
const
|
|
299
|
+
const transformWithEsbuild = vite__namespace.transformWithEsbuild;
|
|
300
|
+
const tsCompileRes = await (transformWithOxc ?? transformWithEsbuild)(
|
|
307
301
|
compiledCode,
|
|
308
302
|
id,
|
|
309
303
|
{
|
|
310
304
|
sourcemap,
|
|
305
|
+
lang: "ts",
|
|
311
306
|
loader: "ts",
|
|
312
307
|
target: "esnext"
|
|
313
308
|
},
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
inputMap
|
|
323
|
-
) : null;
|
|
309
|
+
sourcemap ? {
|
|
310
|
+
version: 3,
|
|
311
|
+
names: [],
|
|
312
|
+
sources: [id],
|
|
313
|
+
sourcesContent: [src],
|
|
314
|
+
mappings: compileRes.mappings
|
|
315
|
+
} : void 0
|
|
316
|
+
);
|
|
324
317
|
if (!tsCompileRes) {
|
|
325
318
|
this.error("Current Vite runtime does not provide TypeScript transform APIs.");
|
|
326
319
|
}
|
|
327
320
|
if (!sourcemap) {
|
|
328
321
|
return tsCompileRes.code;
|
|
329
322
|
}
|
|
330
|
-
|
|
323
|
+
let transformedMap = tsCompileRes.map;
|
|
324
|
+
if (typeof tsCompileRes.map === "string") {
|
|
325
|
+
transformedMap = JSON.parse(tsCompileRes.map);
|
|
326
|
+
}
|
|
331
327
|
return {
|
|
332
328
|
code: tsCompileRes.code,
|
|
333
329
|
map: Object.assign(baseMap, {
|
|
@@ -335,7 +331,7 @@ function qingkuai() {
|
|
|
335
331
|
})
|
|
336
332
|
};
|
|
337
333
|
} catch (err) {
|
|
338
|
-
if (err.loc
|
|
334
|
+
if (err.loc && "start" in err.loc && "index" in err.loc.start) {
|
|
339
335
|
err.pos = err.loc.start.index, this.error(err);
|
|
340
336
|
} else {
|
|
341
337
|
this.error(
|
package/dist/index.js
CHANGED
|
@@ -274,39 +274,35 @@ function qingkuai() {
|
|
|
274
274
|
})
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
|
-
const inputMap = sourcemap ? {
|
|
278
|
-
version: 3,
|
|
279
|
-
sources: [id],
|
|
280
|
-
sourcesContent: [src],
|
|
281
|
-
mappings: compileRes.mappings
|
|
282
|
-
} : void 0;
|
|
283
|
-
const transformWithEsbuild = vite.transformWithEsbuild;
|
|
284
277
|
const transformWithOxc = vite.transformWithOxc;
|
|
285
|
-
const
|
|
278
|
+
const transformWithEsbuild = vite.transformWithEsbuild;
|
|
279
|
+
const tsCompileRes = await (transformWithOxc ?? transformWithEsbuild)(
|
|
286
280
|
compiledCode,
|
|
287
281
|
id,
|
|
288
282
|
{
|
|
289
283
|
sourcemap,
|
|
284
|
+
lang: "ts",
|
|
290
285
|
loader: "ts",
|
|
291
286
|
target: "esnext"
|
|
292
287
|
},
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
inputMap
|
|
302
|
-
) : null;
|
|
288
|
+
sourcemap ? {
|
|
289
|
+
version: 3,
|
|
290
|
+
names: [],
|
|
291
|
+
sources: [id],
|
|
292
|
+
sourcesContent: [src],
|
|
293
|
+
mappings: compileRes.mappings
|
|
294
|
+
} : void 0
|
|
295
|
+
);
|
|
303
296
|
if (!tsCompileRes) {
|
|
304
297
|
this.error("Current Vite runtime does not provide TypeScript transform APIs.");
|
|
305
298
|
}
|
|
306
299
|
if (!sourcemap) {
|
|
307
300
|
return tsCompileRes.code;
|
|
308
301
|
}
|
|
309
|
-
|
|
302
|
+
let transformedMap = tsCompileRes.map;
|
|
303
|
+
if (typeof tsCompileRes.map === "string") {
|
|
304
|
+
transformedMap = JSON.parse(tsCompileRes.map);
|
|
305
|
+
}
|
|
310
306
|
return {
|
|
311
307
|
code: tsCompileRes.code,
|
|
312
308
|
map: Object.assign(baseMap, {
|
|
@@ -314,7 +310,7 @@ function qingkuai() {
|
|
|
314
310
|
})
|
|
315
311
|
};
|
|
316
312
|
} catch (err) {
|
|
317
|
-
if (err.loc
|
|
313
|
+
if (err.loc && "start" in err.loc && "index" in err.loc.start) {
|
|
318
314
|
err.pos = err.loc.start.index, this.error(err);
|
|
319
315
|
} else {
|
|
320
316
|
this.error(
|