@danielx/civet 0.9.0 → 0.9.2
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/CHANGELOG.md +11 -0
- package/dist/babel-plugin.js +6 -7
- package/dist/babel-plugin.mjs +3 -3
- package/dist/browser.js +4606 -9813
- package/dist/civet +11 -10
- package/dist/config.js +6 -7
- package/dist/config.mjs +3 -3
- package/dist/esbuild-plugin.js +6 -7
- package/dist/esm.mjs +1 -1
- package/dist/main.js +1151 -1135
- package/dist/main.mjs +1153 -1130
- package/dist/node-worker.mjs +29 -0
- package/dist/ts-diagnostic.js +5 -8
- package/dist/ts-diagnostic.mjs +2 -4
- package/dist/types.d.ts +4 -0
- package/dist/unplugin/unplugin.d.ts +2 -0
- package/dist/unplugin/unplugin.js +135 -130
- package/dist/unplugin/unplugin.mjs +135 -130
- package/package.json +6 -6
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// unplugin-civet:C:\Users\edemaine\Projects\Civet\source\node-worker.civet.jsx
|
|
2
|
+
import { parentPort } from "node:worker_threads";
|
|
3
|
+
import module from "node:module";
|
|
4
|
+
try {
|
|
5
|
+
module.enableCompileCache();
|
|
6
|
+
} catch (e) {
|
|
7
|
+
}
|
|
8
|
+
(async () => {
|
|
9
|
+
{
|
|
10
|
+
const { compile } = await import("./main.mjs");
|
|
11
|
+
return parentPort.on("message", async ({ id, op, args }) => {
|
|
12
|
+
try {
|
|
13
|
+
let result;
|
|
14
|
+
switch (op) {
|
|
15
|
+
case "compile": {
|
|
16
|
+
result = await compile(...args);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
default: {
|
|
20
|
+
throw `Unknown operation: ${op}`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return parentPort.postMessage({ id, result });
|
|
24
|
+
} catch (error) {
|
|
25
|
+
return parentPort.postMessage({ id, error });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
})();
|
package/dist/ts-diagnostic.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -16,20 +15,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
18
|
+
var ts_diagnostic_civet_exports = {};
|
|
19
|
+
__export(ts_diagnostic_civet_exports, {
|
|
21
20
|
flattenDiagnosticMessageText: () => flattenDiagnosticMessageText,
|
|
22
21
|
remapPosition: () => remapPosition,
|
|
23
22
|
remapRange: () => remapRange
|
|
24
23
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(ts_diagnostic_civet_exports);
|
|
26
25
|
function remapPosition(position, sourcemapLines) {
|
|
27
|
-
if (!sourcemapLines)
|
|
28
|
-
return position;
|
|
26
|
+
if (!sourcemapLines) return position;
|
|
29
27
|
const { line, character } = position;
|
|
30
28
|
const textLine = sourcemapLines[line];
|
|
31
|
-
if (!textLine?.length)
|
|
32
|
-
return position;
|
|
29
|
+
if (!textLine?.length) return position;
|
|
33
30
|
let i = 0, p = 0, l = textLine.length, lastMapping, lastMappingPosition = 0;
|
|
34
31
|
while (i < l) {
|
|
35
32
|
const mapping = textLine[i];
|
package/dist/ts-diagnostic.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
function remapPosition(position, sourcemapLines) {
|
|
2
|
-
if (!sourcemapLines)
|
|
3
|
-
return position;
|
|
2
|
+
if (!sourcemapLines) return position;
|
|
4
3
|
const { line, character } = position;
|
|
5
4
|
const textLine = sourcemapLines[line];
|
|
6
|
-
if (!textLine?.length)
|
|
7
|
-
return position;
|
|
5
|
+
if (!textLine?.length) return position;
|
|
8
6
|
let i = 0, p = 0, l = textLine.length, lastMapping, lastMappingPosition = 0;
|
|
9
7
|
while (i < l) {
|
|
10
8
|
const mapping = textLine[i];
|
package/dist/types.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ declare module "@danielx/civet" {
|
|
|
49
49
|
hits?: string
|
|
50
50
|
trace?: string
|
|
51
51
|
parseOptions?: ParseOptions
|
|
52
|
+
/** Specifying an empty array will prevent ParseErrors from being thrown */
|
|
53
|
+
errors?: ParseError[]
|
|
54
|
+
/** Number of parallel threads to compile with (Node only) */
|
|
55
|
+
threads?: number
|
|
52
56
|
}
|
|
53
57
|
export type GenerateOptions = Omit<CompileOptions, "sourceMap"> & {
|
|
54
58
|
sourceMap?: undefined | SourceMap
|
|
@@ -12,6 +12,8 @@ export type PluginOptions = {
|
|
|
12
12
|
js?: boolean;
|
|
13
13
|
/** @deprecated Use "emitDeclaration" instead */
|
|
14
14
|
dts?: boolean;
|
|
15
|
+
/** Number of parallel threads to compile with (Node only) */
|
|
16
|
+
threads?: number;
|
|
15
17
|
/** Cache compilation results based on file mtime (useful for serve or watch mode) */
|
|
16
18
|
cache?: boolean;
|
|
17
19
|
/** config filename, or null to not look for default config file */
|
|
@@ -53,7 +53,7 @@ DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
|
|
|
53
53
|
DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
|
|
54
54
|
DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
|
|
55
55
|
var civetExtension = /\.civet$/;
|
|
56
|
-
var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
|
|
56
|
+
var isCivetTranspiled = /(\.civet)(\.[jt]sx)?([?#].*)?$/;
|
|
57
57
|
var postfixRE = /[?#].*$/s;
|
|
58
58
|
var isWindows = import_os.default.platform() === "win32";
|
|
59
59
|
var windowsSlashRE = /\\/g;
|
|
@@ -102,12 +102,10 @@ function implicitCivet(file) {
|
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
var rawPlugin = (options = {}, meta) => {
|
|
105
|
-
if (options.dts)
|
|
106
|
-
options.emitDeclaration = options.dts;
|
|
105
|
+
if (options.dts) options.emitDeclaration = options.dts;
|
|
107
106
|
let compileOptions = {};
|
|
108
107
|
let ts = options.ts;
|
|
109
|
-
if (options.js)
|
|
110
|
-
ts = "civet";
|
|
108
|
+
if (options.js) ts = "civet";
|
|
111
109
|
if (!(ts != null)) {
|
|
112
110
|
console.log('WARNING: You are using the default mode for `options.ts` which is `"civet"`. This mode does not support all TS features. If this is intentional, you should explicitly set `options.ts` to `"civet"`, or choose a different mode.');
|
|
113
111
|
ts = "civet";
|
|
@@ -142,7 +140,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
142
140
|
getCanonicalFileName: sys.useCaseSensitiveFileNames ? (f) => f : (f) => f.toLowerCase()
|
|
143
141
|
};
|
|
144
142
|
};
|
|
145
|
-
const cache = options.cache ? /* @__PURE__ */ new Map() : void 0;
|
|
143
|
+
const cache = !(options.cache === false) ? /* @__PURE__ */ new Map() : void 0;
|
|
146
144
|
const plugin = {
|
|
147
145
|
name: "unplugin-civet",
|
|
148
146
|
enforce: "pre",
|
|
@@ -155,6 +153,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
155
153
|
...compileOptions.parseOptions,
|
|
156
154
|
...options.parseOptions
|
|
157
155
|
};
|
|
156
|
+
if (options.threads != null) {
|
|
157
|
+
compileOptions.threads = options.threads;
|
|
158
|
+
}
|
|
158
159
|
if (transformTS || ts === "tsc") {
|
|
159
160
|
let mogrify = function(key) {
|
|
160
161
|
if (key in config && Array.isArray(config[key])) {
|
|
@@ -218,10 +219,8 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
218
219
|
readDirectory: systemReadDirectory
|
|
219
220
|
} = system;
|
|
220
221
|
system.fileExists = (filename) => {
|
|
221
|
-
if (!filename.endsWith(".civet.tsx"))
|
|
222
|
-
|
|
223
|
-
if (fsMap.has(filename))
|
|
224
|
-
return true;
|
|
222
|
+
if (!filename.endsWith(".civet.tsx")) return systemFileExists(filename);
|
|
223
|
+
if (fsMap.has(filename)) return true;
|
|
225
224
|
return systemFileExists(filename.slice(0, -4));
|
|
226
225
|
};
|
|
227
226
|
system.readDirectory = (path2) => {
|
|
@@ -258,10 +257,8 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
258
257
|
recurse(parsed.imports);
|
|
259
258
|
return modified ? JSON.stringify(parsed) : json;
|
|
260
259
|
}
|
|
261
|
-
if (!filename.endsWith(".civet.tsx"))
|
|
262
|
-
|
|
263
|
-
if (fsMap.has(filename))
|
|
264
|
-
return fsMap.get(filename);
|
|
260
|
+
if (!filename.endsWith(".civet.tsx")) return systemReadFile(filename, encoding);
|
|
261
|
+
if (fsMap.has(filename)) return fsMap.get(filename);
|
|
265
262
|
const civetFilename = filename.slice(0, -4);
|
|
266
263
|
const rawCivetSource = fs.readFileSync(civetFilename, {
|
|
267
264
|
encoding
|
|
@@ -290,11 +287,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
290
287
|
});
|
|
291
288
|
const diagnostics = ts2.getPreEmitDiagnostics(program).map((diagnostic) => {
|
|
292
289
|
const file = diagnostic.file;
|
|
293
|
-
if (!file)
|
|
294
|
-
return diagnostic;
|
|
290
|
+
if (!file) return diagnostic;
|
|
295
291
|
const sourceMap = sourceMaps.get(file.fileName);
|
|
296
|
-
if (!sourceMap)
|
|
297
|
-
return diagnostic;
|
|
292
|
+
if (!sourceMap) return diagnostic;
|
|
298
293
|
const sourcemapLines = sourceMap.data.lines;
|
|
299
294
|
const range = (0, import_ts_diagnostic.remapRange)(
|
|
300
295
|
{
|
|
@@ -323,14 +318,10 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
323
318
|
if (options.typecheck) {
|
|
324
319
|
let failures = [];
|
|
325
320
|
if (typeof options.typecheck === "string") {
|
|
326
|
-
if (options.typecheck.includes("error"))
|
|
327
|
-
|
|
328
|
-
if (options.typecheck.includes("
|
|
329
|
-
|
|
330
|
-
if (options.typecheck.includes("suggestion"))
|
|
331
|
-
failures.push(DiagnosticCategory.Suggestion);
|
|
332
|
-
if (options.typecheck.includes("message"))
|
|
333
|
-
failures.push(DiagnosticCategory.Message);
|
|
321
|
+
if (options.typecheck.includes("error")) failures.push(DiagnosticCategory.Error);
|
|
322
|
+
if (options.typecheck.includes("warning")) failures.push(DiagnosticCategory.Warning);
|
|
323
|
+
if (options.typecheck.includes("suggestion")) failures.push(DiagnosticCategory.Suggestion);
|
|
324
|
+
if (options.typecheck.includes("message")) failures.push(DiagnosticCategory.Message);
|
|
334
325
|
if (options.typecheck.includes("all")) {
|
|
335
326
|
failures = { includes: () => true };
|
|
336
327
|
}
|
|
@@ -383,7 +374,9 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
383
374
|
import_path.default.dirname(
|
|
384
375
|
import_path.default.resolve(esbuildOptions.outdir, pathFromDistDir)
|
|
385
376
|
),
|
|
386
|
-
{
|
|
377
|
+
{
|
|
378
|
+
recursive: true
|
|
379
|
+
}
|
|
387
380
|
);
|
|
388
381
|
}
|
|
389
382
|
return this.emitFile({
|
|
@@ -408,8 +401,7 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
408
401
|
if (aliasResolver != null) {
|
|
409
402
|
id = aliasResolver(id);
|
|
410
403
|
}
|
|
411
|
-
if (/\0/.test(id))
|
|
412
|
-
return null;
|
|
404
|
+
if (/\0/.test(id)) return null;
|
|
413
405
|
if (plugin.__virtualModulePrefix && importer?.startsWith(plugin.__virtualModulePrefix)) {
|
|
414
406
|
importer = decodeURIComponent(importer.slice(plugin.__virtualModulePrefix.length));
|
|
415
407
|
}
|
|
@@ -423,14 +415,11 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
423
415
|
}
|
|
424
416
|
;
|
|
425
417
|
let resolvedId = ref2;
|
|
426
|
-
if (!resolvedId)
|
|
427
|
-
return null;
|
|
418
|
+
if (!resolvedId) return null;
|
|
428
419
|
if (!resolvedId.endsWith(".civet")) {
|
|
429
|
-
if (!implicitExtension)
|
|
430
|
-
return null;
|
|
420
|
+
if (!implicitExtension) return null;
|
|
431
421
|
const implicitId = implicitCivet(resolvedId);
|
|
432
|
-
if (!implicitId)
|
|
433
|
-
return null;
|
|
422
|
+
if (!implicitId) return null;
|
|
434
423
|
resolvedId = implicitId;
|
|
435
424
|
}
|
|
436
425
|
if (options2.scan && meta.framework === "vite") {
|
|
@@ -448,114 +437,130 @@ var rawPlugin = (options = {}, meta) => {
|
|
|
448
437
|
}
|
|
449
438
|
const basename = id.slice(0, match.index + match[1].length);
|
|
450
439
|
const filename = import_path.default.resolve(rootDir, basename);
|
|
451
|
-
let mtime;
|
|
452
|
-
if (cache) {
|
|
440
|
+
let mtime, cached, resolve;
|
|
441
|
+
if (cache != null) {
|
|
453
442
|
mtime = (await fs.promises.stat(filename)).mtimeMs;
|
|
454
|
-
|
|
443
|
+
cached = cache?.get(filename);
|
|
455
444
|
if (cached && cached.mtime === mtime) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
let sourceMap;
|
|
463
|
-
const civetOptions = {
|
|
464
|
-
...compileOptions,
|
|
465
|
-
filename: id,
|
|
466
|
-
errors: []
|
|
467
|
-
};
|
|
468
|
-
function checkErrors() {
|
|
469
|
-
if (civetOptions.errors.length) {
|
|
470
|
-
throw new import_civet.default.ParseErrors(civetOptions.errors);
|
|
445
|
+
if (cached.promise) {
|
|
446
|
+
await cached.promise;
|
|
447
|
+
}
|
|
448
|
+
if (cached.result) {
|
|
449
|
+
return cached.result;
|
|
450
|
+
}
|
|
471
451
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
const ast = await import_civet.default.compile(rawCivetSource, {
|
|
476
|
-
...civetOptions,
|
|
477
|
-
ast: true
|
|
478
|
-
});
|
|
479
|
-
const civetSourceMap = (0, import_civet.SourceMap)(rawCivetSource);
|
|
480
|
-
if (ts === "civet") {
|
|
481
|
-
compiled = await import_civet.default.generate(ast, {
|
|
482
|
-
...civetOptions,
|
|
483
|
-
js: true,
|
|
484
|
-
sourceMap: civetSourceMap
|
|
452
|
+
const promise = new Promise((r) => {
|
|
453
|
+
resolve = r;
|
|
485
454
|
});
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
455
|
+
cache.set(filename, cached = { mtime, promise });
|
|
456
|
+
}
|
|
457
|
+
try {
|
|
458
|
+
let checkErrors = function() {
|
|
459
|
+
if (civetOptions.errors.length) {
|
|
460
|
+
throw new import_civet.default.ParseErrors(civetOptions.errors);
|
|
461
|
+
}
|
|
462
|
+
;
|
|
463
|
+
return;
|
|
464
|
+
};
|
|
465
|
+
this.addWatchFile(filename);
|
|
466
|
+
let compiled;
|
|
467
|
+
let sourceMap;
|
|
468
|
+
const civetOptions = {
|
|
469
|
+
...compileOptions,
|
|
470
|
+
filename: id,
|
|
471
|
+
errors: []
|
|
472
|
+
};
|
|
473
|
+
const rawCivetSource = await fs.promises.readFile(filename, "utf-8");
|
|
474
|
+
const ast = await import_civet.default.compile(rawCivetSource, {
|
|
490
475
|
...civetOptions,
|
|
491
|
-
|
|
492
|
-
sourceMap: civetSourceMap
|
|
476
|
+
ast: true
|
|
493
477
|
});
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
478
|
+
const civetSourceMap = (0, import_civet.SourceMap)(rawCivetSource);
|
|
479
|
+
if (ts === "civet") {
|
|
480
|
+
compiled = await import_civet.default.generate(ast, {
|
|
481
|
+
...civetOptions,
|
|
482
|
+
js: true,
|
|
483
|
+
sourceMap: civetSourceMap
|
|
484
|
+
});
|
|
485
|
+
sourceMap = civetSourceMap;
|
|
486
|
+
checkErrors();
|
|
487
|
+
} else {
|
|
488
|
+
const compiledTS = await import_civet.default.generate(ast, {
|
|
489
|
+
...civetOptions,
|
|
490
|
+
js: false,
|
|
491
|
+
sourceMap: civetSourceMap
|
|
492
|
+
});
|
|
493
|
+
checkErrors();
|
|
494
|
+
switch (ts) {
|
|
495
|
+
case "esbuild": {
|
|
496
|
+
const esbuildTransform = (await import("esbuild")).transform;
|
|
497
|
+
const result = await esbuildTransform(compiledTS, {
|
|
498
|
+
jsx: "preserve",
|
|
499
|
+
loader: "tsx",
|
|
500
|
+
sourcefile: id,
|
|
501
|
+
sourcemap: "external"
|
|
502
|
+
});
|
|
503
|
+
compiled = result.code;
|
|
504
|
+
sourceMap = result.map;
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
case "tsc": {
|
|
508
|
+
const tsTranspile = (await tsPromise).transpileModule;
|
|
509
|
+
const result = tsTranspile(compiledTS, {
|
|
510
|
+
compilerOptions: compilerOptionsWithSourceMap
|
|
511
|
+
});
|
|
512
|
+
compiled = result.outputText;
|
|
513
|
+
sourceMap = result.sourceMapText;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
case "preserve": {
|
|
517
|
+
compiled = compiledTS;
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
507
520
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
521
|
+
}
|
|
522
|
+
if (transformTS) {
|
|
523
|
+
for (let ref3 = import_civet.lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref3.length; i < len; i++) {
|
|
524
|
+
const _spec = ref3[i];
|
|
525
|
+
const spec = _spec;
|
|
526
|
+
if (spec.module?.input) {
|
|
527
|
+
spec.module.token = spec.module.input.replace(/\.([mc])?ts(['"])$/, ".$1js$2");
|
|
528
|
+
}
|
|
516
529
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
530
|
+
const compiledTS = await import_civet.default.generate(ast, {
|
|
531
|
+
...civetOptions,
|
|
532
|
+
js: false,
|
|
533
|
+
sourceMap: civetSourceMap
|
|
534
|
+
});
|
|
535
|
+
checkErrors();
|
|
536
|
+
const tsx = filename + ".tsx";
|
|
537
|
+
fsMap.set(tsx, compiledTS);
|
|
538
|
+
sourceMaps.set(tsx, civetSourceMap);
|
|
539
|
+
const slashed = slash(tsx);
|
|
540
|
+
if (!(tsx === slashed)) {
|
|
541
|
+
fsMap.set(slashed, compiledTS);
|
|
542
|
+
sourceMaps.set(slashed, civetSourceMap);
|
|
520
543
|
}
|
|
521
544
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
545
|
+
const jsonSourceMap = sourceMap && (typeof sourceMap === "string" ? JSON.parse(sourceMap) : sourceMap.json(
|
|
546
|
+
import_path.default.basename(id.replace(/\.[jt]sx$/, "")),
|
|
547
|
+
import_path.default.basename(id)
|
|
548
|
+
));
|
|
549
|
+
let transformed = {
|
|
550
|
+
code: compiled,
|
|
551
|
+
map: jsonSourceMap
|
|
552
|
+
};
|
|
553
|
+
if (options.transformOutput) {
|
|
554
|
+
transformed = await options.transformOutput(transformed.code, id);
|
|
530
555
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
sourceMap: civetSourceMap
|
|
535
|
-
});
|
|
536
|
-
checkErrors();
|
|
537
|
-
const tsx = filename + ".tsx";
|
|
538
|
-
fsMap.set(tsx, compiledTS);
|
|
539
|
-
sourceMaps.set(tsx, civetSourceMap);
|
|
540
|
-
const slashed = slash(tsx);
|
|
541
|
-
if (!(tsx === slashed)) {
|
|
542
|
-
fsMap.set(slashed, compiledTS);
|
|
543
|
-
sourceMaps.set(slashed, civetSourceMap);
|
|
556
|
+
if (cached != null) {
|
|
557
|
+
cached.result = transformed;
|
|
558
|
+
delete cached.promise;
|
|
544
559
|
}
|
|
560
|
+
return transformed;
|
|
561
|
+
} finally {
|
|
562
|
+
resolve?.();
|
|
545
563
|
}
|
|
546
|
-
const jsonSourceMap = sourceMap && (typeof sourceMap === "string" ? JSON.parse(sourceMap) : sourceMap.json(
|
|
547
|
-
import_path.default.basename(id.replace(/\.[jt]sx$/, "")),
|
|
548
|
-
import_path.default.basename(id)
|
|
549
|
-
));
|
|
550
|
-
let transformed = {
|
|
551
|
-
code: compiled,
|
|
552
|
-
map: jsonSourceMap
|
|
553
|
-
};
|
|
554
|
-
if (options.transformOutput) {
|
|
555
|
-
transformed = await options.transformOutput(transformed.code, id);
|
|
556
|
-
}
|
|
557
|
-
cache?.set(filename, { mtime, result: transformed });
|
|
558
|
-
return transformed;
|
|
559
564
|
},
|
|
560
565
|
esbuild: {
|
|
561
566
|
config(options2) {
|