102 Commits

Author SHA1 Message Date
Jake Bailey b5b6048bb3 Clean up helpers which are always present in ES2020 (#55515) 2023-08-28 12:26:22 -07:00
Jake Bailey 5e8c261b6a dprint the codebase (#54820) 2023-08-16 14:26:38 -07:00
Jake Bailey 6fe711f85a Remove unused eslint-disable directives (#52987) 2023-02-27 11:01:37 -08:00
Jake Bailey 718e63b9c9 Add links to github above big var blocks (#52925) 2023-02-22 17:01:15 -08:00
Jake Bailey b39f10f651 Switch to var in emitter, writer, printer (#52906) 2023-02-22 11:45:51 -08:00
Jake Bailey f1ff0de943 Use native generators/iterables, remove helper cruft (#51921) 2023-01-06 14:40:56 -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 db440d8468 Directly import namespaces for improved esbuild output
I should report this upstream, if I can manage to minimize this.
2022-11-07 13:36:08 -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
Jake Bailey 6362fb2dce Replace eslint rulesdir with eslint-plugin-local, convert eslint rules to JS (#50380) 2022-08-22 13:46:03 -07:00
Joel Einbinder 46a12fdb8a fix(sourcemap): accept a sourceMappingURL that ends with a newline (#45983)
* fix(sourcemap): accept a sourceMappingURL that ends with a newline

* Update src/compiler/sourcemap.ts

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2021-10-01 05:16:05 -07:00
Wesley Wigham fcabb5c0cc Simplify or optimize regexes with polynomial time worst cases (#44197)
* Simplify or optimize regexes with polynomial time worst cases

* PR feedback & cleanup

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>

* Use builtin scanner function for checking whitespace in fallback method (its faster)

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-24 15:28:52 -07:00
David Michon 9136bb13fe Generate SourceMap mappings string using array of character codes and fewer String.fromCharCode calls (#44031)
* Test normal char code array for source mappings

* Limit buffer size, minor performance tweaks

* Always commit at exactly chunk size

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-17 18:16:32 -07:00
Daniel Rosenwasser 31f4957494 Revert "Optimize source mapping into external source map sources (#40055)" (#40126)
This reverts commit 1e84ffc703.
2020-08-19 11:46:52 -07:00
Joost Koehoorn 1e84ffc703 Optimize source mapping into external source map sources (#40055) 2020-08-18 18:09:05 -07:00
Ron Buckton 9d5cd280ef Merge branch 'master' into migrateMapsAndSets
# Conflicts:
#	src/compiler/checker.ts
#	src/compiler/commandLineParser.ts
#	src/compiler/core.ts
#	src/compiler/moduleNameResolver.ts
#	src/compiler/transformers/declarations.ts
#	src/compiler/tsbuildPublic.ts
#	src/compiler/types.ts
#	src/compiler/utilities.ts
#	src/harness/client.ts
#	src/server/editorServices.ts
#	src/server/typingsCache.ts
#	src/server/utilities.ts
#	src/services/codefixes/convertToAsyncFunction.ts
#	src/services/documentRegistry.ts
#	src/services/importTracker.ts
#	src/services/refactorProvider.ts
#	src/services/refactors/extractSymbol.ts
#	src/testRunner/unittests/programApi.ts
#	src/typingsInstallerCore/typingsInstaller.ts
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2020-07-07 13:53:46 -07:00
Ron Buckton 7b942b4fa8 Revert the type change to ts.Map (#39366) 2020-07-01 17:00:26 -07:00
Ron Buckton 611b77f2e6 Migrate more places to use Map/Set 2020-06-26 10:15:53 -07:00
Ron Buckton eb2f4e2337 Switch to ES Map/Set internally (#33771)
* Add full implemention of Map and Set to shims

* Update default Map interface

* Remove WeakMap/WeakSet

* Add tests for set shim

* Update most usages of Map<K, true> to Set

* PR Feedback

* Fix lint issues

* Change key in fsWatchCallback

* Simpler shim, more tests

* Fix typo in collection shim
2020-06-26 10:12:47 -07:00
Alexander ceccfd8867 array-type: [ default: array, generic: array ] 2019-08-08 21:30:18 +03:00
Alexander 0059763d8f move eslint rules from eslint-plugin-microsoft-typescript to scripts/eslint 2019-07-24 13:31:17 +03:00
Alexander T 2c32308f35 no-null/no-null 2019-07-18 10:50:38 +03:00
Alexander T 4defd1d635 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-07-04 12:49:33 +03:00
Ron Buckton e8bf9584aa Improve type checking and inference for Generators and Async Generators (#30790)
* Improve typing for Generators and Async Generators

* Add TReturn and TNext to Iterator, IterableIterator, etc.

* Update ts internal Iterator to be assignable from global Iterator

* Make 'done' optional in IteratorYieldResult

* Revert Iterable and IterableIterator to simpler versions plus other fixes

* Add additional inference tests

* Added additional tests

* PR cleanup and minor async iteration type fix

* Updated diagnostics message and added non-strict tests

* Fix expected arity of Iterator/AsyncIterator
2019-07-03 21:55:59 -07:00
Alexander T 769bb0b475 remove tslint configuration 2019-06-27 13:49:35 +03:00
Alexander T a96a08a329 microsoft-typescript/boolean-trivia 2019-06-14 11:17:49 +03:00
Sheetal Nandi c739defe25 Handle prologues in prepend outputs 2019-01-25 14:31:40 -08:00
Sheetal Nandi 6e5770928f Handle shebang when using prepend nodes 2019-01-25 14:31:39 -08:00
Sheetal Nandi c156c9377a Add note about comparing source positions 2018-12-07 08:56:22 -08:00
Sheetal Nandi fa7f5cb5a0 Actually verify when dependency and main project is open 2018-12-06 15:22:45 -08:00
Sheetal Nandi 0113f43632 Fix the edits clamping from #28583 after rebasing to master 2018-12-06 15:22:43 -08:00
Sheetal Nandi 12428d45c0 Add method on host to get DocumentPositionMapper so it can be cached. 2018-12-06 15:22:39 -08:00
Sheetal Nandi 1db8bb062c Use file names instead of paths for reading files 2018-12-06 15:22:38 -08:00
Wesley Wigham cd08a22ef5 Clamp calculated sourcemap positions rather than throwing (#28583)
* Clamp calculated sourcemap positions rather than throwing, to allow the underlying file to drift out of date with the sourcemap without a crash

* Clamp line as well
2018-11-16 16:05:07 -08:00
Ron Buckton 6927bc74fd Remove SortedUniqueList 2018-11-09 14:32:31 -08:00
Ron Buckton 151dc074a8 Merge branch 'master' into sourceMapGenerator 2018-11-09 11:50:51 -08:00
Ron Buckton b006287cb1 Refactor and clean up sourcemap decoder 2018-09-04 17:50:06 -07:00
Ron Buckton 173b5dfcfb Refactor sourcemap emitter 2018-08-22 12:42:36 -07:00
Andy 93722c8942 findAllReferences/rename: Search in all open projects (#25648)
* findAllReferences/rename: Search in all open projects

* Avoid needing a dummy location when location is unused

* Remove Program#getDeclarationEmitPath

* Only iterate over enabled projects
2018-07-20 16:53:59 -07:00
Andy 64555aa6a9 navigateTo: Collect results from all referenced projects. (#25283)
* navigateTo: Collect results from all referenced projects.

* Don't use project references, just source maps

* Move more code to session

* Test when implementation file is deleted

* Use tsserver tests instead of fourslash tests to ensure session is used

* Support find-all-references

* Restore fourslash tests

* Update emit baselines (added missing newline)

* Support rename

* @weswigham code review

* Don't open/close files

* Avoid growing `toDo` too eagerly

* @sheetalkamat code review

* Also get symlinked projects for originalLocation

* Update API (#24966)

* More @sheetalkamat code review

* Remove unnecessary test

* Update API (#24966)
2018-07-05 15:39:03 -07:00
Wesley Wigham 5b92678285 Optimize sourcemap application more (#25425)
* Optimize sourcemap application more

* Remove test-only memory hog sourceMapDecodedMappings field

* Update for style, remove unused function that triggers warnings in node 10

* Avoid all raw buffer constructor calls

* Small TDZ fix
2018-07-05 15:12:10 -07:00
Ryan Cavanaugh 43d1ae42a9 Do fewer calls to getRelativePathToDirectoryOrUrl when writing sourcemaps 2018-06-18 11:12:19 -07:00
Ron Buckton 575ab61c6b Fix sources array case sensitivity 2018-06-14 23:27:04 -07:00