@fluojs/vite 1.0.6 → 1.0.7
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 +7 -0
- package/README.md +7 -0
- package/dist/decorators-plugin.d.ts +6 -4
- package/dist/decorators-plugin.d.ts.map +1 -1
- package/dist/decorators-plugin.js +19 -4
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -8,6 +8,7 @@ fluo 프로젝트를 위한 Vite 플러그인과 빌드 유틸리티입니다.
|
|
|
8
8
|
|
|
9
9
|
- [설치](#설치)
|
|
10
10
|
- [사용 시점](#사용-시점)
|
|
11
|
+
- [런타임 및 peer 계약](#런타임-및-peer-계약)
|
|
11
12
|
- [빠른 시작](#빠른-시작)
|
|
12
13
|
- [데코레이터 변환 경계](#데코레이터-변환-경계)
|
|
13
14
|
- [공개 API](#공개-api)
|
|
@@ -28,6 +29,12 @@ npm install --save-dev @fluojs/vite vite @babel/core @babel/plugin-proposal-deco
|
|
|
28
29
|
- starter 프로젝트가 Babel 설정을 inline으로 복사하지 않고 유지보수되는 decorator transform을 import해야 할 때
|
|
29
30
|
- 향후 Vite 대상 fluo 빌드 유틸리티에 독립적인 public package 경계가 필요할 때
|
|
30
31
|
|
|
32
|
+
## 런타임 및 peer 계약
|
|
33
|
+
|
|
34
|
+
`@fluojs/vite`는 `engines.node` 하한을 `>=20.0.0`으로 두는 Node.js 패키지입니다. 생성된 non-Deno starter는 이 Node 기준선과 Vite `>=6.2.0`, 그리고 위에 나열한 Babel peer를 함께 사용합니다.
|
|
35
|
+
|
|
36
|
+
패키지 root는 Babel이 설치되거나 해석되기 전에 import해도 안전합니다. `@fluojs/vite`를 import하거나 `fluoDecoratorsPlugin()`을 생성해도 `@babel/core`를 로드하지 않습니다. Babel은 eligible 애플리케이션 `.ts` 파일에 대한 Vite `transform` hook에서만 lazy load되며, 누락된 Babel peer도 plugin 생성 시점이 아니라 이 transform 경계에서 보고됩니다.
|
|
37
|
+
|
|
31
38
|
## 빠른 시작
|
|
32
39
|
|
|
33
40
|
```ts
|
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Vite plugin and build utilities for fluo projects.
|
|
|
8
8
|
|
|
9
9
|
- [Installation](#installation)
|
|
10
10
|
- [When to Use](#when-to-use)
|
|
11
|
+
- [Runtime and Peer Contract](#runtime-and-peer-contract)
|
|
11
12
|
- [Quick Start](#quick-start)
|
|
12
13
|
- [Decorator Transform Boundary](#decorator-transform-boundary)
|
|
13
14
|
- [Public API](#public-api)
|
|
@@ -28,6 +29,12 @@ npm install --save-dev @fluojs/vite vite @babel/core @babel/plugin-proposal-deco
|
|
|
28
29
|
- when starter projects should import the maintained decorator transform instead of copying Babel configuration inline
|
|
29
30
|
- when future Vite-facing fluo build utilities need a dedicated public package boundary
|
|
30
31
|
|
|
32
|
+
## Runtime and Peer Contract
|
|
33
|
+
|
|
34
|
+
`@fluojs/vite` is a Node.js package with an `engines.node` floor of `>=20.0.0`. Generated non-Deno starters pair that Node baseline with Vite `>=6.2.0` and the Babel peers listed above.
|
|
35
|
+
|
|
36
|
+
The package root is safe to import before Babel is installed or resolved: importing `@fluojs/vite` and creating `fluoDecoratorsPlugin()` do not load `@babel/core`. Babel is loaded lazily only from Vite's `transform` hook for eligible application `.ts` files, and missing Babel peers are reported from that transform boundary instead of plugin creation.
|
|
37
|
+
|
|
31
38
|
## Quick Start
|
|
32
39
|
|
|
33
40
|
```ts
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Creates the Vite plugin used by generated fluo starter projects to transform
|
|
4
|
+
* TypeScript application files that contain TC39 standard decorators.
|
|
5
|
+
*
|
|
6
|
+
* @returns A Vite plugin that lazily loads Babel for eligible application `.ts` files.
|
|
7
|
+
*/
|
|
4
8
|
export declare function fluoDecoratorsPlugin(): Plugin;
|
|
5
|
-
export declare function createFluoDecoratorsPluginForTesting(importBabelCoreModule: BabelCoreImporter): Plugin;
|
|
6
|
-
export {};
|
|
7
9
|
//# sourceMappingURL=decorators-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators-plugin.d.ts","sourceRoot":"","sources":["../src/decorators-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"decorators-plugin.d.ts","sourceRoot":"","sources":["../src/decorators-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAiJnD;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -70,7 +70,7 @@ function shouldRequestBabelSourceMaps(config) {
|
|
|
70
70
|
*/
|
|
71
71
|
function createFluoDecoratorsPlugin(importBabelCoreModule) {
|
|
72
72
|
let shouldGenerateSourceMaps = false;
|
|
73
|
-
let
|
|
73
|
+
let babelCore;
|
|
74
74
|
return {
|
|
75
75
|
name: 'fluo-babel-decorators',
|
|
76
76
|
configResolved(config) {
|
|
@@ -81,9 +81,9 @@ function createFluoDecoratorsPlugin(importBabelCoreModule) {
|
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
83
|
const filePath = readViteFilePath(id);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const result = await
|
|
84
|
+
const loadedBabelCore = babelCore ?? (await loadBabelCore(filePath, importBabelCoreModule));
|
|
85
|
+
babelCore = loadedBabelCore;
|
|
86
|
+
const result = await loadedBabelCore.transformAsync(code, {
|
|
87
87
|
babelrc: false,
|
|
88
88
|
configFile: false,
|
|
89
89
|
filename: filePath,
|
|
@@ -107,9 +107,24 @@ function createFluoDecoratorsPlugin(importBabelCoreModule) {
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Creates the Vite plugin used by generated fluo starter projects to transform
|
|
113
|
+
* TypeScript application files that contain TC39 standard decorators.
|
|
114
|
+
*
|
|
115
|
+
* @returns A Vite plugin that lazily loads Babel for eligible application `.ts` files.
|
|
116
|
+
*/
|
|
110
117
|
export function fluoDecoratorsPlugin() {
|
|
111
118
|
return createFluoDecoratorsPlugin(importBabelCore);
|
|
112
119
|
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Creates the fluo Vite decorators plugin with an injected Babel importer for regression tests.
|
|
123
|
+
*
|
|
124
|
+
* @internal
|
|
125
|
+
* @param importBabelCoreModule - Async loader used instead of the production `@babel/core` dynamic import.
|
|
126
|
+
* @returns A Vite plugin that preserves the production transform boundary while allowing tests to control Babel loading.
|
|
127
|
+
*/
|
|
113
128
|
export function createFluoDecoratorsPluginForTesting(importBabelCoreModule) {
|
|
114
129
|
return createFluoDecoratorsPlugin(importBabelCoreModule);
|
|
115
130
|
}
|