@rolldown-plugin/solid 0.0.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,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Roman A
4
+ Copyright (c) 2025 gmero
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,184 @@
1
+ # @rolldown-plugin/solid
2
+
3
+ A Rolldown plugin for compiling SolidJS JSX/TSX files.
4
+
5
+ **This is a fork of [rolldown-plugin-solid](https://github.com/g-mero/rolldown-plugin-solid)**
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ # Using bun
11
+ bun add -d @rolldown-plugin/solid
12
+
13
+ # Using pnpm
14
+ pnpm add -D @rolldown-plugin/solid
15
+
16
+ # Using npm
17
+ npm install --save-dev @rolldown-plugin/solid
18
+
19
+ # Using yarn
20
+ yarn add --dev @rolldown-plugin/solid
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### Basic Setup
26
+
27
+ Create a `rolldown.config.js` file in your project root:
28
+
29
+ ```javascript
30
+ import { defineConfig } from 'rolldown';
31
+ import solid from '@rolldown-plugin/solid';
32
+
33
+ export default defineConfig({
34
+ input: 'src/index.tsx',
35
+ plugins: [
36
+ solid()
37
+ ],
38
+ });
39
+ ```
40
+
41
+ ## Configuration Options
42
+
43
+ The plugin accepts an options object with the following properties:
44
+
45
+ ### Basic Options
46
+
47
+ ```typescript
48
+ interface Options {
49
+ /** TypeScript preset options */
50
+ typescript?: object;
51
+
52
+ /** Solid-specific options */
53
+ solid?: SolidOptions;
54
+ }
55
+ ```
56
+
57
+ ### Solid Options
58
+
59
+ ```typescript
60
+ interface SolidOptions {
61
+ /** Runtime module name @default "solid-js/web" */
62
+ moduleName?: string;
63
+
64
+ /** Output mode @default "dom" */
65
+ generate?: 'ssr' | 'dom' | 'universal';
66
+
67
+ /** Enable hydration markers @default false */
68
+ hydratable?: boolean;
69
+
70
+ /** Enable automatic event delegation @default true */
71
+ delegateEvents?: boolean;
72
+
73
+ /** Enable smart conditional detection @default true */
74
+ wrapConditionals?: boolean;
75
+
76
+ /** Set render context on Custom Elements @default true */
77
+ contextToCustomElements?: boolean;
78
+
79
+ /** Built-in components to auto-import */
80
+ builtIns?: string[];
81
+ }
82
+ ```
83
+
84
+ ### Basic SolidJS App
85
+
86
+ ```typescript
87
+ // src/App.tsx
88
+ import { createSignal } from 'solid-js';
89
+
90
+ export default function App() {
91
+ const [count, setCount] = createSignal(0);
92
+
93
+ return (
94
+ <div>
95
+ <h1>Count: {count()}</h1>
96
+ <button onClick={() => setCount(count() + 1)}>
97
+ Increment
98
+ </button>
99
+ </div>
100
+ );
101
+ }
102
+ ```
103
+
104
+ ### SSR Configuration
105
+
106
+ ```javascript
107
+ // rolldown.config.js
108
+ import { defineConfig } from 'rolldown';
109
+ import solid from '@rolldown-plugin/solid';
110
+
111
+ export default defineConfig({
112
+ input: 'src/server.tsx',
113
+ plugins: [
114
+ solid({
115
+ solid: {
116
+ generate: 'ssr',
117
+ hydratable: true
118
+ }
119
+ })
120
+ ],
121
+ });
122
+ ```
123
+
124
+ ### Advanced Configuration
125
+
126
+ ```javascript
127
+ // rolldown.config.js
128
+ import { defineConfig } from 'rolldown';
129
+ import solid from '@rolldown-plugin/solid';
130
+
131
+ export default defineConfig({
132
+ input: 'src/index.tsx',
133
+ plugins: [
134
+ solid({
135
+ // TypeScript options
136
+ typescript: {
137
+ onlyRemoveTypeImports: true
138
+ },
139
+
140
+ // Solid options
141
+ solid: {
142
+ moduleName: 'solid-js/web',
143
+ generate: 'dom',
144
+ hydratable: false,
145
+ delegateEvents: true,
146
+ wrapConditionals: true,
147
+ contextToCustomElements: true,
148
+ builtIns: [
149
+ 'For', 'Show', 'Switch', 'Match',
150
+ 'Suspense', 'SuspenseList', 'Portal',
151
+ 'Index', 'Dynamic', 'ErrorBoundary'
152
+ ]
153
+ },
154
+ })
155
+ ],
156
+ });
157
+ ```
158
+
159
+ ### Universal/Isomorphic Setup
160
+
161
+ ```javascript
162
+ // rolldown.config.js
163
+ import { defineConfig } from 'rolldown';
164
+ import solid from '@rolldown-plugin/solid';
165
+
166
+ export default defineConfig({
167
+ input: 'src/index.tsx',
168
+ plugins: [
169
+ solid({
170
+ solid: {
171
+ generate: 'universal',
172
+ moduleName: 'solid-js/universal'
173
+ }
174
+ })
175
+ ],
176
+ });
177
+ ```
178
+
179
+ ## Related Projects
180
+
181
+ - [Rolldown](https://github.com/rolldown/rolldown) - Fast Rust-based bundler
182
+ - [SolidJS](https://github.com/solidjs/solid) - Simple and performant reactivity
183
+ - [rolldown-plugin-solid](https://github.com/g-mero/rolldown-plugin-solid) - Original plugin for rolldown
184
+ - [babel-preset-solid](https://github.com/solidjs/solid/tree/main/packages/babel-preset-solid) - Babel preset for Solid
@@ -0,0 +1,83 @@
1
+ import { RolldownPlugin } from "rolldown";
2
+
3
+ //#region src/preset-typescript/normalize-options.d.ts
4
+ interface Options$1 {
5
+ ignoreExtensions?: boolean;
6
+ allowDeclareFields?: boolean;
7
+ allowNamespaces?: boolean;
8
+ disallowAmbiguousJSXLike?: boolean;
9
+ jsxPragma?: string;
10
+ jsxPragmaFrag?: string;
11
+ onlyRemoveTypeImports?: boolean;
12
+ optimizeConstEnums?: boolean;
13
+ rewriteImportExtensions?: boolean;
14
+ allExtensions?: boolean;
15
+ isTSX?: boolean;
16
+ }
17
+ //#endregion
18
+ //#region src/index.d.ts
19
+ /** Configuration options */
20
+ interface Options {
21
+ /** The options to use for @babel/preset-typescript @default {} */
22
+ typescript?: Options$1;
23
+ /**
24
+ * Pass any additional [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main/packages/babel-plugin-jsx-dom-expressions#plugin-options).
25
+ * They will be merged with the defaults sets by [babel-preset-solid](https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js#L8-L25).
26
+ *
27
+ * @default {}
28
+ */
29
+ solid?: {
30
+ /**
31
+ * The name of the runtime module to import the methods from.
32
+ *
33
+ * @default "solid-js/web"
34
+ */
35
+ moduleName?: string;
36
+ /**
37
+ * The output mode of the compiler.
38
+ * Can be:
39
+ * - "dom" is standard output
40
+ * - "ssr" is for server side rendering of strings.
41
+ * - "universal" is for using custom renderers from solid-js/universal
42
+ *
43
+ * @default "dom"
44
+ */
45
+ generate?: "ssr" | "dom" | "universal";
46
+ /**
47
+ * Indicate whether the output should contain hydratable markers.
48
+ *
49
+ * @default false
50
+ */
51
+ hydratable?: boolean;
52
+ /**
53
+ * Boolean to indicate whether to enable automatic event delegation on camelCase.
54
+ *
55
+ * @default true
56
+ */
57
+ delegateEvents?: boolean;
58
+ /**
59
+ * Boolean indicates whether smart conditional detection should be used.
60
+ * This optimizes simple boolean expressions and ternaries in JSX.
61
+ *
62
+ * @default true
63
+ */
64
+ wrapConditionals?: boolean;
65
+ /**
66
+ * Boolean indicates whether to set current render context on Custom Elements and slots.
67
+ * Useful for seemless Context API with Web Components.
68
+ *
69
+ * @default true
70
+ */
71
+ contextToCustomElements?: boolean;
72
+ /**
73
+ * Array of Component exports from module, that aren't included by default with the library.
74
+ * This plugin will automatically import them if it comes across them in the JSX.
75
+ *
76
+ * @default ["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"]
77
+ */
78
+ builtIns?: string[];
79
+ };
80
+ }
81
+ declare const rolldownPluginSolid: (options?: Options) => RolldownPlugin;
82
+ //#endregion
83
+ export { Options, rolldownPluginSolid as default };