@alloy-js/csharp 0.20.0-dev.8 → 0.20.0-dev.9
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/src/components/class/declaration.test.js +1 -1
- package/dist/src/components/enum/declaration.ref.test.js +1 -1
- package/dist/src/components/index.d.ts +1 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -1
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/namespace.ref.test.js +1 -1
- package/dist/src/components/namespace.test.js +1 -1
- package/dist/src/components/{SourceFile.d.ts → source-file/source-file.d.ts} +3 -2
- package/dist/src/components/source-file/source-file.d.ts.map +1 -0
- package/dist/src/components/{SourceFile.js → source-file/source-file.js} +18 -13
- package/dist/src/components/source-file/source-file.js.map +1 -0
- package/dist/src/components/source-file/source-file.test.d.ts +2 -0
- package/dist/src/components/source-file/source-file.test.d.ts.map +1 -0
- package/dist/src/components/source-file/source-file.test.js +136 -0
- package/dist/src/components/source-file/source-file.test.js.map +1 -0
- package/dist/src/contexts/format-options.d.ts +5 -0
- package/dist/src/contexts/format-options.d.ts.map +1 -0
- package/dist/src/contexts/format-options.js +9 -0
- package/dist/src/contexts/format-options.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/class/declaration.test.tsx +1 -1
- package/src/components/enum/declaration.ref.test.tsx +1 -1
- package/src/components/index.ts +1 -1
- package/src/components/namespace.ref.test.tsx +1 -1
- package/src/components/namespace.test.tsx +1 -1
- package/src/components/source-file/source-file.test.tsx +96 -0
- package/src/components/{SourceFile.tsx → source-file/source-file.tsx} +20 -10
- package/src/contexts/format-options.ts +14 -0
- package/src/index.ts +1 -0
- package/temp/api.json +155 -4
- package/dist/src/components/SourceFile.d.ts.map +0 -1
- package/dist/src/components/SourceFile.js.map +0 -1
- package/dist/test/sourcefile.test.d.ts +0 -2
- package/dist/test/sourcefile.test.d.ts.map +0 -1
- package/dist/test/sourcefile.test.js +0 -47
- package/dist/test/sourcefile.test.js.map +0 -1
- package/test/sourcefile.test.tsx +0 -33
|
@@ -11,7 +11,7 @@ import { Attribute } from "../attributes/attributes.js";
|
|
|
11
11
|
import { Field } from "../field/field.js";
|
|
12
12
|
import { Method } from "../method/method.js";
|
|
13
13
|
import { Property } from "../property/property.js";
|
|
14
|
-
import { SourceFile } from "../
|
|
14
|
+
import { SourceFile } from "../source-file/source-file.js";
|
|
15
15
|
import { ClassDeclaration } from "./declaration.js";
|
|
16
16
|
function Wrapper({
|
|
17
17
|
children
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { Namespace } from "#components/namespace.js";
|
|
3
|
-
import { SourceFile } from "#components/
|
|
3
|
+
import { SourceFile } from "#components/source-file/source-file.js";
|
|
4
4
|
import { Output, refkey } from "@alloy-js/core";
|
|
5
5
|
import { d } from "@alloy-js/core/testing";
|
|
6
6
|
import { expect, it } from "vitest";
|
|
@@ -21,7 +21,7 @@ export * from "./ProjectDirectory.js";
|
|
|
21
21
|
export * from "./property/property.jsx";
|
|
22
22
|
export * from "./record/declaration.js";
|
|
23
23
|
export * from "./Reference.js";
|
|
24
|
-
export * from "./
|
|
24
|
+
export * from "./source-file/source-file.jsx";
|
|
25
25
|
export * from "./struct/declaration.jsx";
|
|
26
26
|
export type { TypeParameterProps } from "./type-parameters/type-parameter.jsx";
|
|
27
27
|
export * from "./UsingDirective.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAA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B,CAAC;AAC/B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
@@ -21,7 +21,7 @@ export * from "./ProjectDirectory.js";
|
|
|
21
21
|
export * from "./property/property.js";
|
|
22
22
|
export * from "./record/declaration.js";
|
|
23
23
|
export * from "./Reference.js";
|
|
24
|
-
export * from "./
|
|
24
|
+
export * from "./source-file/source-file.js";
|
|
25
25
|
export * from "./struct/declaration.js";
|
|
26
26
|
export * from "./UsingDirective.js";
|
|
27
27
|
export * from "./var/declaration.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":[null],"mappings":"AAAA;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA,cAAc,4BAA4B;AAC1C,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B;AACA,cAAc,uBAAuB;AACrC;AACA,cAAc,yBAAyB;AACvC,cAAc,gBAAgB;AAC9B
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":[null],"mappings":"AAAA;AACA;AACA;AACA,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA,cAAc,4BAA4B;AAC1C,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC;AACA;AACA;AACA;AACA,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B;AACA,cAAc,uBAAuB;AACrC;AACA,cAAc,yBAAyB;AACvC,cAAc,gBAAgB;AAC9B;AACA;AAEA,cAAc,qBAAqB;AACnC;AAAsC","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ import { d } from "@alloy-js/core/testing";
|
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
5
|
import { ClassDeclaration } from "./class/declaration.js";
|
|
6
6
|
import { Namespace } from "./namespace.js";
|
|
7
|
-
import { SourceFile } from "./
|
|
7
|
+
import { SourceFile } from "./source-file/source-file.js";
|
|
8
8
|
it("references types in the same namespace", () => {
|
|
9
9
|
const classRef = refkey();
|
|
10
10
|
const tree = _$createComponent(Output, {
|
|
@@ -4,7 +4,7 @@ import { d } from "@alloy-js/core/testing";
|
|
|
4
4
|
import { expect, it } from "vitest";
|
|
5
5
|
import { ClassDeclaration } from "./class/declaration.js";
|
|
6
6
|
import { Namespace } from "./namespace.js";
|
|
7
|
-
import { SourceFile } from "./
|
|
7
|
+
import { SourceFile } from "./source-file/source-file.js";
|
|
8
8
|
it("defines multiple namespaces and source files with unique content", () => {
|
|
9
9
|
const tree = _$createComponent(Output, {
|
|
10
10
|
get children() {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Children } from "@alloy-js/core";
|
|
2
|
+
import { CSharpFormatOptions } from "../../contexts/format-options.js";
|
|
2
3
|
/**
|
|
3
4
|
* Props for {@link SourceFile} component
|
|
4
5
|
*/
|
|
5
|
-
export interface SourceFileProps {
|
|
6
|
+
export interface SourceFileProps extends CSharpFormatOptions {
|
|
6
7
|
/** Path of the source file */
|
|
7
8
|
path: string;
|
|
8
9
|
/** Source file content */
|
|
@@ -15,4 +16,4 @@ export interface SourceFileProps {
|
|
|
15
16
|
}
|
|
16
17
|
/** A C# source file exists within the context of a namespace contains using statements and declarations */
|
|
17
18
|
export declare function SourceFile(props: SourceFileProps): Children;
|
|
18
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=source-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file.d.ts","sourceRoot":"","sources":["../../../../src/components/source-file/source-file.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,QAAQ,EAKT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EAEpB,MAAM,kCAAkC,CAAC;AAM1C;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,2GAA2G;AAC3G,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,YA2DhD"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { createComponent as _$createComponent, memo as _$memo, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
1
|
+
import { createComponent as _$createComponent, memo as _$memo, mergeProps as _$mergeProps, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { NamespaceScopes } from "#components/namespace-scopes.js";
|
|
3
|
+
import { Reference } from "#components/Reference.js";
|
|
4
|
+
import { UsingDirective } from "#components/UsingDirective.js";
|
|
2
5
|
import { Block, computed, SourceFile as CoreSourceFile, Scope, useBinder } from "@alloy-js/core";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { Reference } from "./Reference.js";
|
|
8
|
-
import { UsingDirective } from "./UsingDirective.js";
|
|
6
|
+
import { useCsharpFormatOptions } from "../../contexts/format-options.js";
|
|
7
|
+
import { getGlobalNamespace } from "../../contexts/global-namespace.js";
|
|
8
|
+
import { useNamespaceContext } from "../../contexts/namespace.js";
|
|
9
|
+
import { CSharpSourceFileScope } from "../../scopes/source-file.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Props for {@link SourceFile} component
|
|
@@ -27,14 +28,18 @@ export function SourceFile(props) {
|
|
|
27
28
|
return props.children;
|
|
28
29
|
}
|
|
29
30
|
}));
|
|
30
|
-
|
|
31
|
+
const opts = useCsharpFormatOptions({
|
|
32
|
+
printWidth: props.printWidth,
|
|
33
|
+
tabWidth: props.tabWidth,
|
|
34
|
+
useTabs: props.useTabs
|
|
35
|
+
});
|
|
36
|
+
return _$createComponent(CoreSourceFile, _$mergeProps({
|
|
31
37
|
get path() {
|
|
32
38
|
return props.path;
|
|
33
39
|
},
|
|
34
40
|
filetype: "cs",
|
|
35
|
-
reference: Reference
|
|
36
|
-
|
|
37
|
-
printWidth: 120,
|
|
41
|
+
reference: Reference
|
|
42
|
+
}, opts, {
|
|
38
43
|
get children() {
|
|
39
44
|
return _$createComponent(Scope, {
|
|
40
45
|
value: sourceFileScope,
|
|
@@ -49,6 +54,6 @@ export function SourceFile(props) {
|
|
|
49
54
|
}
|
|
50
55
|
});
|
|
51
56
|
}
|
|
52
|
-
});
|
|
57
|
+
}));
|
|
53
58
|
}
|
|
54
|
-
//# sourceMappingURL=
|
|
59
|
+
//# sourceMappingURL=source-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NamespaceScopes","Reference","UsingDirective","Block","computed","SourceFile","CoreSourceFile","Scope","useBinder","useCsharpFormatOptions","getGlobalNamespace","useNamespaceContext","CSharpSourceFileScope","props","sourceFileScope","path","nsContext","globalNs","nsSymbol","symbol","nsRef","name","undefined","usings","Array","from","concat","using","content","_$createComponent","children","opts","printWidth","tabWidth","useTabs","_$mergeProps","filetype","reference","value","_$memo","size","length","namespaces","_$createIntrinsic","hasBlockNamespace"],"sources":["../../../../src/components/source-file/source-file.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,eAAe;AACxB,SAASC,SAAS;AAClB,SAASC,cAAc;AACvB,SACEC,KAAK,EAELC,QAAQ,EACRC,UAAU,IAAIC,cAAc,EAC5BC,KAAK,EACLC,SAAS,QACJ,gBAAgB;AACvB,SAEEC,sBAAsB,QACjB,kCAAkC;AACzC,SAASC,kBAAkB,QAAQ,oCAAoC;AACvE,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,qBAAqB,QAAQ,6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UAAA,QAAAS,MAAA,OAC1BA,MAAA,UAACzB,eAAe,CAACS,MAAM,CAACiB,IAAI,GAAG,CAAC,IAC9B3B,KAAK,CAACc,KAAK,IAAId,KAAK,CAACc,KAAK,CAACc,MAAM,GAAG,CAAE,SAAAZ,iBAAA,CAEpC3B,cAAc;YAAA,IAACwC,UAAUA,CAAA;cAAA,OAAEnB,MAAM,CAACe,KAAK;YAAA;UAAA,IAAAK,iBAAA,aAAAA,iBAAA,YAI3C,GAAAJ,MAAA,OACArB,QAAQ,KAAKD,QAAQ,GACpBW,OAAO,kBAEMR,KAAK,EAAAmB,MAAA,OACfA,MAAA,SAAAzB,eAAe,CAAC8B,iBAAiB,OAE7B,GAAG,EAAAf,iBAAA,CACH1B,KAAK;YAAA2B,QAAA,EAAEF;UAAO,YAAAe,iBAAA,aAAAA,iBAAA,aAKdf,OAAO,CACP,EAEJ;QAAA;MAAA;IAAA;EAAA;AAKb","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file.test.d.ts","sourceRoot":"","sources":["../../../../src/components/source-file/source-file.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { ClassDeclaration } from "#components/class/declaration.js";
|
|
3
|
+
import { Namespace } from "#components/namespace.js";
|
|
4
|
+
import { FormatOptions, Indent, Output, Prose } from "@alloy-js/core";
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
import { CSharpFormatOptions } from "../../contexts/format-options.js";
|
|
7
|
+
import { SourceFile } from "./source-file.js";
|
|
8
|
+
it("defines multiple source files with unique content", () => {
|
|
9
|
+
expect(_$createComponent(Output, {
|
|
10
|
+
get children() {
|
|
11
|
+
return _$createComponent(Namespace, {
|
|
12
|
+
name: "TestCode",
|
|
13
|
+
get children() {
|
|
14
|
+
return [_$createComponent(SourceFile, {
|
|
15
|
+
path: "Test1.cs",
|
|
16
|
+
get children() {
|
|
17
|
+
return _$createComponent(ClassDeclaration, {
|
|
18
|
+
"public": true,
|
|
19
|
+
name: "TestClass1"
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}), _$createComponent(SourceFile, {
|
|
23
|
+
path: "Test2.cs",
|
|
24
|
+
get children() {
|
|
25
|
+
return _$createComponent(ClassDeclaration, {
|
|
26
|
+
"public": true,
|
|
27
|
+
name: "TestClass2"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
})];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
})).toRenderTo({
|
|
35
|
+
"Test1.cs": `
|
|
36
|
+
namespace TestCode;
|
|
37
|
+
|
|
38
|
+
public class TestClass1;
|
|
39
|
+
`,
|
|
40
|
+
"Test2.cs": `
|
|
41
|
+
namespace TestCode;
|
|
42
|
+
|
|
43
|
+
public class TestClass2;
|
|
44
|
+
`
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe("format options", () => {
|
|
48
|
+
function FileWithFormatOptions(props) {
|
|
49
|
+
return _$createComponent(CSharpFormatOptions, {
|
|
50
|
+
get value() {
|
|
51
|
+
return props.options;
|
|
52
|
+
},
|
|
53
|
+
get children() {
|
|
54
|
+
return _$createComponent(SourceFile, {
|
|
55
|
+
path: "hi.cs",
|
|
56
|
+
get children() {
|
|
57
|
+
return props.children;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
it("respect tabWidth", () => {
|
|
64
|
+
expect(_$createComponent(FileWithFormatOptions, {
|
|
65
|
+
options: {
|
|
66
|
+
tabWidth: 5
|
|
67
|
+
},
|
|
68
|
+
get children() {
|
|
69
|
+
return ["hello", _$createComponent(Indent, {
|
|
70
|
+
children: "indented 5 spaces"
|
|
71
|
+
})];
|
|
72
|
+
}
|
|
73
|
+
})).toRenderTo(`
|
|
74
|
+
hello
|
|
75
|
+
indented 5 spaces
|
|
76
|
+
`);
|
|
77
|
+
});
|
|
78
|
+
it("respect useTabs", () => {
|
|
79
|
+
expect(_$createComponent(FileWithFormatOptions, {
|
|
80
|
+
options: {
|
|
81
|
+
useTabs: true
|
|
82
|
+
},
|
|
83
|
+
get children() {
|
|
84
|
+
return ["hello", _$createComponent(Indent, {
|
|
85
|
+
children: "indented with tabs"
|
|
86
|
+
})];
|
|
87
|
+
}
|
|
88
|
+
})).toRenderTo(`
|
|
89
|
+
hello
|
|
90
|
+
\tindented with tabs
|
|
91
|
+
`);
|
|
92
|
+
});
|
|
93
|
+
it("respect printWidth", () => {
|
|
94
|
+
expect(_$createComponent(FileWithFormatOptions, {
|
|
95
|
+
options: {
|
|
96
|
+
printWidth: 10
|
|
97
|
+
},
|
|
98
|
+
get children() {
|
|
99
|
+
return _$createComponent(Prose, {
|
|
100
|
+
children: "this is too long"
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
})).toRenderTo(`
|
|
104
|
+
this is
|
|
105
|
+
too long
|
|
106
|
+
`);
|
|
107
|
+
});
|
|
108
|
+
it("CSharpFormatOptions takes precedence over FormatOptions", () => {
|
|
109
|
+
expect(_$createComponent(FormatOptions, {
|
|
110
|
+
value: {
|
|
111
|
+
tabWidth: 5
|
|
112
|
+
},
|
|
113
|
+
get children() {
|
|
114
|
+
return _$createComponent(CSharpFormatOptions, {
|
|
115
|
+
value: {
|
|
116
|
+
tabWidth: 3
|
|
117
|
+
},
|
|
118
|
+
get children() {
|
|
119
|
+
return _$createComponent(SourceFile, {
|
|
120
|
+
path: "hi.cs",
|
|
121
|
+
get children() {
|
|
122
|
+
return ["hello", _$createComponent(Indent, {
|
|
123
|
+
children: "indented 3 spaces"
|
|
124
|
+
})];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
})).toRenderTo(`
|
|
131
|
+
hello
|
|
132
|
+
indented 3 spaces
|
|
133
|
+
`);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=source-file.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ClassDeclaration","Namespace","FormatOptions","Indent","Output","Prose","describe","expect","it","CSharpFormatOptions","SourceFile","_$createComponent","children","name","path","toRenderTo","FileWithFormatOptions","props","value","options","tabWidth","useTabs","printWidth"],"sources":["../../../../src/components/source-file/source-file.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,gBAAgB;AACzB,SAASC,SAAS;AAClB,SAAmBC,aAAa,EAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAC/E,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,UAAU;AAEnBF,EAAE,CAAC,mDAAmD,EAAE,MAAM;EAC5DD,MAAM,CAAAI,iBAAA,CACHP,MAAM;IAAA,IAAAQ,SAAA;MAAA,OAAAD,iBAAA,CACJV,SAAS;QAACY,IAAI;QAAA,IAAAD,SAAA;UAAA,QAAAD,iBAAA,CACZD,UAAU;YAACI,IAAI;YAAA,IAAAF,SAAA;cAAA,OAAAD,iBAAA,CACbX,gBAAgB;gBAAA;gBAAQa,IAAI;cAAA;YAAA;UAAA,IAAAF,iBAAA,CAE9BD,UAAU;YAACI,IAAI;YAAA,IAAAF,SAAA;cAAA,OAAAD,iBAAA,CACbX,gBAAgB;gBAAA;gBAAQa,IAAI;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA,EAIrC,CAAC,CAACE,UAAU,CAAC;IACX,UAAU,EAAE;AAChB;AACA;AACA;AACA,KAAK;IACD,UAAU,EAAE;AAChB;AACA;AACA;AACA;EACE,CAAC,CAAC;AACJ,CAAC,CAAC;AAEFT,QAAQ,CAAC,gBAAgB,EAAE,MAAM;EAC/B,SAASU,qBAAqBA,CAACC,KAG9B,EAAE;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,QAAQ,EAAE;MAAE,CAAC;MAAA,IAAAR,SAAA;QAAA,OAAAD,iBAAA,CAClCF,mBAAmB;UAACS,KAAK,EAAE;YAAEE,QAAQ,EAAE;UAAE,CAAC;UAAA,IAAAR,SAAA;YAAA,OAAAD,iBAAA,CACxCD,UAAU;cAACI,IAAI;cAAA,IAAAF,SAAA;gBAAA,iBAAAD,iBAAA,CAEbR,MAAM;kBAAAS,QAAA;gBAAA;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA,EAIf,CAAC,CAACG,UAAU,CAAC;AACjB;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CommonFormatOptions } from "@alloy-js/core";
|
|
2
|
+
export interface CSharpFormatOptions extends CommonFormatOptions {
|
|
3
|
+
}
|
|
4
|
+
export declare const CSharpFormatOptions: import("@alloy-js/core").ComponentDefinition<import("@alloy-js/core").ContextProviderProps<CSharpFormatOptions>>, useCsharpFormatOptions: (overrides?: Partial<CSharpFormatOptions> | undefined) => CSharpFormatOptions;
|
|
5
|
+
//# sourceMappingURL=format-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-options.d.ts","sourceRoot":"","sources":["../../../src/contexts/format-options.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;CAAG;AAEnE,eAAO,MACK,mBAAmB,oHACX,sBAAsB,+EAIxC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createFormatOptionsContextFor } from "@alloy-js/core";
|
|
2
|
+
export const {
|
|
3
|
+
Provider: CSharpFormatOptions,
|
|
4
|
+
useFormatOptions: useCsharpFormatOptions
|
|
5
|
+
} = createFormatOptionsContextFor("csharp", {
|
|
6
|
+
tabWidth: 4,
|
|
7
|
+
printWidth: 120
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=format-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFormatOptionsContextFor","Provider","CSharpFormatOptions","useFormatOptions","useCsharpFormatOptions","tabWidth","printWidth"],"sources":["../../../src/contexts/format-options.ts"],"sourcesContent":[null],"mappings":"AAAA,SAEEA,6BAA6B,QACxB,gBAAgB;AAIvB,OAAO,MAAM;EACXC,QAAQ,EAAEC,mBAAmB;EAC7BC,gBAAgB,EAAEC;AACpB,CAAC,GAAGJ,6BAA6B,CAAsB,QAAQ,EAAE;EAC/DK,QAAQ,EAAE,CAAC;EACXC,UAAU,EAAE;AACd,CAAC,CAAC","ignoreList":[]}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
|
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc,uBAAuB;AACrC,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc,uBAAuB;AACrC,cAAc,8BAA8B;AAC5C,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,oBAAoB","ignoreList":[]}
|