Skip to content

Commit

Permalink
refactor(react): remove wildcard imports (#5075)
Browse files Browse the repository at this point in the history
* refactor(react): remove wildcard imports

* chore: add changeset

---------

Co-authored-by: Josh Black <joshblack@users.noreply.github.com>
  • Loading branch information
joshblack and joshblack authored Oct 18, 2024
1 parent 4680ce6 commit de7dbde
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-maps-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': major
---

Remove wildcard exports from `@primer/react`
13 changes: 1 addition & 12 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@
"./test-helpers": {
"import": "./lib-esm/test-helpers.js",
"require": "./lib/test-helpers.js"
},
"./lib-esm/*": {
"import": [
"./lib-esm/*.js",
"./lib-esm/*/index.js"
],
"require": [
"./lib/*.js",
"./lib/*/index.js"
]
},
"./lib-esm/internal/*": null
}
},
"typings": "lib/index.d.ts",
"sideEffects": [
Expand Down
37 changes: 0 additions & 37 deletions packages/react/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import path from 'node:path'
import {fileURLToPath} from 'node:url'
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import babel from '@rollup/plugin-babel'
import replace from '@rollup/plugin-replace'
import terser from '@rollup/plugin-terser'
import glob from 'fast-glob'
import {visualizer} from 'rollup-plugin-visualizer'
import {importCSS} from 'rollup-plugin-import-css'
import postcss from 'rollup-plugin-postcss'
import postcssPresetPrimer from 'postcss-preset-primer'
import MagicString from 'magic-string'
import packageJson from './package.json' with {type: 'json'}

const __dirname = path.dirname(fileURLToPath(import.meta.url))

const input = new Set([
// "exports"
// "."
Expand All @@ -28,39 +24,6 @@ const input = new Set([

// "./next"
'src/next/index.ts',

// Make sure all members are exported
'src/constants.ts',

...glob.sync(
[
// "./lib-esm/hooks/*"
'src/hooks/*',

// "./lib-esm/polyfills/*"
'src/polyfills/*',

// "./lib-esm/utils/*"
'src/utils/*',

// for backward compatbility, see https://github.com/primer/react/pull/3740
'src/ActionMenu/index.ts',
],
{
cwd: __dirname,
ignore: [
'**/__tests__/**',
'*.stories.tsx',

// File currently imports from package.json
'src/utils/test-deprecations.tsx',

// Files use dependencies which are not listed by package
'src/utils/testing.tsx',
'src/utils/test-matchers.tsx',
],
},
),
])

function getEntrypointsFromInput(input) {
Expand Down

0 comments on commit de7dbde

Please sign in to comment.