Граф коммитов

49 Коммитов

Автор SHA1 Сообщение Дата
Timothee Guerin b1e6a64a14
Ignore already escaped `|` when building markdown table (#3281)
Fix CodeQL issue
https://github.com/microsoft/typespec/security/code-scanning/13
2024-05-07 20:04:00 +00:00
Timothee Guerin 5757fd16e4
Include `type` in generated extern dec (#3250)
This allows us to use `verbatimModuleSyntax: true`
2024-04-29 20:23:34 +00:00
Timothee Guerin d290c17b5e
Update dependencies - april 2024 (#3169)
Notable: 
- vitest `1.5.0` which solves some issues with running in the extension
- remove `sinon` from compiler which is not needed anymore as vitest
provide spies built-in
2024-04-15 10:24:38 -07:00
Timothee Guerin 35f5c90343
Migrate to eslint flat config (#3123)
resolve https://github.com/microsoft/typespec/issues/3121
same change in typespec-azure
https://github.com/Azure/typespec-azure/pull/620

## Single top level config
This makes it a little nicer to run as you know get the absolute path
for errors
No need to have the hacky rushstack dependency to allow using the same
shared config.

## Able to lint the projects that are outside of the pnpm workspace
<img width="1054" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/f88691d9-1bf2-4140-ba2b-533207b15f9d">


## Eslint 9 -no yet

eslint 9 was just released firday which makes this config the new
default however it does include breaking changes and not all our plugins
have updated
2024-04-08 09:58:19 -07:00
Timothee Guerin 0c1b96be47
Ci improvements (#3099)
- Use corepack to install pnpm: Faster and respect the pnpm version set
in package.json instead of having another place to keep up to date
- dependency cache
- upgrade to new code coverage task
- Move all consitency check to independent github action workflow(Makes
it easier to see which one failed immediately without having to open
devops and dig into the steps)
2024-04-03 16:19:59 -07:00
Timothee Guerin 0dea649cd7
Update dependencies to resolve vulnerabilities and license issue (#3081)
- Remove unused rollup-plugin-dts dep that had problematic license
- Update dependencies to fix vulnerabilies
2024-03-29 21:22:06 +00:00
Timothee Guerin 06f514dc92
Fix non portable export (#3039)
Not sure why only catching that in the typespec-azure repo build but it
complains that the return type of this function wasn't portable,
Probably good anyway to be more explicit here.
2024-03-22 01:55:12 +00:00
Timothee Guerin 077db13c8d
Generate TypeScript decorator signatures from `extern dec` (#2122)
Note this is added to `tspd` which is not published yet so this can be
iterated over without any issues.

Adds a decorator signature generator. Generates 2 files:
- `<namespace>.ts` : Contains the decorator signatures that can be
imported and when declaring the decorators functions
- `<namespace>.ts-test.ts`: Contains some test using typescript type
system to make sure the package does reexport the right `$<name>` for
each decorator

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-03-19 23:08:59 +00:00
Timothee Guerin 4199f83575
Upgrade dependencies march 2024 (#3027)
General update of all dependencies, notable
- typescript 5.4
- vitest 1.4
2024-03-18 10:52:06 -07:00
Timothee Guerin d8576effd5
Website & Docs Cleanup (#3002)
Co-authored-by: Mario Guerra <85648637+mario-guerra@users.noreply.github.com>
Co-authored-by: Libba Lawrence <llawrence@microsoft.com>
Co-authored-by: Allen Zhang <allenzhang@live.com>
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-03-11 18:56:35 -07:00
Timothee Guerin 02ed01e79b
Improved ref docs for model (#2951)
fix https://github.com/Azure/typespec-azure-pr/issues/3861
fix #2232
Generate docs for model properties and reference models within the same
package
<img width="1213" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/ae7eccd0-97d8-401e-b07f-3375c7b41446">
2024-02-29 07:21:13 -08:00
Timothee Guerin 7452fe9a57
Update dependencies - feb 2024 (#2900)
General dependency updates, notable:
- typescript 5.3
- chronus 0.6.0 (BREAKING  THE CHANGELOG FORMAT)
2024-02-08 15:14:01 -08:00
Timothee Guerin 173c0de73c
Merge hotfix back into main (#2899) 2024-02-08 11:37:38 -08:00
Timothee Guerin ad74773b53
Bump version for February release (#2890) 2024-02-06 16:14:38 -08:00
Timothee Guerin 3186305426
Fix publishing (#2865)
Because apparently `pnpm config set` just silently make the default
`script:` batch crash without an error
2024-01-30 20:11:39 -08:00
Timothee Guerin be9f6d8145
Rename references from microsoft.github.io/typespec to typespec.io (#2858)
All reference but the README as it is being rewritten here
https://github.com/microsoft/typespec/pull/2855
2024-01-30 12:58:42 -08:00
Jordan Danford 9f556004ec
Clean up capitalization, parentheses, and phrasing in docs (#2817)
I updated library documentation links
(https://microsoft.github.io/typespec/libraries =>
https://typespec.io/docs/libraries), should I update the other
https://microsoft.github.io links as well?
2024-01-25 10:40:16 -08:00
Timothee Guerin 842405e8d1
Get rid of rush and move to pnpm (#2775)
Remove the opinionated (wrongly so most of the time) middleman that
brings more config pain than value.

Things to check:
- [x] Parallel build performance vs rush
- [ ] Publishing with submodule
- [x] Changesets
2024-01-24 13:37:34 -08:00
Mark Cowlishaw 345cd594da
Prepare Publish for January Release (#2816) 2024-01-24 11:14:23 -08:00
Timothee Guerin 55ea44250d
Vitest improvements: vitest-ui, watch mode for deps, debug config (#2791)
Add vitest ui package and `test:ui` command to popup the vitest UI
https://vitest.dev/guide/ui

Import the common vitest config from the workspace so each package
doesn't need to define all of it.
Added `watchExclude: []` to the common config to preven vitest from
excluding dist and node_modules folder which is required so it can auto
rerun the test on when a dependency (monorepo dep) rebuilds

Added debug config to debug the current test. As the vitest extensions
is quite unreliable this should help
2024-01-22 09:56:55 -08:00
Timothee Guerin 9c7bf80187
Migrate test framework to vitest (#2769)
Get rid of mocha and upgrade to vitest which is a more modern
alternative providing, watch, direct typescript compilation out of the
box, expect library and more.

Advantage over mocha:
- Much better cli
  -  watch mode
  - better diff
- Better extension:
  -  tree organization for files too (not everything flattened)
- update in real time the test(no more need to refresh manually to
discover where are the tests)
  - just a little buggy
- Compiles typescript directly
- provides more expectation apis(like jest)

Cons over mocha: 
- Slower(about 2x) but that means we don't need to build the test as
part of build which would speed up that part(not as much as is lost)

Todo: 
- typespec-azure migration
2024-01-02 11:40:29 -08:00
Timothee Guerin da99aa955b
Detach linter from `$lib` and add state declaration to `$lib` (#2773)
fix #2301 

## Deteach the linter from `$lib`

Having the linter rules defined in `$lib` caused this circular reference
where the rules would call to some accessor that needed the $lib
diagnostics.

With this we keep $lib as manifest and helper functions only.

## Add state key declaration
```ts
export const internalLib = createTypeSpecLibrary({
 state: {
    authentication: { description: "State for the @auth decorator" },
    header: { description: "State for the @header decorator" },
    ...
});

// use with StateKeys.authentication
```
2023-12-22 17:27:00 -08:00
Timothee Guerin 9f15ba5502
General dependency upgrades (#2753)
Major:
- Typescript 5.3
- Vite 5
- Rollup 4
2023-12-13 21:01:13 +00:00
Mark Cowlishaw e52a32c76a
Prepare Publish for December release (#2740) 2023-12-06 12:43:01 -08:00
Timothee Guerin 360add229e
Feature: String templates (#2630)
fix https://github.com/microsoft/typespec/issues/1591


## String templates
[Playground
examples](https://cadlplayground.z22.web.core.windows.net/prs/2630/?c=aW1wb3J0ICJAdHlwZXNwZWMvanNvbi1zY2hlbWEiOwoKdXNpbmcgVHlwZVNwZWMuSnNvblPFHTsKCkDELMYOCm5hbWVzcGFjZSDGEXM7CgphbGlhcyBteWNvbnN0ID0gImZvb2JhcsRXbW9kZWwgUGVyc29uIHsKICBzaW1wbGU6ICJTxQkgJHsxMjN9IGVuZCI7CiAgbXVsdGlsaW7EIiIiCiAgTcQRIAogxAHHLMUNJHt0cnVlfQogIMQuCiDELzsKCiAgcmVmOiAiUmVmIHRoaXMg5gCcJHvnAJ7KanRlbXBsYXRlOiBUxwo8ImN1c3RvbSI%2BOwp96ADWyR1UIGV4dGVuZHMgdmFsdWVvZiBzdHJpbmc%2B5ADxRm9vICR7VH0g5QD3&e=%40typespec%2Fjson-schema&options=%7B%7D)

```
import "@typespec/json-schema";

using TypeSpec.JsonSchema;

@jsonSchema
namespace Schemas;

alias myconst = "foobar";

model Person {
  simple: "Simple ${123} end";
  multiline: """
  Multi 
     ${123} 
    ${true}
  line
  """;

  ref: "Ref this alias ${myconst} end";
  template: Template<"custom">;
}

alias Template<T extends valueof string> = "Foo ${T} bar";
```

## Other fixes
Also fixes https://github.com/Azure/typespec-azure/issues/3399(Show
invalid escape sequence char instead of the whole string)
<img width="561" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/7592a046-2c2c-4597-acfd-e45ebfb02cb7">

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-12-01 14:33:09 -08:00
Timothee Guerin c749b1148f
Split libraries from standard library (#2674)
Having the std and other libraries merged together always made it harder

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-21 20:13:40 +00:00
Timothee Guerin 38aa320002
Add ref docs for linter rules (#2668)
Add some generated doc for the linter capability of a library.

Each linter rule can also provide a url pointing to the the full
documentation where we can get a more detailed set of examples of what
is good and what is bad.

Example for http linter 

https://tspwebsitepr.z22.web.core.windows.net/prs/2668/next/standard-library/http/reference/linter.html



![image](https://github.com/microsoft/typespec/assets/1031227/81c2dddc-fa0f-40dd-bad7-9d193f764c55)


![image](https://github.com/microsoft/typespec/assets/1031227/36652cd5-418b-43b9-bd9a-aff046cbe538)

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-15 13:03:36 -08:00
Timothee Guerin bc62493c3f
Upgrade to prettier 3.1 (#2666)
https://prettier.io/blog/2023/11/13/3.1.0
2023-11-14 07:38:48 -08:00
Mark Cowlishaw 6d69297a05
Prepare typespec publish for November Release (#2646) 2023-11-07 16:56:19 -08:00
Timothee Guerin 3695abb65a
Fix: Default must be last (#2636)
`default` entry must be last in `exports`. Most tools do not care but it
seems like webpack and docusaurus do. This is causing issue when trying
to imoport the playground directly there.
2023-11-06 22:50:49 +00:00
Timothee Guerin adba3b92e6
Upgrade to docusaurus 3.0 (#2628)
Docusaurus 3.0 was just released, this new version brings up 
- react 18 which allows us to not use an outdated version here
- config can use typescript
- some perf improvement(however we already were proactive so its not
very noticable)

https://docusaurus.io/blog/releases/3.0

Typespec azure PR https://github.com/Azure/typespec-azure/pull/3823
2023-11-06 10:24:24 -08:00
Timothee Guerin 043ab92925
Use rollup in playground (#2584)
Use rollup to bundle the playground UI library package.

This allows to bundle the css with watch.
2023-11-01 16:52:45 +00:00
Timothee Guerin 533c974a47
Drop support for node 16 (#2605)
fix [#1847](https://github.com/microsoft/typespec/issues/1847)
2023-10-26 11:41:54 -07:00
Alexander Batishchev 2353586552
Added maxDiffSize to Mocha configuration (#2593)
Copying changes from https://github.com/Azure/typespec-azure/pull/3731/

Note: I added the following files as they were missing but the
corresponding `.mocharc.yaml` files already exist:

- packages/protobuf/mocha.reporter.config.json
- packages/samples/mocha.reporter.config.json
- packages/typespec-vscode/mocha.reporter.config.json
2023-10-19 22:37:26 +00:00
Mark Cowlishaw e76223066e
Prepare typespec publish (#2567) 2023-10-11 17:38:29 -07:00
Timothee Guerin 430dc7e9a8
Website perf improvements (#2507)
Progress in #2480

## `Swc-loader`
Some minor perf improviement. Using `swc-loader` is much faster at
loading the js in the compile stage. This make the timed build nearly
50% faster but it **still gets stuck at** `cache (99%) shutdown
IdleFileCachePlugin` for the vast majority of the time. So this is a
little win but nearly negligable

## Updateing `typedoc-markdown` 

This has changed the file structure to group by folder and has basically
brought back the perf from before the migration to the new doc format.
Not sure why but it works great now.
2023-09-29 12:29:37 -07:00
Travis Prescott a5fc253410
Core documentation - generate data type docs programmatically (#2467)
Fixes #2297.
2023-09-25 09:50:32 -07:00
Timothee Guerin 61ba17d2d2
General dependencies update september 2023 (#2445)
fix https://github.com/Azure/typespec-azure/issues/3602

Notable change:
- yaml update removes the uncessary escaping of openapi paths
2023-09-21 13:34:11 -07:00
Timothee Guerin 4309d71afa
Bump typedoc to 0.25.1 (#2447)
This contained breaking changes and was required to upgrade to
typescript 5.2

---------

Co-authored-by: Mike Harder <mharder@microsoft.com>
2023-09-20 18:22:47 +00:00
Mark Cowlishaw aa4d05ac5b
Backmerge 2023 09 19 hotfixes (#2444)
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
Co-authored-by: adam-joffe <58192966+adam-joffe@users.noreply.github.com>
2023-09-19 15:13:38 -07:00
Mark Cowlishaw c9a2751618
Prepare typespec publish for September release (#2409) 2023-09-12 16:38:24 -07:00
Timothee Guerin 1098447b31
Parse tspconfig as yaml to be able to figure out where errors are (#2273)
fix #2298 
Update yaml parser library from `js-yaml` to `yaml` which allow us to
have an ast and resolve where values are coming from.

Before

<img width="973" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/42149942-f077-4058-808f-e3cda2424649">
Now:
<img width="904" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/f6544f42-7523-489e-b1dd-335a53668292">

On top of providing error locations for config errors that the compiler
can resolve this also setup the base to provide the ability for an
emitter to report na error on its emitter options and show where it is.

---------

Co-authored-by: Microsoft Auto Changeset Bot <autochangesetbot@microsoft.com>
2023-09-08 07:04:39 -07:00
Mark Cowlishaw 7ed112b6da
Update doc generator to remove source links #2348 (#2380) 2023-09-07 00:21:32 +00:00
Timothee Guerin ee3c4fa2f6
Fix should regen docs from compiler on build (#2310)
Co-authored-by: Microsoft Auto Changeset Bot <autochangesetbot@microsoft.com>
2023-08-18 13:27:58 -07:00
Timothee Guerin 6d98cd0afb
Merge `--config` hotfix back into main (#2289)
Co-authored-by: Mingzhe Huang <archerzz@users.noreply.github.com>
2023-08-10 14:29:32 -07:00
Mark Cowlishaw 42d00cef2b
Prepare typespec publish for August release (#2272) 2023-08-08 16:20:33 -07:00
Timothee Guerin 7cce379d3e
Render README from refdoc (#2242)
fix #2130 

Generate the README.md for typespec libraries automatically using the
subset of the content as what gets included in the ref doc

To achieve this I reoganized the markdown rendering to be able to
provide a reusable system that can be cusomized for different markdown
engines.

- The markdown renderer will render a markdown compatible with Github
Flavored Markdown.
- The docusuaurs rendererer extends the markdown renderer and include a
few extra metadata.
2023-08-07 22:24:56 +00:00
Timothee Guerin d355e5c427
Update to support prettier 3.0 (#2157)
fix #2153

This include breaking change if using the typespec formatter
programatically. Some breaking changes to prettier carry over
https://prettier.io/blog/2023/07/05/3.0.0.html
2023-08-03 17:11:54 -07:00
Timothee Guerin adbb1559cd
Rename `ref-doc` package to `tspd` and provide a cli that can be used by each package (#2225)
Progress towards providing the ref doc generation as a usable tool by
any typespec library.

Detach the generation from the website, instead each package define
where they want their doc and we generate it.

This adds a new `tspd` package and CLI tool that is meant to be used by
library authors. It will have the following functionalities
- generate docs
- generate TS signatures
- lint library?

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-08-01 22:34:18 +00:00