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

fix: exports file extensions #1

Merged
merged 4 commits into from
Jul 10, 2024
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
],
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.esm.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.cjs.js",
"import": "./dist/index.esm.js",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ isApng(new Uint8Array(buffer))
#### As old-school global script tag

Url for latest version: `https://unpkg.com/is-apng`<br>
Url for specific version: `https://unpkg.com/is-apng@1.0.1/dist/index.js`
Url for specific version: `https://unpkg.com/is-apng@1.1.0/dist/index.js`

```html
<script src="https://unpkg.com/is-apng" type="text/javascript"></script>
Expand All @@ -52,12 +52,12 @@ Url for specific version: `https://unpkg.com/[email protected]/dist/index.js`

#### As module

Url for latest version: `https://unpkg.com/is-apng/dist/index.esm.js`<br>
Url for specific version: `https://unpkg.com/is-apng@1.0.1/dist/index.esm.js`
Url for latest version: `https://unpkg.com/is-apng/dist/index.mjs`<br>
Url for specific version: `https://unpkg.com/is-apng@1.1.0/dist/index.mjs`

```html
<script type="module">
import isApng from 'https://unpkg.com/is-apng/dist/index.esm.js'
import isApng from 'https://unpkg.com/is-apng/dist/index.mjs'

console.log(typeof isApng);
// isApng(...)
Expand All @@ -72,7 +72,7 @@ or
<script type="importmap">
{
"imports": {
"is-apng": "https://unpkg.com/is-apng/dist/index.esm.js"
"is-apng": "https://unpkg.com/is-apng/dist/index.mjs"
}
}
</script>
Expand Down
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export default [
],
output: [
{
file: `${isProduction ? 'dist' : 'lib'}/index.esm.js`,
file: `${isProduction ? 'dist' : 'lib'}/index.mjs`,
format: 'esm',
// sourcemap: isProduction,
},
{
name: 'isApng',
file: `${isProduction ? 'dist' : 'lib'}/index.cjs.js`,
file: `${isProduction ? 'dist' : 'lib'}/index.cjs`,
format: 'cjs',
// interop: 'auto',
// sourcemap: isProduction,
Expand Down Expand Up @@ -75,7 +75,7 @@ export default [
// ],
// output: {
// name: 'isApng',
// file: `${isProduction ? 'dist' : 'lib'}/index.cjs.js`,
// file: `${isProduction ? 'dist' : 'lib'}/index.cjs`,
// format: 'cjs',
// // interop: 'default',
// interop: 'auto',
Expand Down
2 changes: 1 addition & 1 deletion src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'ava'
import { readFileSync } from 'node:fs'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import isApng from '../dist/index.esm.js'
import isApng from '../dist/index.mjs'

const dir =
typeof __dirname !== 'undefined'
Expand Down
2 changes: 1 addition & 1 deletion src/test-browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- Module JS -->
<!--
<script type="module">
import isApng from './js/index.esm.js'
import isApng from './js/index.mjs'

if (typeof isApng !== 'function') {
console.error(
Expand Down
Loading