Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support native esm #2643

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const configs = [
{
...common,
output: {
file: `./packages/${pkg}/dist/nivo-${pkg}.es.js`,
file: `./packages/${pkg}/dist/nivo-${pkg}.mjs`,
format: 'es',
name: `@nivo/${pkg}`,
sourcemap: true,
Expand Down
9 changes: 8 additions & 1 deletion packages/annotations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"annotations"
],
"main": "./dist/nivo-annotations.cjs.js",
"module": "./dist/nivo-annotations.es.js",
"module": "./dist/nivo-annotations.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -38,5 +38,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-annotations.mjs",
"require": "./dist/nivo-annotations.cjs.js"
}
}
}
2 changes: 1 addition & 1 deletion packages/annotations/src/AnnotationNote.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createElement } from 'react'
import omit from 'lodash/omit'
import omit from 'lodash/omit.js'
import { useSpring, animated } from '@react-spring/web'
import { useTheme, useMotionConfig } from '@nivo/core'
import { NoteSvg } from './types'
Expand Down
6 changes: 3 additions & 3 deletions packages/annotations/src/compute.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import filter from 'lodash/filter'
import isNumber from 'lodash/isNumber'
import omit from 'lodash/omit'
import filter from 'lodash/filter.js'
import isNumber from 'lodash/isNumber.js'
import omit from 'lodash/omit.js'
import {
radiansToDegrees,
absoluteAngleDegrees,
Expand Down
9 changes: 8 additions & 1 deletion packages/arcs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"arcs"
],
"main": "./dist/nivo-arcs.cjs.js",
"module": "./dist/nivo-arcs.es.js",
"module": "./dist/nivo-arcs.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -39,5 +39,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-arcs.mjs",
"require": "./dist/nivo-arcs.cjs.js"
}
}
}
9 changes: 8 additions & 1 deletion packages/axes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"axes"
],
"main": "./dist/nivo-axes.cjs.js",
"module": "./dist/nivo-axes.es.js",
"module": "./dist/nivo-axes.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -40,5 +40,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-axes.mjs",
"require": "./dist/nivo-axes.cjs.js"
}
}
}
9 changes: 8 additions & 1 deletion packages/bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"bar-chart"
],
"main": "./dist/nivo-bar.cjs.js",
"module": "./dist/nivo-bar.es.js",
"module": "./dist/nivo-bar.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand Down Expand Up @@ -48,5 +48,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-bar.mjs",
"require": "./dist/nivo-bar.cjs.js"
}
}
}
2 changes: 1 addition & 1 deletion packages/bar/src/compute/legends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
LegendLabelDatum,
} from '../types'
import { getPropertyAccessor } from '@nivo/core'
import uniqBy from 'lodash/uniqBy'
import uniqBy from 'lodash/uniqBy.js'

export const getLegendDataForKeys = <RawDatum extends BarDatum>(
bars: BarsWithHidden<RawDatum>,
Expand Down
9 changes: 8 additions & 1 deletion packages/boxplot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"stats"
],
"main": "./dist/nivo-boxplot.cjs.js",
"module": "./dist/nivo-boxplot.es.js",
"module": "./dist/nivo-boxplot.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand Down Expand Up @@ -53,5 +53,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-boxplot.mjs",
"require": "./dist/nivo-boxplot.cjs.js"
}
}
}
4 changes: 2 additions & 2 deletions packages/boxplot/src/compute/legends.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BoxPlotDatum, BoxPlotCommonProps, ComputedBoxPlotSummary, LegendData } from '../types'
import { getPropertyAccessor } from '@nivo/core'
import uniqBy from 'lodash/uniqBy'
import sortBy from 'lodash/sortBy'
import uniqBy from 'lodash/uniqBy.js'
import sortBy from 'lodash/sortBy.js'

export const getLegendData = <RawDatum extends BoxPlotDatum>({
boxPlots,
Expand Down
9 changes: 8 additions & 1 deletion packages/bullet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"bullet-chart"
],
"main": "./dist/nivo-bullet.cjs.js",
"module": "./dist/nivo-bullet.es.js",
"module": "./dist/nivo-bullet.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -42,5 +42,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-bullet.mjs",
"require": "./dist/nivo-bullet.cjs.js"
}
}
}
9 changes: 8 additions & 1 deletion packages/bump/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"area-bump-chart"
],
"main": "./dist/nivo-bump.cjs.js",
"module": "./dist/nivo-bump.es.js",
"module": "./dist/nivo-bump.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -48,5 +48,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-bump.mjs",
"require": "./dist/nivo-bump.cjs.js"
}
}
}
9 changes: 8 additions & 1 deletion packages/calendar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"calendar"
],
"main": "./dist/nivo-calendar.cjs.js",
"module": "./dist/nivo-calendar.es.js",
"module": "./dist/nivo-calendar.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -45,5 +45,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-calendar.mjs",
"require": "./dist/nivo-calendar.cjs.js"
}
}
}
6 changes: 3 additions & 3 deletions packages/calendar/src/compute/calendar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import isDate from 'lodash/isDate'
import memoize from 'lodash/memoize'
import range from 'lodash/range'
import isDate from 'lodash/isDate.js'
import memoize from 'lodash/memoize.js'
import range from 'lodash/range.js'
import { alignBox } from '@nivo/core'
import { timeFormat } from 'd3-time-format'
import { timeDays, timeWeek, timeWeeks, timeMonths, timeYear } from 'd3-time'
Expand Down
2 changes: 1 addition & 1 deletion packages/calendar/src/compute/timeRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from 'd3-time'
import { timeFormat } from 'd3-time-format'
import { DateOrString, Weekday } from '../types'
import isDate from 'lodash/isDate'
import isDate from 'lodash/isDate.js'

// Interfaces
interface ComputeBaseProps {
Expand Down
9 changes: 8 additions & 1 deletion packages/canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"canvas"
],
"main": "./dist/nivo-canvas.cjs.js",
"module": "./dist/nivo-canvas.es.js",
"module": "./dist/nivo-canvas.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -29,5 +29,12 @@
],
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-canvas.mjs",
"require": "./dist/nivo-canvas.cjs.js"
}
}
}
9 changes: 8 additions & 1 deletion packages/chord/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"chord-diagram"
],
"main": "./dist/nivo-chord.cjs.js",
"module": "./dist/nivo-chord.es.js",
"module": "./dist/nivo-chord.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -45,5 +45,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-chord.mjs",
"require": "./dist/nivo-chord.cjs.js"
}
}
}
9 changes: 8 additions & 1 deletion packages/circle-packing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"circle-packing"
],
"main": "./dist/nivo-circle-packing.cjs.js",
"module": "./dist/nivo-circle-packing.es.js",
"module": "./dist/nivo-circle-packing.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -42,5 +42,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-circle-packing.mjs",
"require": "./dist/nivo-circle-packing.cjs.js"
}
}
}
4 changes: 2 additions & 2 deletions packages/circle-packing/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo, MouseEvent, MutableRefObject, useCallback } from 'react'
import { pack as d3Pack, hierarchy as d3Hierarchy } from 'd3-hierarchy'
import cloneDeep from 'lodash/cloneDeep'
import sortBy from 'lodash/sortBy'
import cloneDeep from 'lodash/cloneDeep.js'
import sortBy from 'lodash/sortBy.js'
import {
usePropertyAccessor,
useValueFormatter,
Expand Down
9 changes: 8 additions & 1 deletion packages/colors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"directory": "packages/colors"
},
"main": "./dist/nivo-colors.cjs.js",
"module": "./dist/nivo-colors.es.js",
"module": "./dist/nivo-colors.mjs",
"types": "./dist/types/index.d.ts",
"files": [
"README.md",
Expand All @@ -37,5 +37,12 @@
},
"publishConfig": {
"access": "public"
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/nivo-colors.mjs",
"require": "./dist/nivo-colors.cjs.js"
}
}
}
4 changes: 2 additions & 2 deletions packages/colors/src/inheritedColor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react'
import get from 'lodash/get'
import isPlainObject from 'lodash/isPlainObject'
import get from 'lodash/get.js'
import isPlainObject from 'lodash/isPlainObject.js'
import { rgb, RGBColor } from 'd3-color'
import { Theme } from '@nivo/core'

Expand Down
4 changes: 2 additions & 2 deletions packages/colors/src/scales/ordinalColorScale.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react'
import get from 'lodash/get'
import isPlainObject from 'lodash/isPlainObject'
import get from 'lodash/get.js'
import isPlainObject from 'lodash/isPlainObject.js'
import { scaleOrdinal } from 'd3-scale'
import {
ColorSchemeId,
Expand Down
9 changes: 8 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"directory": "packages/core"
},
"main": "./dist/nivo-core.cjs.js",
"module": "./dist/nivo-core.es.js",
"module": "./dist/nivo-core.mjs",
"types": "./index.d.ts",
"files": [
"README.md",
Expand Down Expand Up @@ -43,5 +43,12 @@
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/nivo/donate"
},
"exports": {
".": {
"types": "./index.d.ts",
"import": "./dist/nivo-core.mjs",
"require": "./dist/nivo-core.cjs.js"
}
}
}
6 changes: 3 additions & 3 deletions packages/core/src/lib/colors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import last from 'lodash/last'
import isArray from 'lodash/isArray'
import isString from 'lodash/isString'
import last from 'lodash/last.js'
import isArray from 'lodash/isArray.js'
import isString from 'lodash/isString.js'
import { scaleOrdinal, scaleSequential } from 'd3-scale'
import {
// categorical
Expand Down
Loading
Loading