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

72 Коммитов

Автор SHA1 Сообщение Дата
Timothee Guerin 12c67ef552
Upgrade dependencies - October 2024 (#4679) 2024-10-10 16:54:34 +00:00
Timothee Guerin 3d809416fc
Upgrade dependencies, fix rollup vulnerability (#4531)
Upgrade rollup that has a vulnerability and other packages while at it
2024-09-25 19:44:09 +00:00
Timothee Guerin 3d14d7c2c9
Bump dependencies - Sep 2024 (#4424)
Notable: 
- Typescript 5.6: iterator functions  and more
- typescript-eslint 8: new rules, breaking change to some other, found a
few bugs/test not actually testing
- eslint 9: new rules
- removed deprecation/deprecation plugin as typescript eslint has rule
for it now(and updated) many places where it wasn't reporting correctly
2024-09-13 15:50:22 +00:00
Timothee Guerin f3c2c9b67c
Dependency updates July 2024 (#3718)
Notable: Typescript 5.5
2024-07-01 21:42:11 +00:00
Timothee Guerin 7ec17161b7
Value world, object, tuple literals, const (#3022)
resolves #2046
[Playround](https://cadlplayground.z22.web.core.windows.net/prs/3022/)

Add the new syntax for object literals using `#{`. For this first
version an object literal can only contain other object literal and
other literals(string, number, boolean))

## Values axioms
1. `alias` always produces a type. If you attempt to alias a value, you
get an error.
2. A string template produces a string template type if all
substitutions are types, and a value if all substitutions are numeric,
boolean, or string values. A mixture of types and values is an error.
3. The string literal syntax always results in a string literal type
4. A string literal type may be passed as a string value when the
signature expects a value. When the signature expects either a string
literal type or a string value, it is passed as a string value.
5. A string template type can be passed as a string value when all its
substitutions are string literal types.

## Breaking change

### Removal of the `ValueType` replacement with `MixedConstraint`

This shouldn't affect anyone as you were only exposed to this if you
digged into the template parameter and looked at the constraint

## Deprecation

## Using a tuple instead of a tuple literal
-  still work
- emit a warning
<img width="1013" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/ab05359a-5ed9-4a27-a8d1-f40d1e21766f">

- provide a codefix
<img width="312" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/5ef93bdf-665f-4445-a6b2-62475efe8c16">

## Using a model expression instead of an object literal
This technically didn't work before(different from above where tuple was
used as a value) but allow this will allow us to convert most of our
decorators to use `valueof` without being breaking
![Kapture 2024-03-18 at 19 31
32](https://github.com/microsoft/typespec/assets/1031227/f6d69ab4-139e-4b01-95a3-f376b8515d1c)

## Old decorator marshalling

If a library had a decorator with `valueof` one of those types
`numeric`, `int64`, `uint64`, `integer`, `float`, `decimal`,
`decimal128`, `null` it used to marshall those as JS `number` and
`NullType` for `null`. With the introduction of values we have a new
marshalling logic which will marshall those numeric types as `Numeric`
and the others will remain numbers. `null` will also get marshalled as
`null`.

For now this is an opt-in behavior with a warning on decorators not
opt-in having a parameter with a constraint from the list above.

Example: 
```
extern dec multipleOf(target: numeric | Reflection.ModelProperty, value: valueof numeric);
```
Will now emit a deprecated warning because `value` is of type `valueof
string` which would marshall to `Numeric` under the new logic but as
`number` previously.

To opt-in you can add the following to your library 
```ts
export const $flags = defineModuleFlags({
  decoratorArgMarshalling: "value",
});
```

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2024-05-08 20:06:28 +00: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 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 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 ad74773b53
Bump version for February release (#2890) 2024-02-06 16:14:38 -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
Mark Cowlishaw 345cd594da
Prepare Publish for January Release (#2816) 2024-01-24 11:14:23 -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
Mark Cowlishaw 6d69297a05
Prepare typespec publish for November Release (#2646) 2023-11-07 16:56:19 -08:00
Timothee Guerin 0ca049cf13
Migrate out of typesVersions in package.json and cleanup (#2560)
Re-Reverts microsoft/typespec#2554

Making this pr for next release

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-06 19:55:30 +00:00
Mark Cowlishaw e76223066e
Prepare typespec publish (#2567) 2023-10-11 17:38:29 -07:00
Timothee Guerin 1a18ef2ac4
Revert "Migrate out of typesVersions in package.json and cleanup" (#2554)
Reverts microsoft/typespec#2488

This PR ends up being a breaking change, will move it to next release
after going through process
2023-10-10 18:01:41 +00:00
Timothee Guerin e02b74a876
Migrate out of typesVersions in package.json and cleanup (#2488)
Same pr in typespec-azure
https://github.com/Azure/typespec-azure/pull/3641

Migrate to use the `types` entry under `exports` instead of hte legacy
typesVersions. This was a leftover to when es modules where not
completely supported in typescript and using typesVersions was a
workaround.
2023-10-04 22:16:08 +00:00
Mark Cowlishaw c9a2751618
Prepare typespec publish for September release (#2409) 2023-09-12 16:38:24 -07:00
Mark Cowlishaw 42d00cef2b
Prepare typespec publish for August release (#2272) 2023-08-08 16:20:33 -07:00
Brian Terlson 5b55012cb5
Support for omitting variant names in union declarations (#2199)
This makes a union declaration like:

```
union Foo { A, B }
```

behave roughly equivalently to the union expression `A | B`.

Fixes #45.

---------

Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2023-08-04 14:11:37 -07:00
Mark Cowlishaw 140d6ce464
Prepare typespec publish for July release (#2175) 2023-07-11 16:27:59 -07:00
Brian Terlson 9f055a1f74
Implement JSON Schema Record<unknown>, Record<A | B>, and fix many emitter framework bugs (#2143) 2023-07-05 21:12:25 +00:00
Timothee Guerin b87583fbed
Rush pnpm workspaces (#2080) 2023-06-19 09:55:18 -07:00
Nick Guerrera 7a8197f620
Use canonical github microsoft/typespec org/repo casing (all lowercase) (#2038) 2023-06-08 15:50:57 -05:00
Mark Cowlishaw b85fa7143c
Prepare typespec publish (#2020) 2023-06-06 16:55:01 -07:00
Timothee Guerin 6733c5b0a8
Feature: `valueof` for string, numeric and boolean literals (#1877) 2023-06-02 13:35:00 -07:00
Mark Cowlishaw 6f5e1c9329
Prepare publish for May release (#1929)
* Prepare typespec publish

* Adding core release doc
2023-05-10 16:25:52 -07:00
Timothee Guerin d8677f2b66
Update dependencies: March 2023 (TS 5.0) (#1756) 2023-04-12 11:17:23 -07:00
Nick Guerrera dfa63a26d6
Implement pre-projection (#1791)
- Add support for `pre to` and `pre from` projections that can run before
  children are projected and return never to delete or a different type.

- It is an error to mutate anything pre-projections but this is not
  currently enforced by the compiler. We had a note to document this, but
  projections are still experimental and undocumented, so documeting it
  here.

- Add support for `#enummember`, `#unionvariant`, and `#modelproperty`
  projections.

- Use these features in versioning library to fix issues that led to emitter
  crashes with versioned resource types.

- Fix issues with incompatible versioniing verification:
  - Bogus error asking to annotate a template definition when passing a
    versioned template argument.
  - Failure to validate versioned types in tuples or unions.
  - Failure to validate template arguments/array element type in operation
    return type.

- Add access to the extends list of an interface via
  `Interface.sourceInterfaces`. This was a requested feature for next
  sprint, but ended up helping to get the validation fixed so it is done
  here.
2023-04-07 13:12:54 -05:00
Mark Cowlishaw ae177b6b24
Prepare typespec publish (#1692) 2023-03-03 12:47:28 -08:00
Lei Ni 766cdb728f
Escape identifier with backtick (#1551)
* Escape identifier with backtick

* revert binder.test.ts

* backticked

* add test case

* test case

* rush change

* Remove StringLiteral for model property keys and enum

* clean todo

* rush change

* support the same escape characters in backticked identifier

* limit where string literal can be used

* address comment

* support non-ASCII characters in backticked identifiers

* fix identifier printer

* rush format

* improve changelog

* remove workaround in Versions enum

* fix bug

* regen samples

* Update packages/compiler/core/scanner.ts

Co-authored-by: Nick Guerrera <nicholg@microsoft.com>

* add test case for completion

* fix renaming

* type signatures

* printable type signatures

* allow the same escapeCharaters in quotes and backticks

* optimize parseIdentifier

* escape special characters when printing

* test case

---------

Co-authored-by: Nick Guerrera <nicholg@microsoft.com>
2023-03-01 00:54:29 +00:00
Allen Zhang d1b20c1238
update package homepage link (#1676) 2023-02-26 18:28:11 -08:00
Allen Zhang 064161d827 1/3 TypeSpec: Find/Replace Content 2023-02-16 13:07:22 -08:00
Brian Terlson 8a0badcfe3
fix parsing of logical and in projections (#1555) 2023-01-18 07:57:26 -08:00
Mark Cowlishaw 1a2cd1f43f
Publish January Release (#1532)
* Prepare cadl publish

* Adding release notes
2023-01-12 17:35:15 -08:00
Timothee Guerin 540b95e817
Prepare release December 2022 (#1386) 2022-12-07 18:10:48 +00:00
Nick Guerrera a9cf17bdd0
Fix watch-spec location, ts-check errors (#1375) 2022-12-06 17:42:32 +00:00
Timothee Guerin 0f8ea06fff
Update dependencies Nov 2022 (#1308) 2022-11-29 20:11:48 +00:00
Timothee Guerin 1e48fa423c
Include language specification on website (#1322) 2022-11-29 11:18:17 -08:00
Timothee Guerin 607962e49c
New scalar type (#1305) 2022-11-29 17:09:39 +00:00
Timothee Guerin bd116d29be
Feature: Decorator/Function declaration in cadl using `extern` (#1161) 2022-10-24 20:46:24 -07:00
Timothee Guerin 961b73b5eb
Augment decorator (#1036) 2022-10-03 22:07:36 +00:00
Timothee Guerin 90d84de1fb
Setup spell check and fix issues in markdown, ts and changelogs (#1000) 2022-09-09 19:54:18 +00:00
Mark Cowlishaw ab6904a286
Prepare cadl publish (#848) 2022-08-11 13:44:05 -07:00
Timothee Guerin b61baf7cc7
Feature: Template constraints (#749) 2022-07-27 11:47:56 -07:00
Timothee Guerin a90bb2b115
Type relations (#571) 2022-07-21 08:53:15 -07:00
Lei Ni 71463e13c3
Spread enum (#734)
* support spread enum

* rush change

* add optional sourceMember

* update spec.emu.html

* add format test case

* fix comment
2022-07-21 12:02:51 +08:00
Brian Terlson 2d4333da91
Optional braces for model is (#673) 2022-06-29 19:30:25 +00:00