qsharp-lang 1.3.1 → 1.3.2-dev
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.d.ts +4 -6
- package/dist/browser.js +1 -1
- package/dist/compiler/compiler.d.ts +3 -1
- package/dist/compiler/compiler.js +4 -0
- package/dist/katas-content.generated.js +555 -3
- package/lib/node/qsc_wasm.cjs +41 -4
- package/lib/node/qsc_wasm.d.cts +18 -2
- package/lib/node/qsc_wasm_bg.wasm +0 -0
- package/lib/web/qsc_wasm.d.ts +19 -2
- package/lib/web/qsc_wasm.js +40 -4
- package/lib/web/qsc_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/ux/circuit.tsx +48 -0
- package/ux/index.ts +2 -0
- package/ux/qsharp-circuit.css +185 -0
package/dist/browser.d.ts
CHANGED
|
@@ -18,16 +18,14 @@ export declare function getLanguageService(readFile?: (uri: string) => Promise<s
|
|
|
18
18
|
manifestDirectory: string;
|
|
19
19
|
} | null>): Promise<ILanguageService>;
|
|
20
20
|
export declare function getLanguageServiceWorker(worker: string | Worker): ILanguageServiceWorker;
|
|
21
|
+
export { StepResultId, type IStructStepResult } from "../lib/web/qsc_wasm.js";
|
|
22
|
+
export type { IBreakpointSpan, ICodeLens, ILocation, IOperationInfo, IPosition, IRange, IStackFrame, VSDiagnostic, } from "../lib/web/qsc_wasm.js";
|
|
21
23
|
export { type Dump, type ShotResult } from "./compiler/common.js";
|
|
22
24
|
export { type CompilerState } from "./compiler/compiler.js";
|
|
23
25
|
export { QscEventTarget } from "./compiler/events.js";
|
|
24
26
|
export { getAllKatas, getExerciseSources, getKata, type ContentItem, type Example, type Exercise, type ExplainedSolution, type ExplainedSolutionItem, type Kata, type KataSection, type Lesson, type LessonItem, type Question, } from "./katas.js";
|
|
27
|
+
export { type LanguageServiceEvent } from "./language-service/language-service.js";
|
|
25
28
|
export { default as samples } from "./samples.generated.js";
|
|
26
29
|
export { log, type LogLevel, type TargetProfile };
|
|
27
|
-
export type { ICompilerWorker,
|
|
28
|
-
export type { ILanguageServiceWorker, ILanguageService };
|
|
29
|
-
export type { IDebugServiceWorker, IDebugService };
|
|
30
|
-
export type { IBreakpointSpan, IStackFrame, IPosition, IRange, ILocation, VSDiagnostic, } from "../lib/web/qsc_wasm.js";
|
|
31
|
-
export { type IStructStepResult, StepResultId } from "../lib/web/qsc_wasm.js";
|
|
32
|
-
export { type LanguageServiceEvent } from "./language-service/language-service.js";
|
|
30
|
+
export type { ICompiler, ICompilerWorker, IDebugService, IDebugServiceWorker, ILanguageService, ILanguageServiceWorker, };
|
|
33
31
|
export * as utils from "./utils.js";
|
package/dist/browser.js
CHANGED
|
@@ -107,9 +107,9 @@ export function getLanguageServiceWorker(worker) {
|
|
|
107
107
|
throw "Wasm module must be loaded first";
|
|
108
108
|
return createProxy(worker, wasmModule, languageServiceProtocol);
|
|
109
109
|
}
|
|
110
|
+
export { StepResultId } from "../lib/web/qsc_wasm.js";
|
|
110
111
|
export { QscEventTarget } from "./compiler/events.js";
|
|
111
112
|
export { getAllKatas, getExerciseSources, getKata, } from "./katas.js";
|
|
112
113
|
export { default as samples } from "./samples.generated.js";
|
|
113
114
|
export { log };
|
|
114
|
-
export { StepResultId } from "../lib/web/qsc_wasm.js";
|
|
115
115
|
export * as utils from "./utils.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VSDiagnostic } from "../../lib/web/qsc_wasm.js";
|
|
1
|
+
import { IOperationInfo, TargetProfile, type VSDiagnostic } from "../../lib/web/qsc_wasm.js";
|
|
2
2
|
import { IServiceProxy, ServiceProtocol, ServiceState } from "../workers/common.js";
|
|
3
3
|
import { IQscEventTarget, QscEventData } from "./events.js";
|
|
4
4
|
type Wasm = typeof import("../../lib/node/qsc_wasm.cjs");
|
|
@@ -29,6 +29,7 @@ export interface ICompiler {
|
|
|
29
29
|
**/
|
|
30
30
|
getEstimates(sources: [string, string][], params: string, languageFeatures?: string[]): Promise<string>;
|
|
31
31
|
getEstimates(config: ProgramConfig, params: string): Promise<string>;
|
|
32
|
+
getCircuit(config: ProgramConfig, target: TargetProfile, operation?: IOperationInfo): Promise<object>;
|
|
32
33
|
checkExerciseSolution(userCode: string, exerciseSources: string[], eventHandler: IQscEventTarget): Promise<boolean>;
|
|
33
34
|
}
|
|
34
35
|
/** Type definition for the configuration of a program. */
|
|
@@ -52,6 +53,7 @@ export declare class Compiler implements ICompiler {
|
|
|
52
53
|
deprecatedGetEstimates(sources: [string, string][], params: string, languageFeatures: string[]): Promise<string>;
|
|
53
54
|
getHir(code: string, languageFeatures: string[]): Promise<string>;
|
|
54
55
|
run(sourcesOrConfig: [string, string][] | ProgramConfig, expr: string, shots: number, eventHandler: IQscEventTarget): Promise<void>;
|
|
56
|
+
getCircuit(config: ProgramConfig, target: TargetProfile, operation?: IOperationInfo): Promise<object>;
|
|
55
57
|
checkExerciseSolution(userCode: string, exerciseSources: string[], eventHandler: IQscEventTarget): Promise<boolean>;
|
|
56
58
|
}
|
|
57
59
|
export declare function onCompilerEvent(msg: string, eventTarget: IQscEventTarget): void;
|
|
@@ -73,6 +73,9 @@ export class Compiler {
|
|
|
73
73
|
// may reject without all shots running or events firing.
|
|
74
74
|
this.wasm.run(sources, expr, (msg) => onCompilerEvent(msg, eventHandler), shots, languageFeatures);
|
|
75
75
|
}
|
|
76
|
+
async getCircuit(config, target, operation) {
|
|
77
|
+
return this.wasm.get_circuit(config.sources, target, operation, config.languageFeatures || []);
|
|
78
|
+
}
|
|
76
79
|
async checkExerciseSolution(userCode, exerciseSources, eventHandler) {
|
|
77
80
|
const success = this.wasm.check_exercise_solution(userCode, exerciseSources, (msg) => onCompilerEvent(msg, eventHandler));
|
|
78
81
|
return success;
|
|
@@ -114,6 +117,7 @@ export const compilerProtocol = {
|
|
|
114
117
|
getHir: "request",
|
|
115
118
|
getQir: "request",
|
|
116
119
|
getEstimates: "request",
|
|
120
|
+
getCircuit: "request",
|
|
117
121
|
run: "requestWithProgress",
|
|
118
122
|
checkExerciseSolution: "requestWithProgress",
|
|
119
123
|
},
|