Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More →
Socket
Sign inDemoInstall
Socket

@intlify/vue-i18n-bridge

Package Overview
Dependencies
Maintainers
2
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intlify/vue-i18n-bridge - npm Package Compare versions

Comparing version 0.1.0-0cf3395 to 0.1.0-2e90b5a

2

lib/index.d.ts

@@ -1,2 +0,2 @@

declare const VueI18n: any // eslint-disable-line @typescript-eslint/no-explicit-any
declare const VueI18n: undefined
declare const isVueI18n8: boolean

@@ -3,0 +3,0 @@ declare const isVueI18n9: boolean

@@ -1,2 +0,2 @@

declare const VueI18n: any // eslint-disable-line @typescript-eslint/no-explicit-any
declare const VueI18n: undefined
declare const isVueI18n8: boolean

@@ -3,0 +3,0 @@ declare const isVueI18n9: boolean

{
"name": "@intlify/vue-i18n-bridge",
"version": "0.1.0-0cf3395",
"version": "0.1.0-2e90b5a",
"description": "Vue I18n bridging for Vue 2 & Vue 3",

@@ -5,0 +5,0 @@ "peerDependencies": {

@@ -9,3 +9,3 @@ # @intlify/vue-i18n-bridge

- Vue I18n composable APIs available on Vue 2 & Vue 3 (e.g `createI18n`, `useI18n`)
- Auto detect Vue Router version on bundling
- Auto detect Vue I18n version on bundling
- Manual switch versions

@@ -51,3 +51,3 @@ ## đŸ’ŋ Installation

Import everything related to Vue Router from it, it will redirect to `vue-i18n@8.26` + `@vue/composition-api` or `vue-i18n@9.2` based on users' environments.
Import everything related to Vue I18n from it, it will redirect to `vue-i18n@8.26` + `@vue/composition-api` or `vue-i18n@9.2` based on users' environments.

@@ -91,5 +91,5 @@ ```js

```sh
npx vue-i18n-switch 2
npx vue-i18n-switch 8
# or
npx vue-i18n-switch 3
npx vue-i18n-switch 9
```

@@ -102,9 +102,9 @@

```sh
npx vue-i18n-switch 2 vue2
npx vue-i18n-switch 8 vue-i18n-8
# or
npx vue-i18n-switch 3 vue3
npx vue-i18n-switch 9 vue-i18n-9
```
### 🩹 Auto Fix
If the postinstall hook doesn't get triggered or you have updated the Vue Router version, try to run the following command to resolve the redirecting:
If the postinstall hook doesn't get triggered or you have updated the Vue I18n version, try to run the following command to resolve the redirecting:

@@ -121,9 +121,9 @@ ```sh

"scripts": {
"test:8": "vue-i18n-switch 8 vue-i18n-8 && jest",
"test:8": "vue-i18n-switch 8 vue-i18n-legacy && jest",
"test:9": "vue-i18n-switch 9 && jest",
},
"devDependencies": {
"vue-i18n-8": "^8.26.1",
"vue-i18n-legacy": "npm:vue-i18n@^8.26.1",
"vue-i18n-bridge": "^9.2.0-beta.25",
"vue-i18n": "npm:vue-i18n@9.2.0-beta.25"
"vue-i18n": "^9.2.0-beta.25"
},

@@ -139,7 +139,7 @@ }

"test:8": "vue-i18n-switch 8 && jest",
"test:9": "vue-i18n-switch 9 vue-i18n-9 && jest",
"test:9": "vue-i18n-switch 9 vue-i18n-next && jest",
},
"devDependencies": {
"vue-i18n": "^8.26.1",
"vue-i18n-9": "npm:vue-i18n@9.2.0-beta.25"
"vue-i18n-next": "npm:vue-i18n@9.2.0-beta.25"
},

@@ -146,0 +146,0 @@ }

@@ -22,7 +22,9 @@ const fs = require('fs') // eslint-disable-line @typescript-eslint/no-var-requires

function copy(name, version, i18n) {
function copy(name, version, i18n, esm = false) {
const src = path.join(dir, `v${version}`, name)
const dest = path.join(dir, name)
let content = fs.readFileSync(src, 'utf-8')
content = content.replace(/'i18n'/g, `'${i18n}'`)
content = esm
? content.replace(/from 'vue-i18n'/g, `from '${i18n}'`)
: content.replace(/require\('vue-i18n'\)/g, `require('${i18n}')`)
try {

@@ -43,4 +45,16 @@ fs.unlinkSync(dest)

function checkVueI18n(pkg) {
const i18n = loadModule(pkg)
if (!i18n) {
warn('Vue I18n plugin is not found. Please run "npm install vue-i18n" to install.')
return false
}
return true
}
function switchVersion(version, i18n) {
i18n = i18n || 'vue-i18n'
if (!checkVueI18n(i18n)) {
return
}
if (version === 8 && !checkBridge()) {

@@ -50,4 +64,4 @@ return

copy('index.cjs', version, i18n)
copy('index.mjs', version, i18n)
copy('index.d.ts', version, i18n)
copy('index.mjs', version, i18n, true)
copy('index.d.ts', version, i18n, true)
}

@@ -54,0 +68,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡ī¸ by Socket Inc