@typespec/playground 0.5.0-dev.1 → 0.5.0-dev.2

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { c as createBrowserHost, a as createUrlStateStorage, r as registerMonacoLanguage } from './state-storage-BjOULkS3.js';
1
+ export { c as createBrowserHost, a as createUrlStateStorage, r as registerMonacoLanguage } from './state-storage-CPYqeLVy.js';
2
2
 
3
3
  function registerMonacoDefaultWorkersForVite() {
4
4
  self.MonacoEnvironment = {
@@ -0,0 +1,6 @@
1
+ const manifest = {
2
+ "version": "0.59.0",
3
+ "commit": "96b3347620c6dc3059f2b0d8eefb3acb13824ce4"
4
+ };
5
+
6
+ export { manifest as default };
@@ -7,7 +7,7 @@ import { mergeClasses as mergeClasses$1, Popover, PopoverTrigger, PopoverSurface
7
7
  import { Settings24Regular, Save16Regular, Broom16Filled, Bug16Regular, FolderListRegular, CircleFilled, Square16Filled, Square12Filled, Checkmark16Filled, Checkmark12Filled, AppsListRegular, DatabaseRegular, ChevronDownRegular, ChevronRightRegular, DataLineRegular, ErrorCircle16Filled, Warning16Filled, ChevronDown16Regular } from '@fluentui/react-icons';
8
8
  import debounce from 'debounce';
9
9
  import { CompletionItemTag as CompletionItemTag$1 } from 'vscode-languageserver';
10
- import { g as getMonacoRange, a as createUrlStateStorage, c as createBrowserHost, r as registerMonacoLanguage } from '../state-storage-BjOULkS3.js';
10
+ import { g as getMonacoRange, a as createUrlStateStorage, c as createBrowserHost, r as registerMonacoLanguage } from '../state-storage-CPYqeLVy.js';
11
11
  import { ErrorBoundary } from 'react-error-boundary';
12
12
  import { getSourceLocation } from '@typespec/compiler';
13
13
  import { createRoot } from 'react-dom/client';
@@ -31419,6 +31419,12 @@ const diagnostics = {
31419
31419
  default: paramMessage `Path "${"path"}" cannot be relative. Use {cwd} or {project-root} to specify what the path should be relative to.`,
31420
31420
  },
31421
31421
  },
31422
+ "path-unix-style": {
31423
+ severity: "warning",
31424
+ messages: {
31425
+ default: paramMessage `Path should use unix style separators. Use "/" instead of "\\".`,
31426
+ },
31427
+ },
31422
31428
  "config-path-not-found": {
31423
31429
  severity: "error",
31424
31430
  messages: {
@@ -31658,6 +31664,7 @@ const diagnostics = {
31658
31664
  wrongType: paramMessage `Encoding '${"encoding"}' cannot be used on type '${"type"}'. Expected: ${"expected"}.`,
31659
31665
  wrongEncodingType: paramMessage `Encoding '${"encoding"}' on type '${"type"}' is expected to be serialized as '${"expected"}' but got '${"actual"}'.`,
31660
31666
  wrongNumericEncodingType: paramMessage `Encoding '${"encoding"}' on type '${"type"}' is expected to be serialized as '${"expected"}' but got '${"actual"}'. Set '@encode' 2nd parameter to be of type ${"expected"}. e.g. '@encode("${"encoding"}", int32)'`,
31667
+ firstArg: `First argument of "@encode" must be the encoding name or the string type when encoding numeric types.`,
31661
31668
  },
31662
31669
  },
31663
31670
  "invalid-mime-type": {
@@ -38687,6 +38694,15 @@ function compilerAssert(condition, message, target) {
38687
38694
  throw new Error(message);
38688
38695
  }
38689
38696
 
38697
+ function absolutePathStatus(path) {
38698
+ if (path.startsWith(".") || !isPathAbsolute(path)) {
38699
+ return "not-absolute";
38700
+ }
38701
+ if (path.includes("\\")) {
38702
+ return "windows-style";
38703
+ }
38704
+ return "valid";
38705
+ }
38690
38706
  function createJSONSchemaValidator(schema, options = { strict: true }) {
38691
38707
  const ajv = new ajvExports.Ajv({
38692
38708
  strict: options.strict,
@@ -38695,9 +38711,7 @@ function createJSONSchemaValidator(schema, options = { strict: true }) {
38695
38711
  });
38696
38712
  ajv.addFormat("absolute-path", {
38697
38713
  type: "string",
38698
- validate: (path) => {
38699
- return !path.startsWith(".") && isPathAbsolute(path);
38700
- },
38714
+ validate: (path) => absolutePathStatus(path) === "valid",
38701
38715
  });
38702
38716
  return { validate };
38703
38717
  function validate(config, target) {
@@ -38716,11 +38730,22 @@ const IGNORED_AJV_PARAMS = new Set(["type", "errors"]);
38716
38730
  function ajvErrorToDiagnostic(obj, error, target) {
38717
38731
  const tspTarget = resolveTarget(error, target);
38718
38732
  if (error.params.format === "absolute-path") {
38719
- return createDiagnostic({
38720
- code: "config-path-absolute",
38721
- format: { path: getErrorValue(obj, error) },
38722
- target: tspTarget,
38723
- });
38733
+ const value = getErrorValue(obj, error);
38734
+ const status = absolutePathStatus(value);
38735
+ if (status === "windows-style") {
38736
+ return createDiagnostic({
38737
+ code: "path-unix-style",
38738
+ format: { path: value },
38739
+ target: tspTarget,
38740
+ });
38741
+ }
38742
+ else {
38743
+ return createDiagnostic({
38744
+ code: "config-path-absolute",
38745
+ format: { path: value },
38746
+ target: tspTarget,
38747
+ });
38748
+ }
38724
38749
  }
38725
38750
  const messageLines = [`Schema violation: ${error.message} (${error.instancePath || "/"})`];
38726
38751
  for (const [name, value] of Object.entries(error.params).filter(([name]) => !IGNORED_AJV_PARAMS.has(name))) {
@@ -38792,7 +38817,7 @@ let manifest;
38792
38817
  try {
38793
38818
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
38794
38819
  // @ts-ignore
38795
- manifest = (await import('../manifest-dq4u9tDK-dq4u9tDK.js')).default;
38820
+ manifest = (await import('../manifest-cw894x-a-cw894x-a.js')).default;
38796
38821
  }
38797
38822
  catch {
38798
38823
  const name = "../dist/manifest.js";
@@ -40492,6 +40517,8 @@ function parse$1(original) {
40492
40517
  return { n, e: exp, s: sign, d: decimal };
40493
40518
  }
40494
40519
  function stringify(value) {
40520
+ if (value.n === 0n)
40521
+ return "0";
40495
40522
  const n = value.n.toString();
40496
40523
  const sign = value.s === -1 ? "-" : "";
40497
40524
  const int = value.e === 0 ? "0" : n.slice(0, value.e);
@@ -51998,7 +52025,8 @@ function computeTree(program) {
51998
52025
  };
51999
52026
  }
52000
52027
  function computeTypeNode(parentPath, type, name) {
52001
- const path = parentPath + "." + type.name.toString();
52028
+ const pathSeg = name ?? type.name.toString();
52029
+ const path = parentPath + "." + pathSeg;
52002
52030
  return computeTypeNodeProps(path, type, name);
52003
52031
  }
52004
52032
  function computeTypeNodeProps(path, type, name) {
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAmC9C,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,iBA4T7D;AAED,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,cAAc,oBAAoB,CAAC,EACrD,MAAM,EAAE,gBAAgB,GAAG,OAAO,QAAQ,GACzC,MAAM,CAAC,MAAM,CAkBf"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EAEd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAmC9C,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,iBA+T7D;AAED,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,cAAc,oBAAoB,CAAC,EACrD,MAAM,EAAE,gBAAgB,GAAG,OAAO,QAAQ,GACzC,MAAM,CAAC,MAAM,CAkBf"}
@@ -286,6 +286,9 @@ function getTypeSpecLanguageConfiguration() {
286
286
  };
287
287
  }
288
288
  async function registerMonacoLanguage(host) {
289
+ if (monaco.languages.getLanguages().some((x) => x.id === "typespec")) {
290
+ return;
291
+ }
289
292
  monaco.languages.register({ id: "typespec", extensions: [".tsp"] });
290
293
  monaco.languages.setLanguageConfiguration("typespec", getTypeSpecLanguageConfiguration());
291
294
  const serverHost = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/playground",
3
- "version": "0.5.0-dev.1",
3
+ "version": "0.5.0-dev.2",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec playground UI components.",
6
6
  "homepage": "https://typespec.io",
@@ -57,15 +57,15 @@
57
57
  "dependencies": {
58
58
  "@fluentui/react-components": "~9.54.5",
59
59
  "@fluentui/react-icons": "^2.0.249",
60
- "@typespec/bundler": "~0.1.5 || >=0.2.0-dev <0.2.0",
61
- "@typespec/compiler": "~0.58.1 || >=0.59.0-dev <0.59.0",
62
- "@typespec/html-program-viewer": "~0.58.0 || >=0.59.0-dev <0.59.0",
63
- "@typespec/http": "~0.58.0 || >=0.59.0-dev <0.59.0",
64
- "@typespec/openapi": "~0.58.0 || >=0.59.0-dev <0.59.0",
65
- "@typespec/openapi3": "~0.58.0 || >=0.59.0-dev <0.59.0",
66
- "@typespec/protobuf": "~0.58.0 || >=0.59.0-dev <0.59.0",
67
- "@typespec/rest": "~0.58.0 || >=0.59.0-dev <0.59.0",
68
- "@typespec/versioning": "~0.58.0 || >=0.59.0-dev <0.59.0",
60
+ "@typespec/bundler": "~0.1.6 || >=0.2.0-dev <0.2.0",
61
+ "@typespec/compiler": "~0.59.0 || >=0.60.0-dev <0.60.0",
62
+ "@typespec/html-program-viewer": "~0.59.0 || >=0.60.0-dev <0.60.0",
63
+ "@typespec/http": "~0.59.0 || >=0.60.0-dev <0.60.0",
64
+ "@typespec/openapi": "~0.59.0 || >=0.60.0-dev <0.60.0",
65
+ "@typespec/openapi3": "~0.59.0 || >=0.60.0-dev <0.60.0",
66
+ "@typespec/protobuf": "~0.59.0 || >=0.60.0-dev <0.60.0",
67
+ "@typespec/rest": "~0.59.0 || >=0.60.0-dev <0.60.0",
68
+ "@typespec/versioning": "~0.59.0 || >=0.60.0-dev <0.60.0",
69
69
  "clsx": "^2.1.1",
70
70
  "debounce": "~2.1.0",
71
71
  "lzutf8": "0.6.3",
@@ -91,7 +91,7 @@
91
91
  "@types/react": "~18.3.3",
92
92
  "@types/react-dom": "~18.3.0",
93
93
  "@types/swagger-ui-dist": "~3.30.5",
94
- "@typespec/bundler": "~0.1.5 || >=0.2.0-dev <0.2.0",
94
+ "@typespec/bundler": "~0.1.6 || >=0.2.0-dev <0.2.0",
95
95
  "@vitejs/plugin-react": "~4.3.1",
96
96
  "c8": "^10.1.2",
97
97
  "cross-env": "~7.0.3",
@@ -1,6 +0,0 @@
1
- const manifest = {
2
- "version": "0.58.1",
3
- "commit": "54c6d889564a230afc1b9f13c71905171e350fb3"
4
- };
5
-
6
- export { manifest as default };