nitro-ui-solid 0.0.1 → 0.1.0-preview.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Margelo
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 copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ 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.
@@ -0,0 +1,5 @@
1
+ import { Plugin } from "rolldown";
2
+ /** Compiles Nitro app TSX to Solid component calls and native renderer operations. */
3
+ export default function solidCompiler(context: {
4
+ readonly root: string;
5
+ }, options?: unknown): Plugin;
@@ -0,0 +1,33 @@
1
+ import { transform } from "@solidjs/compiler";
2
+ import { isAbsolute, relative, resolve } from "node:path";
3
+ // src/compiler.ts
4
+ /** Compiles Nitro app TSX to Solid component calls and native renderer operations. */
5
+ function solidCompiler(context, options) {
6
+ let root = context.root;
7
+ if (options !== void 0) {
8
+ if (typeof options !== "object" || options === null || !("directory" in options) || typeof options.directory !== "string") throw new TypeError("Solid compiler options must provide a source directory.");
9
+ root = resolve(context.root, options.directory);
10
+ }
11
+ return {
12
+ name: "nitro-ui-solid",
13
+ transform: {
14
+ filter: { id: /\.tsx$/ },
15
+ handler(source, filename) {
16
+ const local = relative(root, filename);
17
+ if (!(!isAbsolute(local) && !local.startsWith("..") && !local.split(/[\\/]/).includes("node_modules")) && !source.includes("@jsxImportSource nitro-ui-solid")) return null;
18
+ const result = transform(source, {
19
+ filename,
20
+ generate: "universal",
21
+ moduleName: "nitro-ui-solid",
22
+ sourceMap: true
23
+ });
24
+ return {
25
+ code: result.code,
26
+ map: result.map,
27
+ moduleType: "ts"
28
+ };
29
+ }
30
+ }
31
+ };
32
+ }
33
+ export { solidCompiler as default };