Skip to content

Commit ff92080

Browse files
authored
Simplify and update package.json (#835)
1 parent 63a03cf commit ff92080

File tree

7 files changed

+48
-105
lines changed

7 files changed

+48
-105
lines changed

.eslintrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": [
3+
"@antfu"
4+
],
5+
"ignorePatterns": [
6+
"node_modules/",
7+
"dist/",
8+
"coverage/",
9+
"pnpm-lock.yaml",
10+
"*.js"
11+
],
12+
"rules": {
13+
"vue/component-definition-name-casing": ["error", "kebab-case"],
14+
"n/prefer-global/process": 0
15+
}
16+
}

.eslintrc.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "fluent-vue",
3+
"type": "module",
34
"version": "3.4.0",
45
"description": "Internationalization plugin for Vue.js. Project Fluent bindings for Vue.js",
56
"author": "Ivan Demchuk <ivan.demchuk@gmail.com>",
@@ -28,30 +29,21 @@
2829
"sideEffects": false,
2930
"exports": {
3031
".": {
31-
"types": "./index.d.ts",
32-
"production": {
33-
"import": "./dist/prod/index.mjs",
34-
"require": "./dist/prod/index.cjs"
35-
},
36-
"import": "./dist/index.mjs",
32+
"import": "./dist/index.js",
3733
"require": "./dist/index.cjs"
3834
}
3935
},
40-
"main": "dist/index.cjs",
41-
"module": "dist/index.mjs",
42-
"unpkg": "dist/prod/index.global.js",
43-
"jsdelivr": "dist/prod/index.global.js",
44-
"types": "index.d.ts",
36+
"main": "dist/index.js",
37+
"module": "dist/index.js",
38+
"unpkg": "dist/index.global.js",
39+
"jsdelivr": "dist/index.global.js",
40+
"types": "dist/index.d.ts",
4541
"files": [
46-
"index.d.ts",
4742
"dist",
4843
"README.md"
4944
],
50-
"engines": {
51-
"node": ">=12.0.0"
52-
},
5345
"scripts": {
54-
"build": "rimraf dist && tsup",
46+
"build": "tsup",
5547
"lint": "eslint .",
5648
"ls-lint": "ls-lint",
5749
"typecheck": "tsc --noEmit -p tsconfig.json",

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import './types/volar'
12
import type { FluentBundle, FluentVariable } from '@fluent/bundle'
23
import { isVue3, shallowRef } from 'vue-demi'
34
import type { FluentVueOptions } from './types'
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
1-
import { PropType, DefineComponent, FunctionDirective } from 'vue-demi'
2-
import { FluentVariable } from '@fluent/bundle'
1+
import type { DefineComponent, FunctionDirective, PropType } from 'vue-demi'
2+
import type { FluentVariable } from '@fluent/bundle'
33

44
type ComponentType = DefineComponent<{
55
/**
66
* The key of the translation.
77
*/
88
path: {
9-
type: StringConstructor,
10-
required: true,
11-
},
9+
type: StringConstructor
10+
required: true
11+
}
1212
/**
1313
* Arguments to pass to the translation.
1414
*/
1515
args: {
16-
type: PropType<Record<string, FluentVariable>>,
17-
default: () => Record<string, FluentVariable>,
18-
},
16+
type: PropType<Record<string, FluentVariable>>
17+
default: () => Record<string, FluentVariable>
18+
}
1919
/**
2020
* The tag to use as a root element.
2121
*/
2222
tag: {
23-
type: StringConstructor,
24-
default: 'span',
25-
},
23+
type: StringConstructor
24+
default: 'span'
25+
}
2626
/**
2727
* Whether to render translation as html.
2828
*/
2929
html: {
30-
type: BooleanConstructor,
31-
default: false,
32-
},
30+
type: BooleanConstructor
31+
default: false
32+
}
3333
/**
3434
* Whether to render translation without a root element.
3535
*/
3636
noTag: {
37-
type: BooleanConstructor,
38-
default: false,
37+
type: BooleanConstructor
38+
default: false
3939
}
4040
}>
4141

42+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
4243
// @ts-ignore: works on Vue 2, fails in Vue 3
4344
declare module 'vue/types/vue' {
4445
export interface Vue {
@@ -47,6 +48,7 @@ declare module 'vue/types/vue' {
4748
}
4849
}
4950

51+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
5052
// @ts-ignore: works on Vue 3, fails in Vue 2
5153
declare module '@vue/runtime-core' {
5254
export interface ComponentCustomProperties {
@@ -59,5 +61,3 @@ declare module '@vue/runtime-core' {
5961
i18n: ComponentType
6062
}
6163
}
62-
63-
export * from './dist'

src/util/warn.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ export function assert(condition: boolean, message: string): asserts condition {
44
}
55

66
export function warn(message: string, ...args: unknown[]): void {
7-
if (process.env.NODE_ENV !== 'production')
8-
console.warn(`[fluent-vue] ${message}`, ...args)
7+
console.warn(`[fluent-vue] ${message}`, ...args)
98
}

tsup.config.ts

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
import { defineConfig } from 'tsup'
22
import GlobalsPlugin from 'esbuild-plugin-globals'
33

4-
const common = defineConfig({
4+
export default defineConfig({
55
target: 'node12',
6-
outExtension: ({ format }) => {
7-
if (format === 'iife')
8-
return { js: '.global.js' }
9-
10-
if (format === 'cjs')
11-
return { js: '.cjs' }
12-
13-
if (format === 'esm')
14-
return { js: '.mjs' }
15-
16-
return { js: '.js' }
17-
},
186
globalName: 'FluentVue',
197
splitting: true,
208
esbuildPlugins: [
@@ -24,45 +12,8 @@ const common = defineConfig({
2412
}),
2513
],
2614
external: ['vue-demi', '@fluent/bundle'],
27-
})
28-
29-
const dev = defineConfig({
30-
outDir: 'dist/',
31-
env: {
32-
NODE_ENV: 'development',
33-
},
34-
})
35-
36-
const prod = defineConfig({
37-
outDir: 'dist/prod',
38-
env: {
39-
NODE_ENV: 'production',
40-
},
41-
minify: true,
42-
})
43-
44-
export default defineConfig([{
45-
...common,
4615
entry: ['src/index.ts', 'src/composition.ts'],
47-
format: ['esm', 'cjs'],
16+
format: ['esm', 'cjs', 'iife'],
4817
dts: true,
49-
...dev,
50-
},
51-
{
52-
...common,
53-
entry: ['src/index.ts', 'src/composition.ts'],
54-
format: ['esm', 'cjs'],
55-
...prod,
56-
},
57-
{
58-
...common,
59-
entry: ['src/index.ts'],
60-
format: 'iife',
61-
...dev,
62-
},
63-
{
64-
...common,
65-
entry: ['src/index.ts'],
66-
format: 'iife',
67-
...prod,
68-
}])
18+
clean: true,
19+
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy