Skip to content

Commit

Permalink
Use TypeScript project references
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed Apr 26, 2024
1 parent d3182fe commit bbeb19b
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 14 deletions.
8 changes: 4 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ await build({
// The file monaco-yaml/lib/esm/schemaSelectionHandlers.js imports code from the language
// server part that we don’t want.
onResolve({ filter: /\/schemaSelectionHandlers$/ }, () => ({
path: fileURLToPath(new URL('src/fillers/schemaSelectionHandlers.ts', import.meta.url))
path: fileURLToPath(new URL('fillers/schemaSelectionHandlers.ts', import.meta.url))
}))
// The yaml language service only imports re-exports of vscode-languageserver-types from
// vscode-languageserver.
Expand All @@ -32,11 +32,11 @@ await build({
}))
// Ajv would significantly increase bundle size.
onResolve({ filter: /^ajv$/ }, () => ({
path: fileURLToPath(new URL('src/fillers/ajv.ts', import.meta.url))
path: fileURLToPath(new URL('fillers/ajv.ts', import.meta.url))
}))
// We only need cloneDeep from lodash. This can be replaced with structuredClone.
onResolve({ filter: /^lodash$/ }, () => ({
path: fileURLToPath(new URL('src/fillers/lodash.ts', import.meta.url))
path: fileURLToPath(new URL('fillers/lodash.ts', import.meta.url))
}))
// The yaml language service uses path. We can stub it using path-browserify.
onResolve({ filter: /^path$/ }, () => ({
Expand All @@ -53,7 +53,7 @@ await build({
}))
// This tiny filler implementation serves all our needs.
onResolve({ filter: /vscode-nls/ }, () => ({
path: fileURLToPath(new URL('src/fillers/vscode-nls.ts', import.meta.url)),
path: fileURLToPath(new URL('fillers/vscode-nls.ts', import.meta.url)),
sideEffects: false
}))
// The language server dependencies tend to write both ESM and UMD output alongside each
Expand Down
3 changes: 3 additions & 0 deletions examples/demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.base.json"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions fillers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../tsconfig.base.json"
}
File renamed without changes.
3 changes: 3 additions & 0 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../tsconfig.base.json"
}
10 changes: 10 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"module": "nodenext",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"types": []
}
}
16 changes: 6 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"compilerOptions": {
"module": "nodenext",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2017",
"types": []
}
"files": [],
"references": [
{ "path": "./fillers/tsconfig.json" },
{ "path": "./src/tsconfig.json" },
{ "path": "./examples/demo/tsconfig.json" }
]
}

0 comments on commit bbeb19b

Please sign in to comment.