boss-css 0.0.1 → 0.0.2

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,38 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_watch = require('../../tasks/watch.cjs');
3
+ let _clack_prompts = require("@clack/prompts");
4
+
5
+ //#region src/cli/tasks/watch.ts
6
+ const watch = async (config) => {
7
+ return [{ prompt: async () => {
8
+ const formatDuration = (ms) => {
9
+ if (ms < 1e3) return `${ms.toFixed(0)}ms`;
10
+ if (ms < 6e4) return `${(ms / 1e3).toFixed(2)}s`;
11
+ return `${(ms / 6e4).toFixed(2)}m`;
12
+ };
13
+ try {
14
+ await require_watch.runWatch(config.userConfig, {
15
+ onBuild: (result) => {
16
+ const cssNote = result.cssPath ? `${result.cssBytes} bytes -> ${result.cssPath}` : "runtime-only (no css output)";
17
+ _clack_prompts.log.message(`boss watch updated (${result.filesParsed} files, ${cssNote}, ${formatDuration(result.durationMs)}).`);
18
+ },
19
+ onError: (error) => {
20
+ _clack_prompts.log.error(`boss watch error: ${error.message}`);
21
+ },
22
+ onReady: () => {
23
+ _clack_prompts.log.message("boss watch listening for changes...");
24
+ }
25
+ });
26
+ } catch (error) {
27
+ const message = error instanceof Error ? error.message : "boss watch failed.";
28
+ _clack_prompts.log.error(message);
29
+ process.exit(1);
30
+ }
31
+ await new Promise(() => {});
32
+ return true;
33
+ } }];
34
+ };
35
+ var watch_default = watch;
36
+
37
+ //#endregion
38
+ exports.default = watch_default;
@@ -0,0 +1,37 @@
1
+ import { runWatch } from "../../tasks/watch.mjs";
2
+ import { log } from "@clack/prompts";
3
+
4
+ //#region src/cli/tasks/watch.ts
5
+ const watch = async (config) => {
6
+ return [{ prompt: async () => {
7
+ const formatDuration = (ms) => {
8
+ if (ms < 1e3) return `${ms.toFixed(0)}ms`;
9
+ if (ms < 6e4) return `${(ms / 1e3).toFixed(2)}s`;
10
+ return `${(ms / 6e4).toFixed(2)}m`;
11
+ };
12
+ try {
13
+ await runWatch(config.userConfig, {
14
+ onBuild: (result) => {
15
+ const cssNote = result.cssPath ? `${result.cssBytes} bytes -> ${result.cssPath}` : "runtime-only (no css output)";
16
+ log.message(`boss watch updated (${result.filesParsed} files, ${cssNote}, ${formatDuration(result.durationMs)}).`);
17
+ },
18
+ onError: (error) => {
19
+ log.error(`boss watch error: ${error.message}`);
20
+ },
21
+ onReady: () => {
22
+ log.message("boss watch listening for changes...");
23
+ }
24
+ });
25
+ } catch (error) {
26
+ const message = error instanceof Error ? error.message : "boss watch failed.";
27
+ log.error(message);
28
+ process.exit(1);
29
+ }
30
+ await new Promise(() => {});
31
+ return true;
32
+ } }];
33
+ };
34
+ var watch_default = watch;
35
+
36
+ //#endregion
37
+ export { watch_default as default };
@@ -0,0 +1,82 @@
1
+
2
+ //#region src/cli/templates/init.ts
3
+ const configTemplate = `/* eslint-disable */
4
+ // @ts-check
5
+ // @@@ each plugin of $.plugins
6
+ // @@@ if $.plugin.enabled
7
+ import * as /* @@@ echo $.plugin.importName */token/* @@@ endecho */ from '/* @@@ echo $.plugin.importPath */boss-css/use/token/server/* @@@ endecho */'
8
+ // @@@ endif
9
+ // @@@ endeach
10
+
11
+ // @@@ if $.jsxEnabled && $.globalsEnabled
12
+ // globalThis.$$
13
+ jsx.settings.set('globals', true)
14
+ // @@@ endif
15
+
16
+ /** @type {import('boss-css/api/config').UserConfig} */
17
+ export default {
18
+ // Path from your project root
19
+ folder: /* @@@ echo JSON.stringify($.folder) */'./.bo$$'/* @@@ endecho */,
20
+ // @@@ if $.cssAutoLoad === false
21
+ css: {
22
+ autoLoad: false,
23
+ },
24
+ // @@@ endif
25
+ // @@@ if $.runtimeEnabled
26
+ // Runtime-only/hybrid configuration
27
+ runtime: {
28
+ only: /* @@@ echo $.runtimeOnly ? 'true' : 'false' */true/* @@@ endecho */,
29
+ strategy: /* @@@ echo JSON.stringify($.runtimeStrategy) */'inline-first'/* @@@ endecho */,
30
+ },
31
+ // @@@ endif
32
+ // Order matters
33
+ plugins: [
34
+ // @@@ each plugin of $.plugins
35
+ // @@@ if $.plugin.enabled
36
+ /* @@@ echo $.plugin.importName */token/* @@@ endecho */,
37
+ // @@@ endif
38
+ // @@@ endeach
39
+ ],
40
+ // Files to look for when parsing
41
+ content: [
42
+ // @@@ each glob of $.content
43
+ /* @@@ echo JSON.stringify($.glob) */"src/**/*"/* @@@ endecho */,
44
+ // @@@ endeach
45
+ ],
46
+ }
47
+ `;
48
+ const packageTemplate = `{
49
+ "type": "module",
50
+ "sideEffects": true
51
+ }
52
+ `;
53
+ const jsconfigTemplate = `{
54
+ "compilerOptions": {
55
+ "checkJs": true
56
+ },
57
+ "include": [
58
+ "./config.js"
59
+ ]
60
+ }
61
+ `;
62
+ const postcssTemplate = `export default {
63
+ plugins: {
64
+ // bo$$:begin
65
+ // @@@ if $.useOptions
66
+ 'boss-css/postcss': { dirDependencies: /* @@@ echo $.dirDependencies ? 'true' : 'false' */false/* @@@ endecho */ },
67
+ // @@@ else
68
+ 'boss-css/postcss': {},
69
+ // @@@ endif
70
+ // bo$$:end
71
+ // @@@ if $.includeAutoprefixer
72
+ 'autoprefixer': {},
73
+ // @@@ endif
74
+ },
75
+ }
76
+ `;
77
+
78
+ //#endregion
79
+ exports.configTemplate = configTemplate;
80
+ exports.jsconfigTemplate = jsconfigTemplate;
81
+ exports.packageTemplate = packageTemplate;
82
+ exports.postcssTemplate = postcssTemplate;
@@ -0,0 +1,78 @@
1
+ //#region src/cli/templates/init.ts
2
+ const configTemplate = `/* eslint-disable */
3
+ // @ts-check
4
+ // @@@ each plugin of $.plugins
5
+ // @@@ if $.plugin.enabled
6
+ import * as /* @@@ echo $.plugin.importName */token/* @@@ endecho */ from '/* @@@ echo $.plugin.importPath */boss-css/use/token/server/* @@@ endecho */'
7
+ // @@@ endif
8
+ // @@@ endeach
9
+
10
+ // @@@ if $.jsxEnabled && $.globalsEnabled
11
+ // globalThis.$$
12
+ jsx.settings.set('globals', true)
13
+ // @@@ endif
14
+
15
+ /** @type {import('boss-css/api/config').UserConfig} */
16
+ export default {
17
+ // Path from your project root
18
+ folder: /* @@@ echo JSON.stringify($.folder) */'./.bo$$'/* @@@ endecho */,
19
+ // @@@ if $.cssAutoLoad === false
20
+ css: {
21
+ autoLoad: false,
22
+ },
23
+ // @@@ endif
24
+ // @@@ if $.runtimeEnabled
25
+ // Runtime-only/hybrid configuration
26
+ runtime: {
27
+ only: /* @@@ echo $.runtimeOnly ? 'true' : 'false' */true/* @@@ endecho */,
28
+ strategy: /* @@@ echo JSON.stringify($.runtimeStrategy) */'inline-first'/* @@@ endecho */,
29
+ },
30
+ // @@@ endif
31
+ // Order matters
32
+ plugins: [
33
+ // @@@ each plugin of $.plugins
34
+ // @@@ if $.plugin.enabled
35
+ /* @@@ echo $.plugin.importName */token/* @@@ endecho */,
36
+ // @@@ endif
37
+ // @@@ endeach
38
+ ],
39
+ // Files to look for when parsing
40
+ content: [
41
+ // @@@ each glob of $.content
42
+ /* @@@ echo JSON.stringify($.glob) */"src/**/*"/* @@@ endecho */,
43
+ // @@@ endeach
44
+ ],
45
+ }
46
+ `;
47
+ const packageTemplate = `{
48
+ "type": "module",
49
+ "sideEffects": true
50
+ }
51
+ `;
52
+ const jsconfigTemplate = `{
53
+ "compilerOptions": {
54
+ "checkJs": true
55
+ },
56
+ "include": [
57
+ "./config.js"
58
+ ]
59
+ }
60
+ `;
61
+ const postcssTemplate = `export default {
62
+ plugins: {
63
+ // bo$$:begin
64
+ // @@@ if $.useOptions
65
+ 'boss-css/postcss': { dirDependencies: /* @@@ echo $.dirDependencies ? 'true' : 'false' */false/* @@@ endecho */ },
66
+ // @@@ else
67
+ 'boss-css/postcss': {},
68
+ // @@@ endif
69
+ // bo$$:end
70
+ // @@@ if $.includeAutoprefixer
71
+ 'autoprefixer': {},
72
+ // @@@ endif
73
+ },
74
+ }
75
+ `;
76
+
77
+ //#endregion
78
+ export { configTemplate, jsconfigTemplate, packageTemplate, postcssTemplate };
@@ -0,0 +1,13 @@
1
+ const require_types = require('../shared/types.cjs');
2
+
3
+ //#region src/cli/types.ts
4
+ let PackageManagerType = /* @__PURE__ */ function(PackageManagerType) {
5
+ PackageManagerType["NPM"] = "npm";
6
+ PackageManagerType["PNPM"] = "pnpm";
7
+ PackageManagerType["YARN"] = "yarn";
8
+ PackageManagerType["BUN"] = "bun";
9
+ return PackageManagerType;
10
+ }({});
11
+
12
+ //#endregion
13
+ exports.PackageManagerType = PackageManagerType;
@@ -0,0 +1,13 @@
1
+ import { RuntimeType } from "../shared/types.mjs";
2
+
3
+ //#region src/cli/types.ts
4
+ let PackageManagerType = /* @__PURE__ */ function(PackageManagerType) {
5
+ PackageManagerType["NPM"] = "npm";
6
+ PackageManagerType["PNPM"] = "pnpm";
7
+ PackageManagerType["YARN"] = "yarn";
8
+ PackageManagerType["BUN"] = "bun";
9
+ return PackageManagerType;
10
+ }({});
11
+
12
+ //#endregion
13
+ export { PackageManagerType };
@@ -0,0 +1,43 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let _clack_prompts = require("@clack/prompts");
3
+
4
+ //#region src/cli/utils.ts
5
+ const cancelIf = (value, message = "Operation cancelled.") => {
6
+ if ((0, _clack_prompts.isCancel)(value)) {
7
+ (0, _clack_prompts.cancel)(message);
8
+ process.exit(0);
9
+ }
10
+ };
11
+ async function runTask(config) {
12
+ const { argv, runtimeType } = config;
13
+ const taskName = argv._[0] || "choose";
14
+ const loadTask = {
15
+ choose: () => Promise.resolve().then(() => require("./tasks/choose.cjs")),
16
+ init: () => Promise.resolve().then(() => require("./tasks/init.cjs")),
17
+ build: () => Promise.resolve().then(() => require("./tasks/build.cjs")),
18
+ watch: () => Promise.resolve().then(() => require("./tasks/watch.cjs")),
19
+ compile: () => Promise.resolve().then(() => require("./tasks/compile.cjs")),
20
+ dev: () => Promise.resolve().then(() => require("./tasks/dev.cjs"))
21
+ }[taskName];
22
+ if (!loadTask) {
23
+ _clack_prompts.log.error(`Unknown command: ${taskName}`);
24
+ config.argv._ = ["choose"];
25
+ return runTask(config);
26
+ }
27
+ const steps = await (await loadTask()).default(config);
28
+ for (const step of steps) {
29
+ const { prompt, key, procedures } = step;
30
+ const value = await prompt(config);
31
+ cancelIf(value);
32
+ if (key) config[key] = value;
33
+ if (procedures) config.procedures.push(...procedures);
34
+ }
35
+ for (const procedure of config.procedures) {
36
+ const { prompt } = procedure;
37
+ await prompt(config);
38
+ }
39
+ }
40
+
41
+ //#endregion
42
+ exports.cancelIf = cancelIf;
43
+ exports.runTask = runTask;
@@ -0,0 +1,41 @@
1
+ import { cancel, isCancel, log } from "@clack/prompts";
2
+
3
+ //#region src/cli/utils.ts
4
+ const cancelIf = (value, message = "Operation cancelled.") => {
5
+ if (isCancel(value)) {
6
+ cancel(message);
7
+ process.exit(0);
8
+ }
9
+ };
10
+ async function runTask(config) {
11
+ const { argv, runtimeType } = config;
12
+ const taskName = argv._[0] || "choose";
13
+ const loadTask = {
14
+ choose: () => import("./tasks/choose.mjs"),
15
+ init: () => import("./tasks/init.mjs"),
16
+ build: () => import("./tasks/build.mjs"),
17
+ watch: () => import("./tasks/watch.mjs"),
18
+ compile: () => import("./tasks/compile.mjs"),
19
+ dev: () => import("./tasks/dev.mjs")
20
+ }[taskName];
21
+ if (!loadTask) {
22
+ log.error(`Unknown command: ${taskName}`);
23
+ config.argv._ = ["choose"];
24
+ return runTask(config);
25
+ }
26
+ const steps = await (await loadTask()).default(config);
27
+ for (const step of steps) {
28
+ const { prompt, key, procedures } = step;
29
+ const value = await prompt(config);
30
+ cancelIf(value);
31
+ if (key) config[key] = value;
32
+ if (procedures) config.procedures.push(...procedures);
33
+ }
34
+ for (const procedure of config.procedures) {
35
+ const { prompt } = procedure;
36
+ await prompt(config);
37
+ }
38
+ }
39
+
40
+ //#endregion
41
+ export { cancelIf, runTask };
@@ -0,0 +1,79 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let _emotion_hash = require("@emotion/hash");
3
+ _emotion_hash = require_rolldown_runtime.__toESM(_emotion_hash);
4
+
5
+ //#region src/compile/classname-strategy.ts
6
+ const shortestAlphabet = "cCsSxyzXYZwqWQ";
7
+ const isUnsafeUnicode = (codePoint) => {
8
+ if (codePoint <= 31) return true;
9
+ if (codePoint >= 127 && codePoint <= 159) return true;
10
+ if (codePoint === 173) return true;
11
+ if (codePoint >= 55296 && codePoint <= 57343) return true;
12
+ if (codePoint >= 64976 && codePoint <= 65007) return true;
13
+ if ((codePoint & 65535) === 65534 || (codePoint & 65535) === 65535) return true;
14
+ const char = String.fromCodePoint(codePoint);
15
+ if (/\s/u.test(char)) return true;
16
+ return false;
17
+ };
18
+ const createShortestGenerator = (alphabet) => {
19
+ const letters = alphabet.split("");
20
+ const base = letters.length;
21
+ let counter = 0;
22
+ return () => {
23
+ let index = counter;
24
+ counter += 1;
25
+ let result = "";
26
+ let value = index + 1;
27
+ while (value > 0) {
28
+ value -= 1;
29
+ result = letters[value % base] + result;
30
+ value = Math.floor(value / base);
31
+ }
32
+ return result;
33
+ };
34
+ };
35
+ const createUnicodeGenerator = () => {
36
+ let codePoint = 161;
37
+ return () => {
38
+ while (isUnsafeUnicode(codePoint)) codePoint += 1;
39
+ const next = String.fromCodePoint(codePoint);
40
+ codePoint += 1;
41
+ return next;
42
+ };
43
+ };
44
+ const applyPrefix = (value, prefix) => {
45
+ const applied = `${prefix ?? ""}${value}`;
46
+ if (!prefix && /^[0-9]/.test(applied)) return `_${applied}`;
47
+ return applied;
48
+ };
49
+ const createClassNameMapper = (options) => {
50
+ const { strategy, prefix } = options;
51
+ const map = /* @__PURE__ */ new Map();
52
+ if (!strategy) return {
53
+ strategy,
54
+ get: () => void 0,
55
+ getOrCreate: (token) => token
56
+ };
57
+ const nextShortest = createShortestGenerator(shortestAlphabet);
58
+ const nextUnicode = createUnicodeGenerator();
59
+ const createValue = (token) => {
60
+ if (strategy === "hash") return applyPrefix((0, _emotion_hash.default)(token), prefix);
61
+ if (strategy === "shortest") return applyPrefix(nextShortest(), prefix);
62
+ if (strategy === "unicode") return applyPrefix(nextUnicode(), prefix);
63
+ return applyPrefix(token, prefix);
64
+ };
65
+ return {
66
+ strategy,
67
+ get: (token) => map.get(token),
68
+ getOrCreate: (token) => {
69
+ const existing = map.get(token);
70
+ if (existing) return existing;
71
+ const created = createValue(token);
72
+ map.set(token, created);
73
+ return created;
74
+ }
75
+ };
76
+ };
77
+
78
+ //#endregion
79
+ exports.createClassNameMapper = createClassNameMapper;
@@ -0,0 +1,77 @@
1
+ import hash from "@emotion/hash";
2
+
3
+ //#region src/compile/classname-strategy.ts
4
+ const shortestAlphabet = "cCsSxyzXYZwqWQ";
5
+ const isUnsafeUnicode = (codePoint) => {
6
+ if (codePoint <= 31) return true;
7
+ if (codePoint >= 127 && codePoint <= 159) return true;
8
+ if (codePoint === 173) return true;
9
+ if (codePoint >= 55296 && codePoint <= 57343) return true;
10
+ if (codePoint >= 64976 && codePoint <= 65007) return true;
11
+ if ((codePoint & 65535) === 65534 || (codePoint & 65535) === 65535) return true;
12
+ const char = String.fromCodePoint(codePoint);
13
+ if (/\s/u.test(char)) return true;
14
+ return false;
15
+ };
16
+ const createShortestGenerator = (alphabet) => {
17
+ const letters = alphabet.split("");
18
+ const base = letters.length;
19
+ let counter = 0;
20
+ return () => {
21
+ let index = counter;
22
+ counter += 1;
23
+ let result = "";
24
+ let value = index + 1;
25
+ while (value > 0) {
26
+ value -= 1;
27
+ result = letters[value % base] + result;
28
+ value = Math.floor(value / base);
29
+ }
30
+ return result;
31
+ };
32
+ };
33
+ const createUnicodeGenerator = () => {
34
+ let codePoint = 161;
35
+ return () => {
36
+ while (isUnsafeUnicode(codePoint)) codePoint += 1;
37
+ const next = String.fromCodePoint(codePoint);
38
+ codePoint += 1;
39
+ return next;
40
+ };
41
+ };
42
+ const applyPrefix = (value, prefix) => {
43
+ const applied = `${prefix ?? ""}${value}`;
44
+ if (!prefix && /^[0-9]/.test(applied)) return `_${applied}`;
45
+ return applied;
46
+ };
47
+ const createClassNameMapper = (options) => {
48
+ const { strategy, prefix } = options;
49
+ const map = /* @__PURE__ */ new Map();
50
+ if (!strategy) return {
51
+ strategy,
52
+ get: () => void 0,
53
+ getOrCreate: (token) => token
54
+ };
55
+ const nextShortest = createShortestGenerator(shortestAlphabet);
56
+ const nextUnicode = createUnicodeGenerator();
57
+ const createValue = (token) => {
58
+ if (strategy === "hash") return applyPrefix(hash(token), prefix);
59
+ if (strategy === "shortest") return applyPrefix(nextShortest(), prefix);
60
+ if (strategy === "unicode") return applyPrefix(nextUnicode(), prefix);
61
+ return applyPrefix(token, prefix);
62
+ };
63
+ return {
64
+ strategy,
65
+ get: (token) => map.get(token),
66
+ getOrCreate: (token) => {
67
+ const existing = map.get(token);
68
+ if (existing) return existing;
69
+ const created = createValue(token);
70
+ map.set(token, created);
71
+ return created;
72
+ }
73
+ };
74
+ };
75
+
76
+ //#endregion
77
+ export { createClassNameMapper };