@fluojs/vite 1.0.0-beta.2 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +2 -2
- package/README.md +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/package.json +6 -4
package/README.ko.md
CHANGED
|
@@ -19,7 +19,7 @@ fluo 프로젝트를 위한 Vite 플러그인과 빌드 유틸리티입니다.
|
|
|
19
19
|
npm install --save-dev @fluojs/vite vite @babel/core @babel/plugin-proposal-decorators @babel/preset-typescript
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
`@babel/core
|
|
22
|
+
`@babel/core` `>=7.26.0`, `@babel/plugin-proposal-decorators` `>=7.28.0`, `@babel/preset-typescript` `>=7.27.0`, `vite` `>=6.2.0`은 peer dependency입니다. `fluoDecoratorsPlugin()`이 Vite transform 시점에 Babel decorator plugin과 TypeScript preset을 해석하기 때문입니다.
|
|
23
23
|
|
|
24
24
|
## 사용 시점
|
|
25
25
|
|
|
@@ -42,7 +42,7 @@ export default defineConfig({
|
|
|
42
42
|
});
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
이 플러그인은 `.ts` 애플리케이션 파일을 Babel로 변환하며 `2023-11` decorators proposal과 `@babel/preset-typescript`를 사용합니다.
|
|
45
|
+
이 플러그인은 `.ts` 애플리케이션 파일을 Babel로 변환하며 `2023-11` decorators proposal과 `@babel/preset-typescript`를 사용합니다. declaration 파일, `.test.` 또는 `.spec.` 파일, `node_modules`, `.ts`가 아닌 파일은 건너뛰므로 생성된 Vitest 테스트 파일은 계속 전용 `@fluojs/testing/vitest` transform 경로를 사용합니다.
|
|
46
46
|
|
|
47
47
|
## 공개 API
|
|
48
48
|
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Vite plugin and build utilities for fluo projects.
|
|
|
19
19
|
npm install --save-dev @fluojs/vite vite @babel/core @babel/plugin-proposal-decorators @babel/preset-typescript
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
`@babel/core`
|
|
22
|
+
`@babel/core` `>=7.26.0`, `@babel/plugin-proposal-decorators` `>=7.28.0`, `@babel/preset-typescript` `>=7.27.0`, and `vite` `>=6.2.0` are peer dependencies because `fluoDecoratorsPlugin()` resolves the Babel decorator plugin and TypeScript preset when Vite transforms source files.
|
|
23
23
|
|
|
24
24
|
## When to Use
|
|
25
25
|
|
|
@@ -42,7 +42,7 @@ export default defineConfig({
|
|
|
42
42
|
});
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
The plugin transforms `.ts` application files with Babel using the `2023-11` decorators proposal and `@babel/preset-typescript`. It skips files
|
|
45
|
+
The plugin transforms `.ts` application files with Babel using the `2023-11` decorators proposal and `@babel/preset-typescript`. It skips declaration files, `.test.` or `.spec.` files, `node_modules`, and non-`.ts` files so generated Vitest test files continue to use the dedicated `@fluojs/testing/vitest` transform path.
|
|
46
46
|
|
|
47
47
|
## Public API
|
|
48
48
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAYnC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CA0B7C"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { transformAsync } from '@babel/core';
|
|
2
|
+
function shouldTransformTypeScriptApplicationFile(id) {
|
|
3
|
+
const [filePath] = id.split('?', 1);
|
|
4
|
+
if (!filePath.endsWith('.ts') || filePath.endsWith('.d.ts')) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
return !filePath.includes('/node_modules/') && !filePath.includes('.test.') && !filePath.includes('.spec.');
|
|
8
|
+
}
|
|
9
|
+
|
|
2
10
|
/**
|
|
3
11
|
* Creates the Vite transform plugin used by fluo starter projects to compile
|
|
4
12
|
* TC39 standard decorator syntax through Babel before Vite bundles the app.
|
|
@@ -19,13 +27,14 @@ export function fluoDecoratorsPlugin() {
|
|
|
19
27
|
return {
|
|
20
28
|
name: 'fluo-babel-decorators',
|
|
21
29
|
async transform(code, id) {
|
|
22
|
-
if (!
|
|
30
|
+
if (!shouldTransformTypeScriptApplicationFile(id)) {
|
|
23
31
|
return null;
|
|
24
32
|
}
|
|
33
|
+
const [filename] = id.split('?', 1);
|
|
25
34
|
const result = await transformAsync(code, {
|
|
26
35
|
babelrc: false,
|
|
27
36
|
configFile: false,
|
|
28
|
-
filename
|
|
37
|
+
filename,
|
|
29
38
|
plugins: [['@babel/plugin-proposal-decorators', {
|
|
30
39
|
version: '2023-11'
|
|
31
40
|
}]],
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"babel",
|
|
9
9
|
"build-tooling"
|
|
10
10
|
],
|
|
11
|
-
"version": "1.0.0-beta.
|
|
11
|
+
"version": "1.0.0-beta.3",
|
|
12
12
|
"private": false,
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"repository": {
|
|
@@ -35,15 +35,17 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@babel/core": ">=7.
|
|
39
|
-
"
|
|
38
|
+
"@babel/core": ">=7.26.0",
|
|
39
|
+
"@babel/plugin-proposal-decorators": ">=7.28.0",
|
|
40
|
+
"@babel/preset-typescript": ">=7.27.0",
|
|
41
|
+
"vite": ">=6.2.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"vitest": "^3.2.4"
|
|
43
45
|
},
|
|
44
46
|
"scripts": {
|
|
45
47
|
"prebuild": "node ../../tooling/scripts/clean-dist.mjs",
|
|
46
|
-
"build": "pnpm exec babel src --extensions .ts --ignore 'src/**/*.test.ts' --out-dir dist --config-file ../../tooling/babel/babel.config.cjs && pnpm exec tsc -p tsconfig.build.json",
|
|
48
|
+
"build": "pnpm exec babel src --extensions .ts --ignore 'src/**/*.test.ts','src/**/*.spec.ts' --out-dir dist --config-file ../../tooling/babel/babel.config.cjs && pnpm exec tsc -p tsconfig.build.json",
|
|
47
49
|
"typecheck": "pnpm exec tsc -p tsconfig.json --noEmit",
|
|
48
50
|
"test": "pnpm exec vitest run -c vitest.config.ts",
|
|
49
51
|
"test:watch": "pnpm exec vitest -c vitest.config.ts"
|