Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
df89c74
Make a few changes to allow all code to be loaded as one project
jakebailey Jul 26, 2022
7698653
Explicitly reference ts namespace in tsserverlibrary
jakebailey Jul 26, 2022
94724a8
Generated module conversion step - unindent
jakebailey Nov 7, 2022
9a0b85c
Generated module conversion step - explicitify
jakebailey Nov 7, 2022
b6c0538
Generated module conversion step - stripNamespaces
jakebailey Nov 7, 2022
07758c0
Generated module conversion step - inlineImports
jakebailey Nov 7, 2022
5f5ccc9
Generated module conversion step - .git-ignore-blame-revs
jakebailey Nov 7, 2022
d5274a9
Add gitlens settings suggestion
jakebailey Oct 14, 2022
180554c
Make processDiagnosticMessages generate a module
jakebailey May 26, 2022
39e27fb
Fix up linting, make lint clean
jakebailey Sep 7, 2022
8bd5e54
Undo changes needed to load codebase into ts-morph
jakebailey Oct 3, 2022
231fa27
Add JSDoc eslint rule
jakebailey Sep 24, 2022
d12116d
Fix all internal JSDoc comments
jakebailey Sep 7, 2022
01e5200
Convert require calls to imports
jakebailey May 27, 2022
6dfa429
Remove typescriptServices, protocol.d.ts, typescript_standalone.d.ts
jakebailey Sep 13, 2022
36e2944
Get codebase building pre bundling
jakebailey May 31, 2022
4139807
Add build via esbuild
jakebailey Sep 13, 2022
c651422
Add dts bundling
jakebailey Sep 2, 2022
dc92488
Consolidate checks that test if the current environment is Node
jakebailey Sep 26, 2022
776907c
Add ts to globalThis in run.js for convenience during debugging
jakebailey Sep 30, 2022
f45cc45
Rename Gulpfile to Herebyfile for improved git diff
jakebailey Oct 9, 2022
3cd72e7
Change build system to hereby
jakebailey Oct 9, 2022
d0db80e
Update baselines for corrected line endings in lib files
jakebailey Oct 10, 2022
394c4ae
Use jsonc-parser instead of LKG compiler in build
jakebailey Oct 9, 2022
aec2761
Modernize localize script, use new XML library
jakebailey Oct 10, 2022
bbc906d
Don't use needsUpdate for quick tasks
jakebailey Oct 10, 2022
acfe7ac
Remove mkdirp
jakebailey Oct 10, 2022
8486229
Export ts namespace from tsserver for hacky-post patching
jakebailey Oct 13, 2022
db440d8
Directly import namespaces for improved esbuild output
jakebailey Oct 18, 2022
c5a9573
Ensure ts object passed to plugins contains deprecatedCompat declarat…
jakebailey Oct 18, 2022
25a85d1
Move compiler-debug into Debug namespace, which allows the compiler t…
jakebailey Oct 15, 2022
43cf787
Remove Promise redeclaration
jakebailey Oct 19, 2022
b9e24ee
Remove globalThisShim and globalThis modification for TypeScriptServi…
jakebailey Oct 19, 2022
8edbf8d
Disable slow CodeQL queries
jakebailey Oct 22, 2022
7988e40
Remove outFiles from launch.json
jakebailey Oct 25, 2022
da6f067
Remove dynamicImport and setDynamicImport
jakebailey Nov 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make a few changes to allow all code to be loaded as one project
  • Loading branch information
jakebailey committed Nov 7, 2022
commit df89c7457d41e787fe0310e2b8ea471f24310101
15 changes: 12 additions & 3 deletions src/compiler/factory/nodeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ namespace ts {
NoOriginalNode = 1 << 3,
}

const nodeFactoryPatchers: ((factory: NodeFactory) => void)[] = [];

/* @internal */
export function addNodeFactoryPatcher(fn: (factory: NodeFactory) => void) {
nodeFactoryPatchers.push(fn);
}

/**
* Creates a `NodeFactory` that can be used to create and update a syntax tree.
* @param flags Flags that control factory behavior.
Expand Down Expand Up @@ -161,11 +168,11 @@ namespace ts {
createObjectLiteralExpression,
updateObjectLiteralExpression,
createPropertyAccessExpression: flags & NodeFactoryFlags.NoIndentationOnFreshPropertyAccess ?
(expression, name) => setEmitFlags(createPropertyAccessExpression(expression, name), EmitFlags.NoIndentation) :
(expression: Expression, name: string | MemberName) => setEmitFlags(createPropertyAccessExpression(expression, name), EmitFlags.NoIndentation) :
createPropertyAccessExpression,
updatePropertyAccessExpression,
createPropertyAccessChain: flags & NodeFactoryFlags.NoIndentationOnFreshPropertyAccess ?
(expression, questionDotToken, name) => setEmitFlags(createPropertyAccessChain(expression, questionDotToken, name), EmitFlags.NoIndentation) :
(expression: Expression, questionDotToken: QuestionDotToken | undefined, name: string | MemberName) => setEmitFlags(createPropertyAccessChain(expression, questionDotToken, name), EmitFlags.NoIndentation) :
createPropertyAccessChain,
updatePropertyAccessChain,
createElementAccessExpression,
Expand Down Expand Up @@ -534,7 +541,9 @@ namespace ts {
liftToBlock,
mergeLexicalEnvironment,
updateModifiers,
};
} as any;

forEach(nodeFactoryPatchers, fn => fn(factory));

return factory;

Expand Down
12 changes: 2 additions & 10 deletions src/deprecatedCompat/4.2/abstractConstructorTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,8 @@ namespace ts {

// Patch `createNodeFactory` because it creates the factories that are provided to transformers
// in the public API.

const prevCreateNodeFactory = createNodeFactory;

// eslint-disable-next-line @typescript-eslint/no-unnecessary-qualifier
ts.createNodeFactory = (flags, baseFactory) => {
const factory = prevCreateNodeFactory(flags, baseFactory);
patchNodeFactory(factory);
return factory;
};
addNodeFactoryPatcher(patchNodeFactory);

// Patch `ts.factory` because its public
patchNodeFactory(factory);
}
}
12 changes: 2 additions & 10 deletions src/deprecatedCompat/4.6/importTypeAssertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,8 @@ namespace ts {

// Patch `createNodeFactory` because it creates the factories that are provided to transformers
// in the public API.

const prevCreateNodeFactory = createNodeFactory;

// eslint-disable-next-line @typescript-eslint/no-unnecessary-qualifier
ts.createNodeFactory = (flags, baseFactory) => {
const factory = prevCreateNodeFactory(flags, baseFactory);
patchNodeFactory(factory);
return factory;
};
addNodeFactoryPatcher(patchNodeFactory);

// Patch `ts.factory` because its public
patchNodeFactory(factory);
}
}
12 changes: 2 additions & 10 deletions src/deprecatedCompat/4.7/typeParameterModifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,8 @@ namespace ts {

// Patch `createNodeFactory` because it creates the factories that are provided to transformers
// in the public API.

const prevCreateNodeFactory = createNodeFactory;

// eslint-disable-next-line @typescript-eslint/no-unnecessary-qualifier
ts.createNodeFactory = (flags, baseFactory) => {
const factory = prevCreateNodeFactory(flags, baseFactory);
patchNodeFactory(factory);
return factory;
};
addNodeFactoryPatcher(patchNodeFactory);

// Patch `ts.factory` because its public
patchNodeFactory(factory);
}
}
10 changes: 1 addition & 9 deletions src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1397,15 +1397,7 @@ namespace ts {

// Patch `createNodeFactory` because it creates the factories that are provided to transformers
// in the public API.

const prevCreateNodeFactory = createNodeFactory;

// eslint-disable-next-line @typescript-eslint/no-unnecessary-qualifier
ts.createNodeFactory = (flags, baseFactory) => {
const factory = prevCreateNodeFactory(flags, baseFactory);
patchNodeFactory(factory);
return factory;
};
addNodeFactoryPatcher(patchNodeFactory);

// Patch `ts.factory` because its public
patchNodeFactory(factory);
Expand Down
10 changes: 7 additions & 3 deletions src/tsserver/webServer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/*@internal*/

/// <reference lib="webworker" />

namespace ts.server {
declare const addEventListener: any;
declare const postMessage: any;
declare const close: any;
declare const location: any;
declare const XMLHttpRequest: any;
declare const self: any;

const nullLogger: Logger = {
close: noop,
hasLevel: returnFalse,
Expand Down
12 changes: 6 additions & 6 deletions src/webServer/webServer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*@internal*/
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />

namespace ts.server {
declare const fetch: any;
declare const importScripts: any;

export interface HostWithWriteMessage {
writeMessage(s: any): void;
}
Expand Down Expand Up @@ -112,8 +113,6 @@ namespace ts.server {
}
}

export declare const dynamicImport: ((id: string) => Promise<any>) | undefined;

// Attempt to load `dynamicImport`
if (typeof importScripts === "function") {
try {
Expand All @@ -132,9 +131,10 @@ namespace ts.server {
const getWebPath = (path: string) => startsWith(path, directorySeparator) ? path.replace(directorySeparator, getExecutingDirectoryPath()) : undefined;

const dynamicImport = async (id: string): Promise<any> => {
const serverDynamicImport: ((id: string) => Promise<any>) | undefined = (server as any).dynamicImport;
// Use syntactic dynamic import first, if available
if (server.dynamicImport) {
return server.dynamicImport(id);
if (serverDynamicImport) {
return serverDynamicImport(id);
}

throw new Error("Dynamic import not implemented");
Expand Down