vite-plugin-qingkuai 1.0.18 → 1.0.19

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 CHANGED
@@ -295,15 +295,9 @@ 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 tsCompileRes = transformWithEsbuild ? await transformWithEsbuild(
299
+ const transformWithEsbuild = vite__namespace.transformWithEsbuild;
300
+ const tsCompileRes = await (transformWithOxc ?? transformWithEsbuild)(
307
301
  compiledCode,
308
302
  id,
309
303
  {
@@ -311,23 +305,23 @@ function qingkuai() {
311
305
  loader: "ts",
312
306
  target: "esnext"
313
307
  },
314
- inputMap
315
- ) : transformWithOxc ? await transformWithOxc(
316
- compiledCode,
317
- id,
318
- {
319
- sourcemap,
320
- target: "esnext"
321
- },
322
- inputMap
323
- ) : null;
308
+ sourcemap ? {
309
+ version: 3,
310
+ sources: [id],
311
+ sourcesContent: [src],
312
+ mappings: compileRes.mappings
313
+ } : void 0
314
+ );
324
315
  if (!tsCompileRes) {
325
316
  this.error("Current Vite runtime does not provide TypeScript transform APIs.");
326
317
  }
327
318
  if (!sourcemap) {
328
319
  return tsCompileRes.code;
329
320
  }
330
- const transformedMap = typeof tsCompileRes.map === "string" ? JSON.parse(tsCompileRes.map) : tsCompileRes.map;
321
+ let transformedMap = tsCompileRes.map;
322
+ if (typeof tsCompileRes.map === "string") {
323
+ transformedMap = JSON.parse(tsCompileRes.map);
324
+ }
331
325
  return {
332
326
  code: tsCompileRes.code,
333
327
  map: Object.assign(baseMap, {
package/dist/index.js CHANGED
@@ -274,15 +274,9 @@ 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 tsCompileRes = transformWithEsbuild ? await transformWithEsbuild(
278
+ const transformWithEsbuild = vite.transformWithEsbuild;
279
+ const tsCompileRes = await (transformWithOxc ?? transformWithEsbuild)(
286
280
  compiledCode,
287
281
  id,
288
282
  {
@@ -290,23 +284,23 @@ function qingkuai() {
290
284
  loader: "ts",
291
285
  target: "esnext"
292
286
  },
293
- inputMap
294
- ) : transformWithOxc ? await transformWithOxc(
295
- compiledCode,
296
- id,
297
- {
298
- sourcemap,
299
- target: "esnext"
300
- },
301
- inputMap
302
- ) : null;
287
+ sourcemap ? {
288
+ version: 3,
289
+ sources: [id],
290
+ sourcesContent: [src],
291
+ mappings: compileRes.mappings
292
+ } : void 0
293
+ );
303
294
  if (!tsCompileRes) {
304
295
  this.error("Current Vite runtime does not provide TypeScript transform APIs.");
305
296
  }
306
297
  if (!sourcemap) {
307
298
  return tsCompileRes.code;
308
299
  }
309
- const transformedMap = typeof tsCompileRes.map === "string" ? JSON.parse(tsCompileRes.map) : tsCompileRes.map;
300
+ let transformedMap = tsCompileRes.map;
301
+ if (typeof tsCompileRes.map === "string") {
302
+ transformedMap = JSON.parse(tsCompileRes.map);
303
+ }
310
304
  return {
311
305
  code: tsCompileRes.code,
312
306
  map: Object.assign(baseMap, {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vite-plugin-qingkuai",
3
3
  "author": "mlgq",
4
4
  "license": "MIT",
5
- "version": "1.0.18",
5
+ "version": "1.0.19",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "vite",