Skip to content

Commit 0b44cbe

Browse files
committed
migrate to ESM only, prepare 6.0.0-next.1
1 parent 2f8b5be commit 0b44cbe

36 files changed

+113
-117
lines changed

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
"request": "launch",
1717
"runtimeArgs": [
1818
"--test",
19-
"./lib/umd/test/**/*.test.js"
19+
"./lib/esm/test/**/*.test.js"
2020
],
2121
"cwd": "${workspaceRoot}",
2222
"sourceMaps": true,
23-
"outFiles": [ "${workspaceRoot}/lib/umd/**/*.js" ],
23+
"outFiles": [ "${workspaceRoot}/lib/esm/**/*.js" ],
2424
"preLaunchTask": "npm: watch"
2525
},
2626
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ function deleteRefs(dir) {
1515
deleteRefs(filePath);
1616
} else if (path.extname(file) === '.js') {
1717
const content = fs.readFileSync(filePath, 'utf8');
18-
const newContent = content.replace(/\/\/\# sourceMappingURL=[^]+.js.map/, '')
18+
const newContent = content.replace(/\/\/\# sourceMappingURL=[^]+.js.map/, '');
1919
if (content.length !== newContent.length) {
2020
console.log('remove sourceMappingURL in ' + filePath);
2121
fs.writeFileSync(filePath, newContent);
2222
}
2323
} else if (path.extname(file) === '.map') {
24-
fs.unlinkSync(filePath)
24+
fs.unlinkSync(filePath);
2525
console.log('remove ' + filePath);
2626
}
2727
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"name": "vscode-json-languageservice",
3-
"version": "5.7.2",
3+
"version": "6.0.0-next.1",
44
"description": "Language service for JSON",
5-
"main": "./lib/umd/jsonLanguageService.js",
6-
"typings": "./lib/umd/jsonLanguageService",
7-
"module": "./lib/esm/jsonLanguageService.js",
5+
"type": "module",
6+
"types": "./lib/esm/jsonLanguageService.d.ts",
7+
"exports": {
8+
".": {
9+
"types": "./lib/esm/jsonLanguageService.d.ts",
10+
"import": "./lib/esm/jsonLanguageService.js"
11+
}
12+
},
813
"author": "Microsoft Corporation",
914
"repository": {
1015
"type": "git",
@@ -31,18 +36,17 @@
3136
"@vscode/l10n": "^0.0.18"
3237
},
3338
"scripts": {
34-
"prepack": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
39+
"prepack": "npm run clean && npm run compile && npm run test && npm run remove-sourcemap-refs",
3540
"compile": "tsc -p ./src",
36-
"compile-esm": "tsc -p ./src/tsconfig.esm.json",
3741
"clean": "rimraf lib",
38-
"remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js",
42+
"remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.cjs",
3943
"watch": "tsc -w -p ./src",
4044
"pretest": "npm run compile",
41-
"test": "node --test ./lib/umd/test/**/*.test.js",
45+
"test": "node --test ./lib/esm/test/**/*.test.js",
4246
"posttest": "npm run lint",
4347
"coverage": "npx nyc -r lcov npm run test",
4448
"lint": "eslint src/**/*.ts",
4549
"install-types-next": "npm install vscode-languageserver-types@next -f -S && npm install vscode-languageserver-textdocument@next -f -S",
46-
"sample": "npm run compile && node ./lib/umd/example/sample.js"
50+
"sample": "npm run compile && node ./lib/esm/example/sample.js"
4751
}
4852
}

src/example/sample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
import { getLanguageService, TextDocument } from '../jsonLanguageService';
3+
import { getLanguageService, TextDocument } from '../jsonLanguageService.js';
44

55
async function main() {
66
const jsonContentUri = 'foo://server/example.data.json';

src/jsonContributions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5-
import { MarkedString, CompletionItem } from './jsonLanguageService';
5+
import { MarkedString, CompletionItem } from './jsonLanguageService.js';
66

77
export interface JSONWorkerContribution {
88
getInfoContribution(uri: string, location: JSONPath): PromiseLike<MarkedString[]>;

src/jsonLanguageService.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { JSONCompletion } from './services/jsonCompletion';
7-
import { JSONHover } from './services/jsonHover';
8-
import { JSONValidation } from './services/jsonValidation';
6+
import { JSONCompletion } from './services/jsonCompletion.js';
7+
import { JSONHover } from './services/jsonHover.js';
8+
import { JSONValidation } from './services/jsonValidation.js';
99

10-
import { JSONDocumentSymbols } from './services/jsonDocumentSymbols';
11-
import { parse as parseJSON, newJSONDocument } from './parser/jsonParser';
12-
import { schemaContributions } from './services/configuration';
13-
import { JSONSchemaService } from './services/jsonSchemaService';
14-
import { getFoldingRanges } from './services/jsonFolding';
15-
import { getSelectionRanges } from './services/jsonSelectionRanges';
16-
import { sort } from './utils/sort';
17-
import { format } from './utils/format';
10+
import { JSONDocumentSymbols } from './services/jsonDocumentSymbols.js';
11+
import { parse as parseJSON, newJSONDocument } from './parser/jsonParser.js';
12+
import { schemaContributions } from './services/configuration.js';
13+
import { JSONSchemaService } from './services/jsonSchemaService.js';
14+
import { getFoldingRanges } from './services/jsonFolding.js';
15+
import { getSelectionRanges } from './services/jsonSelectionRanges.js';
16+
import { sort } from './utils/sort.js';
17+
import { format } from './utils/format.js';
1818

1919
import {
2020
ASTNode,
@@ -24,15 +24,15 @@ import {
2424
TextDocument,
2525
Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic,
2626
TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema, JSONLanguageStatus, SortOptions
27-
} from './jsonLanguageTypes';
28-
import { findLinks } from './services/jsonLinks';
27+
} from './jsonLanguageTypes.js';
28+
import { findLinks } from './services/jsonLinks.js';
2929
import { DocumentLink } from 'vscode-languageserver-types';
3030

3131
export type JSONDocument = {
3232
root: ASTNode | undefined;
3333
getNodeFromOffset(offset: number, includeRightBound?: boolean): ASTNode | undefined;
3434
};
35-
export * from './jsonLanguageTypes';
35+
export * from './jsonLanguageTypes.js';
3636

3737
export interface LanguageService {
3838
configure(settings: LanguageSettings): void;

src/jsonLanguageTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { JSONWorkerContribution, JSONPath, Segment, CompletionsCollector } from './jsonContributions';
7-
import { JSONSchema } from './jsonSchema';
6+
import { JSONWorkerContribution, JSONPath, Segment, CompletionsCollector } from './jsonContributions.js';
7+
import { JSONSchema } from './jsonSchema.js';
88
import {
99
Range, Position, DocumentUri, MarkupContent, MarkupKind,
1010
Color, ColorInformation, ColorPresentation,

src/parser/jsonParser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as Json from 'jsonc-parser';
7-
import { JSONSchema, JSONSchemaRef } from '../jsonSchema';
8-
import { isNumber, equals, isBoolean, isString, isDefined, isObject } from '../utils/objects';
9-
import { extendedRegExp, stringLength } from '../utils/strings';
10-
import { TextDocument, ASTNode, ObjectASTNode, ArrayASTNode, BooleanASTNode, NumberASTNode, StringASTNode, NullASTNode, PropertyASTNode, JSONPath, ErrorCode, Diagnostic, DiagnosticSeverity, Range, SchemaDraft } from '../jsonLanguageTypes';
7+
import { JSONSchema, JSONSchemaRef } from '../jsonSchema.js';
8+
import { isNumber, equals, isBoolean, isString, isDefined, isObject } from '../utils/objects.js';
9+
import { extendedRegExp, stringLength } from '../utils/strings.js';
10+
import { TextDocument, ASTNode, ObjectASTNode, ArrayASTNode, BooleanASTNode, NumberASTNode, StringASTNode, NullASTNode, PropertyASTNode, JSONPath, ErrorCode, Diagnostic, DiagnosticSeverity, Range, SchemaDraft } from '../jsonLanguageTypes.js';
1111
import { URI } from 'vscode-uri';
1212

1313
import * as l10n from '@vscode/l10n';

src/services/configuration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { ISchemaContributions } from './jsonSchemaService';
7-
import draft201909Flat from './schemas/draft-2019-09-flat';
8-
import draft202012Flat from './schemas/draft-2020-12-flat';
6+
import { ISchemaContributions } from './jsonSchemaService.js';
7+
import draft201909Flat from './schemas/draft-2019-09-flat.js';
8+
import draft202012Flat from './schemas/draft-2020-12-flat.js';
99

1010
import * as l10n from '@vscode/l10n';
1111

0 commit comments

Comments
 (0)