Skip to content

Commit 58aaa9e

Browse files
committed
switch kit-codemirror to type: "module";
1 parent e8a55b3 commit 58aaa9e

File tree

20 files changed

+230
-111
lines changed

20 files changed

+230
-111
lines changed

.editorconfig

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tab_width = 4
1313
trim_trailing_whitespace = true
1414
ij_continuation_indent_size = 4
1515

16-
[{*.cjs,*.js,*.ts,*.jsx,*.tsx}]
16+
[{*.cjs,*.js,*.mjs,*.ts,*.jsx,*.tsx}]
1717
max_line_length = 240
1818
ij_continuation_indent_size = 4
1919
ij_javascript_align_imports = false
@@ -34,7 +34,7 @@ ij_javascript_array_initializer_wrap = off
3434
ij_javascript_assignment_wrap = off
3535
ij_javascript_binary_operation_sign_on_next_line = false
3636
ij_javascript_binary_operation_wrap = off
37-
ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/**
37+
ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/**
3838
ij_javascript_blank_lines_after_imports = 1
3939
ij_javascript_blank_lines_around_class = 1
4040
ij_javascript_blank_lines_around_field = 0
@@ -153,7 +153,7 @@ ij_javascript_spaces_within_brackets = false
153153
ij_javascript_spaces_within_catch_parentheses = false
154154
ij_javascript_spaces_within_for_parentheses = false
155155
ij_javascript_spaces_within_if_parentheses = false
156-
ij_javascript_spaces_within_imports = false
156+
ij_javascript_spaces_within_imports = true
157157
ij_javascript_spaces_within_interpolation_expressions = false
158158
ij_javascript_spaces_within_method_call_parentheses = false
159159
ij_javascript_spaces_within_method_parentheses = false

babel.config.json

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
"@babel/preset-env",
2222
"@babel/preset-react",
2323
"@babel/preset-typescript"
24+
],
25+
"plugins": [
26+
[
27+
"babel-plugin-replace-import-extension",
28+
{
29+
"extMapping": {
30+
".js": ".cjs"
31+
}
32+
}
33+
]
2434
]
2535
},
2636
"test": {

package-lock.json

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
"scripts": {
88
"start": "npm run clean-dist && npm run serve -- demo",
99
"docs": "npm run serve -- docs",
10-
"serve": "cross-env NODE_ENV=development node packerConfig.js --serve",
10+
"serve": "cross-env NODE_ENV=development node packerConfig.mjs --serve",
1111
"prebuild": "npm run clean-dist && npm run static-gen",
1212
"build_": "npm run build-all && npm run dtsgen",
1313
"build": "npm run build-babel && npm run dtsgen && npm run build-webpack",
14-
"build-all": "cross-env NODE_ENV=production CI=true node packerConfig.js --build --babel --webpack",
15-
"build-babel": "cross-env NODE_ENV=production CI=true node packerConfig.js --build --babel",
16-
"build-webpack": "cross-env NODE_ENV=production CI=true node packerConfig.js --build --webpack",
14+
"build-all": "cross-env NODE_ENV=production CI=true node packerConfig.mjs --build --babel --webpack",
15+
"build-babel": "cross-env NODE_ENV=production CI=true node packerConfig.mjs --build --babel",
16+
"build-webpack": "cross-env NODE_ENV=production CI=true node packerConfig.mjs --build --webpack",
1717
"static-gen": "npm run sitemaps && npm run doc-gen && npm run page-index",
1818
"sitemaps": "lerna run sitemap",
1919
"doc-gen": "lerna run doc-gen",
2020
"page-index": "lerna run page-index",
2121
"dtsgen": "lerna run dtsgen",
2222
"tscheck": "lerna run tscheck",
23-
"profile": "cross-env NODE_OPTIONS='--max-old-space-size=4096' NODE_ENV=production node packerConfig.js --build --profile",
23+
"profile": "cross-env NODE_OPTIONS='--max-old-space-size=4096' NODE_ENV=production node packerConfig.mjs --build --profile",
2424
"clean": "npm run clean-dist && lerna clean -y",
25-
"clean-dist": "node packerConfig.js --clean",
25+
"clean-dist": "node packerConfig.mjs --clean",
2626
"clean-lock": "rimraf --glob packages/*/package-lock.json",
2727
"bootstrap": "lerna bootstrap --force-local",
2828
"link": "lerna link --force-local",
@@ -38,6 +38,7 @@
3838
"license": "MIT",
3939
"devDependencies": {
4040
"babel-plugin-named-asset-import": "^0.3.8",
41+
"babel-plugin-replace-import-extension": "^1.1.4",
4142
"cross-env": "^6.0.3",
4243
"eslint-plugin-jsx-a11y": "^6.5.1",
4344
"eslint-plugin-react-hooks": "^4.3.0",

packages/demo/package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/demo/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"@codemirror/language": "^6.1.0",
3030
"@ui-schema/dictionary": "~0.0.10",
3131
"@ui-schema/ds-material": "~0.4.0-alpha.5",
32-
"@ui-schema/kit-codemirror": "~0.1.0",
33-
"@ui-schema/material-code": "~0.4.3",
32+
"@ui-schema/kit-codemirror": "~0.2.0",
33+
"@ui-schema/material-code": "~0.4.5",
3434
"@ui-schema/ui-schema": "~0.4.1",
3535
"immutable": "^4.0.0",
3636
"react": "^18.0",

packages/kit-codemirror/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kit-codemirror/package.json

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ui-schema/kit-codemirror",
3-
"version": "0.1.2",
3+
"version": "0.2.0",
44
"description": "CodeMirror v6 as React Component, with hooks and stuff - but only the necessities.",
55
"homepage": "https://ui-schema.bemit.codes/docs/kit-codemirror/kit-codemirror",
66
"author": {
@@ -28,11 +28,24 @@
2828
"bugs": {
2929
"url": "https://github.com/ui-schema/react-codemirror/issues"
3030
},
31-
"main": "./index.js",
32-
"module": "./esm/index.js",
31+
"type": "module",
32+
"main": "./index.cjs",
33+
"module": "./index.js",
3334
"types": "./index.d.ts",
35+
"exports": {
36+
".": {
37+
"types": "./index.d.ts",
38+
"import": "./index.js",
39+
"require": "./index.cjs"
40+
},
41+
"./*": {
42+
"types": "./*/index.d.ts",
43+
"import": "./*/index.js",
44+
"require": "./*/index.cjs"
45+
}
46+
},
3447
"scripts": {
35-
"dtsgen": "tsc -d --emitDeclarationOnly --pretty && merge-dirs build/dts build && rm -rf build/dts && rm -rf build/**/*.test.*"
48+
"dtsgen": "tsc -d --emitDeclarationOnly --pretty && merge-dirs build/dts/kit-codemirror/src build && rm -rf build/dts && rm -rf build/**/*.test.*"
3649
},
3750
"sideEffects": false,
3851
"devDependencies": {
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './CodeMirror'
1+
export * from './CodeMirror.js'
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './createEditorView'
1+
export * from './createEditorView.js'

packages/kit-codemirror/src/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export * from './CodeMirror'
2-
export * from './createEditorView'
3-
export * from './useCodeMirror'
4-
export * from './useEditorClasses'
5-
export * from './useExtension'
1+
export * from './CodeMirror/index.js'
2+
export * from './createEditorView/index.js'
3+
export * from './useCodeMirror/index.js'
4+
export * from './useEditorClasses/index.js'
5+
export * from './useExtension/index.js'
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './useCodeMirror'
1+
export * from './useCodeMirror.js'
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './useEditorClasses'
1+
export * from './useEditorClasses.js'
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './useExtension'
1+
export * from './useExtension.js'

packages/kit-codemirror/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"src"
55
],
66
"compilerOptions": {
7-
"outDir": "build/dts"
7+
"outDir": "build/dts",
8+
"module": "Node16",
9+
"moduleResolution": "Node16"
810
}
911
}

packages/material-code/package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/material-code/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@codemirror/state": "^6.0.0",
5252
"@codemirror/view": "^6.0.0",
5353
"@codemirror/language": "^6.1.0",
54-
"@ui-schema/kit-codemirror": "~0.1.0-alpha.1",
54+
"@ui-schema/kit-codemirror": "~0.2.0",
5555
"@ui-schema/ds-material": "~0.4.0-alpha",
5656
"@ui-schema/ui-schema": "~0.4.0-alpha",
5757
"immutable": "^4.0.0",
@@ -64,7 +64,7 @@
6464
"@codemirror/state": "^6.0.0",
6565
"@codemirror/view": "^6.0.0",
6666
"@codemirror/language": "^6.1.0",
67-
"@ui-schema/kit-codemirror": "~0.1.0-alpha.1",
67+
"@ui-schema/kit-codemirror": "~0.1.0-alpha.1 || ~0.2.0",
6868
"@ui-schema/ds-material": "~0.4.0-alpha",
6969
"@ui-schema/ui-schema": "~0.4.0-alpha",
7070
"immutable": "^4.0.0",

packages/tsconfig.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
{
22
"compilerOptions": {
3-
"module": "esnext",
4-
"target": "es2015",
3+
"module": "ESNext",
4+
"target": "ES2022",
55
"jsx": "preserve",
66
"removeComments": false,
7-
"moduleResolution": "node",
7+
"moduleResolution": "Bundler",
88
"forceConsistentCasingInFileNames": true,
99
"strict": true,
10-
"noEmit": false,
1110
"experimentalDecorators": true,
1211
"baseUrl": "./",
12+
"rootDir": "./",
1313
"allowSyntheticDefaultImports": true,
1414
"noErrorTruncation": true,
15-
"allowJs": true,
15+
"allowJs": false,
1616
"declaration": true,
17-
"resolveJsonModule": true,
17+
"resolveJsonModule": false,
1818
"skipLibCheck": true,
1919
"noUnusedLocals": true,
2020
"noImplicitAny": false,
2121
"noUnusedParameters": true,
2222
"paths": {
2323
"@ui-schema/kit-codemirror": [
24-
"kit-codemirror/src"
24+
"kit-codemirror/src/index.ts"
2525
],
2626
"@ui-schema/kit-codemirror/*": [
27-
"kit-codemirror/src/*"
27+
"kit-codemirror/src/*/index.ts"
2828
],
2929
"@ui-schema/material-code": [
3030
"material-code/src"

packerConfig.js

-66
This file was deleted.

0 commit comments

Comments
 (0)