-
Notifications
You must be signed in to change notification settings - Fork 86
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
Switch from rollup to vite, from commonjs to ecmascript modules #1740
Draft
flevi29
wants to merge
19
commits into
meilisearch:main
Choose a base branch
from
flevi29:rollup-to-esm-vite
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
88759aa
Separate token.ts into its own export
flevi29 c8fc601
Merge branch 'main' into crypto-export
flevi29 438c6de
Fix lint issues
flevi29 f0345fc
Fix env esm test
flevi29 f95ff03
Merge branch 'main' into crypto-export
flevi29 460e23c
Fix env node test
flevi29 da25764
Fix rest of tests, adjust code sample
flevi29 b4747ef
Try fix env tests
flevi29 3035b87
Switch from rollup to vite, from cjs to esm
flevi29 3683291
Fix env test
flevi29 b6d26f6
Fix format issues
flevi29 2836d06
Fix 'types' script
flevi29 6756330
Fix token test
flevi29 890906d
Fix env esm test
flevi29 943539b
Fix env nodejs test
flevi29 da6bca2
Fix env browser test
flevi29 b45b789
Remove unnecessary index file, misc
flevi29 e77f29e
Remove outdated entries from package.json, misc
flevi29 e8911e7
Fix env test
flevi29 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,19 +16,23 @@ | |
"qdequele <[email protected]>" | ||
], | ||
"license": "MIT", | ||
"main": "./dist/bundles/meilisearch.cjs", | ||
"module": "./dist/bundles/meilisearch.mjs", | ||
"typings": "./dist/types/index.d.ts", | ||
"types": "./dist/types/index.d.ts", | ||
"jsdelivr": "./dist/bundles/meilisearch.umd.js", | ||
"unpkg": "./dist/bundles/meilisearch.umd.js", | ||
"type": "module", | ||
"main": "./dist/bundles/index.cjs", | ||
"module": "./dist/esm/index.js", | ||
"jsdelivr": "./dist/bundles/index.umd.min.js", | ||
"unpkg": "./dist/bundles/index.umd.min.js", | ||
"exports": { | ||
".": { | ||
"types": "./dist/types/index.d.ts", | ||
"browser": "./dist/bundles/meilisearch.umd.js", | ||
"import": "./dist/bundles/meilisearch.mjs", | ||
"require": "./dist/bundles/meilisearch.cjs", | ||
"default": "./dist/bundles/meilisearch.umd.js" | ||
"import": "./dist/esm/index.js", | ||
"require": "./dist/bundles/index.cjs", | ||
"default": "./dist/bundles/index.umd.min.js" | ||
}, | ||
"./token": { | ||
"types": "./dist/types/token.d.ts", | ||
"import": "./dist/esm/token.js", | ||
"require": "./dist/bundles/token.cjs", | ||
"default": "./dist/bundles/token.cjs" | ||
} | ||
}, | ||
"sideEffects": false, | ||
|
@@ -38,31 +42,28 @@ | |
}, | ||
"scripts": { | ||
"playground:javascript": "yarn --cwd ./playgrounds/javascript && yarn --cwd ./playgrounds/javascript start", | ||
"cleanup": "shx rm -rf dist/", | ||
"build": "yarn cleanup && rollup -c && rollup -c --environment NODE_ENV:production", | ||
"build": "vite build && tsc -p tsconfig.build.json && vite --mode production-cjs build", | ||
"postbuild": "node scripts/build.js", | ||
"build:docs": "typedoc", | ||
"watch": "yarn cleanup && rollup -c --watch", | ||
"postbuild": "yarn size && yarn typingsheader", | ||
"test": "vitest run --coverage", | ||
"types:watch": "nodemon --config nodemon.json", | ||
"types": "yarn tsc", | ||
"test:env:browser": "yarn build && yarn --cwd tests/env/express && yarn --cwd tests/env/express test", | ||
"types": "tsc -p tsconfig.build.json --noEmit", | ||
"test:env:browser": "node scripts/copy-umd-file.js --to ./tests/env/express/public && yarn build && yarn --cwd tests/env/express && yarn --cwd tests/env/express test", | ||
"test:watch": "vitest watch", | ||
"test:coverage": "yarn test", | ||
"test:ci": "yarn test", | ||
"test:env": "yarn build && yarn test:env:nodejs && yarn test:env:esm && yarn test:env:node-ts", | ||
"test:env:node-ts": "yarn --cwd tests/env/typescript-node start", | ||
"test:env:nodejs": "yarn build && node tests/env/node/index.js && node tests/env/node/getting_started.js", | ||
"test:env:nodejs": "yarn build && node tests/env/node/index.cjs && node tests/env/node/getting_started.cjs", | ||
"test:env:esm": "yarn --cwd tests/env/esm && yarn --cwd tests/env/esm start", | ||
"test:env:nitro-app": "yarn build && yarn --cwd tests/env/nitro-app test", | ||
"size": "node scripts/file-size ./dist/bundles/meilisearch.mjs ./dist/bundles/meilisearch.umd.min.js", | ||
"style": "yarn fmt && yarn lint", | ||
"style:fix": "yarn fmt:fix && yarn lint:fix", | ||
"fmt": "prettier -c ./**/*.{js,ts}", | ||
"fmt:fix": "prettier -w ./**/*.{js,ts}", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"typingsheader": "node scripts/build.js" | ||
"lint:fix": "eslint --fix ." | ||
}, | ||
"files": [ | ||
"src", | ||
|
@@ -80,37 +81,25 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@babel/core": "^7.25.2", | ||
"@babel/preset-env": "^7.25.4", | ||
"@eslint/js": "^9.11.1", | ||
"@rollup/plugin-babel": "^6.0.4", | ||
"@rollup/plugin-commonjs": "28.0.0", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-node-resolve": "15.3.0", | ||
"@types/eslint__js": "^8.42.3", | ||
"@vitest/coverage-v8": "2.0.5", | ||
"@vitest/eslint-plugin": "^1.1.4", | ||
"@types/node": "^20.16.10", | ||
"brotli-size": "^4.0.0", | ||
"eslint": "^9.11.1", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-tsdoc": "^0.3.0", | ||
"globals": "^15.9.0", | ||
"gzip-size": "^6.0.0", | ||
"kleur": "^4.1.5", | ||
"lint-staged": "15.2.10", | ||
"nodemon": "^3.1.7", | ||
"prettier": "^3.3.3", | ||
"prettier-plugin-jsdoc": "^1.3.0", | ||
"pretty-bytes": "^5.6.0", | ||
"rollup": "^4.22.5", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"shx": "^0.3.2", | ||
"typedoc": "^0.26.7", | ||
"typescript": "^5.4.5", | ||
"typescript": "^5.6.2", | ||
"typescript-eslint": "^8.8.0", | ||
"vitest": "2.0.5" | ||
"vitest": "2.0.5", | ||
"vite": "^5.4.8", | ||
"@typescript-eslint/utils": "^8.8.0" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { parseArgs } from "node:util"; | ||
import { createRequire } from "node:module"; | ||
import { fileURLToPath } from "node:url"; | ||
import { resolve, dirname, join, basename } from "node:path"; | ||
import { copyFile } from "node:fs/promises"; | ||
|
||
const { | ||
values: { to }, | ||
} = parseArgs({ options: { to: { type: "string" } } }); | ||
|
||
if (to === undefined) { | ||
throw new Error("required argument `to` missing"); | ||
} | ||
|
||
const pkg = createRequire(import.meta.url)("../package.json"); | ||
const umdAbsolutePath = resolve( | ||
dirname(fileURLToPath(import.meta.url)), | ||
join("..", pkg.jsdelivr), | ||
); | ||
|
||
await copyFile(umdAbsolutePath, join(to, basename(pkg.jsdelivr))); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPLAINER: These are no longer required, as
exports
below contains the types, and TypeScript primarily looks there.