@ripple-ts/language-server 0.3.17 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @ripple-ts/language-server
2
2
 
3
+ ## 0.3.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [#877](https://github.com/Ripple-TS/ripple/pull/877)
8
+ [`7610ef8`](https://github.com/Ripple-TS/ripple/commit/7610ef84847bb77cc83488a902ecb6f96594e113)
9
+ Thanks [@leonidaz](https://github.com/leonidaz)! - Convert the Ripple language
10
+ server, TypeScript plugin, and VS Code extension codebases from CommonJS source
11
+ files to ESM source files, while publishing built dist entrypoints instead of
12
+ source files.
13
+
14
+ This updates package metadata such as `type: module` and dist-based `main`
15
+ paths, replaces `require` and `module.exports` usage with `import` and `export`,
16
+ and adds tsdown bundling configs that emit CommonJS dist output plus a
17
+ dist/package.json that forces `type: commonjs`.
18
+
19
+ Development builds also include sourcemaps.
20
+
21
+ - Updated dependencies
22
+ [[`7610ef8`](https://github.com/Ripple-TS/ripple/commit/7610ef84847bb77cc83488a902ecb6f96594e113)]:
23
+ - @ripple-ts/typescript-plugin@0.3.19
24
+
25
+ ## 0.3.18
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies []:
30
+ - @ripple-ts/typescript-plugin@0.3.18
31
+
3
32
  ## 0.3.17
4
33
 
5
34
  ### Patch Changes
package/README.md CHANGED
@@ -29,8 +29,8 @@ are also specialized plugins for popular editors.
29
29
 
30
30
  #### VS Code
31
31
 
32
- Use the [official
33
- extension](https://marketplace.visualstudio.com/items?itemName=Ripple-TS.ripple-ts-vscode-plugin
32
+ Use the
33
+ [official extension](https://marketplace.visualstudio.com/items?itemName=Ripple-TS.ripple-ts-vscode-plugin)
34
34
  It uses this language server internally.
35
35
 
36
36
  #### WebStorm/IntelliJ
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { createRippleLanguageServer } = require('../src/server.js');
3
+ import { createRippleLanguageServer } from '../src/server.js';
4
4
 
5
5
  createRippleLanguageServer();
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@ripple-ts/language-server",
3
- "version": "0.3.17",
3
+ "version": "0.3.19",
4
4
  "description": "Language Server Protocol implementation for Ripple",
5
- "main": "index.js",
5
+ "main": "dist/server.js",
6
+ "type": "module",
6
7
  "bin": {
7
8
  "ripple-language-server": "bin/language-server.js"
8
9
  },
@@ -19,9 +20,11 @@
19
20
  "volar-service-typescript": "0.0.70",
20
21
  "vscode-languageserver-textdocument": "^1.0.12",
21
22
  "vscode-uri": "^3.1.0",
22
- "@ripple-ts/typescript-plugin": "0.3.17"
23
+ "@ripple-ts/typescript-plugin": "0.3.19",
24
+ "@tsrx/core": "0.0.4"
23
25
  },
24
26
  "devDependencies": {
27
+ "tsdown": "^0.20.3",
25
28
  "@tsrx/ripple": "0.0.5"
26
29
  },
27
30
  "peerDependencies": {
@@ -29,5 +32,8 @@
29
32
  },
30
33
  "publishConfig": {
31
34
  "access": "public"
35
+ },
36
+ "scripts": {
37
+ "build": "tsdown"
32
38
  }
33
39
  }
@@ -1,6 +1,6 @@
1
1
  /** @import { LanguageServicePlugin } from '@volar/language-server' */
2
2
 
3
- const { getVirtualCode, createLogging, is_ripple_document } = require('./utils.js');
3
+ import { getVirtualCode, createLogging, is_ripple_document } from './utils.js';
4
4
 
5
5
  const { log } = createLogging('[Ripple Auto-Insert Plugin]');
6
6
 
@@ -32,7 +32,7 @@ const VOID_ELEMENTS = new Set([
32
32
  * Handles auto-closing tags when typing '>' after a tag name
33
33
  * @returns {LanguageServicePlugin}
34
34
  */
35
- function createAutoInsertPlugin() {
35
+ export function createAutoInsertPlugin() {
36
36
  return {
37
37
  name: 'ripple-auto-insert',
38
38
  capabilities: {
@@ -161,7 +161,3 @@ function createAutoInsertPlugin() {
161
161
  },
162
162
  };
163
163
  }
164
-
165
- module.exports = {
166
- createAutoInsertPlugin,
167
- };
@@ -1,20 +1,19 @@
1
1
  /**
2
2
  * @import {Diagnostic, Range, LanguageServicePlugin, LanguageServiceContext, Position, Mapper} from '@volar/language-server';
3
3
  * @import {TextDocument} from 'vscode-languageserver-textdocument';
4
- * @import {TSRXVirtualCode} from '@ripple-ts/typescript-plugin/src/language.js';
4
+ * @import {TSRXVirtualCodeInstance} from '@ripple-ts/typescript-plugin/src/language.js';
5
5
  */
6
- // @ts-expect-error: ESM type import is fine
7
6
  /** @import {TSRXCompileError} from '@tsrx/ripple'; */
8
7
 
9
- const { getVirtualCode, createLogging } = require('./utils.js');
8
+ import { getVirtualCode, createLogging } from './utils.js';
10
9
 
11
10
  const { log } = createLogging('[Ripple Compile Error Diagnostic Plugin]');
12
- const { DiagnosticSeverity } = require('@volar/language-server');
11
+ import { DiagnosticSeverity } from '@volar/language-server';
13
12
 
14
13
  /**
15
14
  * @returns {LanguageServicePlugin}
16
15
  */
17
- function createCompileErrorDiagnosticPlugin() {
16
+ export function createCompileErrorDiagnosticPlugin() {
18
17
  log('Creating Ripple diagnostic plugin...');
19
18
 
20
19
  return {
@@ -63,7 +62,7 @@ function createCompileErrorDiagnosticPlugin() {
63
62
 
64
63
  /**
65
64
  * @param {TSRXCompileError} error
66
- * @param {TSRXVirtualCode} virtualCode
65
+ * @param {TSRXVirtualCodeInstance} virtualCode
67
66
  * @param {Mapper | undefined} sourceMap
68
67
  * @param {TextDocument} document
69
68
  * @returns {Diagnostic}
@@ -154,7 +153,3 @@ function get_end_offset_from_error(error, start_offset) {
154
153
  function get_start_offset_from_error(error) {
155
154
  return error.pos ?? 0;
156
155
  }
157
-
158
- module.exports = {
159
- createCompileErrorDiagnosticPlugin,
160
- };
@@ -1,13 +1,13 @@
1
1
  /** @import { LanguageServicePlugin, TextEdit, CompletionItem } from '@volar/language-server'; */
2
2
 
3
- const { CompletionItemKind, InsertTextFormat } = require('@volar/language-server');
4
- const {
3
+ import { CompletionItemKind, InsertTextFormat } from '@volar/language-server';
4
+ import {
5
5
  getVirtualCode,
6
6
  createLogging,
7
7
  isInsideImport,
8
8
  isInsideExport,
9
9
  is_ripple_document,
10
- } = require('./utils.js');
10
+ } from './utils.js';
11
11
 
12
12
  const { log } = createLogging('[Ripple Completion Plugin]');
13
13
 
@@ -361,7 +361,7 @@ const RIPPLE_IMPORTS = [
361
361
  /**
362
362
  * @returns {LanguageServicePlugin}
363
363
  */
364
- function createCompletionPlugin() {
364
+ export function createCompletionPlugin() {
365
365
  return {
366
366
  name: 'ripple-completion-enhancer',
367
367
  capabilities: {
@@ -506,7 +506,3 @@ function createCompletionPlugin() {
506
506
  },
507
507
  };
508
508
  }
509
-
510
- module.exports = {
511
- createCompletionPlugin,
512
- };
@@ -1,18 +1,15 @@
1
1
  /** @import { LanguageServicePlugin, LocationLink } from '@volar/language-server'; */
2
- // @ts-expect-error type-only import from ESM module into CJS is fine
3
2
  /** @import { DefinitionLocation } from '@tsrx/ripple'; */
4
3
 
5
- const { TextDocument } = require('vscode-languageserver-textdocument');
6
- const { getVirtualCode, createLogging, getWordFromPosition } = require('./utils.js');
7
- const path = require('path');
8
- const fs = require('fs');
9
-
10
- const {
4
+ import { TextDocument } from 'vscode-languageserver-textdocument';
5
+ import { getVirtualCode, createLogging, getWordFromPosition } from './utils.js';
6
+ import path from 'path';
7
+ import {
11
8
  normalizeFileNameOrUri,
12
9
  getRippleDirForFile,
13
10
  getCachedTypeDefinitionFile,
14
11
  getCachedTypeMatches,
15
- } = require('@ripple-ts/typescript-plugin/src/language.js');
12
+ } from '@ripple-ts/typescript-plugin/src/language.js';
16
13
 
17
14
  const { log } = createLogging('[Ripple Definition Plugin]');
18
15
  /** @type {string | undefined} */
@@ -21,7 +18,7 @@ let ripple_dir;
21
18
  /**
22
19
  * @returns {LanguageServicePlugin}
23
20
  */
24
- function createDefinitionPlugin() {
21
+ export function createDefinitionPlugin() {
25
22
  return {
26
23
  name: 'ripple-definition',
27
24
  capabilities: {
@@ -140,7 +137,9 @@ function createDefinitionPlugin() {
140
137
  const loc = /** @type {DefinitionLocation} */ (def.location);
141
138
 
142
139
  const embeddedCode = loc.embeddedId
143
- ? virtualCode.embeddedCodes?.find(({ id }) => id === loc.embeddedId)
140
+ ? virtualCode.embeddedCodes?.find(
141
+ (/** @type {{ id: string }} */ { id }) => id === loc.embeddedId,
142
+ )
144
143
  : undefined;
145
144
 
146
145
  if (embeddedCode) {
@@ -207,7 +206,3 @@ function createDefinitionPlugin() {
207
206
  },
208
207
  };
209
208
  }
210
-
211
- module.exports = {
212
- createDefinitionPlugin,
213
- };
@@ -1,7 +1,7 @@
1
1
  /** @import { LanguageServicePlugin } from '@volar/language-server' */
2
2
  /** @import { LanguageServicePluginInstance } from '@volar/language-server' */
3
3
 
4
- const { getVirtualCode, getWordFromPosition, createLogging } = require('./utils.js');
4
+ import { getVirtualCode, getWordFromPosition, createLogging } from './utils.js';
5
5
  const { log } = createLogging('[Ripple Document Highlight Plugin]');
6
6
 
7
7
  /**
@@ -9,7 +9,7 @@ const { log } = createLogging('[Ripple Document Highlight Plugin]');
9
9
  * Provides word highlighting (grey background) for custom Ripple keywords like 'pending'
10
10
  * @returns {LanguageServicePlugin}
11
11
  */
12
- function createDocumentHighlightPlugin() {
12
+ export function createDocumentHighlightPlugin() {
13
13
  return {
14
14
  name: 'ripple-document-highlight',
15
15
  capabilities: {
@@ -116,7 +116,3 @@ function createDocumentHighlightPlugin() {
116
116
  },
117
117
  };
118
118
  }
119
-
120
- module.exports = {
121
- createDocumentHighlightPlugin,
122
- };
@@ -5,20 +5,20 @@
5
5
  MarkupContent,
6
6
  } from '@volar/language-server'; */
7
7
 
8
- const {
8
+ import {
9
9
  getVirtualCode,
10
10
  createLogging,
11
11
  getWordFromPosition,
12
12
  concatMarkdownContents,
13
13
  deobfuscateIdentifiers,
14
- } = require('./utils.js');
14
+ } from './utils.js';
15
15
 
16
16
  const { log, logError } = createLogging('[Ripple Hover Plugin]');
17
17
 
18
18
  /**
19
19
  * @returns {LanguageServicePlugin}
20
20
  */
21
- function createHoverPlugin() {
21
+ export function createHoverPlugin() {
22
22
  return {
23
23
  name: 'ripple-hover',
24
24
  capabilities: {
@@ -144,7 +144,3 @@ function createHoverPlugin() {
144
144
  },
145
145
  };
146
146
  }
147
-
148
- module.exports = {
149
- createHoverPlugin,
150
- };
package/src/server.js CHANGED
@@ -1,28 +1,28 @@
1
1
  /** @import {CompilerOptions} from 'typescript' */
2
2
 
3
- const { createLogging } = require('./utils.js');
4
- const {
3
+ import { createLogging } from './utils.js';
4
+ import {
5
5
  createConnection,
6
6
  createServer,
7
7
  createTypeScriptProject,
8
- } = require('@volar/language-server/node');
9
- const { createCompileErrorDiagnosticPlugin } = require('./compileErrorDiagnosticPlugin.js');
10
- const { createDefinitionPlugin } = require('./definitionPlugin.js');
11
- const { createHoverPlugin } = require('./hoverPlugin.js');
12
- const { createCompletionPlugin } = require('./completionPlugin.js');
13
- const { createAutoInsertPlugin } = require('./autoInsertPlugin.js');
14
- const { createTypeScriptDiagnosticFilterPlugin } = require('./typescriptDiagnosticPlugin.js');
15
- const { createDocumentHighlightPlugin } = require('./documentHighlightPlugin.js');
16
- const {
8
+ } from '@volar/language-server/node';
9
+ import { createCompileErrorDiagnosticPlugin } from './compileErrorDiagnosticPlugin.js';
10
+ import { createDefinitionPlugin } from './definitionPlugin.js';
11
+ import { createHoverPlugin } from './hoverPlugin.js';
12
+ import { createCompletionPlugin } from './completionPlugin.js';
13
+ import { createAutoInsertPlugin } from './autoInsertPlugin.js';
14
+ import { createTypeScriptDiagnosticFilterPlugin } from './typescriptDiagnosticPlugin.js';
15
+ import { createDocumentHighlightPlugin } from './documentHighlightPlugin.js';
16
+ import {
17
17
  getRippleLanguagePlugin,
18
18
  resolveConfig,
19
- } = require('@ripple-ts/typescript-plugin/src/language.js');
20
- const { createTypeScriptServices } = require('./typescriptService.js');
21
- const { create: createCssService } = require('volar-service-css');
19
+ } from '@ripple-ts/typescript-plugin/src/language.js';
20
+ import { createTypeScriptServices } from './typescriptService.js';
21
+ import { create as createCssService } from 'volar-service-css';
22
22
 
23
23
  const { log, logError } = createLogging('[Ripple Language Server]');
24
24
 
25
- function createRippleLanguageServer() {
25
+ export function createRippleLanguageServer() {
26
26
  const connection = createConnection();
27
27
  const server = createServer(connection);
28
28
 
@@ -124,7 +124,7 @@ function createRippleLanguageServer() {
124
124
 
125
125
  // Register file watchers for TypeScript/JavaScript files so the language
126
126
  // server is notified when they change on disk. Without this, changes to
127
- // .ts files that are imported by .ripple files are not detected, causing
127
+ // .ts files that are imported by .tsrx files are not detected, causing
128
128
  // stale diagnostics until the server is restarted.
129
129
  try {
130
130
  await server.fileWatcher.watchFiles([
@@ -156,7 +156,3 @@ function createRippleLanguageServer() {
156
156
 
157
157
  return { connection, server };
158
158
  }
159
-
160
- module.exports = {
161
- createRippleLanguageServer,
162
- };
@@ -8,7 +8,7 @@
8
8
  @import {TextDocument} from 'vscode-languageserver-textdocument';
9
9
  */
10
10
 
11
- const { getVirtualCode, createLogging, deobfuscateIdentifiers } = require('./utils.js');
11
+ import { getVirtualCode, createLogging, deobfuscateIdentifiers } from './utils.js';
12
12
 
13
13
  const { log, logError } = createLogging('[Ripple TypeScript Diagnostic Plugin]');
14
14
 
@@ -93,7 +93,7 @@ function processDiagnostics(document, context, diagnostics) {
93
93
  * to work correctly, as volar matches diagnostics by pluginIndex.
94
94
  * @returns {LanguageServicePlugin}
95
95
  */
96
- function createTypeScriptDiagnosticFilterPlugin() {
96
+ export function createTypeScriptDiagnosticFilterPlugin() {
97
97
  log('Creating TypeScript diagnostic filter plugin...');
98
98
 
99
99
  return {
@@ -137,7 +137,3 @@ function createTypeScriptDiagnosticFilterPlugin() {
137
137
  },
138
138
  };
139
139
  }
140
-
141
- module.exports = {
142
- createTypeScriptDiagnosticFilterPlugin,
143
- };
@@ -3,8 +3,18 @@
3
3
  * @import {TextDocument} from 'vscode-languageserver-textdocument'
4
4
  */
5
5
 
6
- // Monkey-patch getUserPreferences before requiring the main module
6
+ import { createRequire } from 'node:module';
7
+
8
+ // Monkey-patch getUserPreferences to inject Ripple-specific defaults.
9
+ // We use createRequire to get the raw CJS module.exports object, bypassing
10
+ // the bundler's __toESM wrapper which interferes with property assignment.
11
+ // volar-service-typescript is also externalized (via regex in tsdown config)
12
+ // so that its internal consumers (semantic.js, codeAction.js, etc.) load
13
+ // getUserPreferences from the same Node module cache entry we patch here.
14
+ const require = createRequire(import.meta.url);
7
15
  const getUserPreferencesModule = require('volar-service-typescript/lib/configs/getUserPreferences');
16
+ const { create } = require('volar-service-typescript');
17
+
8
18
  const originalGetUserPreferences = getUserPreferencesModule.getUserPreferences;
9
19
 
10
20
  /**
@@ -24,23 +34,16 @@ getUserPreferencesModule.getUserPreferences = async function (context, document)
24
34
  return {
25
35
  preferTypeOnlyAutoImports: true,
26
36
  ...origPreferences,
27
- ...tsConfig?.preferences,
28
- ...rippleConfig?.preferences,
37
+ .../** @type {any} */ (tsConfig)?.preferences,
38
+ .../** @type {any} */ (rippleConfig)?.preferences,
29
39
  };
30
40
  };
31
41
 
32
- // Now require the main module which will use our patched getUserPreferences
33
- const { create } = require('volar-service-typescript');
34
-
35
42
  /**
36
43
  * Create TypeScript services with Ripple-specific enhancements.
37
44
  * @param {typeof import('typescript')} ts
38
45
  * @returns {ReturnType<typeof create>}
39
46
  */
40
- function createTypeScriptServices(ts) {
47
+ export function createTypeScriptServices(ts) {
41
48
  return create(ts);
42
49
  }
43
-
44
- module.exports = {
45
- createTypeScriptServices,
46
- };
package/src/utils.js CHANGED
@@ -1,16 +1,15 @@
1
1
  /** @import { TextDocument } from 'vscode-languageserver-textdocument' */
2
2
  /** @import { LanguageServiceContext, Mapper, SourceScript } from '@volar/language-server' */
3
- /** @typedef {import('@ripple-ts/typescript-plugin/src/language.js').TSRXVirtualCode} TSRXVirtualCode */
4
- // @ts-expect-error: ESM type import is fine
3
+ /** @import {TSRXVirtualCodeInstance} from '@ripple-ts/typescript-plugin/src/language.js'; */
5
4
  /** @import { isIdentifierObfuscated, deobfuscateIdentifier, IDENTIFIER_OBFUSCATION_PREFIX } from '@tsrx/core' */
6
5
 
7
- const { URI } = require('vscode-uri');
8
- const {
6
+ import { URI } from 'vscode-uri';
7
+ import {
9
8
  createLogging,
10
9
  getWordFromPosition,
11
10
  charAllowedWordRegex,
12
11
  DEBUG,
13
- } = require('@ripple-ts/typescript-plugin/src/utils.js');
12
+ } from '@ripple-ts/typescript-plugin/src/utils.js';
14
13
 
15
14
  const IMPORT_EXPORT_REGEX = {
16
15
  import: {
@@ -24,7 +23,7 @@ const IMPORT_EXPORT_REGEX = {
24
23
  from: /from\s*['"][^'"]*['"]\s*;?/,
25
24
  };
26
25
 
27
- const RIPPLE_EXTENSIONS = ['.ripple', '.rsrx', '.tsrx'];
26
+ export const RIPPLE_EXTENSIONS = ['.tsrx'];
28
27
 
29
28
  /** @type {typeof isIdentifierObfuscated} */
30
29
  let is_identifier_obfuscated;
@@ -58,7 +57,7 @@ function escapeRegExp(source) {
58
57
  * @param {string} text
59
58
  * @returns {string}
60
59
  */
61
- function deobfuscateIdentifiers(text) {
60
+ export function deobfuscateIdentifiers(text) {
62
61
  return text.replace(obfuscated_identifier_regex, (match) => deobfuscate_identifier(match));
63
62
  }
64
63
 
@@ -66,7 +65,7 @@ function deobfuscateIdentifiers(text) {
66
65
  * @param {...string} contents
67
66
  * @returns string
68
67
  */
69
- function concatMarkdownContents(...contents) {
68
+ export function concatMarkdownContents(...contents) {
70
69
  return contents.join('\n\n<br>\n\n---\n\n<br><br>\n\n');
71
70
  }
72
71
 
@@ -76,20 +75,20 @@ function concatMarkdownContents(...contents) {
76
75
  * @param {TextDocument} document
77
76
  * @returns
78
77
  {{
79
- virtualCode: TSRXVirtualCode;
78
+ virtualCode: TSRXVirtualCodeInstance;
80
79
  sourceUri: URI;
81
80
  sourceScript: SourceScript<URI> | undefined;
82
81
  sourceMap: Mapper | undefined;
83
82
  }}
84
83
  */
85
- function getVirtualCode(document, context) {
84
+ export function getVirtualCode(document, context) {
86
85
  const uri = URI.parse(document.uri);
87
86
  const decoded = /** @type {[documentUri: URI, embeddedCodeId: string]} */ (
88
87
  context.decodeEmbeddedDocumentUri(uri)
89
88
  );
90
89
  const [sourceUri, virtualCodeId] = decoded;
91
90
  const sourceScript = context.language.scripts.get(sourceUri);
92
- const virtualCode = /** @type {TSRXVirtualCode} */ (
91
+ const virtualCode = /** @type {TSRXVirtualCodeInstance} */ (
93
92
  sourceScript?.generated?.embeddedCodes.get(virtualCodeId)
94
93
  );
95
94
 
@@ -139,7 +138,7 @@ function isInsideImportOrExport(type, text, start) {
139
138
  * @param {number} start
140
139
  * @returns {boolean}
141
140
  */
142
- function isInsideImport(text, start) {
141
+ export function isInsideImport(text, start) {
143
142
  return isInsideImportOrExport('import', text, start);
144
143
  }
145
144
 
@@ -148,7 +147,7 @@ function isInsideImport(text, start) {
148
147
  * @param {number} start
149
148
  * @returns {boolean}
150
149
  */
151
- function isInsideExport(text, start) {
150
+ export function isInsideExport(text, start) {
152
151
  return isInsideImportOrExport('export', text, start);
153
152
  }
154
153
 
@@ -156,19 +155,8 @@ function isInsideExport(text, start) {
156
155
  * @param {string} document_uri
157
156
  * @returns {boolean}
158
157
  */
159
- function is_ripple_document(document_uri) {
158
+ export function is_ripple_document(document_uri) {
160
159
  return RIPPLE_EXTENSIONS.some((extension) => document_uri.endsWith(extension));
161
160
  }
162
161
 
163
- module.exports = {
164
- RIPPLE_EXTENSIONS,
165
- getVirtualCode,
166
- getWordFromPosition,
167
- is_ripple_document,
168
- isInsideImport,
169
- isInsideExport,
170
- createLogging,
171
- concatMarkdownContents,
172
- deobfuscateIdentifiers,
173
- DEBUG,
174
- };
162
+ export { createLogging, getWordFromPosition, DEBUG };
package/tsconfig.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "node16",
4
- "moduleResolution": "node16",
5
- "target": "es2020",
3
+ "module": "esnext",
4
+ "moduleResolution": "bundler",
5
+ "target": "esnext",
6
+ "lib": ["esnext"],
6
7
  "allowJs": true,
7
8
  "checkJs": true,
8
9
  "noEmit": true,
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["esnext", "dom", "dom.iterable"],
5
+ "skipLibCheck": true
6
+ }
7
+ }
@@ -0,0 +1,41 @@
1
+ import { defineConfig } from 'tsdown';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+
6
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const isDev = process.env.NODE_ENV !== 'production';
8
+ const ROOT_EXTERNAL_PACKAGES = [
9
+ '@tsrx/react',
10
+ '@tsrx/ripple',
11
+ '@tsrx/core',
12
+ 'typescript',
13
+ 'vscode-uri',
14
+ // need this for monkey patching
15
+ 'volar-service-typescript',
16
+ /* also definitely need it for monkey patching */
17
+ /^volar-service-typescript(?:\/.*)?$/,
18
+ ];
19
+
20
+ export default defineConfig({
21
+ inlineOnly: false,
22
+ entry: ['src/server.js', 'bin/language-server.js'],
23
+ format: ['cjs'],
24
+ outExtensions: () => ({ js: '.js' }),
25
+ platform: 'node',
26
+ target: 'node20',
27
+ outDir: 'dist',
28
+ sourcemap: isDev,
29
+ outputOptions: {
30
+ legalComments: 'inline',
31
+ minify: false,
32
+ },
33
+ external: [...ROOT_EXTERNAL_PACKAGES],
34
+ clean: true,
35
+ noExternal: /.+/,
36
+ hooks: {
37
+ 'build:done': () => {
38
+ fs.writeFileSync(path.join(dirname, 'dist', 'package.json'), '{"type":"commonjs"}\n');
39
+ },
40
+ },
41
+ });
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./src/server');