typespec-vscode 0.56.0-dev.1 → 0.56.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.
@@ -21792,7 +21792,6 @@ async function restartTypeSpecServer() {
21792
21792
  }
21793
21793
  }
21794
21794
  async function launchLanguageClient(context) {
21795
- var _a, _b, _c, _d;
21796
21795
  const exe = await resolveTypeSpecServer(context);
21797
21796
  const options = {
21798
21797
  synchronize: {
@@ -21819,8 +21818,8 @@ async function launchLanguageClient(context) {
21819
21818
  }
21820
21819
  catch (e) {
21821
21820
  if (typeof e === "string" && e.startsWith("Launching server using command")) {
21822
- const workspaceFolder = (_d = (_c = (_b = (_a = require$$0$1.workspace.workspaceFolders) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.uri) === null || _c === void 0 ? void 0 : _c.fsPath) !== null && _d !== void 0 ? _d : "";
21823
- client === null || client === void 0 ? void 0 : client.error([
21821
+ const workspaceFolder = require$$0$1.workspace.workspaceFolders?.[0]?.uri?.fsPath ?? "";
21822
+ client?.error([
21824
21823
  `TypeSpec server executable was not found: '${exe.command}' is not found. Make sure either:`,
21825
21824
  ` - TypeSpec is installed locally at the root of this workspace ("${workspaceFolder}") or in a parent directory.`,
21826
21825
  " - TypeSpec is installed globally with `npm install -g @typespec/compiler'.",
@@ -21834,7 +21833,6 @@ async function launchLanguageClient(context) {
21834
21833
  }
21835
21834
  }
21836
21835
  async function resolveTypeSpecServer(context) {
21837
- var _a, _b, _c, _d, _e;
21838
21836
  const nodeOptions = process.env.TYPESPEC_SERVER_NODE_OPTIONS;
21839
21837
  const args = ["--stdio"];
21840
21838
  // In development mode (F5 launch from source), resolve to locally built server.js.
@@ -21842,7 +21840,7 @@ async function resolveTypeSpecServer(context) {
21842
21840
  const script = context.asAbsolutePath("../compiler/entrypoints/server.js");
21843
21841
  // we use CLI instead of NODE_OPTIONS environment variable in this case
21844
21842
  // because --nolazy is not supported by NODE_OPTIONS.
21845
- const options = (_a = nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.split(" ").filter((o) => o)) !== null && _a !== void 0 ? _a : [];
21843
+ const options = nodeOptions?.split(" ").filter((o) => o) ?? [];
21846
21844
  return { command: "node", args: [...options, script, ...args] };
21847
21845
  }
21848
21846
  const options = {
@@ -21857,7 +21855,7 @@ async function resolveTypeSpecServer(context) {
21857
21855
  if (serverPath && typeof serverPath !== "string") {
21858
21856
  throw new Error("VS Code configuration option 'typespec.tsp-server.path' must be a string");
21859
21857
  }
21860
- const workspaceFolder = (_e = (_d = (_c = (_b = require$$0$1.workspace.workspaceFolders) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.uri) === null || _d === void 0 ? void 0 : _d.fsPath) !== null && _e !== void 0 ? _e : "";
21858
+ const workspaceFolder = require$$0$1.workspace.workspaceFolders?.[0]?.uri?.fsPath ?? "";
21861
21859
  // Default to tsp-server on PATH, which would come from `npm install -g
21862
21860
  // @typespec/compiler` in a vanilla setup.
21863
21861
  if (!serverPath) {
@@ -21919,25 +21917,25 @@ async function isFile$1(path) {
21919
21917
  }
21920
21918
  }
21921
21919
  async function deactivate() {
21922
- await (client === null || client === void 0 ? void 0 : client.stop());
21920
+ await client?.stop();
21923
21921
  }
21924
21922
  /**
21925
21923
  * Resolve some of the VSCode variables.
21926
21924
  * Simpler aLternative until https://github.com/microsoft/vscode/issues/46471 is supported.
21927
21925
  */
21928
21926
  class VSCodeVariableResolver {
21927
+ variables;
21928
+ static VARIABLE_REGEXP = /\$\{(.*?)\}/g;
21929
21929
  constructor(variables) {
21930
21930
  this.variables = variables;
21931
21931
  }
21932
21932
  resolve(value) {
21933
21933
  const replaced = value.replace(VSCodeVariableResolver.VARIABLE_REGEXP, (match, variable) => {
21934
- var _a;
21935
- return (_a = this.variables[variable]) !== null && _a !== void 0 ? _a : match;
21934
+ return this.variables[variable] ?? match;
21936
21935
  });
21937
21936
  return replaced;
21938
21937
  }
21939
21938
  }
21940
- VSCodeVariableResolver.VARIABLE_REGEXP = /\$\{(.*?)\}/g;
21941
21939
 
21942
21940
  // Forked from https://github.com/microsoft/TypeScript/blob/663b19fe4a7c4d4ddaa61aedadd28da06acd27b6/src/compiler/path.ts
21943
21941
  /**
@@ -22258,6 +22256,7 @@ function normalizeSlashes(path) {
22258
22256
  }
22259
22257
 
22260
22258
  class ResolveModuleError extends Error {
22259
+ code;
22261
22260
  constructor(code, message) {
22262
22261
  super(message);
22263
22262
  this.code = code;
@@ -22334,7 +22333,6 @@ async function resolveModule(host, name, options) {
22334
22333
  return undefined;
22335
22334
  }
22336
22335
  async function loadAsDirectory(directory, mustBePackage) {
22337
- var _a;
22338
22336
  const pkgFile = resolvePath(directory, "package.json");
22339
22337
  if (await isFile(host, pkgFile)) {
22340
22338
  const pkg = await readPackage(host, pkgFile);
@@ -22343,7 +22341,7 @@ async function resolveModule(host, name, options) {
22343
22341
  if (mustBePackage) {
22344
22342
  return undefined;
22345
22343
  }
22346
- for (const file of (_a = options.directoryIndexFiles) !== null && _a !== void 0 ? _a : defaultDirectoryIndexFiles) {
22344
+ for (const file of options.directoryIndexFiles ?? defaultDirectoryIndexFiles) {
22347
22345
  const resolvedFile = await loadAsFile(joinPaths(directory, file));
22348
22346
  if (resolvedFile) {
22349
22347
  return resolvedFile;
@@ -22352,7 +22350,6 @@ async function resolveModule(host, name, options) {
22352
22350
  return undefined;
22353
22351
  }
22354
22352
  async function loadPackage(directory, pkg) {
22355
- var _a;
22356
22353
  const mainFile = options.resolveMain ? options.resolveMain(pkg) : pkg.main;
22357
22354
  if (typeof mainFile !== "string") {
22358
22355
  throw new TypeError(`package "${pkg.name}" main must be a string but was '${mainFile}'`);
@@ -22360,7 +22357,7 @@ async function resolveModule(host, name, options) {
22360
22357
  const mainFullPath = resolvePath(directory, mainFile);
22361
22358
  let loaded;
22362
22359
  try {
22363
- loaded = (_a = (await loadAsFile(mainFullPath))) !== null && _a !== void 0 ? _a : (await loadAsDirectory(mainFullPath));
22360
+ loaded = (await loadAsFile(mainFullPath)) ?? (await loadAsDirectory(mainFullPath));
22364
22361
  }
22365
22362
  catch (e) {
22366
22363
  throw new Error(`Cannot find module '${mainFullPath}'. Please verify that the package.json has a valid "main" entry`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typespec-vscode",
3
- "version": "0.56.0-dev.1",
3
+ "version": "0.56.0",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec language support for VS Code",
6
6
  "homepage": "https://typespec.io",
@@ -25,7 +25,7 @@
25
25
  "type": "module",
26
26
  "main": "./dist/src/extension.cjs",
27
27
  "engines": {
28
- "vscode": "^1.87.0"
28
+ "vscode": "^1.88.0"
29
29
  },
30
30
  "activationEvents": [
31
31
  "onLanguage:typespec",
@@ -116,21 +116,19 @@
116
116
  "@rollup/plugin-node-resolve": "~15.2.3",
117
117
  "@rollup/plugin-typescript": "~11.1.6",
118
118
  "@types/node": "~18.11.19",
119
- "@types/vscode": "~1.87.0",
120
- "@typespec/compiler": "~0.55.0 || >=0.56.0-dev <0.56.0",
121
- "@typespec/internal-build-utils": "~0.55.0 || >=0.56.0-dev <0.56.0",
122
- "@vitest/coverage-v8": "^1.4.0",
123
- "@vitest/ui": "^1.4.0",
124
- "@vscode/vsce": "~2.24.0",
119
+ "@types/vscode": "~1.88.0",
120
+ "@vitest/coverage-v8": "^1.5.0",
121
+ "@vitest/ui": "^1.5.0",
122
+ "@vscode/vsce": "~2.25.0",
125
123
  "c8": "^9.1.0",
126
124
  "rimraf": "~5.0.5",
127
- "rollup": "~4.13.2",
128
- "typescript": "~5.4.3",
129
- "vitest": "^1.4.0",
130
- "vscode-languageclient": "~9.0.1"
125
+ "rollup": "~4.14.3",
126
+ "typescript": "~5.4.5",
127
+ "vitest": "^1.5.0",
128
+ "vscode-languageclient": "~9.0.1",
129
+ "@typespec/compiler": "~0.56.0",
130
+ "@typespec/internal-build-utils": "~0.56.0"
131
131
  },
132
- "dependencies": {},
133
- "peerDependencies": {},
134
132
  "scripts": {
135
133
  "clean": "rimraf ./dist ./temp",
136
134
  "build": "npm run compile && npm run copy-tmlanguage && npm run generate-language-configuration && npm run generate-third-party-notices && npm run package-vsix",
index d5606f9..62869af 100644
Binary file