Skip to content

Commit f2bbcd8

Browse files
committed
Support Node.js v20 with @gitbook/icons
1 parent 8d5de97 commit f2bbcd8

File tree

9 files changed

+28
-20
lines changed

9 files changed

+28
-20
lines changed

.changeset/thin-beds-battle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/icons': minor
3+
---
4+
5+
Fix the build to support Node.js v20

packages/icons/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@
4141
"bin": {
4242
"gitbook-icons": "./bin/gitbook-icons.js"
4343
},
44-
"files": ["dist", "src", "bin", "data", "README.md", "CHANGELOG.md"]
44+
"files": ["dist", "src", "bin", "data", "README.md", "CHANGELOG.md"],
45+
"engines": {
46+
"node": ">=20.0.0"
47+
}
4548
}

packages/icons/src/Icon.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import * as React from 'react';
44

5-
import { getIconAssetURL, useIcons } from './IconsProvider';
6-
import { getIconStyle } from './getIconStyle';
7-
import type { IconName, IconStyle } from './types';
5+
import { getIconAssetURL, useIcons } from './IconsProvider.js';
6+
import { getIconStyle } from './getIconStyle.js';
7+
import type { IconName, IconStyle } from './types.js';
88

99
/**
1010
* Props for the icon component.

packages/icons/src/IconsProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22

33
import * as React from 'react';
4-
import { IconStyle } from './types';
4+
import { IconStyle } from './types.js';
55

66
const version = 2;
77

packages/icons/src/getIconStyle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import stylesMap from './data/styles-map.json';
2-
import type { IconName, IconStyle } from './types';
1+
import stylesMap from './data/styles-map.json' with { type: 'json' };
2+
import type { IconName, IconStyle } from './types.js';
33

44
const cache = new Map<IconName, Map<IconStyle, [string, IconName]>>();
55

packages/icons/src/icons.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import rawIcons from './data/icons.json';
2-
import type { IconName, IconStyle } from './types';
1+
import rawIcons from './data/icons.json' with { type: 'json' };
2+
import type { IconName, IconStyle } from './types.js';
33

44
export interface IconStyleDefinition {
55
title: string;

packages/icons/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from './Icon';
2-
export * from './types';
3-
export * from './IconsProvider';
1+
export * from './Icon.js';
2+
export * from './types.js';
3+
export * from './IconsProvider.js';

packages/icons/src/pro.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { it } from 'bun:test';
2-
import { validateIconName } from './icons';
2+
import { validateIconName } from './icons.js';
33

44
it('should have the GitBook custom icon', () => {
55
if (!validateIconName('gitbook')) {

packages/icons/tsconfig.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"compilerOptions": {
3-
"target": "esnext",
4-
"lib": ["dom", "dom.iterable", "esnext"],
5-
"allowJs": true,
6-
"skipLibCheck": true,
3+
"lib": ["es2023"],
4+
"module": "Node16",
5+
"target": "es2022",
76
"strict": true,
7+
"esModuleInterop": true,
8+
"skipLibCheck": true,
9+
"moduleResolution": "node16",
10+
"allowJs": true,
811
"noEmit": false,
912
"declaration": true,
1013
"outDir": "dist",
11-
"esModuleInterop": true,
12-
"module": "esnext",
13-
"moduleResolution": "bundler",
1414
"resolveJsonModule": true,
1515
"isolatedModules": true,
1616
"jsx": "react-jsx",

0 commit comments

Comments
 (0)