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

feat!: drop CJS and use VueUse v13 #254

Merged
merged 21 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from 14 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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ jobs:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4

- run: corepack enable
- run: npm i -fg corepack && corepack enable

- uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4

- name: Enable corepack
run: corepack enable
run: npm i -fg corepack && corepack enable

- name: Setup node
uses: actions/setup-node@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fetch-depth: 0

- name: Enable corepack
run: corepack enable
run: npm i -fg corepack && corepack enable

- name: Setup node.js
uses: actions/setup-node@v4
Expand Down
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

12 changes: 1 addition & 11 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
rollup: {
emitCJS: true,
},
declaration: true,
declaration: 'node16',
// warnings triggered by nuxt exports not being built - happens in separate script
failOnWarn: false,
entries: [
Expand All @@ -16,13 +13,6 @@ export default defineBuildConfig({
format: 'esm',
ext: 'mjs',
},
{
input: 'src/index.ts',
outDir: 'dist',
name: 'index',
format: 'cjs',
ext: 'cjs',
},
],
externals: [
'@nuxt/kit',
Expand Down
21 changes: 8 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,19 @@
],
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./nuxt": {
"import": "./dist/nuxt/module.mjs",
"require": "./dist/nuxt/module.cjs"
}
".": "./dist/index.mjs",
"./nuxt": "./dist/nuxt/module.mjs"
},
"main": "./dist/index.cjs",
Copy link
Contributor

@userquin userquin Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the main entry using "main": "./dist/index.mjs",

"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"types": "./dist/index.d.mts",
"typesVersions": {
Copy link
Contributor

@userquin userquin Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we're not using .js in the file extensions in the package, we need to add the d.mts for nuxt , "./*" isn't effective:

"typesVersions": {
  "*": {
    "nuxt": [
      "./dist/nuxt/module.d.mts"
    ]
  }
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should we have the following?

  "typesVersions": {
    "*": {
      "*": [
        "./dist/*",
        "./*"
      ],
      "nuxt": [
        "./dist/nuxt/module.d.mts"
      ]
    }
  },

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just use .js instead .mjs and keep current "typesVersions"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should we have the following?

  "typesVersions": {
    "*": {
      "*": [
        "./dist/*",
        "./*"
      ],
      "nuxt": [
        "./dist/nuxt/module.d.mts"
      ]
    }
  },

no, just nuxt entry

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact Nuxt will drop support for node10 module resolution (if not yet removed), we can remove "typesVersions" entry

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nuxt still supports node 10 , so it is fine

"*": {
"*": [
"./dist/*",
"./*"
],
"nuxt": [
"./dist/nuxt/module.d.mts"
]
}
},
Expand Down Expand Up @@ -79,8 +75,8 @@
"vue": ">=3.0.0"
},
"dependencies": {
"@vueuse/core": "^10.10.0",
"@vueuse/shared": "^10.10.0",
"@vueuse/core": "^13.0.0",
"@vueuse/shared": "^13.0.0",
"csstype": "^3.1.3",
"framesync": "^6.1.2",
"popmotion": "^11.0.5",
Expand All @@ -106,7 +102,6 @@
"lint-staged": "^15.2.5",
"nuxt": "^3.13.0",
"pkg-pr-new": "^0.0.20",
"prettier": "^3.2.5",
"typescript": "^5.4.5",
"unbuild": "^2.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also update typescript and unbuild versions

"vite": "5.2.12",
Expand Down
125 changes: 113 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions scripts/fix-nuxt-build.mjs

This file was deleted.

Loading
Loading