Files
self/common/scripts/shimConfigs.js
Justin Hernandez 82d26669bc Enable tree-shakeable exports (#823)
* Add tree-shakeable exports

* Migrate imports for tree-shakeable paths

* Document ESM extension requirement

* udpates

* install new lock

* yarn nice

* build deps

* save working index export no wildcard approach

* save wip

* fix building

* add tree shaking doc and examples

* sort package json files

* update package.json

* fix analyzing web

* make sure that web is built

* wip tree shaking

* building works again. save wip logic

* use granular imports

* wip test

* save wip

* Remove hardcoded .d.ts files and setup automatic TypeScript declaration generation

- Remove redundant constants.d.ts, types.d.ts, utils.d.ts files
- Add build:types script to automatically generate TypeScript declarations
- Update tsup config to disable DTS generation (handled separately)
- Update .gitignore to prevent future commits of generated .d.ts files
- Fixes import resolution errors in app by ensuring declarations are always generated

* Add .gitignore rules for generated TypeScript declarations

* ignore dts files

* Remove redundant index.js re-export files

- Remove constants.js, types.js, utils.js as they're redundant with tsup build
- These were just re-exports pointing to dist files that tsup generates
- package.json exports already point directly to built files
- Update .gitignore to prevent future commits of these generated files
- tsup handles all the building, no manual re-export files needed

* save current wip fixes

* add tsup config for web building

* common prettier and fix imports

* prettier

* fix tests

* implement level 3 tree shaking

* improve splitting

* optimize vite web building and prettier

* remove comments

* sort export params

* feedback and fix pipelines

* fix circuit-names path

* fix test

* fix building

* sort

* fix building

* allow cursor to edit scripts

* fix loadDocumentCatalog undefined

* fix build settings

* fix build settings

* additional metro tree shaking

* improved discovery script for xcode building

* pr feedback and fix camelCasing

* simplify shim setup

* fix xcode building and add command to test building

* remove comment

* simplify
2025-08-02 16:55:05 -07:00

230 lines
7.1 KiB
JavaScript

// Shim configurations organized by group and alphabetically by shimPath
export const shimConfigs = [
// ===== CONSTANTS =====
{ shimPath: 'constants', targetPath: '../esm/src/constants/index.js', name: 'constants' },
{
shimPath: 'constants/core',
targetPath: '../../esm/src/constants/constants.js',
name: 'constants/core',
},
{
shimPath: 'constants/countries',
targetPath: '../../esm/src/constants/countries.js',
name: 'constants/countries',
},
{
shimPath: 'constants/hashes',
targetPath: '../../esm/src/constants/sampleDataHashes.js',
name: 'constants/hashes',
},
{
shimPath: 'constants/mockCerts',
targetPath: '../../esm/src/constants/mockCertificates.js',
name: 'constants/mockCerts',
},
{
shimPath: 'constants/skiPem',
targetPath: '../../esm/src/constants/skiPem.js',
name: 'constants/skiPem',
},
{
shimPath: 'constants/vkey',
targetPath: '../../esm/src/constants/vkey.js',
name: 'constants/vkey',
},
// ===== TYPES =====
{ shimPath: 'types', targetPath: '../esm/src/types/index.js', name: 'types' },
{ shimPath: 'types/app', targetPath: '../../esm/src/types/app.js', name: 'types/app' },
{
shimPath: 'types/certificates',
targetPath: '../../esm/src/types/certificates.js',
name: 'types/certificates',
},
{
shimPath: 'types/circuits',
targetPath: '../../esm/src/types/circuits.js',
name: 'types/circuits',
},
{
shimPath: 'types/passport',
targetPath: '../../esm/src/types/passport.js',
name: 'types/passport',
},
// ===== UTILS =====
{ shimPath: 'utils', targetPath: '../esm/src/utils/index.js', name: 'utils' },
{
shimPath: 'utils/appType',
targetPath: '../../esm/src/utils/appType.js',
name: 'utils/appType',
},
{ shimPath: 'utils/arrays', targetPath: '../../esm/src/utils/arrays.js', name: 'utils/arrays' },
{ shimPath: 'utils/bytes', targetPath: '../../esm/src/utils/bytes.js', name: 'utils/bytes' },
{
shimPath: 'utils/certificate_parsing/elliptic',
targetPath: '../../../esm/src/utils/certificate_parsing/elliptic.js',
name: 'utils/certificate_parsing/elliptic',
},
{
shimPath: 'utils/certificates',
targetPath: '../../esm/src/utils/certificate_parsing/index.js',
name: 'utils/certificates',
},
{
shimPath: 'utils/certificates/certUtils',
targetPath: '../../../esm/src/utils/certificate_parsing/certUtils.js',
name: 'utils/certificates/certUtils',
},
{
shimPath: 'utils/certificates/curveUtils',
targetPath: '../../../esm/src/utils/certificate_parsing/curveUtils.js',
name: 'utils/certificates/curveUtils',
},
{
shimPath: 'utils/certificates/ellipticInit',
targetPath: '../../../esm/src/utils/certificate_parsing/ellipticInit.js',
name: 'utils/certificates/ellipticInit',
},
{
shimPath: 'utils/certificates/oidUtils',
targetPath: '../../../esm/src/utils/certificate_parsing/oidUtils.js',
name: 'utils/certificates/oidUtils',
},
{
shimPath: 'utils/certificates/parseNode',
targetPath: '../../../esm/src/utils/certificate_parsing/parseNode.js',
name: 'utils/certificates/parseNode',
},
{
shimPath: 'utils/certificates/parseSimple',
targetPath: '../../../esm/src/utils/certificate_parsing/parseSimple.js',
name: 'utils/certificates/parseSimple',
},
{
shimPath: 'utils/circuitFormat',
targetPath: '../../esm/src/utils/circuits/formatOutputs.js',
name: 'utils/circuitFormat',
},
{
shimPath: 'utils/circuitNames',
targetPath: '../../esm/src/utils/circuits/circuitsName.js',
name: 'utils/circuitNames',
},
{
shimPath: 'utils/circuits',
targetPath: '../../esm/src/utils/circuits/index.js',
name: 'utils/circuits',
},
{
shimPath: 'utils/circuits/circuitsName',
targetPath: '../../esm/src/utils/circuits/circuitsName.js',
name: 'utils/circuits/circuitsName',
},
{
shimPath: 'utils/circuits/discloseInputs',
targetPath: '../../../esm/src/utils/circuits/discloseInputs.js',
name: 'utils/circuits/discloseInputs',
},
{
shimPath: 'utils/circuits/dscInputs',
targetPath: '../../../esm/src/utils/circuits/dscInputs.js',
name: 'utils/circuits/dscInputs',
},
{
shimPath: 'utils/circuits/ofacInputs',
targetPath: '../../../esm/src/utils/circuits/ofacInputs.js',
name: 'utils/circuits/ofacInputs',
},
{
shimPath: 'utils/circuits/registerInputs',
targetPath: '../../../esm/src/utils/circuits/registerInputs.js',
name: 'utils/circuits/registerInputs',
},
{
shimPath: 'utils/contracts',
targetPath: '../../esm/src/utils/contracts/index.js',
name: 'utils/contracts',
},
{ shimPath: 'utils/csca', targetPath: '../../esm/src/utils/csca.js', name: 'utils/csca' },
{
shimPath: 'utils/curves',
targetPath: '../../esm/src/utils/certificate_parsing/curves.js',
name: 'utils/curves',
},
{ shimPath: 'utils/date', targetPath: '../../esm/src/utils/date.js', name: 'utils/date' },
{
shimPath: 'utils/elliptic',
targetPath: '../../esm/src/utils/certificate_parsing/elliptic.js',
name: 'utils/elliptic',
},
{ shimPath: 'utils/hash', targetPath: '../../esm/src/utils/hash.js', name: 'utils/hash' },
{
shimPath: 'utils/hash/custom',
targetPath: '../../../esm/src/utils/hash/custom.js',
name: 'utils/hash/custom',
},
{
shimPath: 'utils/hash/poseidon',
targetPath: '../../../esm/src/utils/hash/poseidon.js',
name: 'utils/hash/poseidon',
},
{
shimPath: 'utils/hash/sha',
targetPath: '../../../esm/src/utils/hash/sha.js',
name: 'utils/hash/sha',
},
{
shimPath: 'utils/oids',
targetPath: '../../esm/src/utils/certificate_parsing/oids.js',
name: 'utils/oids',
},
{
shimPath: 'utils/passportDg1',
targetPath: '../../esm/src/utils/passports/dg1.js',
name: 'utils/passportDg1',
},
{
shimPath: 'utils/passportFormat',
targetPath: '../../esm/src/utils/passports/format.js',
name: 'utils/passportFormat',
},
{
shimPath: 'utils/passportMock',
targetPath: '../../esm/src/utils/passports/mock.js',
name: 'utils/passportMock',
},
{
shimPath: 'utils/passports',
targetPath: '../../esm/src/utils/passports/index.js',
name: 'utils/passports',
},
{
shimPath: 'utils/passports/format',
targetPath: '../../../esm/src/utils/passports/format.js',
name: 'utils/passports/format',
},
{
shimPath: 'utils/passports/mockDsc',
targetPath: '../../../esm/src/utils/passports/mockDsc.js',
name: 'utils/passports/mockDsc',
},
{
shimPath: 'utils/passports/mockGeneration',
targetPath: '../../../esm/src/utils/passports/mockGeneration.js',
name: 'utils/passports/mockGeneration',
},
{
shimPath: 'utils/sanctions',
targetPath: '../../esm/src/utils/contracts/forbiddenCountries.js',
name: 'utils/sanctions',
},
{ shimPath: 'utils/scope', targetPath: '../../esm/src/utils/scope.js', name: 'utils/scope' },
{ shimPath: 'utils/trees', targetPath: '../../esm/src/utils/trees.js', name: 'utils/trees' },
{
shimPath: 'utils/uuid',
targetPath: '../../esm/src/utils/circuits/uuid.js',
name: 'utils/uuid',
},
];