@danielx/civet 0.6.62 → 0.6.63
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/browser.js +9 -13
- package/dist/esbuild.js +18 -10
- package/dist/main.js +9 -13
- package/dist/main.mjs +9 -13
- package/dist/rollup.js +18 -10
- package/dist/unplugin-shared.mjs +18 -10
- package/dist/unplugin.js +18 -10
- package/dist/vite.js +18 -10
- package/dist/webpack.js +18 -10
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -2563,19 +2563,7 @@ ${input.slice(result.pos)}
|
|
|
2563
2563
|
const { initializer } = binding;
|
|
2564
2564
|
if (initializer) {
|
|
2565
2565
|
const exp = initializer[2];
|
|
2566
|
-
|
|
2567
|
-
if (exp.children.at(-2) === ",") {
|
|
2568
|
-
const { parent } = exp;
|
|
2569
|
-
const parenthesizedExpression = makeLeftHandSideExpression(exp);
|
|
2570
|
-
parenthesizedExpression.parent = parent;
|
|
2571
|
-
exp.parent = parenthesizedExpression;
|
|
2572
|
-
return initializer[2] = parenthesizedExpression;
|
|
2573
|
-
}
|
|
2574
|
-
;
|
|
2575
|
-
return;
|
|
2576
|
-
}
|
|
2577
|
-
;
|
|
2578
|
-
return;
|
|
2566
|
+
return exp;
|
|
2579
2567
|
}
|
|
2580
2568
|
;
|
|
2581
2569
|
return;
|
|
@@ -3316,6 +3304,14 @@ ${input.slice(result.pos)}
|
|
|
3316
3304
|
};
|
|
3317
3305
|
}
|
|
3318
3306
|
children.push(arg);
|
|
3307
|
+
if (!children.some(($3) => $3?.type === "ReturnStatement") && children.some(($4) => $4 === ",")) {
|
|
3308
|
+
const { parent } = s;
|
|
3309
|
+
const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
|
|
3310
|
+
Object.assign(s, parenthesizedExpression, {
|
|
3311
|
+
parent,
|
|
3312
|
+
hoistDec: void 0
|
|
3313
|
+
});
|
|
3314
|
+
}
|
|
3319
3315
|
return addParentPointers(s, s.parent);
|
|
3320
3316
|
});
|
|
3321
3317
|
}
|
package/dist/esbuild.js
CHANGED
|
@@ -90,7 +90,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
90
90
|
const implicitExtension = options.implicitExtension ?? true;
|
|
91
91
|
let fsMap = /* @__PURE__ */ new Map();
|
|
92
92
|
const sourceMaps = /* @__PURE__ */ new Map();
|
|
93
|
-
let compilerOptions;
|
|
93
|
+
let compilerOptions, compilerOptionsWithSourceMap;
|
|
94
94
|
let rootDir = process.cwd();
|
|
95
95
|
let esbuildOptions;
|
|
96
96
|
const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
|
|
@@ -128,6 +128,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
128
128
|
...configContents.options,
|
|
129
129
|
target: ts.ScriptTarget.ESNext
|
|
130
130
|
};
|
|
131
|
+
compilerOptionsWithSourceMap = {
|
|
132
|
+
...compilerOptions,
|
|
133
|
+
sourceMap: true
|
|
134
|
+
};
|
|
131
135
|
fsMap = /* @__PURE__ */ new Map();
|
|
132
136
|
}
|
|
133
137
|
},
|
|
@@ -235,7 +239,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
235
239
|
const filename = import_path.default.resolve(process.cwd(), id.slice(0, -outExt.length));
|
|
236
240
|
const rawCivetSource = await fs.promises.readFile(filename, "utf-8");
|
|
237
241
|
this.addWatchFile(filename);
|
|
238
|
-
let compiled
|
|
242
|
+
let compiled;
|
|
239
243
|
if (options.ts === "civet" && !transformTS) {
|
|
240
244
|
compiled = import_civet.default.compile(rawCivetSource, {
|
|
241
245
|
filename: id,
|
|
@@ -248,15 +252,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
248
252
|
js: false,
|
|
249
253
|
sourceMap: true
|
|
250
254
|
});
|
|
251
|
-
const resolved =
|
|
255
|
+
const resolved = filename + outExt;
|
|
252
256
|
sourceMaps.set(
|
|
253
257
|
resolved,
|
|
254
258
|
compiledTS.sourceMap
|
|
255
259
|
);
|
|
256
260
|
if (transformTS) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
const tsx = filename + ".tsx";
|
|
262
|
+
fsMap.set(tsx, compiledTS.code);
|
|
263
|
+
const slashed = slash(tsx);
|
|
264
|
+
if (tsx !== slashed)
|
|
260
265
|
fsMap.set(slashed, compiledTS.code);
|
|
261
266
|
}
|
|
262
267
|
switch (options.ts) {
|
|
@@ -273,10 +278,13 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
273
278
|
}
|
|
274
279
|
case "tsc": {
|
|
275
280
|
const tsTranspile = (await tsPromise).transpileModule;
|
|
276
|
-
const result = tsTranspile(
|
|
281
|
+
const result = tsTranspile(
|
|
282
|
+
compiledTS.code,
|
|
283
|
+
{ compilerOptions: compilerOptionsWithSourceMap }
|
|
284
|
+
);
|
|
277
285
|
compiled = {
|
|
278
286
|
code: result.outputText,
|
|
279
|
-
sourceMap: result.sourceMapText
|
|
287
|
+
sourceMap: result.sourceMapText
|
|
280
288
|
};
|
|
281
289
|
break;
|
|
282
290
|
}
|
|
@@ -300,10 +308,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
300
308
|
}
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
|
-
const jsonSourceMap = typeof compiled.sourceMap
|
|
311
|
+
const jsonSourceMap = compiled.sourceMap && (typeof compiled.sourceMap === "string" ? JSON.parse(compiled.sourceMap) : compiled.sourceMap.json(
|
|
304
312
|
import_path.default.basename(id.replace(/\.[jt]sx$/, "")),
|
|
305
313
|
import_path.default.basename(id)
|
|
306
|
-
);
|
|
314
|
+
));
|
|
307
315
|
let transformed = {
|
|
308
316
|
code: compiled.code,
|
|
309
317
|
map: jsonSourceMap
|
package/dist/main.js
CHANGED
|
@@ -2555,19 +2555,7 @@ var require_lib = __commonJS({
|
|
|
2555
2555
|
const { initializer } = binding;
|
|
2556
2556
|
if (initializer) {
|
|
2557
2557
|
const exp = initializer[2];
|
|
2558
|
-
|
|
2559
|
-
if (exp.children.at(-2) === ",") {
|
|
2560
|
-
const { parent } = exp;
|
|
2561
|
-
const parenthesizedExpression = makeLeftHandSideExpression(exp);
|
|
2562
|
-
parenthesizedExpression.parent = parent;
|
|
2563
|
-
exp.parent = parenthesizedExpression;
|
|
2564
|
-
return initializer[2] = parenthesizedExpression;
|
|
2565
|
-
}
|
|
2566
|
-
;
|
|
2567
|
-
return;
|
|
2568
|
-
}
|
|
2569
|
-
;
|
|
2570
|
-
return;
|
|
2558
|
+
return exp;
|
|
2571
2559
|
}
|
|
2572
2560
|
;
|
|
2573
2561
|
return;
|
|
@@ -3308,6 +3296,14 @@ var require_lib = __commonJS({
|
|
|
3308
3296
|
};
|
|
3309
3297
|
}
|
|
3310
3298
|
children.push(arg);
|
|
3299
|
+
if (!children.some(($3) => $3?.type === "ReturnStatement") && children.some(($4) => $4 === ",")) {
|
|
3300
|
+
const { parent } = s;
|
|
3301
|
+
const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
|
|
3302
|
+
Object.assign(s, parenthesizedExpression, {
|
|
3303
|
+
parent,
|
|
3304
|
+
hoistDec: void 0
|
|
3305
|
+
});
|
|
3306
|
+
}
|
|
3311
3307
|
return addParentPointers(s, s.parent);
|
|
3312
3308
|
});
|
|
3313
3309
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -2553,19 +2553,7 @@ var require_lib = __commonJS({
|
|
|
2553
2553
|
const { initializer } = binding;
|
|
2554
2554
|
if (initializer) {
|
|
2555
2555
|
const exp = initializer[2];
|
|
2556
|
-
|
|
2557
|
-
if (exp.children.at(-2) === ",") {
|
|
2558
|
-
const { parent } = exp;
|
|
2559
|
-
const parenthesizedExpression = makeLeftHandSideExpression(exp);
|
|
2560
|
-
parenthesizedExpression.parent = parent;
|
|
2561
|
-
exp.parent = parenthesizedExpression;
|
|
2562
|
-
return initializer[2] = parenthesizedExpression;
|
|
2563
|
-
}
|
|
2564
|
-
;
|
|
2565
|
-
return;
|
|
2566
|
-
}
|
|
2567
|
-
;
|
|
2568
|
-
return;
|
|
2556
|
+
return exp;
|
|
2569
2557
|
}
|
|
2570
2558
|
;
|
|
2571
2559
|
return;
|
|
@@ -3306,6 +3294,14 @@ var require_lib = __commonJS({
|
|
|
3306
3294
|
};
|
|
3307
3295
|
}
|
|
3308
3296
|
children.push(arg);
|
|
3297
|
+
if (!children.some(($3) => $3?.type === "ReturnStatement") && children.some(($4) => $4 === ",")) {
|
|
3298
|
+
const { parent } = s;
|
|
3299
|
+
const parenthesizedExpression = makeLeftHandSideExpression({ ...s });
|
|
3300
|
+
Object.assign(s, parenthesizedExpression, {
|
|
3301
|
+
parent,
|
|
3302
|
+
hoistDec: void 0
|
|
3303
|
+
});
|
|
3304
|
+
}
|
|
3309
3305
|
return addParentPointers(s, s.parent);
|
|
3310
3306
|
});
|
|
3311
3307
|
}
|
package/dist/rollup.js
CHANGED
|
@@ -90,7 +90,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
90
90
|
const implicitExtension = options.implicitExtension ?? true;
|
|
91
91
|
let fsMap = /* @__PURE__ */ new Map();
|
|
92
92
|
const sourceMaps = /* @__PURE__ */ new Map();
|
|
93
|
-
let compilerOptions;
|
|
93
|
+
let compilerOptions, compilerOptionsWithSourceMap;
|
|
94
94
|
let rootDir = process.cwd();
|
|
95
95
|
let esbuildOptions;
|
|
96
96
|
const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
|
|
@@ -128,6 +128,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
128
128
|
...configContents.options,
|
|
129
129
|
target: ts.ScriptTarget.ESNext
|
|
130
130
|
};
|
|
131
|
+
compilerOptionsWithSourceMap = {
|
|
132
|
+
...compilerOptions,
|
|
133
|
+
sourceMap: true
|
|
134
|
+
};
|
|
131
135
|
fsMap = /* @__PURE__ */ new Map();
|
|
132
136
|
}
|
|
133
137
|
},
|
|
@@ -235,7 +239,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
235
239
|
const filename = import_path.default.resolve(process.cwd(), id.slice(0, -outExt.length));
|
|
236
240
|
const rawCivetSource = await fs.promises.readFile(filename, "utf-8");
|
|
237
241
|
this.addWatchFile(filename);
|
|
238
|
-
let compiled
|
|
242
|
+
let compiled;
|
|
239
243
|
if (options.ts === "civet" && !transformTS) {
|
|
240
244
|
compiled = import_civet.default.compile(rawCivetSource, {
|
|
241
245
|
filename: id,
|
|
@@ -248,15 +252,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
248
252
|
js: false,
|
|
249
253
|
sourceMap: true
|
|
250
254
|
});
|
|
251
|
-
const resolved =
|
|
255
|
+
const resolved = filename + outExt;
|
|
252
256
|
sourceMaps.set(
|
|
253
257
|
resolved,
|
|
254
258
|
compiledTS.sourceMap
|
|
255
259
|
);
|
|
256
260
|
if (transformTS) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
const tsx = filename + ".tsx";
|
|
262
|
+
fsMap.set(tsx, compiledTS.code);
|
|
263
|
+
const slashed = slash(tsx);
|
|
264
|
+
if (tsx !== slashed)
|
|
260
265
|
fsMap.set(slashed, compiledTS.code);
|
|
261
266
|
}
|
|
262
267
|
switch (options.ts) {
|
|
@@ -273,10 +278,13 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
273
278
|
}
|
|
274
279
|
case "tsc": {
|
|
275
280
|
const tsTranspile = (await tsPromise).transpileModule;
|
|
276
|
-
const result = tsTranspile(
|
|
281
|
+
const result = tsTranspile(
|
|
282
|
+
compiledTS.code,
|
|
283
|
+
{ compilerOptions: compilerOptionsWithSourceMap }
|
|
284
|
+
);
|
|
277
285
|
compiled = {
|
|
278
286
|
code: result.outputText,
|
|
279
|
-
sourceMap: result.sourceMapText
|
|
287
|
+
sourceMap: result.sourceMapText
|
|
280
288
|
};
|
|
281
289
|
break;
|
|
282
290
|
}
|
|
@@ -300,10 +308,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
300
308
|
}
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
|
-
const jsonSourceMap = typeof compiled.sourceMap
|
|
311
|
+
const jsonSourceMap = compiled.sourceMap && (typeof compiled.sourceMap === "string" ? JSON.parse(compiled.sourceMap) : compiled.sourceMap.json(
|
|
304
312
|
import_path.default.basename(id.replace(/\.[jt]sx$/, "")),
|
|
305
313
|
import_path.default.basename(id)
|
|
306
|
-
);
|
|
314
|
+
));
|
|
307
315
|
let transformed = {
|
|
308
316
|
code: compiled.code,
|
|
309
317
|
map: jsonSourceMap
|
package/dist/unplugin-shared.mjs
CHANGED
|
@@ -57,7 +57,7 @@ var civetUnplugin = createUnplugin((options = {}, meta) => {
|
|
|
57
57
|
const implicitExtension = options.implicitExtension ?? true;
|
|
58
58
|
let fsMap = /* @__PURE__ */ new Map();
|
|
59
59
|
const sourceMaps = /* @__PURE__ */ new Map();
|
|
60
|
-
let compilerOptions;
|
|
60
|
+
let compilerOptions, compilerOptionsWithSourceMap;
|
|
61
61
|
let rootDir = process.cwd();
|
|
62
62
|
let esbuildOptions;
|
|
63
63
|
const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
|
|
@@ -95,6 +95,10 @@ var civetUnplugin = createUnplugin((options = {}, meta) => {
|
|
|
95
95
|
...configContents.options,
|
|
96
96
|
target: ts.ScriptTarget.ESNext
|
|
97
97
|
};
|
|
98
|
+
compilerOptionsWithSourceMap = {
|
|
99
|
+
...compilerOptions,
|
|
100
|
+
sourceMap: true
|
|
101
|
+
};
|
|
98
102
|
fsMap = /* @__PURE__ */ new Map();
|
|
99
103
|
}
|
|
100
104
|
},
|
|
@@ -202,7 +206,7 @@ var civetUnplugin = createUnplugin((options = {}, meta) => {
|
|
|
202
206
|
const filename = path.resolve(process.cwd(), id.slice(0, -outExt.length));
|
|
203
207
|
const rawCivetSource = await fs.promises.readFile(filename, "utf-8");
|
|
204
208
|
this.addWatchFile(filename);
|
|
205
|
-
let compiled
|
|
209
|
+
let compiled;
|
|
206
210
|
if (options.ts === "civet" && !transformTS) {
|
|
207
211
|
compiled = civet.compile(rawCivetSource, {
|
|
208
212
|
filename: id,
|
|
@@ -215,15 +219,16 @@ var civetUnplugin = createUnplugin((options = {}, meta) => {
|
|
|
215
219
|
js: false,
|
|
216
220
|
sourceMap: true
|
|
217
221
|
});
|
|
218
|
-
const resolved =
|
|
222
|
+
const resolved = filename + outExt;
|
|
219
223
|
sourceMaps.set(
|
|
220
224
|
resolved,
|
|
221
225
|
compiledTS.sourceMap
|
|
222
226
|
);
|
|
223
227
|
if (transformTS) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
228
|
+
const tsx = filename + ".tsx";
|
|
229
|
+
fsMap.set(tsx, compiledTS.code);
|
|
230
|
+
const slashed = slash(tsx);
|
|
231
|
+
if (tsx !== slashed)
|
|
227
232
|
fsMap.set(slashed, compiledTS.code);
|
|
228
233
|
}
|
|
229
234
|
switch (options.ts) {
|
|
@@ -240,10 +245,13 @@ var civetUnplugin = createUnplugin((options = {}, meta) => {
|
|
|
240
245
|
}
|
|
241
246
|
case "tsc": {
|
|
242
247
|
const tsTranspile = (await tsPromise).transpileModule;
|
|
243
|
-
const result = tsTranspile(
|
|
248
|
+
const result = tsTranspile(
|
|
249
|
+
compiledTS.code,
|
|
250
|
+
{ compilerOptions: compilerOptionsWithSourceMap }
|
|
251
|
+
);
|
|
244
252
|
compiled = {
|
|
245
253
|
code: result.outputText,
|
|
246
|
-
sourceMap: result.sourceMapText
|
|
254
|
+
sourceMap: result.sourceMapText
|
|
247
255
|
};
|
|
248
256
|
break;
|
|
249
257
|
}
|
|
@@ -267,10 +275,10 @@ var civetUnplugin = createUnplugin((options = {}, meta) => {
|
|
|
267
275
|
}
|
|
268
276
|
}
|
|
269
277
|
}
|
|
270
|
-
const jsonSourceMap = typeof compiled.sourceMap
|
|
278
|
+
const jsonSourceMap = compiled.sourceMap && (typeof compiled.sourceMap === "string" ? JSON.parse(compiled.sourceMap) : compiled.sourceMap.json(
|
|
271
279
|
path.basename(id.replace(/\.[jt]sx$/, "")),
|
|
272
280
|
path.basename(id)
|
|
273
|
-
);
|
|
281
|
+
));
|
|
274
282
|
let transformed = {
|
|
275
283
|
code: compiled.code,
|
|
276
284
|
map: jsonSourceMap
|
package/dist/unplugin.js
CHANGED
|
@@ -89,7 +89,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
89
89
|
const implicitExtension = options.implicitExtension ?? true;
|
|
90
90
|
let fsMap = /* @__PURE__ */ new Map();
|
|
91
91
|
const sourceMaps = /* @__PURE__ */ new Map();
|
|
92
|
-
let compilerOptions;
|
|
92
|
+
let compilerOptions, compilerOptionsWithSourceMap;
|
|
93
93
|
let rootDir = process.cwd();
|
|
94
94
|
let esbuildOptions;
|
|
95
95
|
const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
|
|
@@ -127,6 +127,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
127
127
|
...configContents.options,
|
|
128
128
|
target: ts.ScriptTarget.ESNext
|
|
129
129
|
};
|
|
130
|
+
compilerOptionsWithSourceMap = {
|
|
131
|
+
...compilerOptions,
|
|
132
|
+
sourceMap: true
|
|
133
|
+
};
|
|
130
134
|
fsMap = /* @__PURE__ */ new Map();
|
|
131
135
|
}
|
|
132
136
|
},
|
|
@@ -234,7 +238,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
234
238
|
const filename = import_path.default.resolve(process.cwd(), id.slice(0, -outExt.length));
|
|
235
239
|
const rawCivetSource = await fs.promises.readFile(filename, "utf-8");
|
|
236
240
|
this.addWatchFile(filename);
|
|
237
|
-
let compiled
|
|
241
|
+
let compiled;
|
|
238
242
|
if (options.ts === "civet" && !transformTS) {
|
|
239
243
|
compiled = import_civet.default.compile(rawCivetSource, {
|
|
240
244
|
filename: id,
|
|
@@ -247,15 +251,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
247
251
|
js: false,
|
|
248
252
|
sourceMap: true
|
|
249
253
|
});
|
|
250
|
-
const resolved =
|
|
254
|
+
const resolved = filename + outExt;
|
|
251
255
|
sourceMaps.set(
|
|
252
256
|
resolved,
|
|
253
257
|
compiledTS.sourceMap
|
|
254
258
|
);
|
|
255
259
|
if (transformTS) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
const tsx = filename + ".tsx";
|
|
261
|
+
fsMap.set(tsx, compiledTS.code);
|
|
262
|
+
const slashed = slash(tsx);
|
|
263
|
+
if (tsx !== slashed)
|
|
259
264
|
fsMap.set(slashed, compiledTS.code);
|
|
260
265
|
}
|
|
261
266
|
switch (options.ts) {
|
|
@@ -272,10 +277,13 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
272
277
|
}
|
|
273
278
|
case "tsc": {
|
|
274
279
|
const tsTranspile = (await tsPromise).transpileModule;
|
|
275
|
-
const result = tsTranspile(
|
|
280
|
+
const result = tsTranspile(
|
|
281
|
+
compiledTS.code,
|
|
282
|
+
{ compilerOptions: compilerOptionsWithSourceMap }
|
|
283
|
+
);
|
|
276
284
|
compiled = {
|
|
277
285
|
code: result.outputText,
|
|
278
|
-
sourceMap: result.sourceMapText
|
|
286
|
+
sourceMap: result.sourceMapText
|
|
279
287
|
};
|
|
280
288
|
break;
|
|
281
289
|
}
|
|
@@ -299,10 +307,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
299
307
|
}
|
|
300
308
|
}
|
|
301
309
|
}
|
|
302
|
-
const jsonSourceMap = typeof compiled.sourceMap
|
|
310
|
+
const jsonSourceMap = compiled.sourceMap && (typeof compiled.sourceMap === "string" ? JSON.parse(compiled.sourceMap) : compiled.sourceMap.json(
|
|
303
311
|
import_path.default.basename(id.replace(/\.[jt]sx$/, "")),
|
|
304
312
|
import_path.default.basename(id)
|
|
305
|
-
);
|
|
313
|
+
));
|
|
306
314
|
let transformed = {
|
|
307
315
|
code: compiled.code,
|
|
308
316
|
map: jsonSourceMap
|
package/dist/vite.js
CHANGED
|
@@ -90,7 +90,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
90
90
|
const implicitExtension = options.implicitExtension ?? true;
|
|
91
91
|
let fsMap = /* @__PURE__ */ new Map();
|
|
92
92
|
const sourceMaps = /* @__PURE__ */ new Map();
|
|
93
|
-
let compilerOptions;
|
|
93
|
+
let compilerOptions, compilerOptionsWithSourceMap;
|
|
94
94
|
let rootDir = process.cwd();
|
|
95
95
|
let esbuildOptions;
|
|
96
96
|
const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
|
|
@@ -128,6 +128,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
128
128
|
...configContents.options,
|
|
129
129
|
target: ts.ScriptTarget.ESNext
|
|
130
130
|
};
|
|
131
|
+
compilerOptionsWithSourceMap = {
|
|
132
|
+
...compilerOptions,
|
|
133
|
+
sourceMap: true
|
|
134
|
+
};
|
|
131
135
|
fsMap = /* @__PURE__ */ new Map();
|
|
132
136
|
}
|
|
133
137
|
},
|
|
@@ -235,7 +239,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
235
239
|
const filename = import_path.default.resolve(process.cwd(), id.slice(0, -outExt.length));
|
|
236
240
|
const rawCivetSource = await fs.promises.readFile(filename, "utf-8");
|
|
237
241
|
this.addWatchFile(filename);
|
|
238
|
-
let compiled
|
|
242
|
+
let compiled;
|
|
239
243
|
if (options.ts === "civet" && !transformTS) {
|
|
240
244
|
compiled = import_civet.default.compile(rawCivetSource, {
|
|
241
245
|
filename: id,
|
|
@@ -248,15 +252,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
248
252
|
js: false,
|
|
249
253
|
sourceMap: true
|
|
250
254
|
});
|
|
251
|
-
const resolved =
|
|
255
|
+
const resolved = filename + outExt;
|
|
252
256
|
sourceMaps.set(
|
|
253
257
|
resolved,
|
|
254
258
|
compiledTS.sourceMap
|
|
255
259
|
);
|
|
256
260
|
if (transformTS) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
const tsx = filename + ".tsx";
|
|
262
|
+
fsMap.set(tsx, compiledTS.code);
|
|
263
|
+
const slashed = slash(tsx);
|
|
264
|
+
if (tsx !== slashed)
|
|
260
265
|
fsMap.set(slashed, compiledTS.code);
|
|
261
266
|
}
|
|
262
267
|
switch (options.ts) {
|
|
@@ -273,10 +278,13 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
273
278
|
}
|
|
274
279
|
case "tsc": {
|
|
275
280
|
const tsTranspile = (await tsPromise).transpileModule;
|
|
276
|
-
const result = tsTranspile(
|
|
281
|
+
const result = tsTranspile(
|
|
282
|
+
compiledTS.code,
|
|
283
|
+
{ compilerOptions: compilerOptionsWithSourceMap }
|
|
284
|
+
);
|
|
277
285
|
compiled = {
|
|
278
286
|
code: result.outputText,
|
|
279
|
-
sourceMap: result.sourceMapText
|
|
287
|
+
sourceMap: result.sourceMapText
|
|
280
288
|
};
|
|
281
289
|
break;
|
|
282
290
|
}
|
|
@@ -300,10 +308,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
300
308
|
}
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
|
-
const jsonSourceMap = typeof compiled.sourceMap
|
|
311
|
+
const jsonSourceMap = compiled.sourceMap && (typeof compiled.sourceMap === "string" ? JSON.parse(compiled.sourceMap) : compiled.sourceMap.json(
|
|
304
312
|
import_path.default.basename(id.replace(/\.[jt]sx$/, "")),
|
|
305
313
|
import_path.default.basename(id)
|
|
306
|
-
);
|
|
314
|
+
));
|
|
307
315
|
let transformed = {
|
|
308
316
|
code: compiled.code,
|
|
309
317
|
map: jsonSourceMap
|
package/dist/webpack.js
CHANGED
|
@@ -90,7 +90,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
90
90
|
const implicitExtension = options.implicitExtension ?? true;
|
|
91
91
|
let fsMap = /* @__PURE__ */ new Map();
|
|
92
92
|
const sourceMaps = /* @__PURE__ */ new Map();
|
|
93
|
-
let compilerOptions;
|
|
93
|
+
let compilerOptions, compilerOptionsWithSourceMap;
|
|
94
94
|
let rootDir = process.cwd();
|
|
95
95
|
let esbuildOptions;
|
|
96
96
|
const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
|
|
@@ -128,6 +128,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
128
128
|
...configContents.options,
|
|
129
129
|
target: ts.ScriptTarget.ESNext
|
|
130
130
|
};
|
|
131
|
+
compilerOptionsWithSourceMap = {
|
|
132
|
+
...compilerOptions,
|
|
133
|
+
sourceMap: true
|
|
134
|
+
};
|
|
131
135
|
fsMap = /* @__PURE__ */ new Map();
|
|
132
136
|
}
|
|
133
137
|
},
|
|
@@ -235,7 +239,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
235
239
|
const filename = import_path.default.resolve(process.cwd(), id.slice(0, -outExt.length));
|
|
236
240
|
const rawCivetSource = await fs.promises.readFile(filename, "utf-8");
|
|
237
241
|
this.addWatchFile(filename);
|
|
238
|
-
let compiled
|
|
242
|
+
let compiled;
|
|
239
243
|
if (options.ts === "civet" && !transformTS) {
|
|
240
244
|
compiled = import_civet.default.compile(rawCivetSource, {
|
|
241
245
|
filename: id,
|
|
@@ -248,15 +252,16 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
248
252
|
js: false,
|
|
249
253
|
sourceMap: true
|
|
250
254
|
});
|
|
251
|
-
const resolved =
|
|
255
|
+
const resolved = filename + outExt;
|
|
252
256
|
sourceMaps.set(
|
|
253
257
|
resolved,
|
|
254
258
|
compiledTS.sourceMap
|
|
255
259
|
);
|
|
256
260
|
if (transformTS) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
const tsx = filename + ".tsx";
|
|
262
|
+
fsMap.set(tsx, compiledTS.code);
|
|
263
|
+
const slashed = slash(tsx);
|
|
264
|
+
if (tsx !== slashed)
|
|
260
265
|
fsMap.set(slashed, compiledTS.code);
|
|
261
266
|
}
|
|
262
267
|
switch (options.ts) {
|
|
@@ -273,10 +278,13 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
273
278
|
}
|
|
274
279
|
case "tsc": {
|
|
275
280
|
const tsTranspile = (await tsPromise).transpileModule;
|
|
276
|
-
const result = tsTranspile(
|
|
281
|
+
const result = tsTranspile(
|
|
282
|
+
compiledTS.code,
|
|
283
|
+
{ compilerOptions: compilerOptionsWithSourceMap }
|
|
284
|
+
);
|
|
277
285
|
compiled = {
|
|
278
286
|
code: result.outputText,
|
|
279
|
-
sourceMap: result.sourceMapText
|
|
287
|
+
sourceMap: result.sourceMapText
|
|
280
288
|
};
|
|
281
289
|
break;
|
|
282
290
|
}
|
|
@@ -300,10 +308,10 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}, meta) =>
|
|
|
300
308
|
}
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
|
-
const jsonSourceMap = typeof compiled.sourceMap
|
|
311
|
+
const jsonSourceMap = compiled.sourceMap && (typeof compiled.sourceMap === "string" ? JSON.parse(compiled.sourceMap) : compiled.sourceMap.json(
|
|
304
312
|
import_path.default.basename(id.replace(/\.[jt]sx$/, "")),
|
|
305
313
|
import_path.default.basename(id)
|
|
306
|
-
);
|
|
314
|
+
));
|
|
307
315
|
let transformed = {
|
|
308
316
|
code: compiled.code,
|
|
309
317
|
map: jsonSourceMap
|