boss-css 0.0.1 → 0.0.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.
Files changed (268) hide show
  1. package/README.md +1 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +43 -0
  3. package/dist/_virtual/rolldown_runtime.mjs +20 -0
  4. package/dist/api/browser.cjs +54 -0
  5. package/dist/api/browser.mjs +48 -0
  6. package/dist/api/config.cjs +94 -0
  7. package/dist/api/config.mjs +91 -0
  8. package/dist/api/css.cjs +304 -0
  9. package/dist/api/css.mjs +303 -0
  10. package/dist/api/dictionary.cjs +218 -0
  11. package/dist/api/dictionary.mjs +215 -0
  12. package/dist/api/file/dts.cjs +21 -0
  13. package/dist/api/file/dts.mjs +21 -0
  14. package/dist/api/file/file.cjs +123 -0
  15. package/dist/api/file/file.mjs +120 -0
  16. package/dist/api/file/js.cjs +118 -0
  17. package/dist/api/file/js.mjs +116 -0
  18. package/dist/api/names.cjs +52 -0
  19. package/dist/api/names.mjs +46 -0
  20. package/dist/api/noopCss.cjs +37 -0
  21. package/dist/api/noopCss.mjs +36 -0
  22. package/dist/api/propTree.cjs +54 -0
  23. package/dist/api/propTree.mjs +48 -0
  24. package/dist/api/server.cjs +112 -0
  25. package/dist/api/server.mjs +106 -0
  26. package/dist/cli/build.cjs +1 -0
  27. package/dist/cli/build.mjs +3 -0
  28. package/dist/cli/index.cjs +30 -0
  29. package/dist/cli/index.mjs +29 -0
  30. package/dist/cli/tasks/build.cjs +24 -0
  31. package/dist/cli/tasks/build.mjs +23 -0
  32. package/dist/cli/tasks/choose.cjs +47 -0
  33. package/dist/cli/tasks/choose.mjs +46 -0
  34. package/dist/cli/tasks/compile.cjs +68 -0
  35. package/dist/cli/tasks/compile.mjs +67 -0
  36. package/dist/cli/tasks/dev.cjs +51 -0
  37. package/dist/cli/tasks/dev.mjs +48 -0
  38. package/dist/cli/tasks/init.cjs +1835 -0
  39. package/dist/cli/tasks/init.mjs +1831 -0
  40. package/dist/cli/tasks/watch.cjs +38 -0
  41. package/dist/cli/tasks/watch.mjs +37 -0
  42. package/dist/cli/templates/init.cjs +82 -0
  43. package/dist/cli/templates/init.mjs +78 -0
  44. package/dist/cli/types.cjs +13 -0
  45. package/dist/cli/types.mjs +13 -0
  46. package/dist/cli/utils.cjs +43 -0
  47. package/dist/cli/utils.mjs +41 -0
  48. package/dist/compile/classname-strategy.cjs +79 -0
  49. package/dist/compile/classname-strategy.mjs +77 -0
  50. package/dist/compile/classname.cjs +366 -0
  51. package/dist/compile/classname.mjs +360 -0
  52. package/dist/compile/index.cjs +238 -0
  53. package/dist/compile/index.mjs +235 -0
  54. package/dist/compile/jsx.cjs +803 -0
  55. package/dist/compile/jsx.mjs +800 -0
  56. package/dist/compile/prepared.cjs +88 -0
  57. package/dist/compile/prepared.mjs +87 -0
  58. package/dist/compile/runtime.cjs +33 -0
  59. package/dist/compile/runtime.mjs +32 -0
  60. package/dist/compile/transform.cjs +371 -0
  61. package/dist/compile/transform.mjs +369 -0
  62. package/dist/cx/index.cjs +93 -0
  63. package/dist/cx/index.mjs +85 -0
  64. package/dist/detect-fw/index.cjs +384 -0
  65. package/dist/detect-fw/index.mjs +379 -0
  66. package/dist/dev/client.cjs +39 -0
  67. package/dist/dev/client.mjs +38 -0
  68. package/dist/dev/plugin/browser.cjs +11 -0
  69. package/dist/dev/plugin/browser.mjs +9 -0
  70. package/dist/dev/plugin/server.cjs +86 -0
  71. package/dist/dev/plugin/server.mjs +78 -0
  72. package/dist/dev/port.cjs +46 -0
  73. package/dist/dev/port.mjs +43 -0
  74. package/dist/dev/runtime.cjs +28 -0
  75. package/dist/dev/runtime.mjs +29 -0
  76. package/dist/dev/server.cjs +808 -0
  77. package/dist/dev/server.mjs +805 -0
  78. package/dist/dev/shared.cjs +6 -0
  79. package/dist/dev/shared.mjs +5 -0
  80. package/dist/eslint-plugin/index.cjs +66 -0
  81. package/dist/eslint-plugin/index.mjs +66 -0
  82. package/dist/eslint-plugin/rules/classnames-only.cjs +68 -0
  83. package/dist/eslint-plugin/rules/classnames-only.mjs +68 -0
  84. package/dist/eslint-plugin/rules/format-classnames.cjs +137 -0
  85. package/dist/eslint-plugin/rules/format-classnames.mjs +136 -0
  86. package/dist/eslint-plugin/rules/no-unknown-classes.cjs +119 -0
  87. package/dist/eslint-plugin/rules/no-unknown-classes.mjs +119 -0
  88. package/dist/eslint-plugin/rules/prefer-classnames.cjs +69 -0
  89. package/dist/eslint-plugin/rules/prefer-classnames.mjs +69 -0
  90. package/dist/eslint-plugin/rules/prefer-token-values.cjs +197 -0
  91. package/dist/eslint-plugin/rules/prefer-token-values.mjs +197 -0
  92. package/dist/eslint-plugin/rules/props-only.cjs +115 -0
  93. package/dist/eslint-plugin/rules/props-only.mjs +115 -0
  94. package/dist/eslint-plugin/rules/redundant-cx.cjs +66 -0
  95. package/dist/eslint-plugin/rules/redundant-cx.mjs +66 -0
  96. package/dist/eslint-plugin/rules/require-prop-functions.cjs +130 -0
  97. package/dist/eslint-plugin/rules/require-prop-functions.mjs +130 -0
  98. package/dist/eslint-plugin/utils/api.cjs +30 -0
  99. package/dist/eslint-plugin/utils/api.mjs +29 -0
  100. package/dist/eslint-plugin/utils/ast.cjs +119 -0
  101. package/dist/eslint-plugin/utils/ast.mjs +112 -0
  102. package/dist/eslint-plugin/utils/boss-classes.cjs +185 -0
  103. package/dist/eslint-plugin/utils/boss-classes.mjs +175 -0
  104. package/dist/eslint-plugin/utils/defaults.cjs +99 -0
  105. package/dist/eslint-plugin/utils/defaults.mjs +93 -0
  106. package/dist/eslint-plugin/utils/format.cjs +20 -0
  107. package/dist/eslint-plugin/utils/format.mjs +19 -0
  108. package/dist/eslint-plugin/utils/order.cjs +76 -0
  109. package/dist/eslint-plugin/utils/order.mjs +76 -0
  110. package/dist/eslint-plugin/utils/property-order.cjs +449 -0
  111. package/dist/eslint-plugin/utils/property-order.mjs +448 -0
  112. package/dist/eslint-plugin/utils/static.cjs +36 -0
  113. package/dist/eslint-plugin/utils/static.mjs +35 -0
  114. package/dist/fontsource/directory.cjs +39588 -0
  115. package/dist/fontsource/directory.mjs +39587 -0
  116. package/dist/fontsource/server.cjs +291 -0
  117. package/dist/fontsource/server.mjs +282 -0
  118. package/dist/index.cjs +10 -0
  119. package/dist/index.mjs +6 -0
  120. package/dist/log/browser.cjs +28 -0
  121. package/dist/log/browser.mjs +28 -0
  122. package/dist/log/server.cjs +32 -0
  123. package/dist/log/server.mjs +30 -0
  124. package/dist/merge/index.cjs +590 -0
  125. package/dist/merge/index.mjs +586 -0
  126. package/dist/native/browser.cjs +78 -0
  127. package/dist/native/browser.mjs +77 -0
  128. package/dist/native/server.cjs +180 -0
  129. package/dist/native/server.mjs +176 -0
  130. package/dist/native/styleTypes.cjs +168 -0
  131. package/dist/native/styleTypes.mjs +164 -0
  132. package/dist/parser/classname/server.cjs +239 -0
  133. package/dist/parser/classname/server.mjs +232 -0
  134. package/dist/parser/jsx/browser.cjs +66 -0
  135. package/dist/parser/jsx/browser.mjs +63 -0
  136. package/dist/parser/jsx/extractCode.cjs +99 -0
  137. package/dist/parser/jsx/extractCode.mjs +98 -0
  138. package/dist/parser/jsx/extractPrepared.cjs +123 -0
  139. package/dist/parser/jsx/extractPrepared.mjs +122 -0
  140. package/dist/parser/jsx/extractProps.cjs +234 -0
  141. package/dist/parser/jsx/extractProps.mjs +232 -0
  142. package/dist/parser/jsx/isDOMProp.cjs +17 -0
  143. package/dist/parser/jsx/isDOMProp.mjs +15 -0
  144. package/dist/parser/jsx/native.cjs +110 -0
  145. package/dist/parser/jsx/native.mjs +108 -0
  146. package/dist/parser/jsx/runtime.cjs +4 -0
  147. package/dist/parser/jsx/runtime.mjs +3 -0
  148. package/dist/parser/jsx/server.cjs +278 -0
  149. package/dist/parser/jsx/server.mjs +268 -0
  150. package/dist/postcss/index.cjs +16 -0
  151. package/dist/postcss/index.mjs +16 -0
  152. package/dist/prop/at/runtime-only.cjs +90 -0
  153. package/dist/prop/at/runtime-only.mjs +88 -0
  154. package/dist/prop/at/server.cjs +282 -0
  155. package/dist/prop/at/server.mjs +268 -0
  156. package/dist/prop/at/shared.cjs +153 -0
  157. package/dist/prop/at/shared.mjs +144 -0
  158. package/dist/prop/bosswind/browser.cjs +18 -0
  159. package/dist/prop/bosswind/browser.mjs +16 -0
  160. package/dist/prop/bosswind/runtime-only.cjs +18 -0
  161. package/dist/prop/bosswind/runtime-only.mjs +16 -0
  162. package/dist/prop/bosswind/server.cjs +81 -0
  163. package/dist/prop/bosswind/server.mjs +72 -0
  164. package/dist/prop/bosswind/shared.cjs +861 -0
  165. package/dist/prop/bosswind/shared.mjs +855 -0
  166. package/dist/prop/bosswind/tailwind-theme.cjs +703 -0
  167. package/dist/prop/bosswind/tailwind-theme.mjs +702 -0
  168. package/dist/prop/child/runtime-only.cjs +18 -0
  169. package/dist/prop/child/runtime-only.mjs +15 -0
  170. package/dist/prop/child/server.cjs +81 -0
  171. package/dist/prop/child/server.mjs +72 -0
  172. package/dist/prop/css/getDtsTemplate.cjs +65 -0
  173. package/dist/prop/css/getDtsTemplate.mjs +63 -0
  174. package/dist/prop/css/runtime-only.cjs +14 -0
  175. package/dist/prop/css/runtime-only.mjs +13 -0
  176. package/dist/prop/css/server.cjs +99 -0
  177. package/dist/prop/css/server.mjs +90 -0
  178. package/dist/prop/pseudo/runtime-only.cjs +23 -0
  179. package/dist/prop/pseudo/runtime-only.mjs +21 -0
  180. package/dist/prop/pseudo/server.cjs +91 -0
  181. package/dist/prop/pseudo/server.mjs +82 -0
  182. package/dist/prop/pseudo/shared.cjs +61 -0
  183. package/dist/prop/pseudo/shared.mjs +60 -0
  184. package/dist/reset/server.cjs +34 -0
  185. package/dist/reset/server.mjs +26 -0
  186. package/dist/runtime/index.cjs +119 -0
  187. package/dist/runtime/index.mjs +118 -0
  188. package/dist/runtime/preact.cjs +4 -0
  189. package/dist/runtime/preact.mjs +3 -0
  190. package/dist/runtime/qwik.cjs +21 -0
  191. package/dist/runtime/qwik.mjs +18 -0
  192. package/dist/runtime/react.cjs +4 -0
  193. package/dist/runtime/react.mjs +3 -0
  194. package/dist/runtime/solid.cjs +15 -0
  195. package/dist/runtime/solid.mjs +14 -0
  196. package/dist/runtime/stencil.cjs +25 -0
  197. package/dist/runtime/stencil.mjs +21 -0
  198. package/dist/runtime/style.cjs +14 -0
  199. package/dist/runtime/style.mjs +13 -0
  200. package/dist/shared/boundaries.cjs +288 -0
  201. package/dist/shared/boundaries.mjs +285 -0
  202. package/dist/shared/customCss.cjs +212 -0
  203. package/dist/shared/customCss.mjs +211 -0
  204. package/dist/shared/debug.cjs +76 -0
  205. package/dist/shared/debug.mjs +74 -0
  206. package/dist/shared/file.cjs +21 -0
  207. package/dist/shared/file.mjs +19 -0
  208. package/dist/shared/framework.cjs +10 -0
  209. package/dist/shared/framework.mjs +9 -0
  210. package/dist/shared/json.cjs +58 -0
  211. package/dist/shared/json.mjs +57 -0
  212. package/dist/shared/types.cjs +11 -0
  213. package/dist/shared/types.mjs +10 -0
  214. package/dist/strategy/classic/runtime-only.cjs +190 -0
  215. package/dist/strategy/classic/runtime-only.mjs +186 -0
  216. package/dist/strategy/classname-first/runtime-only.cjs +138 -0
  217. package/dist/strategy/classname-first/runtime-only.mjs +134 -0
  218. package/dist/strategy/classname-first/server.cjs +139 -0
  219. package/dist/strategy/classname-first/server.mjs +133 -0
  220. package/dist/strategy/classname-only/server.cjs +43 -0
  221. package/dist/strategy/classname-only/server.mjs +35 -0
  222. package/dist/strategy/inline-first/browser.cjs +61 -0
  223. package/dist/strategy/inline-first/browser.mjs +58 -0
  224. package/dist/strategy/inline-first/runtime-only.cjs +159 -0
  225. package/dist/strategy/inline-first/runtime-only.mjs +155 -0
  226. package/dist/strategy/inline-first/server.cjs +92 -0
  227. package/dist/strategy/inline-first/server.mjs +83 -0
  228. package/dist/strategy/runtime/runtime-only.cjs +24 -0
  229. package/dist/strategy/runtime/runtime-only.mjs +22 -0
  230. package/dist/strategy/runtime/server.cjs +72 -0
  231. package/dist/strategy/runtime/server.mjs +63 -0
  232. package/dist/strategy/runtime-only/css.cjs +183 -0
  233. package/dist/strategy/runtime-only/css.mjs +181 -0
  234. package/dist/tasks/build.cjs +88 -0
  235. package/dist/tasks/build.mjs +84 -0
  236. package/dist/tasks/compile.cjs +12 -0
  237. package/dist/tasks/compile.mjs +12 -0
  238. package/dist/tasks/postcss.cjs +116 -0
  239. package/dist/tasks/postcss.mjs +113 -0
  240. package/dist/tasks/session.cjs +46 -0
  241. package/dist/tasks/session.mjs +42 -0
  242. package/dist/tasks/watch.cjs +102 -0
  243. package/dist/tasks/watch.mjs +99 -0
  244. package/dist/transform/cache.cjs +24 -0
  245. package/dist/transform/cache.mjs +21 -0
  246. package/dist/transform/processFile.cjs +26 -0
  247. package/dist/transform/processFile.mjs +24 -0
  248. package/dist/use/token/browser.cjs +65 -0
  249. package/dist/use/token/browser.mjs +61 -0
  250. package/dist/use/token/runtime-only.cjs +245 -0
  251. package/dist/use/token/runtime-only.mjs +239 -0
  252. package/dist/use/token/server.cjs +325 -0
  253. package/dist/use/token/server.mjs +313 -0
  254. package/dist/use/token/vars.cjs +47 -0
  255. package/dist/use/token/vars.mjs +46 -0
  256. package/package.json +300 -4
  257. package/src/api/config.d.ts +1 -0
  258. package/src/fontsource/types.d.ts +50 -0
  259. package/src/packages/document-create-element/createElement.browser.js +3 -0
  260. package/src/packages/document-create-element/createElement.js +7 -0
  261. package/src/packages/document-create-element/package.json +17 -0
  262. package/src/packages/is-css-prop/browser.js +13 -0
  263. package/src/packages/is-css-prop/index.js +13 -0
  264. package/src/packages/is-css-prop/package-lock.json +52 -0
  265. package/src/packages/is-css-prop/package.json +17 -0
  266. package/src/prop/css/csstype.json +4387 -0
  267. package/src/prop/css/package.json +3 -0
  268. package/src/reset/reset.css +259 -0
@@ -0,0 +1,215 @@
1
+ //#region src/api/dictionary.ts
2
+ var Dictionary = class Dictionary extends Map {
3
+ static Instance;
4
+ api;
5
+ constructor(api) {
6
+ super();
7
+ Dictionary.Instance = this;
8
+ this.api = api;
9
+ }
10
+ resolve(name) {
11
+ const direct = this.get(name);
12
+ if (direct) return {
13
+ descriptor: direct,
14
+ name,
15
+ raw: name,
16
+ suffix: null
17
+ };
18
+ if (typeof name !== "string") return {
19
+ descriptor: null,
20
+ name,
21
+ raw: name,
22
+ suffix: null
23
+ };
24
+ const underscoreIndex = name.indexOf("_");
25
+ if (underscoreIndex <= 0 || underscoreIndex === name.length - 1) return {
26
+ descriptor: null,
27
+ name,
28
+ raw: name,
29
+ suffix: null
30
+ };
31
+ const base = name.slice(0, underscoreIndex);
32
+ const suffix = name.slice(underscoreIndex + 1);
33
+ const descriptor = this.get(base);
34
+ if (!descriptor) return {
35
+ descriptor: null,
36
+ name,
37
+ raw: name,
38
+ suffix: null
39
+ };
40
+ return {
41
+ descriptor,
42
+ name: base,
43
+ raw: name,
44
+ suffix
45
+ };
46
+ }
47
+ set(key, value) {
48
+ for (const alias of value.aliases) super.set(alias, value);
49
+ return this;
50
+ }
51
+ toValue(value, property) {
52
+ const propertyName = typeof property === "string" ? property : property?.property ?? property?.aliases?.[0];
53
+ switch (true) {
54
+ case Array.isArray(value): return value.map((v) => this.toValue(v, property)).join(" ");
55
+ case typeof value === "number":
56
+ case isNumericValue(value): {
57
+ const numericValue = typeof value === "number" ? value : Number(value);
58
+ if (propertyName && unitlessProperties.has(propertyName)) return numericValue === 0 ? 0 : `${value}`;
59
+ return numericValue === 0 ? 0 : `${value}${this.api.unit}`;
60
+ }
61
+ default: return value;
62
+ }
63
+ }
64
+ };
65
+ const unitlessProperties = new Set([
66
+ "animationIterationCount",
67
+ "aspectRatio",
68
+ "borderImageOutset",
69
+ "borderImageSlice",
70
+ "borderImageWidth",
71
+ "boxFlex",
72
+ "boxFlexGroup",
73
+ "boxOrdinalGroup",
74
+ "columnCount",
75
+ "columns",
76
+ "flex",
77
+ "flexGrow",
78
+ "flexPositive",
79
+ "flexShrink",
80
+ "flexNegative",
81
+ "flexOrder",
82
+ "gridArea",
83
+ "gridRow",
84
+ "gridRowEnd",
85
+ "gridRowSpan",
86
+ "gridRowStart",
87
+ "gridColumn",
88
+ "gridColumnEnd",
89
+ "gridColumnSpan",
90
+ "gridColumnStart",
91
+ "fontWeight",
92
+ "lineClamp",
93
+ "lineHeight",
94
+ "opacity",
95
+ "order",
96
+ "orphans",
97
+ "scale",
98
+ "tabSize",
99
+ "widows",
100
+ "zIndex",
101
+ "zoom",
102
+ "fillOpacity",
103
+ "floodOpacity",
104
+ "stopOpacity",
105
+ "strokeDasharray",
106
+ "strokeDashoffset",
107
+ "strokeMiterlimit",
108
+ "strokeOpacity",
109
+ "strokeWidth",
110
+ "MozAnimationIterationCount",
111
+ "MozBoxFlex",
112
+ "MozBoxFlexGroup",
113
+ "MozLineClamp",
114
+ "msAnimationIterationCount",
115
+ "msFlex",
116
+ "msFlexGrow",
117
+ "msFlexNegative",
118
+ "msFlexOrder",
119
+ "msFlexPositive",
120
+ "msFlexShrink",
121
+ "msGridColumn",
122
+ "msGridColumnSpan",
123
+ "msGridRow",
124
+ "msGridRowSpan",
125
+ "msZoom",
126
+ "WebkitAnimationIterationCount",
127
+ "WebkitBoxFlex",
128
+ "WebkitBoxFlexGroup",
129
+ "WebkitBoxOrdinalGroup",
130
+ "WebkitColumnCount",
131
+ "WebkitColumns",
132
+ "WebkitFlex",
133
+ "WebkitFlexGrow",
134
+ "WebkitFlexPositive",
135
+ "WebkitFlexShrink",
136
+ "WebkitLineClamp",
137
+ "animation-iteration-count",
138
+ "aspect-ratio",
139
+ "border-image-outset",
140
+ "border-image-slice",
141
+ "border-image-width",
142
+ "box-flex",
143
+ "box-flex-group",
144
+ "box-ordinal-group",
145
+ "column-count",
146
+ "columns",
147
+ "flex",
148
+ "flex-grow",
149
+ "flex-positive",
150
+ "flex-shrink",
151
+ "flex-negative",
152
+ "flex-order",
153
+ "grid-area",
154
+ "grid-row",
155
+ "grid-row-end",
156
+ "grid-row-span",
157
+ "grid-row-start",
158
+ "grid-column",
159
+ "grid-column-end",
160
+ "grid-column-span",
161
+ "grid-column-start",
162
+ "font-weight",
163
+ "line-clamp",
164
+ "line-height",
165
+ "opacity",
166
+ "order",
167
+ "orphans",
168
+ "scale",
169
+ "tab-size",
170
+ "widows",
171
+ "z-index",
172
+ "zoom",
173
+ "fill-opacity",
174
+ "flood-opacity",
175
+ "stop-opacity",
176
+ "stroke-dasharray",
177
+ "stroke-dashoffset",
178
+ "stroke-miterlimit",
179
+ "stroke-opacity",
180
+ "stroke-width",
181
+ "-moz-animation-iteration-count",
182
+ "-moz-box-flex",
183
+ "-moz-box-flex-group",
184
+ "-moz-line-clamp",
185
+ "-ms-animation-iteration-count",
186
+ "-ms-flex",
187
+ "-ms-flex-grow",
188
+ "-ms-flex-negative",
189
+ "-ms-flex-order",
190
+ "-ms-flex-positive",
191
+ "-ms-flex-shrink",
192
+ "-ms-grid-column",
193
+ "-ms-grid-column-span",
194
+ "-ms-grid-row",
195
+ "-ms-grid-row-span",
196
+ "-ms-zoom",
197
+ "-webkit-animation-iteration-count",
198
+ "-webkit-box-flex",
199
+ "-webkit-box-flex-group",
200
+ "-webkit-box-ordinal-group",
201
+ "-webkit-column-count",
202
+ "-webkit-columns",
203
+ "-webkit-flex",
204
+ "-webkit-flex-grow",
205
+ "-webkit-flex-positive",
206
+ "-webkit-flex-shrink",
207
+ "-webkit-line-clamp"
208
+ ]);
209
+ const isNumericValue = (value) => {
210
+ if (typeof value === "number") return true;
211
+ return /^-?\d+(?:\.\d+)?$/.test(value);
212
+ };
213
+
214
+ //#endregion
215
+ export { Dictionary, isNumericValue, unitlessProperties };
@@ -0,0 +1,21 @@
1
+ const require_file = require('./file.cjs');
2
+
3
+ //#region src/api/file/dts.ts
4
+ var Dts = class extends require_file.default {
5
+ get headers() {
6
+ return [
7
+ ...super.headers,
8
+ ["$$:ts-nocheck", { content: "// @ts-nocheck" }],
9
+ ["$$:eslint-disable", { content: "/* eslint-disable */" }]
10
+ ];
11
+ }
12
+ onText(key, value) {
13
+ if (value && (typeof key === "string" ? key : null)?.endsWith(":description")) return ` /**
14
+ ${(typeof value === "string" ? value : String(value)).split("\n").map((line) => ` * ${line}`).join("\n")}
15
+ */`;
16
+ return value;
17
+ }
18
+ };
19
+
20
+ //#endregion
21
+ exports.default = Dts;
@@ -0,0 +1,21 @@
1
+ import File from "./file.mjs";
2
+
3
+ //#region src/api/file/dts.ts
4
+ var Dts = class extends File {
5
+ get headers() {
6
+ return [
7
+ ...super.headers,
8
+ ["$$:ts-nocheck", { content: "// @ts-nocheck" }],
9
+ ["$$:eslint-disable", { content: "/* eslint-disable */" }]
10
+ ];
11
+ }
12
+ onText(key, value) {
13
+ if (value && (typeof key === "string" ? key : null)?.endsWith(":description")) return ` /**
14
+ ${(typeof value === "string" ? value : String(value)).split("\n").map((line) => ` * ${line}`).join("\n")}
15
+ */`;
16
+ return value;
17
+ }
18
+ };
19
+
20
+ //#endregion
21
+ export { Dts as default };
@@ -0,0 +1,123 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let node_fs_promises = require("node:fs/promises");
3
+ node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises);
4
+ let node_path = require("node:path");
5
+ node_path = require_rolldown_runtime.__toESM(node_path);
6
+
7
+ //#region src/api/file/file.ts
8
+ var File = class extends Map {
9
+ api;
10
+ options;
11
+ constructor(api, options = { path: "" }) {
12
+ super();
13
+ this.api = api;
14
+ this.options = options;
15
+ super.set("head", /* @__PURE__ */ new Map());
16
+ super.set("import", /* @__PURE__ */ new Map());
17
+ super.set("body", /* @__PURE__ */ new Map());
18
+ super.set("foot", /* @__PURE__ */ new Map());
19
+ }
20
+ get(section) {
21
+ const existing = super.get(section);
22
+ if (existing) return existing;
23
+ const next = /* @__PURE__ */ new Map();
24
+ super.set(section, next);
25
+ return next;
26
+ }
27
+ get headers() {
28
+ return [["$$:auto-generated-warning", { content: `//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
29
+ // Generated code. Do not edit!
30
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` }]];
31
+ }
32
+ get hasContent() {
33
+ for (const section of this.values()) if (section.size > 0) return true;
34
+ return false;
35
+ }
36
+ onText(key, value) {
37
+ return value;
38
+ }
39
+ get text() {
40
+ const results = [];
41
+ for (const [key, section] of this.entries()) {
42
+ const entries = section.entries();
43
+ for (const [entryKey, entry] of entries) {
44
+ const { content, test } = entry;
45
+ if (!test || test()) {
46
+ results.push(this.onText(entryKey, typeof content === "function" ? content(entry) : content));
47
+ results.push("\n");
48
+ }
49
+ }
50
+ section.size && results.push("\n");
51
+ }
52
+ return results.join("").trim();
53
+ }
54
+ set(sectionOrKey, keyOrValue, content, test) {
55
+ if (content !== void 0 || typeof keyOrValue !== "object" || keyOrValue === null) {
56
+ const section = sectionOrKey;
57
+ const key = keyOrValue ?? (keyOrValue === null ? performance.now() : void 0);
58
+ const entryTest = test ?? (() => true);
59
+ if (this.get("head").size === 0) this.headers.forEach((entry) => this.get("head").set(...entry));
60
+ this.get(section).set(key, {
61
+ content,
62
+ test: entryTest
63
+ });
64
+ return this;
65
+ }
66
+ return super.set(sectionOrKey, keyOrValue);
67
+ }
68
+ append(section, key, content, test = () => true) {
69
+ const existing = this.get(section).get(key) || {
70
+ content: "",
71
+ test
72
+ };
73
+ if (typeof content === "string") {
74
+ const existingContent = typeof existing.content === "string" ? existing.content : "";
75
+ this.get(section).set(key, {
76
+ ...existing,
77
+ content: existingContent + content
78
+ });
79
+ } else throw new Error("File:append content must be a string");
80
+ return this;
81
+ }
82
+ prepend(section, key, content, test = () => true) {
83
+ const existing = this.get(section).get(key) || {
84
+ content: "",
85
+ test
86
+ };
87
+ if (typeof content === "string") {
88
+ const existingContent = typeof existing.content === "string" ? existing.content : "";
89
+ this.get(section).set(key, {
90
+ ...existing,
91
+ content: content + existingContent
92
+ });
93
+ } else throw new Error("File:prepend content must be a string");
94
+ return this;
95
+ }
96
+ replace(section, key, callback) {
97
+ const existing = this.get(section).get(key);
98
+ const value = callback(existing?.content, existing);
99
+ if (typeof value === "string") this.get(section).set(key, {
100
+ ...existing ?? {},
101
+ content: value
102
+ });
103
+ else this.get(section).set(key, {
104
+ ...existing ?? {},
105
+ ...value
106
+ });
107
+ return this;
108
+ }
109
+ _prevText = "";
110
+ async write() {
111
+ const text = this.text;
112
+ if (text === this._prevText) return;
113
+ const baseDir = typeof this.api.baseDir === "string" ? this.api.baseDir : process.cwd();
114
+ const folder = this.api.folder ?? ".bo$$";
115
+ const folderPath = node_path.default.isAbsolute(folder) ? folder : node_path.default.join(baseDir, folder);
116
+ await node_fs_promises.default.mkdir(folderPath, { recursive: true });
117
+ await node_fs_promises.default.writeFile(node_path.default.join(folderPath, this.options.path), text);
118
+ this._prevText = text;
119
+ }
120
+ };
121
+
122
+ //#endregion
123
+ exports.default = File;
@@ -0,0 +1,120 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+
4
+ //#region src/api/file/file.ts
5
+ var File = class extends Map {
6
+ api;
7
+ options;
8
+ constructor(api, options = { path: "" }) {
9
+ super();
10
+ this.api = api;
11
+ this.options = options;
12
+ super.set("head", /* @__PURE__ */ new Map());
13
+ super.set("import", /* @__PURE__ */ new Map());
14
+ super.set("body", /* @__PURE__ */ new Map());
15
+ super.set("foot", /* @__PURE__ */ new Map());
16
+ }
17
+ get(section) {
18
+ const existing = super.get(section);
19
+ if (existing) return existing;
20
+ const next = /* @__PURE__ */ new Map();
21
+ super.set(section, next);
22
+ return next;
23
+ }
24
+ get headers() {
25
+ return [["$$:auto-generated-warning", { content: `//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26
+ // Generated code. Do not edit!
27
+ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!` }]];
28
+ }
29
+ get hasContent() {
30
+ for (const section of this.values()) if (section.size > 0) return true;
31
+ return false;
32
+ }
33
+ onText(key, value) {
34
+ return value;
35
+ }
36
+ get text() {
37
+ const results = [];
38
+ for (const [key, section] of this.entries()) {
39
+ const entries = section.entries();
40
+ for (const [entryKey, entry] of entries) {
41
+ const { content, test } = entry;
42
+ if (!test || test()) {
43
+ results.push(this.onText(entryKey, typeof content === "function" ? content(entry) : content));
44
+ results.push("\n");
45
+ }
46
+ }
47
+ section.size && results.push("\n");
48
+ }
49
+ return results.join("").trim();
50
+ }
51
+ set(sectionOrKey, keyOrValue, content, test) {
52
+ if (content !== void 0 || typeof keyOrValue !== "object" || keyOrValue === null) {
53
+ const section = sectionOrKey;
54
+ const key = keyOrValue ?? (keyOrValue === null ? performance.now() : void 0);
55
+ const entryTest = test ?? (() => true);
56
+ if (this.get("head").size === 0) this.headers.forEach((entry) => this.get("head").set(...entry));
57
+ this.get(section).set(key, {
58
+ content,
59
+ test: entryTest
60
+ });
61
+ return this;
62
+ }
63
+ return super.set(sectionOrKey, keyOrValue);
64
+ }
65
+ append(section, key, content, test = () => true) {
66
+ const existing = this.get(section).get(key) || {
67
+ content: "",
68
+ test
69
+ };
70
+ if (typeof content === "string") {
71
+ const existingContent = typeof existing.content === "string" ? existing.content : "";
72
+ this.get(section).set(key, {
73
+ ...existing,
74
+ content: existingContent + content
75
+ });
76
+ } else throw new Error("File:append content must be a string");
77
+ return this;
78
+ }
79
+ prepend(section, key, content, test = () => true) {
80
+ const existing = this.get(section).get(key) || {
81
+ content: "",
82
+ test
83
+ };
84
+ if (typeof content === "string") {
85
+ const existingContent = typeof existing.content === "string" ? existing.content : "";
86
+ this.get(section).set(key, {
87
+ ...existing,
88
+ content: content + existingContent
89
+ });
90
+ } else throw new Error("File:prepend content must be a string");
91
+ return this;
92
+ }
93
+ replace(section, key, callback) {
94
+ const existing = this.get(section).get(key);
95
+ const value = callback(existing?.content, existing);
96
+ if (typeof value === "string") this.get(section).set(key, {
97
+ ...existing ?? {},
98
+ content: value
99
+ });
100
+ else this.get(section).set(key, {
101
+ ...existing ?? {},
102
+ ...value
103
+ });
104
+ return this;
105
+ }
106
+ _prevText = "";
107
+ async write() {
108
+ const text = this.text;
109
+ if (text === this._prevText) return;
110
+ const baseDir = typeof this.api.baseDir === "string" ? this.api.baseDir : process.cwd();
111
+ const folder = this.api.folder ?? ".bo$$";
112
+ const folderPath = path.isAbsolute(folder) ? folder : path.join(baseDir, folder);
113
+ await fs.mkdir(folderPath, { recursive: true });
114
+ await fs.writeFile(path.join(folderPath, this.options.path), text);
115
+ this._prevText = text;
116
+ }
117
+ };
118
+
119
+ //#endregion
120
+ export { File as default };
@@ -0,0 +1,118 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_file = require('./file.cjs');
3
+ const require_dts = require('./dts.cjs');
4
+ let _emotion_hash = require("@emotion/hash");
5
+ _emotion_hash = require_rolldown_runtime.__toESM(_emotion_hash);
6
+
7
+ //#region src/api/file/js.ts
8
+ var JS = class extends require_file.default {
9
+ _d;
10
+ get dts() {
11
+ return this._d ??= new require_dts.default(this.api, { path: this.options.path.replace(/\.js$/, ".d.ts") });
12
+ }
13
+ get headers() {
14
+ return [
15
+ ...super.headers,
16
+ ["$$:eslint-disable", { content: "/* eslint-disable */" }],
17
+ ["$$:ts-nocheck", { content: "// @ts-nocheck" }]
18
+ ];
19
+ }
20
+ import({ name = null, from, as = null }, test = () => true) {
21
+ const imports = this.get("import");
22
+ if (name === "*") {
23
+ const alias = as ?? `namespace_${(0, _emotion_hash.default)(from)}`;
24
+ if (imports.has(alias)) return alias;
25
+ imports.set(alias, {
26
+ content: `import * as ${alias} from '${from}'`,
27
+ test
28
+ });
29
+ return alias;
30
+ }
31
+ const key = `${name}_${(0, _emotion_hash.default)(from)}`;
32
+ if (imports.has(key)) return key;
33
+ if (name === "default") imports.set(key, {
34
+ content: `import ${key} from '${from}'`,
35
+ test
36
+ });
37
+ else if (name) imports.set(key, {
38
+ content: `import { ${name} as ${key} } from '${from}'`,
39
+ test
40
+ });
41
+ else imports.set(key, {
42
+ content: `import '${from}'`,
43
+ test
44
+ });
45
+ return key;
46
+ }
47
+ _configs = /* @__PURE__ */ new Map();
48
+ config({ from, config }, test = () => true) {
49
+ const existing = this._configs.get(from);
50
+ const configEntry = {
51
+ ...existing,
52
+ config: {
53
+ ...existing?.config,
54
+ ...config
55
+ },
56
+ test
57
+ };
58
+ if (existing?.plugin && config?.plugin) configEntry.config.plugin = {
59
+ ...existing.config.plugin,
60
+ ...config.plugin
61
+ };
62
+ this._configs.set(from, configEntry);
63
+ const testHasConfig = () => Array.from(this._configs.values()).some(({ test: test$1 }) => !test$1 || test$1());
64
+ const createApiVar = this.import({
65
+ name: "createApi",
66
+ from: "boss-css/api/browser"
67
+ }, testHasConfig);
68
+ this.set("body", "$$:createApiStart", `${createApiVar}({`, testHasConfig);
69
+ const serializeConfigValue = (value, keyHint) => JSON.stringify(value, (k, v) => {
70
+ const name = k || keyHint;
71
+ if (typeof v === "string" && name) {
72
+ if (v.startsWith(`${name}_`)) return `$$__${v}__$$`;
73
+ if (name === "runtimeApi" && v === name) return `$$__${v}__$$`;
74
+ }
75
+ return v;
76
+ }, 2).replace(/"\$\$__|__\$\$"/g, "");
77
+ this.set("body", "$$:createApiRoot", () => {
78
+ const results = [];
79
+ for (const conf of this._configs.values()) {
80
+ if (conf.test && !conf.test()) continue;
81
+ Object.entries(conf.config).forEach(([key, value]) => {
82
+ if (key === "plugin" || key === "plugins") return;
83
+ if (value === void 0) return;
84
+ results.push(`${key}: ${serializeConfigValue(value, key)},`);
85
+ });
86
+ }
87
+ return results.join("\n");
88
+ }, testHasConfig);
89
+ this.set("body", "$$:createApiPlugins", () => {
90
+ const results = [];
91
+ for (const conf of this._configs.values()) {
92
+ if (conf.test && !conf.test()) continue;
93
+ if (!conf.config?.plugin) continue;
94
+ results.push(`${serializeConfigValue(conf.config.plugin)}`);
95
+ }
96
+ return results.length ? `plugins: [${results.join(",\n")}],` : "";
97
+ }, testHasConfig);
98
+ this.set("body", "$$:createApiEnd", `})`, testHasConfig);
99
+ }
100
+ importAndConfig({ name, from }, test = () => true) {
101
+ const key = this.import({
102
+ name,
103
+ from
104
+ }, test);
105
+ this.config({
106
+ from,
107
+ config: { plugin: { [name]: key } }
108
+ }, test);
109
+ return key;
110
+ }
111
+ async write() {
112
+ await super.write();
113
+ await this.dts.write();
114
+ }
115
+ };
116
+
117
+ //#endregion
118
+ exports.default = JS;