Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .scripts/postbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ create_compat_export() {
local category=$1
local name=$2
echo "module.exports = require('../dist/compat/$category/$name.js').$name;" > compat/$name.js
echo "export { $name as default } from '../dist/compat/$category/$name.mjs';" > compat/$name.mjs
echo "export { $name as default } from '../dist/compat/$category/$name.js';" > compat/$name.d.ts
echo "export { $name as default } from '../dist/compat/$category/$name.mjs';" > compat/$name.d.mts
Comment thread
Amund211 marked this conversation as resolved.
Resolved
}

# Function to create compat reexports (for functions from main src)
create_compat_reexport() {
local category=$1
local name=$2
echo "module.exports = require('../dist/$category/$name.js').$name;" > compat/$name.js
echo "export { $name as default } from '../dist/$category/$name.mjs';" > compat/$name.mjs
echo "export { $name as default } from '../dist/$category/$name.js';" > compat/$name.d.ts
echo "export { $name as default } from '../dist/$category/$name.mjs';" > compat/$name.d.mts
Comment thread
Amund211 marked this conversation as resolved.
Resolved
}

# Function to create compat alias
Expand All @@ -29,7 +33,9 @@ create_compat_alias() {
local original=$2
local alias=$3
echo "module.exports = require('../dist/compat/$category/$original.js').$original;" > compat/$alias.js
echo "export { $original as default } from '../dist/compat/$category/$original.mjs';" > compat/$alias.mjs
echo "export { $original as default } from '../dist/compat/$category/$original.js';" > compat/$alias.d.ts
echo "export { $original as default } from '../dist/compat/$category/$original.mjs';" > compat/$alias.d.mts
Comment thread
Amund211 marked this conversation as resolved.
Resolved
}

# Create root exports
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@
}
},
"./compat/*": {
"default": {
"import": {
"types": "./compat/*.d.mts",
"default": "./compat/*.mjs"
},
"require": {
"types": "./compat/*.d.ts",
"default": "./compat/*.js"
}
Comment thread
Amund211 marked this conversation as resolved.
Resolved
Expand Down