882 Commits

Author SHA1 Message Date
David Sherret
1761a67ff8
perf: ensure compiler options affecting semantic diagnostics get included in build info (#53423) 2023-03-22 09:54:17 -07:00
Sheetal Nandi
377c4ce32f
Refactor config file syntax search to callback model instead of constructing arrays to iterate over (#53416) 2023-03-21 11:23:36 -07:00
Sheetal Nandi
8814f6da48
Report error if commanline only option is specified in tsconfig (#53397) 2023-03-20 13:26:04 -07:00
Jake Bailey
79a414bb5e
Consistently use '...args' for diagnostic args (#53193) 2023-03-20 12:53:09 -07:00
Sheetal Nandi
7a8238d88d
Refactor config file parsing such that json and jsonSourceFile api use same paths (#53331) 2023-03-20 12:00:08 -07:00
Jake Bailey
86f8114404
Revert PR #53301 (#53366) 2023-03-19 21:29:17 -07:00
Mateusz Burzyński
d458e30a06
Rewrite getPropFromRaw slightly to surface T in the parameters (#53301) 2023-03-19 20:01:16 -07:00
Jake Bailey
6b75ce23ce
Completely remove Push type (#52133) 2023-03-01 09:34:59 -08:00
Jake Bailey
d63d081e37
Mark allowArbitraryExtensions as affectsProgramStructure (#52437) 2023-01-26 13:40:19 -08:00
Ryan Cavanaugh
ff92ab0ac9
Change default newLine, forceConsistentCasingInFileNames (#52298)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2023-01-20 17:20:26 -08:00
Sheetal Nandi
a097d55f81
Remove long deprecated typingOptions and enableAutoDiscovery (#52339) 2023-01-20 15:39:57 -08:00
Andrew Branch
cfe1842adf
Add verbatimModuleSyntax, deprecate importsNotUsedAsValues and preserveValueImports (#52203) 2023-01-19 16:56:30 -08:00
Ron Buckton
5b18979697
Implement the Stage 3 Decorators Proposal (#50820) 2023-01-19 17:54:12 -05:00
Jake Bailey
22b362ceac
Enable strictFunctionTypes (#49929) 2023-01-17 17:20:51 -08:00
Andrew Branch
436833aba1
Allow allowImportingTsExtensions to be set in any module resolution mode (#52230) 2023-01-17 15:13:17 -08:00
navya9singh
f6fc444b33
Fix(51828): extends field in tsconfig.json does nothing with empty string (#51981) 2023-01-17 12:31:23 -08:00
Mykola Basov
cb4c7689e6
Add Array.prototype.findLast() and Array.prototype.findLastIndex() (#49636)
Signed-off-by: mbasov2 <mbasov2@bloomberg.net>
2023-01-13 15:35:50 -08:00
Wesley Wigham
89e928e8b4
Add --allowArbitraryExtensions, a flag for allowing arbitrary extensions on import paths (#51435) 2023-01-09 17:12:42 -08:00
Jake Bailey
f1ff0de943
Use native generators/iterables, remove helper cruft (#51921) 2023-01-06 14:40:56 -08:00
Jake Bailey
bfeb927d43
Remove Push from public API (#52122) 2023-01-05 16:18:53 -08:00
Ron Buckton
f43cd0acca
Add RegExp indices and hasIndices (#52085)
* Add RegExp indices
* update --lib message
* newlines
* implement changes
* Fix failing tests

Thanks @xiBread!
2023-01-03 15:20:10 -05:00
Oleksandr T
5951ee9cff
feat(48665): tsconfig "extends" field ignores "exports" field of source package (#50955)
* feat(48665): resolve configs from the exports field of the source package

* add missed property

* rename loadFileName to loadFileNameFromPackageJsonField

* Apply suggestions from code review

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-12-19 16:40:12 -08:00
Oleksandr T
fe185272cf
feat(51000) - Flag Deprecation Plan (#51424)
* feat(51000): add ignoreDeprecations option

* use constants of versions

* change the ignoreDeprecations type to allow only one value - '5.0'

* add tests

* update baseline

* add typeScriptVersion to CreateProgramOptions

* update baseline

* change diagnostic message
2022-12-15 10:44:06 -08:00
Andrew Branch
e0bfac531b
Rename module resolution option node to node10 (preserving backward-compatible alias) (#51901)
* Rename `node` to `node10` (preserving alias)

* Revert dogfooding change because of LKG

* Update baselines
2022-12-15 10:07:33 -08:00
Andrew Branch
a5dde88dce
--moduleResolution bundler (formerly known as hybrid) (#51669)
* WIP

* Add extension error back unless noEmit is set

* Add non-relative tests

* Add error for importing from declaration file

* Update unit test

* Add explicit flag for importing from .ts extensions

* Add module specifier resolution changes

* Add auto-import tests

* Disallow relative imports into node_modules

* Ensure auto-imports don’t suggest ./node_modules;

* Test a non-portable declaration emit issue

* Test auto-importing TSX file

* Update path completions

* Fix lint due to merge

* Remove minimal-specific stuff

* Remove minimal tests

* Update unit tests

* Add options

* Add customConditions option

* Add first tests

* CJS constructs are not allowed

* Add another test

* Fix extension adding/replacing priority

* Update test to reflect the choice not to block on unrecognized extensions

* Add auto-imports and string completions tests

* Revamp string completions ending preferences

* Comment test

* Auto-imports of declaration files cannot use .ts extension

* Have declaration file auto imports default to extensionless instead

* Add test for custom conditions

* Fix indentation

* Add baseline showing resolvePackageJsonImports/Exports compatibility

* Fix test and prevent CJS require from resolving

* Update unit test baselines

* Fix bad merge conflict resolution

* Make resolvedUsingTsExtension optional

* Update missed baselines

* Revert now-unnecessary API implementation changes

* Clean up

* Update baselines to es5 emit

* Rename to `bundler`
2022-12-13 13:35:16 -08:00
navya9singh
7267fcaeb9
Fix(29118): tsconfig.extends as array (#50403)
* tsconfig.extends as array

* Updated baselines

* Changes for pr

* Changes for pr comments

* Fixed formatting and edited a test

* Resolved errors after a merge conflict

* Added "string | list" type implentation

* Removed string | list type implementation

* Fixed formatting

* Added compiler test

* Resolving programUpdate errors

* Fixing commandLineParser error
2022-12-13 11:16:07 -08:00
Ryan Cavanaugh
4978b3ebeb
Properly detect explicitly-set targets (#51834) 2022-12-09 10:31:51 -08:00
Jake Bailey
00dc0b6674
Flip imports to case insensitive sorting (#51579) 2022-11-17 15:35:28 -08:00
Jake Bailey
2d2a4343b8
Reformat imports to be one identifier per line (#51565) 2022-11-17 13:42:18 -08:00
Jake Bailey
9f64a3a58c
Remove ts.{Map,Set,ESMap,Iterator} and associated types (#51439) 2022-11-09 15:06:31 -08:00
Jake Bailey
c65142244c Add dts bundling
This adds a "small" d.ts bundler script. This script is very basic,
using Node printing to produce its output. Generally speaking, this is
inadvisable as it completely disregards name shadowing, globals, etc.
However, in our case, we don't care about the globals, and we can opt to
restructure our codebase in order to avoid conflict, which we largely
had to do anyway when we were namespaces and everything was in scope.
2022-11-07 13:35:48 -08:00
Jake Bailey
d12116d8da Fix all internal JSDoc comments
If these are regular comments, then they won't appear in our d.ts files.
But, now we are relying on an external d.ts bundler to produce our final
merged, so they need to be present in the "input" d.ts files, meaning
they have to be JSDoc comments.

These comments only work today because all of our builds load their TS
files from scratch, so they see the actual source files and their
non-JSDoc comments.

The comments also need to be attached to a declaration, not floating,
otherwise they won't be used by api-extractor, so move them if needed.
2022-11-07 13:34:44 -08:00
Jake Bailey
07758c08ab Generated module conversion step - inlineImports
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
2022-11-07 13:33:07 -08:00
Jake Bailey
b6c0538826 Generated module conversion step - stripNamespaces
This step converts each file into an exported module by hoisting the namespace bodies into the global scope and transferring internal markers down onto declarations as needed.

The namespaces are reconstructed as "barrel"-style modules, which are identical to the old namespace objects in structure. These reconstructed namespaces are then imported in the newly module-ified files, making existing expressions like "ts." valid.
2022-11-07 13:32:03 -08:00
Jake Bailey
9a0b85ce2a Generated module conversion step - explicitify
This step makes all implicit namespace accesses explicit, e.g. "Node" turns into "ts.Node".
2022-11-07 13:29:05 -08:00
Jake Bailey
94724a8c2e Generated module conversion step - unindent
This step makes further commits look clearer by unindenting all of the top level namespaces preemptively.
2022-11-07 13:28:13 -08:00
Sheetal Nandi
eac566b8c3
Enables passing --declaration, --emitDeclarationOnly, --declarationMap, --soureMap and --inlineSourceMap to tsc --build (#51241)
* Add different tests for baselining before behavior

* Fix assert for first project output

* Add ability to pass declaration, declarationMap, emitDeclarationOnly, sourceMap and inlineSourceMap on commandline of --build

* Store these options in --out scenario

* Store buildInfo program for --out even if not composite

* Changes to make these commanline options work

* Do not include sourceMapUrl text in the sourceFile version

* Emit complete program in --out scenario as well since we need to determine uptodate ness

* Copy js or dts bundle from old build if emitting only js or dts files

* Dont emit dts if we want to emit only js files even though options suggest emitting d.ts files as well

* Adding comments and refactoring some of the code
2022-11-07 10:53:22 -08:00
Sheetal Nandi
cfa55f1c2d
Fixes the tests that got disabled when generating config set es2016 expecting to find libFile and remove incorrect affects flag from listFilesOnly (#51243)
* Fix the existing test

* Remove affectsEmit from listFilesOnly
2022-10-31 10:15:19 -07:00
Sheetal Nandi
2625c1feae
Make the init config category order predictable (#51247) 2022-10-20 13:23:18 -07:00
Jake Bailey
16156b1baf
Add rules from eslint's recommended set that triggered good lints (#50422) 2022-09-19 16:20:55 -07:00
Amit Dahan
ab831d0180
Ignore --help and -? in tsc init generated compilerOptions (#50628)
* Ignore --help and -? in `tsc init` generated compilerOptions

* Disregard -?

* Remove unused fixture
2022-09-07 12:43:16 -07:00
Long Ho
71d1911503
add unknown to DateTimeFormatTypes (#50402)
* add unknown to DateTimeFormatTypes

* move unknown to es2019.intl instead

* Accepted baselines.

Co-authored-by: long.ho <long.ho@cloudkitchens.com>
2022-08-26 13:02:44 -07:00
Sheetal Nandi
b8f6488323
Build improvements (#48784)
* Use fixed time for vfs so baselining is consistent

* Baseline buildinfos

* Write new file text in baseline even if the file wasnt read on the shadow

* Remove unnecessary debugger statement

* Make sure that incremental correctness is checked with correct writeFile so we know buildInfo was written
Also baseline these so its easy to verify the changes

* More baselines for the tsbuildinfo

* If we are writing dts file and have used file text as version, we can update the signature when doing actual emit

* Make WriteFileCallback Api ready for future

* Assert that there is only single source file when emitting d.ts file

* Add test

* Renames

* More refactoring

* If we are updating dts of any of the file and it affects global scope, everything needs update in signature and dts emit
Fixes #42769

* Stacktrace optimization for getModified time in anticipation of using it more than fileExists wherever possible

* Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment

* Remove unnecessary write file finger print code since its not used at all

* Use modified time instead of file existence check

* Remove unnecessary getModifiedTime

* No need to check for file existence before reading the d.ts file

* Do project reference errors before doing input/output file checks

* Dont call getModifiedTimes if dts change

* Passdown modified time if queried

* Use modified time passed through the file watching in tsbuild

* Handle force build as separate upto date status

* uptodate status worker to read buildinfo and use it to determine upto date ness

* No need to update output timestamps if buildinfo will determine uptodateness

* Store change file set instead of hasPendingChange to be able to reuse the information

* Add test that shows input file is not present

* No need to check input time stamp before buildinfo

* Keep buildinfos for lifetime of the solution builder and project

* Store modified time along with text of buildinfo

* Non composite projects dont need to track declaration change time

* Pass through buildInfo so we dont have to parse it back

* Save dts change time in buildinfo itself

* Store dts time for --out in the buildInfo

* Store hash of text in the bundle info so it can be verified before manipulating text for fast updates during prepend
This helps when text changes during incremental build toggling and we determine we can just manipulate text

* Since buildinfo is cached no need to maintain version check state

* Store output time stamps for non incremental builds

* Revert "Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment"

This reverts commit 7e65cd3315ccf387f6d7e7c40263e85bcc3c961c.

* Change verbose messages for upto date status

* Reconcile reusable builder state and builder state so there are not two different types that are almost similar looking

* Cleanup impliedFormat

* Cleanup

* Cleanup noEmit option

* BuildInfo options emit as a flag

* Factor out types for program written in buildinfo with and without bundle emit

* No need to store output file stamps if not in watch mode

* Cleanup

* Test for single watch per file

* Fix emit and error update baselines that were duplicate

* More refactoring

* Only copy emit state fields when backing up to restore if emit fails

* Instead of maintaining delta of changes, maintain old state for those changes

* Add test to verify build when input file does not change

* If version of the input file does not change, dont mark as out of date

* Disable lint warning as build fails without the assert

* Report aggregate statistics for solution as well as some solution perf numbers

* Options solutionDiagnostics instead so that its not too verbose when printing diagnostics

* When tsc --build --clean, only remove tsbuildinfo if its incremental build

* Revert "Options solutionDiagnostics instead so that its not too verbose when printing diagnostics"

This reverts commit 0cf9e301038267bc1d9439c15d279940809b0c00.

* Revert "Report aggregate statistics for solution as well as some solution perf numbers"

This reverts commit 405d8e91978708a613fe8cb631a83b13c430a808.

* Revert "When tsc --build --clean, only remove tsbuildinfo if its incremental build"

This reverts commit e4e66726098201f38f5e8908a538e7a506f15efd.

* Comments in the code

* Feedback
2022-06-08 09:48:34 -07:00
Gabriel Grubba
4c5060181f
Fix(49198): Added missing definition for Atomics.waitAsync and es2022 sharedmemory file (#49204)
* feat(sharedmemory): Added file waitAsync function

* fix: Adjusted promise return type

* Fix(sharedmemory): Addressed PR comments

* Fix: Removed unused @see at sharedmemory

* Feat: Added tests to shared memory

* Fix: fixed ordering in libs.json

* Feat: Added shared memory to line parser

* Update tests es2022SharedMemory.ts as sugested

Co-authored-by: Eyal Halpern Shalev <eyalsh@gmail.com>

* Update es2022SharedMemory.ts

* feat: Accepted baselines

* fix: Adjusted grammar changes in jsdoc

* fix(47821): skip nodes with export modifiers (#47829)

* Use symbolic GitHub Actions Node.js versions (#49403)

* update baselines

Co-authored-by: Eyal Halpern Shalev <eyalsh@gmail.com>
Co-authored-by: Oleksandr T <oleksandr.tarasiuk@outlook.com>
Co-authored-by: Jack Bates <jack@nottheoilrig.com>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-06-07 08:46:23 -07:00
Sheetal Nandi
0ad5f82d62
Fix the implicit glob key so that recursive keys are not differing just directory separator for wildcard directory (#49246)
* Add failing test

* Fix the implicit glob key so that recursive keys are not differing just by directory seperator
Fixes #49078

* Reset the reload level once program is loaded
2022-05-25 12:30:40 -07:00
Sheetal Nandi
6ee549075b
Identify when file name is matched by default include spec (#49040)
Fixes #43679
2022-05-10 10:34:03 -07:00
Kenta Moriuchi
4a0b083c69
Add ES2022 Intl.Segmenter type (#48800)
* Add `Intl.Segmenter` type

* Update baseline

* Fix useless generics

* Fix indent size

* Fix `ResolvedSegmenterOptions`
2022-05-05 17:09:06 -07:00
Daniel Rosenwasser
5f9c9a6ccf
Start Node ESM stable version at Node16 (#48879)
* Remove Node12, add Node16.

* Accepted baselines.

* Refactor checking for top-level await, give a better error message in CJS files.

* Accepted baselines.

* Stop erroring on JSON module imports in node ESM since they're no longer experimental.

* Accepted baselines.

* More refactoring, do the same checks for for-await loops.

* Accepted baselines.

* Adjust phrasing to permit for-await on CJS error.

* Accepted baselines.

* Accepted baselines.

* Fix lints.
2022-05-03 16:29:40 -07:00
Adam Foxman
41aca7c337
Add a new compiler option moduleSuffixes to expand the node module resolver's search algorithm (#48189)
* Add moduleSuffixes compiler option and related tests. Update baselines for compiler options tests.

* Add a flag to the command-line parser which allows "list" params to preserve "falsy" values such as empty strings. Falsy values are normally stripped out.

* Add tests. Rework resolver logic to only run module-suffix code when needed.

* PR feedback

* Add test

* Remove unnecessary conditional.
2022-03-30 15:23:26 -07:00
Pablo Sabater Jiménez
50a4b92bca
fix(48053) Description of tsBuildInfoFile is misleading in generated tsconfig.json (#48072)
* add check for path default value

* fix wrong tsBuildInfoFile description

* updated files to file
2022-03-22 10:35:47 -07:00