Skip to content
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frameworks/vite/errors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { resolve } from 'node:path'
import { describe, expect, it } from 'vitest'

import vue3 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'
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frameworks/vite/external.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { relative, resolve } from 'node:path'
import { describe, expect, it } from 'vitest'

import vue3 from '@vitejs/plugin-vue'

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

import { ExternalFluentPlugin } from '../../../src/vite'
import { compile } from './util'
Expand Down
4 changes: 2 additions & 2 deletions __tests__/frameworks/vite/sfc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, expect, it } from 'vitest'

import vue3 from '@vitejs/plugin-vue'

import compiler from '@vue/compiler-sfc'

import { describe, expect, it } from 'vitest'
import { SFCFluentPlugin } from '../../../src/vite'
import { compile } from './util'

Expand Down
7 changes: 4 additions & 3 deletions __tests__/frameworks/vite/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { resolve, sep } from 'node:path'

import type { InlineConfig, ModuleNode } from 'vite'

import { resolve, sep } from 'node:path'
import { createServer } from 'vite'

const baseDir = resolve(__dirname, '../..')
Expand Down Expand Up @@ -56,7 +56,8 @@ export async function compile(options: InlineConfig, file: string): Promise<stri
.filter(module => module.transform)
.filter(module => !module.module.url.includes('node_modules'))
.filter(module => !module.module.url.includes('virtual:empty:'))
.map(module => `=== ${module.module.url} ===\n${module.transform.code}`).join('\n\n')
.map(module => `=== ${module.module.url} ===\n${module.transform.code}`)
.join('\n\n')

// normalize paths
return code
Expand Down
8 changes: 2 additions & 6 deletions __tests__/frameworks/webpack/sfc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ describe('Webpack SFC', () => {
const stats = await compile('fixtures/test.vue')

// Assert
const ftlModules = stats.toJson({ source: true }).modules
?.filter(module => module.name?.includes('blockType=fluent') === true && !module.source.includes('unplugin-fluent-vue-sfc'))
.map(module => module.source)
const ftlModules = stats.toJson({ source: true }).modules?.filter(module => module.name?.includes('blockType=fluent') === true && !module.source.includes('unplugin-fluent-vue-sfc')).map(module => module.source)

expect(ftlModules).not.toBeUndefined()
expect(ftlModules).toHaveLength(1)
Expand All @@ -24,9 +22,7 @@ describe('Webpack SFC', () => {
const stats = await compile('fixtures/test.vue', {}, true)

// Assert
const ftlModules = stats.toJson({ source: true }).modules
?.filter(module => module.name?.includes('blockType=fluent') === true && !module.source.includes('unplugin-fluent-vue-sfc'))
.map(module => module.source)
const ftlModules = stats.toJson({ source: true }).modules?.filter(module => module.name?.includes('blockType=fluent') === true && !module.source.includes('unplugin-fluent-vue-sfc')).map(module => module.source)

expect(ftlModules).not.toBeUndefined()
expect(ftlModules).toHaveLength(1)
Expand Down
6 changes: 3 additions & 3 deletions __tests__/frameworks/webpack/util.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { SFCPluginOptions } from '../../../src/webpack'
import path from 'node:path'
import webpack from 'webpack'
import { Volume, createFsFromVolume } from 'memfs'
import { createFsFromVolume, Volume } from 'memfs'

import { VueLoaderPlugin } from 'vue-loader'

import webpack from 'webpack'
import { SFCFluentPlugin } from '../../../src/webpack'
import type { SFCPluginOptions } from '../../../src/webpack'

export async function compile(fixture: string, options: Partial<SFCPluginOptions> = {}, hot = false): Promise<webpack.Stats> {
const compilation = webpack({
Expand Down
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,32 @@
"prepare": "husky",
"release": "dotenv release-it"
},
"peerDependencies": {
"@nuxt/kit": "^3"
},
"peerDependenciesMeta": {
"@nuxt/kit": {
"optional": true
}
},
"dependencies": {
"@fluent/syntax": "^0.19.0",
"@nuxt/kit": "^3.11.2",
"@rollup/pluginutils": "^5.0.0",
"@vue/compiler-core": "^3.4.21",
"magic-string": "^0.30.0",
"unplugin": "^1.0.0"
},
"devDependencies": {
"@antfu/eslint-config": "^3.0.0",
"@antfu/eslint-config": "^3.6.0",
"@nuxt/kit": "^3.11.2",
"@nuxt/schema": "^3.13.0",
"@release-it-plugins/lerna-changelog": "7.0.0",
"@types/node": "20.16.2",
"@vitejs/plugin-vue": "5.1.3",
"@vitest/coverage-istanbul": "^2.0.5",
"@vue/compiler-sfc": "3.4.38",
"dotenv-cli": "7.4.2",
"eslint": "9.9.1",
"eslint": "9.10.0",
"execa": "9.3.1",
"husky": "9.1.5",
"lint-staged": "15.2.9",
Expand All @@ -120,7 +128,7 @@
"tsup": "8.2.4",
"typescript": "5.5.4",
"vite": "5.4.2",
"vitest": "2.0.5",
"vitest": "2.1.0",
"vue": "3.4.38",
"vue-loader": "17.4.2",
"webpack": "5.94.0"
Expand Down
Loading
Loading