-
Notifications
You must be signed in to change notification settings - Fork 3
Fix commonjs/esm/types output #610
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
base: master
Are you sure you want to change the base?
Changes from all commits
8c7f8c2
ce3836b
62d4051
d05f670
9fd5f54
04fa477
fd6e4cc
125fa5f
42e546e
9f4b79d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,10 +49,10 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: build-artifacts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| retention-days: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: dist*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: lib*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test-package: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Test package on node ${{ matrix.node }} / ${{ matrix.os }} / rollup v${{ matrix.rollup }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test-package-rollup: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: "rollup v${{ matrix.rollup }} / node ${{ matrix.node }} / ${{ matrix.os }}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -99,16 +99,69 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| npm install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| npm install rollup@${{ matrix.rollup }} --force | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| npx rollup -v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| working-directory: test/package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| working-directory: test/package/rollup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Test package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: npm run test:package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: npm run test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| working-directory: test/package/rollup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test-package-vite: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: "vite v${{ matrix.vite }} / node ${{ matrix.node }} / ${{ matrix.os }}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| node: ["22", "20", "18"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| os: [ubuntu-latest, windows-latest] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vite: ["5", "6", "7"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exclude: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - os: windows-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| node: 20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - os: windows-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| node: 18 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - vite: 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| node: 18 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+108
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Matrix os is defined but not used; runs-on is hardcoded to ubuntu (vite job) Same issue as rollup job; Windows variants won’t execute. - runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/[email protected] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup node & npm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: relative-ci/.github/actions/[email protected] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| version: ${{ matrix.node }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cache: never | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| install: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install vitest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: npm install vitest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Download build files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/[email protected] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: build-artifacts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup local npm registry | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: ./scripts/setup-registry.sh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install test package dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| npm install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| npm install vite@${{ matrix.vite }} --force | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| npx vite -v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| working-directory: test/package/vite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+145
to
+153
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Windows: force bash for the registry script and installs (Vite job) + trim trailing space Prevents failures on windows and fixes YAML lint trailing spaces. Apply: - name: Setup local npm registry
- run: ./scripts/setup-registry.sh
+ run: ./scripts/setup-registry.sh
+ shell: bash
- name: Install test package dependencies
run: |
- npm install
+ npm install
npm install vite@${{ matrix.vite }} --force
npx vite -v
working-directory: test/package/vite
+ shell: bash📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 150-150: trailing spaces (trailing-spaces) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Test package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: npm run test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| working-directory: test/package/vite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tests: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - lint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - test-unit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - test-package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - test-package-rollup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - test-package-vite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - run: exit 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| *.log | ||
| .DS_Store | ||
| node_modules | ||
| dist | ||
| lib | ||
| .env |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "rollup-plugin-webpack-stats", | ||
| "version": "2.1.4", | ||
| "version": "2.1.5-beta.5", | ||
| "private": false, | ||
| "license": "MIT", | ||
| "keywords": [ | ||
|
|
@@ -11,19 +11,19 @@ | |
| "stats", | ||
| "bundle-stats" | ||
| ], | ||
| "main": "dist/index.cjs", | ||
| "module": "dist/index.mjs", | ||
| "typings": "dist/index.d.ts", | ||
| "main": "lib/cjs/index.js", | ||
| "module": "lib/esm/index.js", | ||
| "typings": "lib/types/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.mjs", | ||
| "require": "./dist/index.cjs" | ||
| "types": "./lib/types/index.d.ts", | ||
| "import": "./lib/esm/index.js", | ||
| "require": "./lib/cjs/index.js" | ||
| }, | ||
| "./transform": { | ||
| "types": "./dist/transform.d.ts", | ||
| "import": "./dist/transform.mjs", | ||
| "require": "./dist/transform.cjs" | ||
| "types": "./lib/types/transform.d.ts", | ||
| "import": "./lib/esm/transform.js", | ||
| "require": "./lib/cjs/transform.js" | ||
| } | ||
|
Comment on lines
18
to
27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify declaration emit to lib/types Ensure tsconfig sets declaration output once (to avoid duplicated emits) and to lib/types to satisfy exports/types. Run: Also applies to: 43-44, 49-51 🏁 Script executed: #!/bin/bash
# Inspect tsconfigs for declaration settings
fd -a 'tsconfig*.json'
rg -nP '"declaration"\s*:\s*true' tsconfig*.json || true
rg -nP '"emitDeclarationOnly"\s*:\s*true' tsconfig*.json || true
rg -nP '"declarationDir"\s*:\s*"lib/types"' tsconfig*.json || true
# Show mapped export types
jq -r '.exports["."].types, .exports["./transform"].types, .types? // .typings?' package.jsonLength of output: 618 tsconfig.base.json: configure declaration output directory "emitDeclarationOnly": true,
"declarationDir": "lib/types"to emit all 🤖 Prompt for AI Agents
Comment on lines
+19
to
27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify .d.ts emit goes to lib/types exactly once Ensure tsconfig emits declarations only to lib/types to satisfy these exports and avoid duplicates across CJS/ESM. Run: 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Tsconfig files:" && fd -a 'tsconfig*.json' || true
echo
echo 'Declaration settings:'
rg -nP '"declaration"\s*:\s*true' tsconfig*.json || true
rg -nP '"emitDeclarationOnly"\s*:\s*true' tsconfig*.json || true
rg -nP '"declarationDir"\s*:\s*"lib/types"' tsconfig*.json || true
echo
echo 'Package types mapping:'
jq -r '.exports["."].types, .exports["./transform"].types, .types? // .typings?' package.jsonLength of output: 882 Configure TypeScript to emit declarations only to lib/types "emitDeclarationOnly": true,
"declarationDir": "lib/types"and turn off 🤖 Prompt for AI Agents |
||
| }, | ||
| "author": { | ||
|
|
@@ -40,17 +40,20 @@ | |
| }, | ||
| "homepage": "https://github.com/relative-ci/rollup-plugin-webpack-stats/blob/master/#readme", | ||
| "files": [ | ||
| "dist" | ||
| "lib" | ||
| ], | ||
| "engines": { | ||
| "node": ">=18" | ||
| }, | ||
| "scripts": { | ||
| "prebuild": "rimraf ./dist", | ||
| "build": "tsc && rollup -c rollup.config.mjs", | ||
| "build": "npm run clean && rollup -c && npm run build-package-type", | ||
| "build-package-type": "echo '{\"type\":\"module\"}' > lib/esm/package.json", | ||
| "clean": "rimraf ./lib", | ||
| "lint": "exit 0", | ||
| "test:unit": "vitest test/unit", | ||
| "test:package": "cd test/package && vitest", | ||
| "test:package": "npm run test:package:rollup && npm run test:package:vite", | ||
| "test:package:rollup": "cd test/package/rollup && vitest", | ||
| "test:package:vite": "cd test/package/vite && vitest", | ||
| "bump": "./scripts/bump.sh", | ||
| "release": "./scripts/release.sh" | ||
| }, | ||
|
|
@@ -67,6 +70,8 @@ | |
| }, | ||
| "devDependencies": { | ||
| "@release-it/conventional-changelog": "10.0.1", | ||
| "@rollup/plugin-commonjs": "28.0.6", | ||
| "@rollup/plugin-node-resolve": "16.0.1", | ||
| "@rollup/plugin-typescript": "12.1.4", | ||
| "@tsconfig/node18": "18.2.4", | ||
| "@types/node": "24.3.0", | ||
|
|
@@ -76,17 +81,18 @@ | |
| "release-it": "19.0.4", | ||
| "rimraf": "6.0.1", | ||
| "rollup": "4.46.4", | ||
| "rollup-plugin-node-externals": "8.1.0", | ||
| "tslib": "2.8.1", | ||
| "typescript": "5.9.2", | ||
| "vitest": "3.2.4" | ||
| }, | ||
| "dependencies": { | ||
| "rollup-plugin-stats": "1.5.0" | ||
| "rollup-plugin-stats": "1.5.1-beta.3" | ||
| }, | ||
| "peerDependencies": { | ||
| "vite": "^5.0.0 || ^6.0.0 || ^7.0.0", | ||
| "rolldown": "^1.0.0-beta.0", | ||
| "rollup": "^3.0.0 || ^4.0.0", | ||
| "rolldown": "^1.0.0-beta.0" | ||
| "vite": "^5.0.0 || ^6.0.0 || ^7.0.0" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "vite": { | ||
|
|
||
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.
🛠️ Refactor suggestion
Use the matrix OS for the rollup job
Windows variants won’t run with runs-on hardcoded.
Apply:
📝 Committable suggestion
🤖 Prompt for AI Agents