@rozie/babel-plugin 0.1.0
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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/index.cjs +87796 -0
- package/dist/index.d.cts +24 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.mjs +87722 -0
- package/package.json +60 -0
- package/src/compileImport.ts +22 -0
- package/src/index.ts +114 -0
- package/src/writeSibling.ts +122 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dan Krieger and Rozie.js contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @rozie/babel-plugin
|
|
2
|
+
|
|
3
|
+
A Babel 7+ plugin that detects `.rozie` imports and compiles them to a sibling per-target module by calling into `@rozie/core`'s `compile()`. Provides functional parity with `@rozie/unplugin` for non-Vite Babel pipelines (Babel-driven library builds, Metro / React Native, custom toolchains).
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
Shipped. The plugin visits each `import Foo from './Foo.rozie'`, resolves the absolute path from the importer, and writes a sibling `Foo.{ext}` (`.vue` / `.tsx` / `.svelte` / `.ts`, plus React `.d.ts` sidecars) before letting the rest of the Babel pipeline resolve the import. It is intentionally thin — the heavy lifting lives in `@rozie/core.compile()` — and its output is byte-identical to the `@rozie/unplugin` and `@rozie/cli` entrypoints (gated by the `dist-parity` suite). Marked `@experimental` until v1.0.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Not yet published to npm (current version `0.1.0`; publishing is gated on the public release workflow).
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```jsonc
|
|
16
|
+
// babel.config.json
|
|
17
|
+
{
|
|
18
|
+
"plugins": [
|
|
19
|
+
["@rozie/babel-plugin", { "target": "react" }]
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Place it before `@babel/preset-typescript` / `@babel/preset-react` so the sibling file exists by the time they resolve `./Foo.rozie`.
|
|
25
|
+
|
|
26
|
+
## Options — `RozieBabelPluginOptions`
|
|
27
|
+
|
|
28
|
+
| Option | Type | Default | Notes |
|
|
29
|
+
| --- | --- | --- | --- |
|
|
30
|
+
| `target` | `'vue' \| 'react' \| 'svelte' \| 'angular' \| 'solid' \| 'lit'` | — | **Required.** Selects the emit branch and the sibling-file extension. |
|
|
31
|
+
| `angular` | `{ cva?: boolean }` | `{ cva: true }` | Angular-only. `cva: false` suppresses the auto `ControlValueAccessor` emit. No-op for other targets. |
|
|
32
|
+
|
|
33
|
+
## Public exports
|
|
34
|
+
|
|
35
|
+
- `default` — the Babel plugin (a `declare(...)` factory)
|
|
36
|
+
- Type: `RozieBabelPluginOptions`
|
|
37
|
+
|
|
38
|
+
For the Vite/Rollup/Webpack path, see [`@rozie/unplugin`](../unplugin). For ahead-of-time codegen, see [`@rozie/cli`](../cli).
|
|
39
|
+
|
|
40
|
+
## Links
|
|
41
|
+
|
|
42
|
+
- Project orientation: [`CLAUDE.md`](../../CLAUDE.md)
|
|
43
|
+
- Feature reference: [`docs/guide/features.md`](../../docs/guide/features.md)
|
|
44
|
+
- Roadmap: [`.planning/ROADMAP.md`](../../.planning/ROADMAP.md)
|