Skip to content

fix: fully cjs/esm dual pacakges #222

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

Merged
merged 1 commit into from
Jun 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
2 changes: 1 addition & 1 deletion api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
*/
"mainEntryPointFilePath": "<projectFolder>/dist/cjs/index.d.ts",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",

/**
* A list of NPM package names whose exports should be treated as part of this package.
Expand Down
15 changes: 15 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
declaration: true,
outDir: 'dist',
entries: [
{
name: 'index',
input: 'src/index'
}
],
rollup: {
emitCJS: true
}
})
4 changes: 2 additions & 2 deletions docs/@intlify/vue-i18n-extensions-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Transform `v-t` custom directive

**Signature:**
```typescript
export declare function transformVTDirective<Messages extends Record<string, unknown> = {}, // eslint-disable-line @typescript-eslint/ban-types -- TODO: fix this
declare function transformVTDirective<Messages extends Record<string, unknown> = {}, // eslint-disable-line @typescript-eslint/ban-types -- TODO: fix this
DateTimeFormats extends Record<string, unknown> = {}, // eslint-disable-line @typescript-eslint/ban-types -- TODO: fix this
NumberFormats extends Record<string, unknown> = {}, // eslint-disable-line @typescript-eslint/ban-types -- TODO: fix this
Legacy extends boolean = true>(options?: TransformVTDirectiveOptions<Messages, DateTimeFormats, NumberFormats, Legacy>): DirectiveTransform;
Expand Down Expand Up @@ -84,7 +84,7 @@ Transform options for `v-t` custom directive

**Signature:**
```typescript
export interface TransformVTDirectiveOptions<Messages extends Record<string, unknown> = {}, // eslint-disable-line @typescript-eslint/ban-types -- TODO: fix this
interface TransformVTDirectiveOptions<Messages extends Record<string, unknown> = {}, // eslint-disable-line @typescript-eslint/ban-types -- TODO: fix this
DateTimeFormats extends Record<string, unknown> = {}, // eslint-disable-line @typescript-eslint/ban-types -- TODO: fix this
NumberFormats extends Record<string, unknown> = {}, // eslint-disable-line @typescript-eslint/ban-types -- TODO: fix this
Legacy extends boolean = true>
Expand Down
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"tsx": "^4.11.0",
"typescript": "^5.4.5",
"typescript-eslint": "^7.9.0",
"unbuild": "^2.0.0",
"vitest": "^1.6.0",
"vue": "^3.2.45"
},
Expand All @@ -77,19 +78,22 @@
}
},
"files": [
"dist/cjs/*.js",
"dist/esm/*.js",
"dist/*.d.ts"
"dist/idnex.cjs",
"dist/index.mjs",
"dist/index.d.ts",
"dist/index.d.mts",
"dist/index.d.cts"
],
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/vue-i18n-extensions.d.ts",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/vue-i18n-extensions.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
}
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json"
},
"repository": {
"type": "git",
Expand All @@ -103,9 +107,7 @@
"build:nightly": "pnpm build:transpile && pnpm build:extract",
"build:docs": "api-docs-gen ./temp/vue-i18n-extensions.api.json -c ./docsgen.config.js -o ./docs",
"build:extract": "api-extractor run -l -c ./api-extractor.json --typescript-compiler-folder node_modules/typescript",
"build:transpile": "run-s build:transpile:*",
"build:transpile:cjs": "tsc -p tsconfig.cjs.json",
"build:transpile:esm": "tsc -p tsconfig.esm.json",
"build:transpile": "unbuild",
"check-install": "tsx scripts/playwright.ts",
"clean": "git clean -fdx",
"coverage": "opener coverage/lcov-report/index.html",
Expand Down
Loading