Skip to content

Commit a113cf7

Browse files
authored
feat: Make cspell-io and cspell-service-bus pure ESM modules (#4752)
1 parent 41f1210 commit a113cf7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+136
-532
lines changed

packages/cspell-eslint-plugin/package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin#readme",
1818
"license": "MIT",
1919
"exports": {
20-
"types": "./dist/plugin/index.d.ts",
21-
"require": "./dist/plugin/index.js",
22-
"default": "./dist/plugin/index.js"
20+
"types": "./dist/plugin/index.d.cts",
21+
"require": "./dist/plugin/index.cjs",
22+
"import": "./dist/plugin/index.cjs",
23+
"default": "./dist/plugin/index.cjs"
2324
},
24-
"type": "commonjs",
25-
"main": "dist/plugin/index.js",
26-
"types": "dist/plugin/index.d.ts",
25+
"type": "module",
26+
"main": "dist/plugin/index.cjs",
27+
"types": "dist/plugin/index.d.cts",
2728
"files": [
2829
"assets",
2930
"dist",
@@ -36,13 +37,13 @@
3637
"scripts": {
3738
"build": "pnpm build:schema && pnpm build:src",
3839
"build:src": "tsc -b ./tsconfig.json",
39-
"build:schema": "ts-json-schema-generator --no-top-ref --expose none --path src/common/options.ts --type Options -o ./assets/options.schema.json",
40+
"build:schema": "ts-json-schema-generator --no-top-ref --expose none --path src/common/options.cts --type Options -o ./assets/options.schema.json",
4041
"watch": "tsc -p . --watch",
4142
"clean": "shx rm -rf dist temp coverage \"*.tsbuildInfo\"",
4243
"clean-build": "pnpm run clean && pnpm run build",
4344
"coverage": "echo coverage",
4445
"test-watch": "pnpm run test -- --watch",
45-
"test": "npx mocha --timeout 10000 \"dist/**/*.test.js\""
46+
"test": "npx mocha --timeout 10000 \"dist/**/*.test.cjs\""
4647
},
4748
"repository": {
4849
"type": "git",
@@ -65,7 +66,7 @@
6566
"eslint-plugin-react": "^7.33.2",
6667
"mocha": "^10.2.0",
6768
"ts-json-schema-generator": "^1.3.0",
68-
"typescript": "~5.1.6"
69+
"typescript": "^5.2.2"
6970
},
7071
"dependencies": {
7172
"@cspell/cspell-types": "workspace:*",
File renamed without changes.

packages/cspell-eslint-plugin/src/common/options.test.ts renamed to packages/cspell-eslint-plugin/src/common/options.test.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { CSpellSettings } from '@cspell/cspell-types';
22
import assert from 'assert';
33
import { describe, test } from 'mocha';
44

5-
import { defaultOptions, type Options } from './options.js';
5+
import { defaultOptions, type Options } from './options.cjs';
66

77
describe('options', () => {
88
test('Options are compatible with cspell-types', () => {

packages/cspell-eslint-plugin/src/plugin/cspell-eslint-plugin.ts renamed to packages/cspell-eslint-plugin/src/plugin/cspell-eslint-plugin.cts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { readFileSync } from 'fs';
44
import { join as pathJoin } from 'path';
55
import { createSyncFn } from 'synckit';
66

7-
import type { Issue, SpellCheckSyncFn } from '../worker/types';
8-
import { normalizeOptions } from './defaultCheckOptions';
7+
import type { Issue, SpellCheckSyncFn } from '../worker/types.cjs';
8+
import { normalizeOptions } from './defaultCheckOptions.cjs';
99

1010
const optionsSchema = JSON.parse(readFileSync(pathJoin(__dirname, '../../assets/options.schema.json'), 'utf8'));
1111

packages/cspell-eslint-plugin/src/plugin/defaultCheckOptions.ts renamed to packages/cspell-eslint-plugin/src/plugin/defaultCheckOptions.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Check, Options, RequiredOptions, WorkerOptions } from '../common/options';
1+
import type { Check, Options, RequiredOptions, WorkerOptions } from '../common/options.cjs';
22

33
export const defaultCheckOptions: Required<Check> = {
44
checkComments: true,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export type { Options } from '../common/options.cjs';
2+
export { configs, rules } from './cspell-eslint-plugin.cjs';

packages/cspell-eslint-plugin/src/plugin/index.test.ts renamed to packages/cspell-eslint-plugin/src/plugin/index.test.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { RuleTester } from 'eslint';
22
import * as fs from 'fs';
33
import * as path from 'path';
44

5-
import * as Rule from './index';
5+
import * as Rule from './index.cjs';
66

77
const root = path.resolve(__dirname, '../..');
88
const fixturesDir = path.join(root, 'fixtures');

packages/cspell-eslint-plugin/src/plugin/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/cspell-eslint-plugin/src/plugin/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"moduleResolution": "node",
4+
"module": "CommonJS",
5+
"moduleResolution": "Node",
56
"tsBuildInfoFile": "../../dist/plugin/compile.tsbuildInfo",
67
"rootDir": ".",
78
"outDir": "../../dist/plugin"
File renamed without changes.

0 commit comments

Comments
 (0)