diff --git a/package-lock.json b/package-lock.json index ac907153..648bdb93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,7 @@ "yargs": "^17.7.2" }, "engines": { - "node": ">=18.0.0" + "node": "^18.0.0" } }, "node_modules/@4tw/cypress-drag-drop": { diff --git a/package.json b/package.json index 5475bc50..d8bf4658 100644 --- a/package.json +++ b/package.json @@ -6,27 +6,27 @@ "types": "./dist/types/index.d.ts", "exports": { ".": { - "types": "./dist/types/index.d.ts", - "node": "./dist/cjs/index.js", - "import": "./dist/esm/index.js", - "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js" + "import": { + "types": "./dist/types/index.d.ts", + "default": "./dist/esm/index.mjs" + }, + "require": { + "types": "./dist/types/index.d.ts", + "default": "./dist/cjs/index.js" + } }, "./dist/styles/*": "./dist/styles/*", "./package.json": "./package.json" }, "module": "./dist/esm/index.js", - "directories": { - "example": "examples", - "test": "tests" - }, "repository": { "type": "git", "url": "git+https://github.com/6pac/SlickGrid.git" }, "keywords": [ "slickgrid", - "grid" + "grid", + "datagrid" ], "author": "Michael Leibman ", "contributors": [ @@ -106,6 +106,6 @@ "not dead" ], "engines": { - "node": ">=18.0.0" + "node": "^18.0.0" } } \ No newline at end of file diff --git a/scripts/builds.mjs b/scripts/builds.mjs index f4d6d3d2..4615a4df 100644 --- a/scripts/builds.mjs +++ b/scripts/builds.mjs @@ -13,7 +13,7 @@ import { removeImportsPlugin } from './esbuild-plugins.mjs'; import { outputFileSync } from './fs-utils.mjs'; const argv = yargs(hideBin(process.argv)).argv; -export const BUILD_FORMATS = ['cjs', 'esm']; +export const BUILD_FORMATS = ['cjs', 'esm', 'mjs']; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const projectRootPath = path.join(__dirname, '../'); @@ -71,7 +71,7 @@ export async function executeCjsEsmBuilds() { const startTime = new Date().getTime(); await bundleByFormat(format); const endTime = new Date().getTime(); - console.log(`[${c.yellow('esbuild ⚡')}] Bundled to "${format}" format in ${endTime - startTime}ms`); + console.log(`[${c.yellow('esbuild ⚡')}] Bundled to "${format === 'mjs' ? 'esm (mjs)' : format}" format in ${endTime - startTime}ms`); } } @@ -80,13 +80,16 @@ export async function executeCjsEsmBuilds() { * @param {"cjs" | "esm"} format - build format type */ export async function bundleByFormat(format) { + const esbuildFormat = format === 'mjs' ? 'esm' : format; + const esbuildExt = format === 'mjs' ? 'mjs' : 'js'; + return runBuild({ entryPoints: ['src/index.js'], - format, + format: esbuildFormat, target: 'es2020', treeShaking: true, define: { IIFE_ONLY: 'false' }, - outdir: `dist/${format}`, + outfile: `dist/${esbuildFormat}/index.${esbuildExt}`, }); }