@d1g1tal/tsbuild 1.0.0
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 +21 -0
- package/README.md +388 -0
- package/dist/44KSX2XO.js +269 -0
- package/dist/QAEHWWWE.js +47 -0
- package/dist/QDB5Y2PO.js +2229 -0
- package/dist/index.d.ts +341 -0
- package/dist/index.js +7 -0
- package/dist/tsbuild.js +45 -0
- package/package.json +73 -0
- package/schema.json +200 -0
package/dist/QAEHWWWE.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Encoding,
|
|
3
|
+
Json,
|
|
4
|
+
Paths,
|
|
5
|
+
typeScriptExtensionExpression
|
|
6
|
+
} from "./44KSX2XO.js";
|
|
7
|
+
|
|
8
|
+
// src/plugins/decorator-metadata.ts
|
|
9
|
+
import { dirname } from "node:path";
|
|
10
|
+
import { transformFile } from "@swc/core";
|
|
11
|
+
var swcOptions = {
|
|
12
|
+
jsc: {
|
|
13
|
+
parser: { syntax: "typescript", decorators: true },
|
|
14
|
+
transform: { legacyDecorator: true, decoratorMetadata: true },
|
|
15
|
+
keepClassNames: true,
|
|
16
|
+
target: "esnext"
|
|
17
|
+
},
|
|
18
|
+
sourceMaps: true,
|
|
19
|
+
configFile: false,
|
|
20
|
+
swcrc: false
|
|
21
|
+
};
|
|
22
|
+
var swcDecoratorMetadataPlugin = {
|
|
23
|
+
name: "esbuild:swc-decorator-metadata",
|
|
24
|
+
/**
|
|
25
|
+
* Setup esbuild to use SWC for transforming TypeScript files with decorator metadata.
|
|
26
|
+
* This plugin overrides the default TypeScript handling in esbuild to ensure
|
|
27
|
+
* that decorator metadata is correctly emitted.
|
|
28
|
+
* @param build The esbuild build instance.
|
|
29
|
+
*/
|
|
30
|
+
setup(build) {
|
|
31
|
+
build.initialOptions.keepNames = true;
|
|
32
|
+
build.onLoad({ filter: typeScriptExtensionExpression }, async ({ path }) => {
|
|
33
|
+
const result = await transformFile(path, swcOptions);
|
|
34
|
+
if (result.map) {
|
|
35
|
+
const sources = [];
|
|
36
|
+
for (const source of Json.parse(result.map).sources) {
|
|
37
|
+
sources.push(Paths.relative(dirname(path), source));
|
|
38
|
+
}
|
|
39
|
+
result.code += `//# sourceMappingURL=data:application/json;base64,${Buffer.from(Json.serialize({ sources })).toString(Encoding.base64)}`;
|
|
40
|
+
}
|
|
41
|
+
return { contents: result.code };
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
swcDecoratorMetadataPlugin
|
|
47
|
+
};
|