MCPcopy
hub / github.com/tailwindlabs/heroicons / buildExports

Function buildExports

scripts/build.js:149–200  ·  view source on GitHub ↗

* @param {string[]} styles

(styles)

Source from the content-addressed store, hash-verified

147 * @param {string[]} styles
148 */
149async function buildExports(styles) {
150 let pkg = {}
151
152 // To appease Vite's optimizeDeps feature which requires a root-level import
153 pkg[`.`] = {
154 import: `./index.esm.js`,
155 require: `./index.js`,
156 }
157
158 // For those that want to read the version from package.json
159 pkg[`./package.json`] = { default: './package.json' }
160
161 // Backwards compatibility with v1 imports (points to proxy that prints an error message):
162 pkg['./outline'] = { default: './outline/index.js' }
163 pkg['./outline/index'] = { default: './outline/index.js' }
164 pkg['./outline/index.js'] = { default: './outline/index.js' }
165 pkg['./solid'] = { default: './solid/index.js' }
166 pkg['./solid/index'] = { default: './solid/index.js' }
167 pkg['./solid/index.js'] = { default: './solid/index.js' }
168
169 // Explicit exports for each style:
170 for (let style of styles) {
171 pkg[`./${style}`] = {
172 types: `./${style}/index.d.ts`,
173 import: `./${style}/esm/index.js`,
174 require: `./${style}/index.js`,
175 }
176 pkg[`./${style}/*`] = {
177 types: `./${style}/*.d.ts`,
178 import: `./${style}/esm/*.js`,
179 require: `./${style}/*.js`,
180 }
181 pkg[`./${style}/*.js`] = {
182 types: `./${style}/*.d.ts`,
183 import: `./${style}/esm/*.js`,
184 require: `./${style}/*.js`,
185 }
186
187 // This dir is basically an implementation detail, but it's needed for
188 // backwards compatibility in case people were importing from it directly.
189 pkg[`./${style}/esm/*`] = {
190 types: `./${style}/*.d.ts`,
191 import: `./${style}/esm/*.js`,
192 }
193 pkg[`./${style}/esm/*.js`] = {
194 types: `./${style}/*.d.ts`,
195 import: `./${style}/esm/*.js`,
196 }
197 }
198
199 return pkg
200}
201
202async function main(package) {
203 const cjsPackageJson = { module: './esm/index.js', sideEffects: false }

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…