Skip to content

Commit bbb1a40

Browse files
authored
Convert React packages to ESM (#1650)
* react-base16-styling * Use inline react-base16-styling themes * Fix * Format * Fix * Fixes * Transform more * react-json-tree * Update lock * Remove unnecessary * react-dock * Move to dep * Lock * Fix * Fix * Create tame-eagles-relax.md
1 parent 18cde73 commit bbb1a40

File tree

136 files changed

+1141
-833
lines changed

Some content is hidden

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

136 files changed

+1141
-833
lines changed

.changeset/tame-eagles-relax.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'react-base16-styling': major
3+
'react-dock': major
4+
'react-json-tree': major
5+
---
6+
7+
Convert React packages to ESM

packages/map2tree/test/map2tree.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { map2tree, Node } from '../src';
1+
import { map2tree, Node } from '../src/index.js';
22
import * as immutable from 'immutable';
33

44
test('# rootNodeKey', () => {
File renamed without changes.

packages/react-base16-styling/babel.config.esm.json

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

packages/react-base16-styling/babel.config.json

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
testEnvironment: 'jsdom',
3+
extensionsToTreatAsEsm: ['.ts'],
4+
moduleNameMapper: {
5+
'^(\\.{1,2}/.*)\\.js$': '$1',
6+
},
7+
transform: {
8+
'^.+\\.ts$': ['ts-jest', { tsconfig: 'tsconfig.test.json', useESM: true }],
9+
},
10+
};

packages/react-base16-styling/jest.config.js

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

packages/react-base16-styling/package.json

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,33 @@
1818
"lib",
1919
"src"
2020
],
21-
"main": "lib/cjs/index.js",
22-
"module": "lib/esm/index.js",
23-
"types": "lib/types/index.d.ts",
21+
"main": "lib/index.js",
22+
"types": "lib/index.d.ts",
23+
"type": "module",
2424
"sideEffects": false,
2525
"repository": {
2626
"type": "git",
2727
"url": "git+https://github.com/reduxjs/redux-devtools.git"
2828
},
2929
"scripts": {
30-
"build": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:types",
31-
"build:cjs": "babel src --extensions \".ts\" --out-dir lib/cjs",
32-
"build:esm": "babel src --config-file ./babel.config.esm.json --extensions \".ts\" --out-dir lib/esm",
33-
"build:types": "tsc --emitDeclarationOnly",
30+
"build": "tsc",
3431
"clean": "rimraf lib",
35-
"test": "jest",
32+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
3633
"lint": "eslint . --ext .ts",
3734
"type-check": "tsc --noEmit",
3835
"prepack": "pnpm run clean && pnpm run build",
39-
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
36+
"prepublish": "pnpm run lint && pnpm run test"
4037
},
4138
"dependencies": {
42-
"@babel/runtime": "^7.24.1",
43-
"@types/base16": "^1.0.5",
4439
"@types/lodash": "^4.17.0",
45-
"base16": "^1.0.0",
4640
"color": "^4.2.3",
4741
"csstype": "^3.1.3",
48-
"lodash.curry": "^4.1.1"
42+
"lodash-es": "^4.17.21"
4943
},
5044
"devDependencies": {
51-
"@babel/cli": "^7.24.1",
52-
"@babel/core": "^7.24.3",
53-
"@babel/eslint-parser": "^7.24.1",
54-
"@babel/plugin-transform-runtime": "^7.24.3",
55-
"@babel/preset-env": "^7.24.3",
56-
"@babel/preset-typescript": "^7.24.1",
5745
"@types/color": "^3.0.6",
5846
"@types/jest": "^29.5.12",
59-
"@types/lodash.curry": "^4.1.9",
47+
"@types/lodash-es": "^4.17.12",
6048
"@typescript-eslint/eslint-plugin": "^7.4.0",
6149
"@typescript-eslint/parser": "^7.4.0",
6250
"eslint": "^8.57.0",

packages/react-base16-styling/src/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import * as base16 from 'base16';
2-
import { Base16Theme } from 'base16';
31
import Color from 'color';
42
import * as CSS from 'csstype';
5-
import curry from 'lodash.curry';
3+
import { curry } from 'lodash-es';
64
import type { CurriedFunction3 } from 'lodash';
7-
import { Color as ColorTuple, yuv2rgb, rgb2yuv } from './colorConverters';
5+
import { Color as ColorTuple, yuv2rgb, rgb2yuv } from './colorConverters.js';
86
import {
97
Styling,
108
StylingConfig,
119
StylingFunction,
1210
StylingValue,
1311
StylingValueFunction,
1412
Theme,
15-
} from './types';
13+
} from './types.js';
14+
import { base16Themes as base16 } from './themes/index.js';
15+
import type { Base16Theme } from './themes/index.js';
1616

1717
const DEFAULT_BASE16 = base16.default;
1818

@@ -272,7 +272,7 @@ export const getBase16Theme = (
272272
if (base16Themes) {
273273
theme = base16Themes[themeName];
274274
} else {
275-
theme = base16[themeName as keyof typeof base16];
275+
theme = base16[themeName as keyof typeof base16] as Base16Theme;
276276
}
277277
if (modifier === 'inverted') {
278278
theme = invertBase16Theme(theme);
@@ -308,4 +308,5 @@ export const invertTheme = (theme: Theme | undefined): Theme | undefined => {
308308
};
309309

310310
export type { Base16Theme };
311-
export * from './types';
311+
export { base16 as base16Themes };
312+
export * from './types.js';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export default {
2+
scheme: 'apathy',
3+
author: 'jannik siebert (https://github.com/janniks)',
4+
base00: '#031A16',
5+
base01: '#0B342D',
6+
base02: '#184E45',
7+
base03: '#2B685E',
8+
base04: '#5F9C92',
9+
base05: '#81B5AC',
10+
base06: '#A7CEC8',
11+
base07: '#D2E7E4',
12+
base08: '#3E9688',
13+
base09: '#3E7996',
14+
base0A: '#3E4C96',
15+
base0B: '#883E96',
16+
base0C: '#963E4C',
17+
base0D: '#96883E',
18+
base0E: '#4C963E',
19+
base0F: '#3E965B',
20+
};

0 commit comments

Comments
 (0)