@typespec/compiler 0.41.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 +9 -0
- package/cmd/tsp-server.js +3 -0
- package/cmd/tsp.js +3 -0
- package/dist/cmd/runner.d.ts +9 -0
- package/dist/cmd/runner.d.ts.map +1 -0
- package/dist/cmd/runner.js +62 -0
- package/dist/cmd/runner.js.map +1 -0
- package/dist/config/config-interpolation.d.ts +11 -0
- package/dist/config/config-interpolation.d.ts.map +1 -0
- package/dist/config/config-interpolation.js +109 -0
- package/dist/config/config-interpolation.js.map +1 -0
- package/dist/config/config-loader.d.ts +25 -0
- package/dist/config/config-loader.d.ts.map +1 -0
- package/dist/config/config-loader.js +182 -0
- package/dist/config/config-loader.js.map +1 -0
- package/dist/config/config-schema.d.ts +4 -0
- package/dist/config/config-schema.d.ts.map +1 -0
- package/dist/config/config-schema.js +84 -0
- package/dist/config/config-schema.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +79 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/core/binder.d.ts +29 -0
- package/dist/core/binder.d.ts.map +1 -0
- package/dist/core/binder.js +455 -0
- package/dist/core/binder.js.map +1 -0
- package/dist/core/charcode.d.ts +130 -0
- package/dist/core/charcode.d.ts.map +1 -0
- package/dist/core/charcode.js +115 -0
- package/dist/core/charcode.js.map +1 -0
- package/dist/core/checker.d.ts +138 -0
- package/dist/core/checker.d.ts.map +1 -0
- package/dist/core/checker.js +4070 -0
- package/dist/core/checker.js.map +1 -0
- package/dist/core/cli/args.d.ts +18 -0
- package/dist/core/cli/args.d.ts.map +1 -0
- package/dist/core/cli/args.js +108 -0
- package/dist/core/cli/args.js.map +1 -0
- package/dist/core/cli/cli.d.ts +2 -0
- package/dist/core/cli/cli.d.ts.map +1 -0
- package/dist/core/cli/cli.js +477 -0
- package/dist/core/cli/cli.js.map +1 -0
- package/dist/core/cli/index.d.ts +2 -0
- package/dist/core/cli/index.d.ts.map +1 -0
- package/dist/core/cli/index.js +2 -0
- package/dist/core/cli/index.js.map +1 -0
- package/dist/core/decorator-utils.d.ts +108 -0
- package/dist/core/decorator-utils.d.ts.map +1 -0
- package/dist/core/decorator-utils.js +326 -0
- package/dist/core/decorator-utils.js.map +1 -0
- package/dist/core/diagnostics.d.ts +93 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +315 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/emitter-utils.d.ts +14 -0
- package/dist/core/emitter-utils.d.ts.map +1 -0
- package/dist/core/emitter-utils.js +16 -0
- package/dist/core/emitter-utils.js.map +1 -0
- package/dist/core/formatter-fs.d.ts +21 -0
- package/dist/core/formatter-fs.d.ts.map +1 -0
- package/dist/core/formatter-fs.js +79 -0
- package/dist/core/formatter-fs.js.map +1 -0
- package/dist/core/formatter.d.ts +10 -0
- package/dist/core/formatter.d.ts.map +1 -0
- package/dist/core/formatter.js +24 -0
- package/dist/core/formatter.js.map +1 -0
- package/dist/core/helpers/discriminator-utils.d.ts +14 -0
- package/dist/core/helpers/discriminator-utils.d.ts.map +1 -0
- package/dist/core/helpers/discriminator-utils.js +169 -0
- package/dist/core/helpers/discriminator-utils.js.map +1 -0
- package/dist/core/helpers/index.d.ts +6 -0
- package/dist/core/helpers/index.d.ts.map +1 -0
- package/dist/core/helpers/index.js +6 -0
- package/dist/core/helpers/index.js.map +1 -0
- package/dist/core/helpers/operation-utils.d.ts +15 -0
- package/dist/core/helpers/operation-utils.d.ts.map +1 -0
- package/dist/core/helpers/operation-utils.js +35 -0
- package/dist/core/helpers/operation-utils.js.map +1 -0
- package/dist/core/helpers/projected-names-utils.d.ts +20 -0
- package/dist/core/helpers/projected-names-utils.d.ts.map +1 -0
- package/dist/core/helpers/projected-names-utils.js +40 -0
- package/dist/core/helpers/projected-names-utils.js.map +1 -0
- package/dist/core/helpers/type-name-utils.d.ts +14 -0
- package/dist/core/helpers/type-name-utils.d.ts.map +1 -0
- package/dist/core/helpers/type-name-utils.js +122 -0
- package/dist/core/helpers/type-name-utils.js.map +1 -0
- package/dist/core/helpers/usage-resolver.d.ts +20 -0
- package/dist/core/helpers/usage-resolver.d.ts.map +1 -0
- package/dist/core/helpers/usage-resolver.js +108 -0
- package/dist/core/helpers/usage-resolver.js.map +1 -0
- package/dist/core/index.d.ts +26 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +26 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/install.d.ts +2 -0
- package/dist/core/install.d.ts.map +1 -0
- package/dist/core/install.js +26 -0
- package/dist/core/install.js.map +1 -0
- package/dist/core/library.d.ts +34 -0
- package/dist/core/library.d.ts.map +1 -0
- package/dist/core/library.js +100 -0
- package/dist/core/library.js.map +1 -0
- package/dist/core/logger/console-sink.browser.d.ts +4 -0
- package/dist/core/logger/console-sink.browser.d.ts.map +1 -0
- package/dist/core/logger/console-sink.browser.js +14 -0
- package/dist/core/logger/console-sink.browser.js.map +1 -0
- package/dist/core/logger/console-sink.d.ts +9 -0
- package/dist/core/logger/console-sink.d.ts.map +1 -0
- package/dist/core/logger/console-sink.js +81 -0
- package/dist/core/logger/console-sink.js.map +1 -0
- package/dist/core/logger/index.d.ts +3 -0
- package/dist/core/logger/index.d.ts.map +1 -0
- package/dist/core/logger/index.js +3 -0
- package/dist/core/logger/index.js.map +1 -0
- package/dist/core/logger/logger.d.ts +7 -0
- package/dist/core/logger/logger.d.ts.map +1 -0
- package/dist/core/logger/logger.js +32 -0
- package/dist/core/logger/logger.js.map +1 -0
- package/dist/core/logger/tracer.d.ts +3 -0
- package/dist/core/logger/tracer.d.ts.map +1 -0
- package/dist/core/logger/tracer.js +91 -0
- package/dist/core/logger/tracer.js.map +1 -0
- package/dist/core/manifest.d.ts +21 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/core/manifest.js +8 -0
- package/dist/core/manifest.js.map +1 -0
- package/dist/core/messages.d.ts +2253 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +749 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/module-resolver.d.ts +84 -0
- package/dist/core/module-resolver.d.ts.map +1 -0
- package/dist/core/module-resolver.js +170 -0
- package/dist/core/module-resolver.js.map +1 -0
- package/dist/core/node-host.browser.d.ts +2 -0
- package/dist/core/node-host.browser.d.ts.map +1 -0
- package/dist/core/node-host.browser.js +2 -0
- package/dist/core/node-host.browser.js.map +1 -0
- package/dist/core/node-host.d.ts +7 -0
- package/dist/core/node-host.d.ts.map +1 -0
- package/dist/core/node-host.js +43 -0
- package/dist/core/node-host.js.map +1 -0
- package/dist/core/nonascii.d.ts +2 -0
- package/dist/core/nonascii.d.ts.map +1 -0
- package/dist/core/nonascii.js +712 -0
- package/dist/core/nonascii.js.map +1 -0
- package/dist/core/options.d.ts +46 -0
- package/dist/core/options.d.ts.map +1 -0
- package/dist/core/options.js +2 -0
- package/dist/core/options.js.map +1 -0
- package/dist/core/parser.d.ts +17 -0
- package/dist/core/parser.d.ts.map +1 -0
- package/dist/core/parser.js +2561 -0
- package/dist/core/parser.js.map +1 -0
- package/dist/core/path-utils.d.ts +193 -0
- package/dist/core/path-utils.d.ts.map +1 -0
- package/dist/core/path-utils.js +427 -0
- package/dist/core/path-utils.js.map +1 -0
- package/dist/core/program.d.ts +104 -0
- package/dist/core/program.d.ts.map +1 -0
- package/dist/core/program.js +898 -0
- package/dist/core/program.js.map +1 -0
- package/dist/core/projection-members.d.ts +8 -0
- package/dist/core/projection-members.d.ts.map +1 -0
- package/dist/core/projection-members.js +387 -0
- package/dist/core/projection-members.js.map +1 -0
- package/dist/core/projector.d.ts +26 -0
- package/dist/core/projector.d.ts.map +1 -0
- package/dist/core/projector.js +523 -0
- package/dist/core/projector.js.map +1 -0
- package/dist/core/scanner.d.ts +125 -0
- package/dist/core/scanner.d.ts.map +1 -0
- package/dist/core/scanner.js +1012 -0
- package/dist/core/scanner.js.map +1 -0
- package/dist/core/schema-validator.d.ts +6 -0
- package/dist/core/schema-validator.d.ts.map +1 -0
- package/dist/core/schema-validator.js +38 -0
- package/dist/core/schema-validator.js.map +1 -0
- package/dist/core/semantic-walker.d.ts +53 -0
- package/dist/core/semantic-walker.d.ts.map +1 -0
- package/dist/core/semantic-walker.js +355 -0
- package/dist/core/semantic-walker.js.map +1 -0
- package/dist/core/type-utils.d.ts +49 -0
- package/dist/core/type-utils.d.ts.map +1 -0
- package/dist/core/type-utils.js +95 -0
- package/dist/core/type-utils.js.map +1 -0
- package/dist/core/types.d.ts +1345 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +105 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/util.d.ts +150 -0
- package/dist/core/util.d.ts.map +1 -0
- package/dist/core/util.js +417 -0
- package/dist/core/util.js.map +1 -0
- package/dist/emitter-framework/asset-emitter.d.ts +5 -0
- package/dist/emitter-framework/asset-emitter.d.ts.map +1 -0
- package/dist/emitter-framework/asset-emitter.js +610 -0
- package/dist/emitter-framework/asset-emitter.js.map +1 -0
- package/dist/emitter-framework/builders/array-builder.d.ts +7 -0
- package/dist/emitter-framework/builders/array-builder.d.ts.map +1 -0
- package/dist/emitter-framework/builders/array-builder.js +45 -0
- package/dist/emitter-framework/builders/array-builder.js.map +1 -0
- package/dist/emitter-framework/builders/object-builder.d.ts +9 -0
- package/dist/emitter-framework/builders/object-builder.d.ts.map +1 -0
- package/dist/emitter-framework/builders/object-builder.js +30 -0
- package/dist/emitter-framework/builders/object-builder.js.map +1 -0
- package/dist/emitter-framework/builders/string-builder.d.ts +13 -0
- package/dist/emitter-framework/builders/string-builder.d.ts.map +1 -0
- package/dist/emitter-framework/builders/string-builder.js +98 -0
- package/dist/emitter-framework/builders/string-builder.js.map +1 -0
- package/dist/emitter-framework/custom-key-map.d.ts +29 -0
- package/dist/emitter-framework/custom-key-map.d.ts.map +1 -0
- package/dist/emitter-framework/custom-key-map.js +62 -0
- package/dist/emitter-framework/custom-key-map.js.map +1 -0
- package/dist/emitter-framework/index.d.ts +8 -0
- package/dist/emitter-framework/index.d.ts.map +1 -0
- package/dist/emitter-framework/index.js +8 -0
- package/dist/emitter-framework/index.js.map +1 -0
- package/dist/emitter-framework/placeholder.d.ts +12 -0
- package/dist/emitter-framework/placeholder.d.ts.map +1 -0
- package/dist/emitter-framework/placeholder.js +27 -0
- package/dist/emitter-framework/placeholder.js.map +1 -0
- package/dist/emitter-framework/type-emitter.d.ts +314 -0
- package/dist/emitter-framework/type-emitter.d.ts.map +1 -0
- package/dist/emitter-framework/type-emitter.js +612 -0
- package/dist/emitter-framework/type-emitter.js.map +1 -0
- package/dist/emitter-framework/types.d.ts +124 -0
- package/dist/emitter-framework/types.d.ts.map +1 -0
- package/dist/emitter-framework/types.js +39 -0
- package/dist/emitter-framework/types.js.map +1 -0
- package/dist/formatter/index.d.ts +11 -0
- package/dist/formatter/index.d.ts.map +1 -0
- package/dist/formatter/index.js +28 -0
- package/dist/formatter/index.js.map +1 -0
- package/dist/formatter/parser.d.ts +16 -0
- package/dist/formatter/parser.d.ts.map +1 -0
- package/dist/formatter/parser.js +23 -0
- package/dist/formatter/parser.js.map +1 -0
- package/dist/formatter/print/comment-handler.d.ts +7 -0
- package/dist/formatter/print/comment-handler.d.ts.map +1 -0
- package/dist/formatter/print/comment-handler.js +81 -0
- package/dist/formatter/print/comment-handler.js.map +1 -0
- package/dist/formatter/print/index.d.ts +3 -0
- package/dist/formatter/print/index.d.ts.map +1 -0
- package/dist/formatter/print/index.js +3 -0
- package/dist/formatter/print/index.js.map +1 -0
- package/dist/formatter/print/needs-parens.d.ts +10 -0
- package/dist/formatter/print/needs-parens.d.ts.map +1 -0
- package/dist/formatter/print/needs-parens.js +27 -0
- package/dist/formatter/print/needs-parens.js.map +1 -0
- package/dist/formatter/print/printer.d.ts +62 -0
- package/dist/formatter/print/printer.d.ts.map +1 -0
- package/dist/formatter/print/printer.js +1025 -0
- package/dist/formatter/print/printer.js.map +1 -0
- package/dist/formatter/print/types.d.ts +9 -0
- package/dist/formatter/print/types.d.ts.map +1 -0
- package/dist/formatter/print/types.js +2 -0
- package/dist/formatter/print/types.js.map +1 -0
- package/dist/init/index.d.ts +2 -0
- package/dist/init/index.d.ts.map +1 -0
- package/dist/init/index.js +2 -0
- package/dist/init/index.js.map +1 -0
- package/dist/init/init-template.d.ts +45 -0
- package/dist/init/init-template.d.ts.map +1 -0
- package/dist/init/init-template.js +45 -0
- package/dist/init/init-template.js.map +1 -0
- package/dist/init/init.d.ts +49 -0
- package/dist/init/init.d.ts.map +1 -0
- package/dist/init/init.js +224 -0
- package/dist/init/init.js.map +1 -0
- package/dist/lib/decorators.d.ts +222 -0
- package/dist/lib/decorators.d.ts.map +1 -0
- package/dist/lib/decorators.js +745 -0
- package/dist/lib/decorators.js.map +1 -0
- package/dist/lib/service.d.ts +38 -0
- package/dist/lib/service.d.ts.map +1 -0
- package/dist/lib/service.js +78 -0
- package/dist/lib/service.js.map +1 -0
- package/dist/manifest.js +4 -0
- package/dist/server/completion.d.ts +10 -0
- package/dist/server/completion.d.ts.map +1 -0
- package/dist/server/completion.js +207 -0
- package/dist/server/completion.js.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/language-config.d.ts +195 -0
- package/dist/server/language-config.d.ts.map +1 -0
- package/dist/server/language-config.js +102 -0
- package/dist/server/language-config.js.map +1 -0
- package/dist/server/server.d.ts +2 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +131 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/serverlib.d.ts +72 -0
- package/dist/server/serverlib.d.ts.map +1 -0
- package/dist/server/serverlib.js +1034 -0
- package/dist/server/serverlib.js.map +1 -0
- package/dist/server/symbol-structure.d.ts +4 -0
- package/dist/server/symbol-structure.d.ts.map +1 -0
- package/dist/server/symbol-structure.js +121 -0
- package/dist/server/symbol-structure.js.map +1 -0
- package/dist/server/tmlanguage.d.ts +3 -0
- package/dist/server/tmlanguage.d.ts.map +1 -0
- package/dist/server/tmlanguage.js +713 -0
- package/dist/server/tmlanguage.js.map +1 -0
- package/dist/server/type-details.d.ts +11 -0
- package/dist/server/type-details.d.ts.map +1 -0
- package/dist/server/type-details.js +72 -0
- package/dist/server/type-details.js.map +1 -0
- package/dist/server/type-signature.d.ts +2 -0
- package/dist/server/type-signature.d.ts.map +1 -0
- package/dist/server/type-signature.js +108 -0
- package/dist/server/type-signature.js.map +1 -0
- package/dist/testing/expect.d.ts +49 -0
- package/dist/testing/expect.d.ts.map +1 -0
- package/dist/testing/expect.js +83 -0
- package/dist/testing/expect.js.map +1 -0
- package/dist/testing/index.d.ts +6 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +6 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/test-host.d.ts +14 -0
- package/dist/testing/test-host.d.ts.map +1 -0
- package/dist/testing/test-host.js +271 -0
- package/dist/testing/test-host.js.map +1 -0
- package/dist/testing/test-server-host.d.ts +39 -0
- package/dist/testing/test-server-host.d.ts.map +1 -0
- package/dist/testing/test-server-host.js +112 -0
- package/dist/testing/test-server-host.js.map +1 -0
- package/dist/testing/test-utils.d.ts +22 -0
- package/dist/testing/test-utils.d.ts.map +1 -0
- package/dist/testing/test-utils.js +60 -0
- package/dist/testing/test-utils.js.map +1 -0
- package/dist/testing/types.d.ts +69 -0
- package/dist/testing/types.d.ts.map +1 -0
- package/dist/testing/types.js +7 -0
- package/dist/testing/types.js.map +1 -0
- package/dist/typespec.tmLanguage +1760 -0
- package/lib/decorators.tsp +420 -0
- package/lib/lib.tsp +158 -0
- package/lib/main.tsp +4 -0
- package/lib/projected-names.tsp +94 -0
- package/lib/reflection.tsp +10 -0
- package/package.json +119 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Enum, Interface, Model, ModelProperty, Operation, Program, Scalar, Tuple, Type, Union } from "../core/index.js";
|
|
2
|
+
import { Placeholder } from "./placeholder.js";
|
|
3
|
+
type AssetEmitterOptions<TOptions extends object> = {
|
|
4
|
+
noEmit: boolean;
|
|
5
|
+
emitterOutputDir: string;
|
|
6
|
+
} & TOptions;
|
|
7
|
+
export interface AssetEmitter<T, TOptions extends object = Record<string, unknown>> {
|
|
8
|
+
/**
|
|
9
|
+
* Get the current emitter context as set by the TypeEmitter's various
|
|
10
|
+
* context methods.
|
|
11
|
+
*
|
|
12
|
+
* @returns The current emitter context
|
|
13
|
+
*/
|
|
14
|
+
getContext(): Context;
|
|
15
|
+
getOptions(): AssetEmitterOptions<TOptions>;
|
|
16
|
+
getProgram(): Program;
|
|
17
|
+
emitTypeReference(type: Type): EmitEntity<T>;
|
|
18
|
+
emitDeclarationName(type: TypeSpecDeclaration): string;
|
|
19
|
+
emitType(type: Type): EmitEntity<T>;
|
|
20
|
+
emitProgram(options?: {
|
|
21
|
+
emitGlobalNamespace?: boolean;
|
|
22
|
+
emitTypeSpecNamespace?: boolean;
|
|
23
|
+
}): void;
|
|
24
|
+
emitModelProperties(model: Model): EmitEntity<T>;
|
|
25
|
+
emitModelProperty(prop: ModelProperty): EmitEntity<T>;
|
|
26
|
+
emitOperationParameters(operation: Operation): EmitEntity<T>;
|
|
27
|
+
emitOperationReturnType(operation: Operation): EmitEntity<T>;
|
|
28
|
+
emitInterfaceOperations(iface: Interface): EmitEntity<T>;
|
|
29
|
+
emitInterfaceOperation(operation: Operation): EmitEntity<T>;
|
|
30
|
+
emitEnumMembers(en: Enum): EmitEntity<T>;
|
|
31
|
+
emitUnionVariants(union: Union): EmitEntity<T>;
|
|
32
|
+
emitTupleLiteralValues(tuple: Tuple): EmitEntity<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Create a source file.
|
|
35
|
+
*
|
|
36
|
+
* @param name the path of the file, resolved relative to the emitter's output directory.
|
|
37
|
+
*/
|
|
38
|
+
createSourceFile(name: string): SourceFile<T>;
|
|
39
|
+
createScope(sourceFile: SourceFile<T>, name: string): SourceFileScope<T>;
|
|
40
|
+
createScope(namespace: any, name: string, parentScope: Scope<T>): NamespaceScope<T>;
|
|
41
|
+
createScope(block: any, name: string, parentScope?: Scope<T> | null): Scope<T>;
|
|
42
|
+
result: {
|
|
43
|
+
declaration(name: string, value: T | Placeholder<T>): Declaration<T>;
|
|
44
|
+
rawCode(value: T | Placeholder<T>): RawCode<T>;
|
|
45
|
+
none(): NoEmit;
|
|
46
|
+
};
|
|
47
|
+
writeOutput(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export interface ScopeBase<T> {
|
|
50
|
+
kind: string;
|
|
51
|
+
name: string;
|
|
52
|
+
parentScope: Scope<T> | null;
|
|
53
|
+
childScopes: Scope<T>[];
|
|
54
|
+
declarations: Declaration<T>[];
|
|
55
|
+
}
|
|
56
|
+
export interface SourceFileScope<T> extends ScopeBase<T> {
|
|
57
|
+
kind: "sourceFile";
|
|
58
|
+
sourceFile: SourceFile<T>;
|
|
59
|
+
}
|
|
60
|
+
export interface NamespaceScope<T> extends ScopeBase<T> {
|
|
61
|
+
kind: "namespace";
|
|
62
|
+
parentScope: Scope<T>;
|
|
63
|
+
namespace: any;
|
|
64
|
+
}
|
|
65
|
+
export type Scope<T> = SourceFileScope<T> | NamespaceScope<T>;
|
|
66
|
+
export interface TypeReference {
|
|
67
|
+
expression: string;
|
|
68
|
+
}
|
|
69
|
+
export interface SourceFile<T> {
|
|
70
|
+
path: string;
|
|
71
|
+
globalScope: Scope<T>;
|
|
72
|
+
imports: Map<string, string[]>;
|
|
73
|
+
}
|
|
74
|
+
export interface EmittedSourceFile {
|
|
75
|
+
contents: string;
|
|
76
|
+
path: string;
|
|
77
|
+
}
|
|
78
|
+
export type EmitEntity<T> = Declaration<T> | RawCode<T> | NoEmit | CircularEmit;
|
|
79
|
+
export declare class EmitterResult {
|
|
80
|
+
}
|
|
81
|
+
export declare class Declaration<T> extends EmitterResult {
|
|
82
|
+
name: string;
|
|
83
|
+
scope: Scope<T>;
|
|
84
|
+
value: T | Placeholder<T>;
|
|
85
|
+
kind: "declaration";
|
|
86
|
+
constructor(name: string, scope: Scope<T>, value: T | Placeholder<T>);
|
|
87
|
+
}
|
|
88
|
+
export declare class RawCode<T> extends EmitterResult {
|
|
89
|
+
value: T | Placeholder<T>;
|
|
90
|
+
kind: "code";
|
|
91
|
+
constructor(value: T | Placeholder<T>);
|
|
92
|
+
}
|
|
93
|
+
export declare class NoEmit extends EmitterResult {
|
|
94
|
+
kind: "none";
|
|
95
|
+
}
|
|
96
|
+
export declare class CircularEmit extends EmitterResult {
|
|
97
|
+
emitEntityKey: [string, Type, ContextState];
|
|
98
|
+
kind: "circular";
|
|
99
|
+
constructor(emitEntityKey: [string, Type, ContextState]);
|
|
100
|
+
}
|
|
101
|
+
export interface AssetTag {
|
|
102
|
+
language: AssetTagFactory;
|
|
103
|
+
create(key: string): AssetTagFactory;
|
|
104
|
+
}
|
|
105
|
+
export interface AssetTagInstance {
|
|
106
|
+
}
|
|
107
|
+
export type AssetTagFactory = {
|
|
108
|
+
(value: string): AssetTagInstance;
|
|
109
|
+
};
|
|
110
|
+
export type TypeSpecDeclaration = Model | Interface | Union | Operation | Enum | Scalar;
|
|
111
|
+
export interface ContextState {
|
|
112
|
+
lexicalContext: Record<string, any>;
|
|
113
|
+
referenceContext: Record<string, any>;
|
|
114
|
+
}
|
|
115
|
+
export type Context = Record<string, any>;
|
|
116
|
+
export type ESRecord = Record<string, any> & {
|
|
117
|
+
_record: true;
|
|
118
|
+
};
|
|
119
|
+
export interface EmitterState {
|
|
120
|
+
lexicalTypeStack: Type[];
|
|
121
|
+
context: ContextState;
|
|
122
|
+
}
|
|
123
|
+
export {};
|
|
124
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
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M,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACvC;AAED,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1C,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AAE/D,MAAM,WAAW,YAAY;IAC3B,gBAAgB,EAAE,IAAI,EAAE,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;CACvB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Placeholder } from "./placeholder.js";
|
|
2
|
+
export class EmitterResult {
|
|
3
|
+
}
|
|
4
|
+
export class Declaration extends EmitterResult {
|
|
5
|
+
constructor(name, scope, value) {
|
|
6
|
+
if (value instanceof Placeholder) {
|
|
7
|
+
value.onValue((v) => (this.value = v));
|
|
8
|
+
}
|
|
9
|
+
super();
|
|
10
|
+
this.name = name;
|
|
11
|
+
this.scope = scope;
|
|
12
|
+
this.value = value;
|
|
13
|
+
this.kind = "declaration";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export class RawCode extends EmitterResult {
|
|
17
|
+
constructor(value) {
|
|
18
|
+
if (value instanceof Placeholder) {
|
|
19
|
+
value.onValue((v) => (this.value = v));
|
|
20
|
+
}
|
|
21
|
+
super();
|
|
22
|
+
this.value = value;
|
|
23
|
+
this.kind = "code";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export class NoEmit extends EmitterResult {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.kind = "none";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class CircularEmit extends EmitterResult {
|
|
33
|
+
constructor(emitEntityKey) {
|
|
34
|
+
super();
|
|
35
|
+
this.emitEntityKey = emitEntityKey;
|
|
36
|
+
this.kind = "circular";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../emitter-framework/types.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAqF/C,MAAM,OAAO,aAAa;CAAG;AAC7B,MAAM,OAAO,WAAe,SAAQ,aAAa;IAG/C,YAAmB,IAAY,EAAS,KAAe,EAAS,KAAyB;QACvF,IAAI,KAAK,YAAY,WAAW,EAAE;YAChC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;SACxC;QAED,KAAK,EAAE,CAAC;QALS,SAAI,GAAJ,IAAI,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAU;QAAS,UAAK,GAAL,KAAK,CAAoB;QAFlF,SAAI,GAAG,aAAsB,CAAC;IAQrC,CAAC;CACF;AAED,MAAM,OAAO,OAAW,SAAQ,aAAa;IAG3C,YAAmB,KAAyB;QAC1C,IAAI,KAAK,YAAY,WAAW,EAAE;YAChC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;SACxC;QAED,KAAK,EAAE,CAAC;QALS,UAAK,GAAL,KAAK,CAAoB;QAFrC,SAAI,GAAG,MAAe,CAAC;IAQ9B,CAAC;CACF;AAED,MAAM,OAAO,MAAO,SAAQ,aAAa;IAAzC;;QACS,SAAI,GAAG,MAAe,CAAC;IAChC,CAAC;CAAA;AAED,MAAM,OAAO,YAAa,SAAQ,aAAa;IAE7C,YAAmB,aAA2C;QAC5D,KAAK,EAAE,CAAC;QADS,kBAAa,GAAb,aAAa,CAA8B;QADvD,SAAI,GAAG,UAAmB,CAAC;IAGlC,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Parser, SupportLanguage } from "prettier";
|
|
2
|
+
import { Node } from "../core/types.js";
|
|
3
|
+
export declare const defaultOptions: {};
|
|
4
|
+
export declare const languages: SupportLanguage[];
|
|
5
|
+
export declare const parsers: {
|
|
6
|
+
typespec: Parser<any>;
|
|
7
|
+
};
|
|
8
|
+
export declare const printers: {
|
|
9
|
+
"typespec-format": import("prettier").Printer<Node>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../formatter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIxC,eAAO,MAAM,cAAc,IAAK,CAAC;AAEjC,eAAO,MAAM,SAAS,EAAE,eAAe,EAOtC,CAAC;AAYF,eAAO,MAAM,OAAO;;CAEnB,CAAC;AAEF,eAAO,MAAM,QAAQ;;CAEpB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { parse } from "./parser.js";
|
|
2
|
+
import { typespecPrinter } from "./print/index.js";
|
|
3
|
+
export const defaultOptions = {};
|
|
4
|
+
export const languages = [
|
|
5
|
+
{
|
|
6
|
+
name: "TypeSpec",
|
|
7
|
+
parsers: ["typespec"],
|
|
8
|
+
extensions: [".tsp", ".cadl"],
|
|
9
|
+
vscodeLanguageIds: ["typespec"],
|
|
10
|
+
},
|
|
11
|
+
];
|
|
12
|
+
const TypeSpecParser = {
|
|
13
|
+
parse,
|
|
14
|
+
astFormat: "typespec-format",
|
|
15
|
+
locStart(node) {
|
|
16
|
+
return node.pos;
|
|
17
|
+
},
|
|
18
|
+
locEnd(node) {
|
|
19
|
+
return node.end;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const parsers = {
|
|
23
|
+
typespec: TypeSpecParser,
|
|
24
|
+
};
|
|
25
|
+
export const printers = {
|
|
26
|
+
"typespec-format": typespecPrinter,
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../formatter/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,SAAS,GAAsB;IAC1C;QACE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,CAAC,UAAU,CAAC;QACrB,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QAC7B,iBAAiB,EAAE,CAAC,UAAU,CAAC;KAChC;CACF,CAAC;AAEF,MAAM,cAAc,GAAW;IAC7B,KAAK;IACL,SAAS,EAAE,iBAAiB;IAC5B,QAAQ,CAAC,IAAU;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IACD,MAAM,CAAC,IAAU;QACf,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,QAAQ,EAAE,cAAc;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,iBAAiB,EAAE,eAAe;CACnC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Parser, ParserOptions } from "prettier";
|
|
2
|
+
import { Diagnostic, TypeSpecScriptNode } from "../core/types.js";
|
|
3
|
+
export declare function parse(text: string, parsers: {
|
|
4
|
+
[parserName: string]: Parser;
|
|
5
|
+
}, opts: ParserOptions & {
|
|
6
|
+
parentParser?: string;
|
|
7
|
+
}): TypeSpecScriptNode;
|
|
8
|
+
export declare class PrettierParserError extends Error {
|
|
9
|
+
readonly error: Diagnostic;
|
|
10
|
+
loc: {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
};
|
|
14
|
+
constructor(error: Diagnostic);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../formatter/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAElE,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACzC,IAAI,EAAE,aAAa,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9C,kBAAkB,CAOpB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;aAET,KAAK,EAAE,UAAU;IAD7C,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;gBACR,KAAK,EAAE,UAAU;CAQrD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getSourceLocation } from "../core/diagnostics.js";
|
|
2
|
+
import { parse as typespecParse } from "../core/parser.js";
|
|
3
|
+
export function parse(text, parsers, opts) {
|
|
4
|
+
const result = typespecParse(text, { comments: true });
|
|
5
|
+
const errors = result.parseDiagnostics.filter((x) => x.severity === "error");
|
|
6
|
+
if (errors.length > 0 && !result.printable) {
|
|
7
|
+
throw new PrettierParserError(errors[0]);
|
|
8
|
+
}
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
export class PrettierParserError extends Error {
|
|
12
|
+
constructor(error) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
super(error.message);
|
|
15
|
+
this.error = error;
|
|
16
|
+
const location = getSourceLocation(error.target);
|
|
17
|
+
this.loc = {
|
|
18
|
+
start: (_a = location === null || location === void 0 ? void 0 : location.pos) !== null && _a !== void 0 ? _a : 0,
|
|
19
|
+
end: (_b = location === null || location === void 0 ? void 0 : location.end) !== null && _b !== void 0 ? _b : 0,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../formatter/parser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG3D,MAAM,UAAU,KAAK,CACnB,IAAY,EACZ,OAAyC,EACzC,IAA+C;IAE/C,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;IAC7E,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;QAC1C,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAE5C,YAAmC,KAAiB;;QAClD,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QADY,UAAK,GAAL,KAAK,CAAY;QAElD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG,GAAG;YACT,KAAK,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,mCAAI,CAAC;YACzB,GAAG,EAAE,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,mCAAI,CAAC;SACxB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Printer } from "prettier";
|
|
2
|
+
import { Node } from "../../core/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Override the default behavior to attach comments to syntax node.
|
|
5
|
+
*/
|
|
6
|
+
export declare const commentHandler: Printer<Node>["handleComments"];
|
|
7
|
+
//# sourceMappingURL=comment-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-handler.d.ts","sourceRoot":"","sources":["../../../formatter/print/comment-handler.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AASvD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAK1D,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import prettier from "prettier";
|
|
2
|
+
import { SyntaxKind } from "../../core/types.js";
|
|
3
|
+
const { util } = prettier;
|
|
4
|
+
/**
|
|
5
|
+
* Override the default behavior to attach comments to syntax node.
|
|
6
|
+
*/
|
|
7
|
+
export const commentHandler = {
|
|
8
|
+
ownLine: (comment) => [addEmptyInterfaceComment, addEmptyModelComment, addStatementDecoratorComment].some((x) => x(comment)),
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* When a comment is on an empty interface make sure it gets added as a dangling comment on it and not on the identifier.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* interface Foo {
|
|
16
|
+
* // My comment
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
function addEmptyInterfaceComment(comment) {
|
|
20
|
+
const { precedingNode, enclosingNode } = comment;
|
|
21
|
+
if (enclosingNode &&
|
|
22
|
+
enclosingNode.kind === SyntaxKind.InterfaceStatement &&
|
|
23
|
+
enclosingNode.operations.length === 0 &&
|
|
24
|
+
precedingNode &&
|
|
25
|
+
precedingNode.kind === SyntaxKind.Identifier) {
|
|
26
|
+
util.addDanglingComment(enclosingNode, comment, undefined);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* When a comment is in between decorators.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
*
|
|
36
|
+
* @foo
|
|
37
|
+
* // My comment
|
|
38
|
+
* @bar
|
|
39
|
+
* model Foo {
|
|
40
|
+
* }
|
|
41
|
+
*/
|
|
42
|
+
function addStatementDecoratorComment(comment) {
|
|
43
|
+
const { enclosingNode, precedingNode } = comment;
|
|
44
|
+
if (precedingNode &&
|
|
45
|
+
precedingNode.kind === SyntaxKind.DecoratorExpression &&
|
|
46
|
+
enclosingNode &&
|
|
47
|
+
(enclosingNode.kind === SyntaxKind.NamespaceStatement ||
|
|
48
|
+
enclosingNode.kind === SyntaxKind.ModelStatement ||
|
|
49
|
+
enclosingNode.kind === SyntaxKind.EnumStatement ||
|
|
50
|
+
enclosingNode.kind === SyntaxKind.ModelProperty ||
|
|
51
|
+
enclosingNode.kind === SyntaxKind.EnumMember ||
|
|
52
|
+
enclosingNode.kind === SyntaxKind.UnionStatement)) {
|
|
53
|
+
util.addTrailingComment(precedingNode, comment);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* When a comment is on an empty model make sure it gets added as a dangling comment on it and not on the identifier.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
*
|
|
63
|
+
* model Foo {
|
|
64
|
+
* // My comment
|
|
65
|
+
* }
|
|
66
|
+
*/
|
|
67
|
+
function addEmptyModelComment(comment) {
|
|
68
|
+
const { precedingNode, enclosingNode } = comment;
|
|
69
|
+
if (enclosingNode &&
|
|
70
|
+
enclosingNode.kind === SyntaxKind.ModelStatement &&
|
|
71
|
+
enclosingNode.properties.length === 0 &&
|
|
72
|
+
precedingNode &&
|
|
73
|
+
(precedingNode === enclosingNode.is ||
|
|
74
|
+
precedingNode === enclosingNode.id ||
|
|
75
|
+
precedingNode === enclosingNode.extends)) {
|
|
76
|
+
util.addDanglingComment(enclosingNode, comment, undefined);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=comment-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-handler.js","sourceRoot":"","sources":["../../../formatter/print/comment-handler.ts"],"names":[],"mappings":"AAAA,OAAO,QAAqB,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;AAO1B;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAoC;IAC7D,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CACnB,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,4BAA4B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACxF,CAAC,CAAC,OAAO,CAAC,CACX;CACJ,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAS,wBAAwB,CAAC,OAAoB;IACpD,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAEjD,IACE,aAAa;QACb,aAAa,CAAC,IAAI,KAAK,UAAU,CAAC,kBAAkB;QACpD,aAAa,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QACrC,aAAa;QACb,aAAa,CAAC,IAAI,KAAK,UAAU,CAAC,UAAU,EAC5C;QACA,IAAI,CAAC,kBAAkB,C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f,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../formatter/print/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../formatter/print/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AstPath } from "prettier";
|
|
2
|
+
import { Node } from "../../core/types.js";
|
|
3
|
+
import { TypeSpecPrettierOptions } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Check if the current path should be wrapped in parentheses
|
|
6
|
+
* @param path Prettier print path.
|
|
7
|
+
* @param options Prettier options
|
|
8
|
+
*/
|
|
9
|
+
export declare function needsParens(path: AstPath<Node>, options: TypeSpecPrettierOptions): boolean;
|
|
10
|
+
//# sourceMappingURL=needs-parens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"needs-parens.d.ts","sourceRoot":"","sources":["../../../formatter/print/needs-parens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAwB1F"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SyntaxKind } from "../../core/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Check if the current path should be wrapped in parentheses
|
|
4
|
+
* @param path Prettier print path.
|
|
5
|
+
* @param options Prettier options
|
|
6
|
+
*/
|
|
7
|
+
export function needsParens(path, options) {
|
|
8
|
+
const parent = path.getParentNode();
|
|
9
|
+
if (!parent) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const node = path.getValue();
|
|
13
|
+
switch (node.kind) {
|
|
14
|
+
case SyntaxKind.IntersectionExpression:
|
|
15
|
+
return (parent.kind === SyntaxKind.UnionExpression || parent.kind === SyntaxKind.ArrayExpression);
|
|
16
|
+
case SyntaxKind.UnionExpression:
|
|
17
|
+
return (parent.kind === SyntaxKind.IntersectionExpression ||
|
|
18
|
+
parent.kind === SyntaxKind.ArrayExpression);
|
|
19
|
+
case SyntaxKind.ProjectionLogicalExpression:
|
|
20
|
+
return parent.kind === SyntaxKind.ProjectionLogicalExpression;
|
|
21
|
+
case SyntaxKind.ProjectionArithmeticExpression:
|
|
22
|
+
return parent.kind === SyntaxKind.ProjectionArithmeticExpression;
|
|
23
|
+
default:
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=needs-parens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"needs-parens.js","sourceRoot":"","sources":["../../../formatter/print/needs-parens.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGvD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAmB,EAAE,OAAgC;IAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;IACpC,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,KAAK,CAAC;KACd;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7B,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,UAAU,CAAC,sBAAsB;YACpC,OAAO,CACL,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,eAAe,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,eAAe,CACzF,CAAC;QACJ,KAAK,UAAU,CAAC,eAAe;YAC7B,OAAO,CACL,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,sBAAsB;gBACjD,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,eAAe,CAC3C,CAAC;QACJ,KAAK,UAAU,CAAC,2BAA2B;YACzC,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,2BAA2B,CAAC;QAChE,KAAK,UAAU,CAAC,8BAA8B;YAC5C,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,8BAA8B,CAAC;QACnE;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import prettier, { AstPath, Doc, Printer } from "prettier";
|
|
2
|
+
import { AliasStatementNode, ArrayExpressionNode, AugmentDecoratorStatementNode, Comment, DecoratorDeclarationStatementNode, DecoratorExpressionNode, DirectiveExpressionNode, EnumMemberNode, EnumStatementNode, FunctionDeclarationStatementNode, InterfaceStatementNode, IntersectionExpressionNode, MemberExpressionNode, ModelExpressionNode, ModelPropertyNode, ModelStatementNode, NamespaceStatementNode, Node, OperationSignatureDeclarationNode, OperationSignatureReferenceNode, OperationStatementNode, ProjectionArithmeticExpressionNode, ProjectionBlockExpressionNode, ProjectionCallExpressionNode, ProjectionEqualityExpressionNode, ProjectionLambdaExpressionNode, ProjectionLambdaParameterDeclarationNode, ProjectionLogicalExpressionNode, ProjectionMemberExpressionNode, ProjectionModelExpressionNode, ProjectionModelPropertyNode, ProjectionRelationalExpressionNode, ProjectionTupleExpressionNode, ProjectionUnaryExpressionNode, ReturnExpressionNode, ScalarStatementNode, TupleExpressionNode, TypeReferenceNode, UnionExpressionNode, UnionStatementNode, UnionVariantNode } from "../../core/types.js";
|
|
3
|
+
import { DecorableNode, PrettierChildPrint, TypeSpecPrettierOptions } from "./types.js";
|
|
4
|
+
export declare const typespecPrinter: Printer<Node>;
|
|
5
|
+
export declare function printTypeSpec(path: AstPath<Node>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.Doc;
|
|
6
|
+
export declare function printNode(path: AstPath<Node>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.Doc;
|
|
7
|
+
export declare function printAliasStatement(path: AstPath<AliasStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
8
|
+
export declare function canAttachComment(node: Node): boolean;
|
|
9
|
+
export declare function printComment(commentPath: AstPath<Node | Comment>, options: TypeSpecPrettierOptions): Doc;
|
|
10
|
+
export declare function printDecorators(path: AstPath<DecorableNode>, options: object, print: PrettierChildPrint, { tryInline }: {
|
|
11
|
+
tryInline: boolean;
|
|
12
|
+
}): {
|
|
13
|
+
decorators: prettier.Doc;
|
|
14
|
+
multiline: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function printDecorator(path: AstPath<DecoratorExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
17
|
+
export declare function printAugmentDecorator(path: AstPath<AugmentDecoratorStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
18
|
+
export declare function printDirectives(path: AstPath<Node>, options: object, print: PrettierChildPrint): "" | prettier.doc.builders.Group;
|
|
19
|
+
export declare function printDirective(path: AstPath<DirectiveExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
20
|
+
export declare function printDirectiveArgs(path: AstPath<DirectiveExpressionNode>, options: object, print: PrettierChildPrint): "" | prettier.doc.builders.Concat;
|
|
21
|
+
export declare function printEnumStatement(path: AstPath<EnumStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
22
|
+
export declare function printEnumMember(path: AstPath<EnumMemberNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
23
|
+
export declare function printUnionStatement(path: AstPath<UnionStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
24
|
+
export declare function printUnionVariantsBlock(path: AstPath<UnionStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Group | "{}";
|
|
25
|
+
export declare function printUnionVariant(path: AstPath<UnionVariantNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
26
|
+
export declare function printInterfaceStatement(path: AstPath<InterfaceStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
27
|
+
export declare function printInterfaceMembers(path: AstPath<InterfaceStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Group | "{}";
|
|
28
|
+
/**
|
|
29
|
+
* Handle printing an intersection node.
|
|
30
|
+
* @example `Foo & Bar` or `{foo: string} & {bar: string}`
|
|
31
|
+
*
|
|
32
|
+
* @param path Prettier AST Path.
|
|
33
|
+
* @param options Prettier options
|
|
34
|
+
* @param print Prettier child print callback.
|
|
35
|
+
* @returns Prettier document.
|
|
36
|
+
*/
|
|
37
|
+
export declare function printIntersection(path: AstPath<IntersectionExpressionNode>, options: object, print: PrettierChildPrint): prettier.doc.builders.Group;
|
|
38
|
+
export declare function printArray(path: AstPath<ArrayExpressionNode>, options: object, print: PrettierChildPrint): Doc;
|
|
39
|
+
export declare function printTuple(path: AstPath<TupleExpressionNode | ProjectionTupleExpressionNode>, options: object, print: PrettierChildPrint): Doc;
|
|
40
|
+
export declare function printMemberExpression(path: AstPath<MemberExpressionNode>, options: object, print: PrettierChildPrint): Doc;
|
|
41
|
+
export declare function printModelExpression(path: AstPath<ModelExpressionNode | ProjectionModelExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Group;
|
|
42
|
+
export declare function printModelStatement(path: AstPath<ModelStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
43
|
+
export declare function printModelProperty(path: AstPath<ModelPropertyNode | ProjectionModelPropertyNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
44
|
+
export declare function printId(sv: string): string;
|
|
45
|
+
export declare function printScalarStatement(path: AstPath<ScalarStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
46
|
+
export declare function printNamespaceStatement(path: AstPath<NamespaceStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc;
|
|
47
|
+
export declare function printOperationSignatureDeclaration(path: AstPath<OperationSignatureDeclarationNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
48
|
+
export declare function printOperationSignatureReference(path: AstPath<OperationSignatureReferenceNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
49
|
+
export declare function printOperationStatement(path: AstPath<OperationStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
50
|
+
export declare function printStatementSequence<T extends Node>(path: AstPath<T>, options: TypeSpecPrettierOptions, print: PrettierChildPrint, property: keyof T): prettier.doc.builders.Doc[];
|
|
51
|
+
export declare function printUnion(path: AstPath<UnionExpressionNode>, options: object, print: PrettierChildPrint): prettier.doc.builders.Concat | prettier.doc.builders.Group;
|
|
52
|
+
export declare function printTypeReference(path: prettier.AstPath<TypeReferenceNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc;
|
|
53
|
+
export declare function printModifiers(path: AstPath<DecoratorDeclarationStatementNode | FunctionDeclarationStatementNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.Doc;
|
|
54
|
+
export declare function printProjectionBlockExpressionNode(path: AstPath<ProjectionBlockExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): "{}" | (string | prettier.doc.builders.Concat | prettier.doc.builders.Indent)[];
|
|
55
|
+
export declare function printProjectionMemberExpression(path: AstPath<ProjectionMemberExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
56
|
+
export declare function printProjectionLeftRightExpression(path: AstPath<ProjectionLogicalExpressionNode | ProjectionRelationalExpressionNode | ProjectionEqualityExpressionNode | ProjectionArithmeticExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
57
|
+
export declare function printProjectionUnaryExpression(path: AstPath<ProjectionUnaryExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
58
|
+
export declare function printProjectionCallExpression(path: AstPath<ProjectionCallExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
59
|
+
export declare function printProjectionLambdaExpression(path: AstPath<ProjectionLambdaExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
60
|
+
export declare function printProjectionLambdaParameterDeclaration(path: AstPath<ProjectionLambdaParameterDeclarationNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc;
|
|
61
|
+
export declare function printReturnExpression(path: AstPath<ReturnExpressionNode>, options: TypeSpecPrettierOptions, print: PrettierChildPrint): prettier.doc.builders.Doc[];
|
|
62
|
+
//# sourceMappingURL=printer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printer.d.ts","sourceRoot":"","sources":["../../../formatter/print/printer.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAI3D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,6BAA6B,EAG7B,OAAO,EACP,iCAAiC,EACjC,uBAAuB,EACvB,uBAAuB,EACvB,cAAc,EAEd,iBAAiB,EACjB,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