Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7fbc222
save initial progress
joao-boechat Mar 24, 2026
2050f1a
unify common exports in single file
joao-boechat Mar 30, 2026
adf2adf
first complete working version
joao-boechat Apr 3, 2026
c482e3e
remove redundant code from main.ts entrypoint
joao-boechat Apr 3, 2026
600f6ab
fix deprecated parameters
joao-boechat Apr 3, 2026
a074ed3
fix qsharp-lang tests
joao-boechat Apr 3, 2026
1db22da
make generate_docs depend on web version of wasm
joao-boechat Apr 8, 2026
65adfc7
use web-worker npm package to make worker code agnostic of platform (…
joao-boechat Apr 8, 2026
642a244
update vscode extension to match new worker api
joao-boechat Apr 8, 2026
59663b7
update playground to match new worker api
joao-boechat Apr 8, 2026
d1d3082
build node-workers separately, keep web-worker external for the node …
joao-boechat Apr 8, 2026
cb2566d
fix qsharp-lang tests
joao-boechat Apr 8, 2026
bf2bcf8
log platform, UI, and remoteName during extension activation
joao-boechat Apr 8, 2026
dbff9f7
centralize platform env
joao-boechat Apr 8, 2026
d4aa75a
export messageHandler for backwards compatibility
joao-boechat Apr 8, 2026
1de5b89
update comments and README for qsharp-lang package
joao-boechat Apr 8, 2026
77a4efd
wasm-bindgen only builds to web
joao-boechat Apr 9, 2026
c1053fe
fix minor typo in variable name
joao-boechat Apr 10, 2026
a91aa50
add strict type to __PLATFORM__ variable
joao-boechat Apr 10, 2026
699ecae
remove common-exports.ts
joao-boechat Apr 10, 2026
36e6360
make logs less noisy
joao-boechat Apr 10, 2026
c65585c
make workers of type module by default
joao-boechat Apr 13, 2026
09510d1
remove browser dependency on web-worker
joao-boechat Apr 13, 2026
e25b89a
simplify build code
joao-boechat Apr 13, 2026
40b20a2
make web-worker optional dependency for qsharp
joao-boechat Apr 13, 2026
167c673
simplify copying web-worker for building package
joao-boechat Apr 13, 2026
526f9a5
fix watch mode
joao-boechat Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
npm_cmd = "npm.cmd" if platform.system() == "Windows" else "npm"

build_type = "debug" if args.debug else "release"
wasm_targets = ["web", "nodejs"] if not args.web_only else ["web"]
wasm_targets = ["web"] if not args.web_only else ["web"]
run_tests = args.test

root_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions source/npm/qsharp/generate_docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

// @ts-check

import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";

import { generate_docs } from "./lib/nodejs/qsc_wasm.cjs";
import initWasm, { generate_docs } from "./lib/web/qsc_wasm.js";

const scriptDirPath = dirname(fileURLToPath(import.meta.url));
const docsDirPath = join(scriptDirPath, "docs");
Expand All @@ -16,6 +16,11 @@ if (!existsSync(docsDirPath)) {
mkdirSync(docsDirPath);
}

// Initialize wasm before calling any exported functions
const wasmPath = join(scriptDirPath, "lib", "web", "qsc_wasm_bg.wasm");
const wasmBytes = readFileSync(wasmPath);
await initWasm({ module_or_path: wasmBytes });

// 'filename' will be of the format 'namespace/api.md' (except for 'toc.yaml')
// 'metadata' will be the metadata that will appear at the top of the file
// 'contents' will contain the non-metadata markdown expected
Expand Down
17 changes: 8 additions & 9 deletions source/npm/qsharp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@
"directory": "npm"
},
"exports": {
".": {
"browser": "./dist/browser.js",
"node": "./dist/main.js",
"default": "./dist/browser.js"
},
"./compiler-worker": "./dist/compiler/worker-browser.js",
"./language-service-worker": "./dist/language-service/worker-browser.js",
"./debug-service-worker": "./dist/debug-service/worker-browser.js",
".": "./dist/main.js",
"./compiler-worker": "./dist/compiler/worker.js",
"./language-service-worker": "./dist/language-service/worker.js",
"./debug-service-worker": "./dist/debug-service/worker.js",
"./katas": "./dist/katas.js",
"./katas-md": "./dist/katas-md.js",
"./state-viz": "./ux/circuit-vis/state-viz/worker/index.ts",
Expand All @@ -44,5 +40,8 @@
"docs",
"lib",
"ux"
]
],
"dependencies": {
"web-worker": "^1.5.0"
}
}
220 changes: 0 additions & 220 deletions source/npm/qsharp/src/browser.ts

This file was deleted.

29 changes: 29 additions & 0 deletions source/npm/qsharp/src/common-exports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export type { IVariable, IVariableChild } from "../lib/web/qsc_wasm.js";
export * as utils from "./utils.js";
export { log } from "./log.js";
export { QscEventTarget } from "./compiler/events.js";
export { QdkDiagnostics } from "./diagnostics.js";
export { default as samples } from "./samples.generated.js";
export { default as openqasm_samples } from "./openqasm-samples.generated.js";
export {
qsharpGithubUriScheme,
qsharpLibraryUriScheme,
} from "./language-service/language-service.js";
export type { Dump, ShotResult } from "./compiler/common.js";
export type { CompilerState, ProgramConfig } from "./compiler/compiler.js";
export type { ICompiler, ICompilerWorker } from "./compiler/compiler.js";
export type {
IDebugService,
IDebugServiceWorker,
} from "./debug-service/debug-service.js";
export type {
ILanguageService,
ILanguageServiceWorker,
LanguageServiceDiagnosticEvent,
LanguageServiceEvent,
LanguageServiceTestCallablesEvent,
} from "./language-service/language-service.js";
export type { ProjectLoader } from "./project.js";
export type { CircuitGroup as CircuitData } from "./data-structures/circuit.js";
export type { LogLevel } from "./log.js";
export { StepResultId } from "../lib/web/qsc_wasm.js";
8 changes: 0 additions & 8 deletions source/npm/qsharp/src/compiler/worker-browser.ts

This file was deleted.

7 changes: 0 additions & 7 deletions source/npm/qsharp/src/compiler/worker-node.ts

This file was deleted.

8 changes: 8 additions & 0 deletions source/npm/qsharp/src/compiler/worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { createWorker } from "../workers/worker.js";
import { compilerProtocol } from "./compiler.js";

const messageHandler = createWorker(compilerProtocol);
addEventListener("message", messageHandler);
2 changes: 1 addition & 1 deletion source/npm/qsharp/src/debug-service/debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
IStructStepResult,
IVariable,
} from "../../lib/web/qsc_wasm.js";
import { ProgramConfig } from "../browser.js";
import { ProgramConfig } from "../main.js";
import { eventStringToMsg } from "../compiler/common.js";
import {
IQscEventTarget,
Expand Down
8 changes: 0 additions & 8 deletions source/npm/qsharp/src/debug-service/worker-browser.ts

This file was deleted.

7 changes: 0 additions & 7 deletions source/npm/qsharp/src/debug-service/worker-node.ts

This file was deleted.

8 changes: 8 additions & 0 deletions source/npm/qsharp/src/debug-service/worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { createWorker } from "../workers/worker.js";
import { debugServiceProtocol } from "./debug-service.js";

const messageHandler = createWorker(debugServiceProtocol);
addEventListener("message", messageHandler);
Loading
Loading