Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fluent-vue/unplugin-fluent-vue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.3
Choose a base ref
...
head repository: fluent-vue/unplugin-fluent-vue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
48 changes: 30 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -16,58 +16,70 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [18]
node: [20, 22]
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v4.2.2
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3.6.0
uses: actions/setup-node@v4.2.0
with:
node-version: ${{ matrix.node }}
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v4.1.0
with:
version: 7.x.x
run_install: true

- name: Test
run: pnpm test:coverage

- name: Upload code coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5

lint:
runs-on: ubuntu-latest
name: Lint source code
steps:
- name: Checkout
uses: actions/checkout@v3.4.0
uses: actions/checkout@v4.2.2
- name: Setup Node.js
uses: actions/setup-node@v3.6.0
- uses: pnpm/action-setup@v2.2.4
uses: actions/setup-node@v4.2.0
- uses: pnpm/action-setup@v4.1.0
with:
version: 7.x.x
run_install: true

- name: Lint
run: pnpm lint

publish:
runs-on: ubuntu-latest
name: Publish test build to pkg.pr.new
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
- name: Setup Node.js
uses: actions/setup-node@v4.2.0
- uses: pnpm/action-setup@v4.1.0
with:
run_install: true

- name: Build
run: pnpm build
- name: Publish
run: pnpx pkg-pr-new publish

test-examples:
runs-on: ubuntu-latest
name: Test build of example projects
steps:
- name: Checkout unplugin-fluent-vue
uses: actions/checkout@v3.4.0
uses: actions/checkout@v4.2.2
- name: Checkout examples
uses: actions/checkout@v3.4.0
uses: actions/checkout@v4.2.2
with:
repository: fluent-vue/examples
path: examples
- name: Setup Node.js
uses: actions/setup-node@v3.6.0
- uses: pnpm/action-setup@v2.2.4
with:
version: 7.x.x
run_install: true
uses: actions/setup-node@v4.2.0
- uses: pnpm/action-setup@v4.1.0

- name: Test
run: node scripts/build-examples.mjs
run: node scripts/build-examples.js
4 changes: 0 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm lint-staged

2 changes: 1 addition & 1 deletion .release-it.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hooks": {
"before:init": ["pnpm lint", "pnpm test -- --run"],
"before:init": ["pnpm lint", "pnpm test --run"],
"after:bump": "pnpm build"
},
"github": {
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,53 @@








## 1.4.0 (2025-02-24)

#### :star: New Features
* [#107](https://github.com/fluent-vue/unplugin-fluent-vue/pull/107) Add an option to parse FTL during build ([@Demivan](https://github.com/Demivan))

#### Committers: 1
- Ivan Demchuk ([@Demivan](https://github.com/Demivan))

## 1.3.2 (2024-11-13)

#### :bug: Bug Fixes
* [#103](https://github.com/fluent-vue/unplugin-fluent-vue/pull/103) Add sourcemap support to SFCFluentPlugin ([@Demivan](https://github.com/Demivan))

#### Committers: 1
- Ivan Demchuk ([@Demivan](https://github.com/Demivan))

## 1.3.1 (2024-09-12)

#### :bug: Bug Fixes
* [#97](https://github.com/fluent-vue/unplugin-fluent-vue/pull/97) Make @nuxt/kit dependency optional ([@Demivan](https://github.com/Demivan))

#### Committers: 1
- Ivan Demchuk ([@Demivan](https://github.com/Demivan))

## 1.3.0 (2024-04-05)

#### :star: New Features
* [#84](https://github.com/fluent-vue/unplugin-fluent-vue/pull/84) Add Nuxt module ([@Demivan](https://github.com/Demivan))

#### Committers: 1
- Ivan Demchuk ([@Demivan](https://github.com/Demivan))

## 1.2.0 (2024-03-05)

#### :star: New Features
* [#55](https://github.com/fluent-vue/unplugin-fluent-vue/pull/55) Mark ftl imports side-effect free ([@Demivan](https://github.com/Demivan))

#### Committers: 1
- Ivan Demchuk ([@Demivan](https://github.com/Demivan))

## 1.1.4 (2023-03-23)

## 1.1.3 (2023-03-22)

#### :bug: Bug Fixes
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -31,11 +31,11 @@ npm install unplugin-fluent-vue --save-dev

```ts
// vite.config.js
import { defineConfig } from 'vite'
import {
ExternalFluentPlugin,
SFCFluentPlugin,
} from 'unplugin-fluent-vue/vite'
import { defineConfig } from 'vite'

export default defineConfig({
plugins: [
@@ -44,12 +44,14 @@ export default defineConfig({
SFCFluentPlugin({ // define messages in SFCs
blockType: 'fluent', // default 'fluent' - name of the block in SFCs
checkSyntax: true, // default true - whether to check syntax of the messages
parseFtl: false, // default false - whether to parse ftl files during build
}),
ExternalFluentPlugin({ // define messages in external ftl files
baseDir: path.resolve('src'), // required - base directory for Vue files
ftlDir: path.resolve('src/locales'), // required - directory with ftl files
locales: ['en', 'da'], // required - list of locales
checkSyntax: true, // default true - whether to check syntax of the messages
parseFtl: false, // default false - whether to parse ftl files during build
}),
],
})
8 changes: 4 additions & 4 deletions __tests__/fixtures/components/external.setup.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup>
const userName = 'test'
</script>

<template>
<div>
<div>{{ $t('hello-user', { userName }) }}</div>
<div>{{ $t('shared-photos', { userName, photoCount, userGender }) }}</div>
</div>
</template>

<script setup>
const test = 'test'
</script>
2 changes: 2 additions & 0 deletions __tests__/fixtures/errors.vue
Original file line number Diff line number Diff line change
@@ -19,4 +19,6 @@ shared-photos =
[female] her stream
*[other] their stream
}.

entry-without-error = Hello, World!
</fluent>
2 changes: 1 addition & 1 deletion __tests__/fixtures/noLocale.vue
Original file line number Diff line number Diff line change
@@ -19,4 +19,4 @@ shared-photos =
[female] her stream
*[other] their stream
}.
</fluent>
</fluent>
2 changes: 1 addition & 1 deletion __tests__/fixtures/test.vue
Original file line number Diff line number Diff line change
@@ -19,4 +19,4 @@ shared-photos =
[female] her stream
*[other] their stream
}.
</fluent>
</fluent>
Binary file modified __tests__/frameworks/vite/__snapshots__/external.spec.ts.snap
Binary file not shown.
Binary file modified __tests__/frameworks/vite/__snapshots__/sfc.spec.ts.snap
Binary file not shown.
30 changes: 15 additions & 15 deletions __tests__/frameworks/vite/errors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import { resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
import vue3 from '@vitejs/plugin-vue'

import vue3base from '@vitejs/plugin-vue'
import compiler from '@vue/compiler-sfc'
import { describe, expect, it } from 'vitest'

import { ExternalFluentPlugin, SFCFluentPlugin } from '../../../src/vite'
import { compile } from './util'

const vue3 = () => vue3base({
compiler,
})

const baseDir = resolve(__dirname, '../..')

describe('Error checking', () => {
describe('error checking', () => {
it('checks for syntax errors in external ftl files', async () => {
// Arrange
// Act
const code = compile({
plugins: [
vue3(),
vue3({
compiler,
}),
ExternalFluentPlugin({
baseDir: resolve(baseDir, 'fixtures'),
ftlDir: resolve(baseDir, 'fixtures/ftl'),
@@ -31,8 +29,8 @@ describe('Error checking', () => {

// Assert
await expect(code).rejects.toThrowErrorMatchingInlineSnapshot(`
"Fluent parse errors:
E0003: Expected token: \\"}\\" (2:31)
[Error: Fluent parse errors:
E0003: Expected token: "}" (2:31)
1 | # Simple things are simple.
2 | hello-user = Hello, {$userName!
| ^
@@ -44,7 +42,7 @@ describe('Error checking', () => {
9 | }to {$userGender ->
| ^
10 | [male] his stream
11 | [female] her stream"
11 | [female] her stream]
`)
})

@@ -53,7 +51,9 @@ describe('Error checking', () => {
// Act
const code = compile({
plugins: [
vue3(),
vue3({
compiler,
}),
SFCFluentPlugin({
checkSyntax: true,
}),
@@ -62,8 +62,8 @@ describe('Error checking', () => {

// Assert
await expect(code).rejects.toThrowErrorMatchingInlineSnapshot(`
"Fluent parse errors:
E0003: Expected token: \\"}\\" (2:31)
[Error: Fluent parse errors:
E0003: Expected token: "}" (2:31)
1 | # Simple things are simple.
2 | hello-user = Hello, {$userName!
| ^
@@ -75,7 +75,7 @@ describe('Error checking', () => {
9 | }to {$userGender ->
| ^
10 | [male] his stream
11 | [female] her stream"
11 | [female] her stream]
`)
})
})
Loading