Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Fix entrypoints for CJS and ESM modules #4792

Merged
merged 1 commit into from
Sep 24, 2023
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
2 changes: 2 additions & 0 deletions configuration/rollup/create-package-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export default async function createPackageConfig(config: PkgConfigInput): Promi
if (config.format === 'es') {
output.dir = path.resolve(config.basePath, 'esm');
output.preserveModules = true;
// Output ESM as .mjs files
output.entryFileNames = '[name].mjs';
}

if (config.format === 'cjs') {
Expand Down
6 changes: 6 additions & 0 deletions scripts/utils/generate-dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ export default async function generateDts(packagePath: string) {

const files = await fg(['lib/**/*.js'], { cwd: packagePath });

// Duplicate the type definitions for ESM
await fs.copy(
path.join(packagePath, 'lib/index.d.ts'),
path.join(packagePath, 'lib/index.d.mts')
);

return Promise.all(files.map((file) => fs.remove(path.join(packagePath, file))));
}
14 changes: 10 additions & 4 deletions src/mantine-carousel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/carousel",
"description": "Embla based carousel",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css",
"./styles/*": "./esm/styles/*"
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-code-highlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/code-highlight",
"description": "Code highlight with Mantine theme",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-colors-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"name": "@mantine/colors-generator",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
}
},
"license": "MIT",
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/core",
"description": "React components library focused on usability, accessibility and developer experience",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css",
"./styles/*": "./esm/styles/*"
Expand Down
13 changes: 10 additions & 3 deletions src/mantine-dates-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
"name": "@mantine/dates-tests",
"private": true,
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
}
},
"license": "MIT",
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-dates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/dates",
"description": "Calendars, date and time pickers based on Mantine components",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-demos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
"description": "Demos used in documentation",
"private": true,
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-dropzone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/dropzone",
"description": "Dropzone component built with Mantine theme and components",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-ds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/ds",
"description": "Internal Mantine components used on *.mantine.dev websites",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/form",
"description": "Mantine form management library",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
}
},
"license": "MIT",
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"name": "@mantine/hooks",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
}
},
"license": "MIT",
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-modals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/modals",
"description": "Modals manager based on Mantine components",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-notifications/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"name": "@mantine/notifications",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-nprogress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "@mantine/nprogress",
"description": "Navigation progress bar",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
14 changes: 10 additions & 4 deletions src/mantine-spotlight/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"name": "@mantine/spotlight",
"version": "7.0.0",
"main": "./cjs/index.js",
"types": "./lib/index.d.ts",
"module": "./esm/index.js",
"module": "./esm/index.mjs",
"exports": {
".": {
"import": "./esm/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
"import": {
"types": "./lib/index.d.mts",
"default": "./esm/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./cjs/index.js"
}
},
"./styles.css": "./esm/index.css"
},
Expand Down
Loading