@@ -11,55 +11,6 @@ const allNodeEnvs = ['development', 'production'] as const
1111 */
1212type NodeEnv = (typeof allNodeEnvs)[number]
1313
14- /**
15- * Set of entry points from the `package.json` file.
16- */
17- const packageJsonEntryPoints = new Set<string>()
18-
19- /**
20- * Recursively collects entry points from the `package.json` exports field.
21- *
22- * @param packageJsonExports - The exports field from `package.json`.
23- * @returns A set of package entry points.
24- */
25- const collectPackageJsonExports = (
26- packageJsonExports:
27- | string
28- | Record<string, any>
29- | null
30- | typeof import('./package.json').exports,
31- ) => {
32- if (
33- typeof packageJsonExports === 'string' &&
34- packageJsonExports.endsWith('js')
35- ) {
36- packageJsonEntryPoints.add(
37- packageJsonExports.startsWith('./')
38- ? packageJsonExports
39- : `./${packageJsonExports}`,
40- )
41- } else if (packageJsonExports && typeof packageJsonExports === 'object') {
42- Object.values(packageJsonExports).forEach(collectPackageJsonExports)
43- }
44-
45- return packageJsonEntryPoints
46- }
47-
48- /**
49- * Gets all package entry points from the `package.json` file.
50- *
51- * @returns A promise that resolves to an array of unique package entry points.
52- */
53- const getAllPackageEntryPoints = async () => {
54- const packageJson = (
55- await import('./package.json', { with: { type: 'json' } })
56- ).default
57-
58- const packageExports = collectPackageJsonExports(packageJson.exports)
59-
60- return [...packageExports]
61- }
62-
6314/**
6415 * Gets all import configurations for a given entry point.
6516 * This function dynamically imports the specified entry point and
@@ -121,7 +72,7 @@ const setNodeEnv = (nodeEnv: NodeEnv) => {
12172 * @returns A promise that resolves to a size limit configuration object.
12273 */
12374const getAllImportsWithNodeEnv = async (nodeEnv: NodeEnv) => {
124- const allPackageEntryPoints = await getAllPackageEntryPoints()
75+ const allPackageEntryPoints = ['./dist/react-redux.mjs']
12576
12677 const allImportsFromAllEntryPoints = (
12778 await Promise.all(allPackageEntryPoints.map(getAllImportsForEntryPoint))
0 commit comments