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.
- package/README.md +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/_virtual/rolldown_runtime.mjs +20 -0
- package/dist/api/browser.cjs +54 -0
- package/dist/api/browser.mjs +48 -0
- package/dist/api/config.cjs +94 -0
- package/dist/api/config.mjs +91 -0
- package/dist/api/css.cjs +304 -0
- package/dist/api/css.mjs +303 -0
- package/dist/api/dictionary.cjs +218 -0
- package/dist/api/dictionary.mjs +215 -0
- package/dist/api/file/dts.cjs +21 -0
- package/dist/api/file/dts.mjs +21 -0
- package/dist/api/file/file.cjs +123 -0
- package/dist/api/file/file.mjs +120 -0
- package/dist/api/file/js.cjs +118 -0
- package/dist/api/file/js.mjs +116 -0
- package/dist/api/names.cjs +52 -0
- package/dist/api/names.mjs +46 -0
- package/dist/api/noopCss.cjs +37 -0
- package/dist/api/noopCss.mjs +36 -0
- package/dist/api/propTree.cjs +54 -0
- package/dist/api/propTree.mjs +48 -0
- package/dist/api/server.cjs +112 -0
- package/dist/api/server.mjs +106 -0
- package/dist/cli/build.cjs +1 -0
- package/dist/cli/build.mjs +3 -0
- package/dist/cli/index.cjs +30 -0
- package/dist/cli/index.mjs +29 -0
- package/dist/cli/tasks/build.cjs +24 -0
- package/dist/cli/tasks/build.mjs +23 -0
- package/dist/cli/tasks/choose.cjs +47 -0
- package/dist/cli/tasks/choose.mjs +46 -0
- package/dist/cli/tasks/compile.cjs +68 -0
- package/dist/cli/tasks/compile.mjs +67 -0
- package/dist/cli/tasks/dev.cjs +51 -0
- package/dist/cli/tasks/dev.mjs +48 -0
- package/dist/cli/tasks/init.cjs +1835 -0
- package/dist/cli/tasks/init.mjs +1831 -0
- package/dist/cli/tasks/watch.cjs +38 -0
- package/dist/cli/tasks/watch.mjs +37 -0
- package/dist/cli/templates/init.cjs +82 -0
- package/dist/cli/templates/init.mjs +78 -0
- package/dist/cli/types.cjs +13 -0
- package/dist/cli/types.mjs +13 -0
- package/dist/cli/utils.cjs +43 -0
- package/dist/cli/utils.mjs +41 -0
- package/dist/compile/classname-strategy.cjs +79 -0
- package/dist/compile/classname-strategy.mjs +77 -0
- package/dist/compile/classname.cjs +366 -0
- package/dist/compile/classname.mjs +360 -0
- package/dist/compile/index.cjs +238 -0
- package/dist/compile/index.mjs +235 -0
- package/dist/compile/jsx.cjs +803 -0
- package/dist/compile/jsx.mjs +800 -0
- package/dist/compile/prepared.cjs +88 -0
- package/dist/compile/prepared.mjs +87 -0
- package/dist/compile/runtime.cjs +33 -0
- package/dist/compile/runtime.mjs +32 -0
- package/dist/compile/transform.cjs +371 -0
- package/dist/compile/transform.mjs +369 -0
- package/dist/cx/index.cjs +93 -0
- package/dist/cx/index.mjs +85 -0
- package/dist/detect-fw/index.cjs +384 -0
- package/dist/detect-fw/index.mjs +379 -0
- package/dist/dev/client.cjs +39 -0
- package/dist/dev/client.mjs +38 -0
- package/dist/dev/plugin/browser.cjs +11 -0
- package/dist/dev/plugin/browser.mjs +9 -0
- package/dist/dev/plugin/server.cjs +86 -0
- package/dist/dev/plugin/server.mjs +78 -0
- package/dist/dev/port.cjs +46 -0
- package/dist/dev/port.mjs +43 -0
- package/dist/dev/runtime.cjs +28 -0
- package/dist/dev/runtime.mjs +29 -0
- package/dist/dev/server.cjs +808 -0
- package/dist/dev/server.mjs +805 -0
- package/dist/dev/shared.cjs +6 -0
- package/dist/dev/shared.mjs +5 -0
- package/dist/eslint-plugin/index.cjs +66 -0
- package/dist/eslint-plugin/index.mjs +66 -0
- package/dist/eslint-plugin/rules/classnames-only.cjs +68 -0
- package/dist/eslint-plugin/rules/classnames-only.mjs +68 -0
- package/dist/eslint-plugin/rules/format-classnames.cjs +137 -0
- package/dist/eslint-plugin/rules/format-classnames.mjs +136 -0
- package/dist/eslint-plugin/rules/no-unknown-classes.cjs +119 -0
- package/dist/eslint-plugin/rules/no-unknown-classes.mjs +119 -0
- package/dist/eslint-plugin/rules/prefer-classnames.cjs +69 -0
- package/dist/eslint-plugin/rules/prefer-classnames.mjs +69 -0
- package/dist/eslint-plugin/rules/prefer-token-values.cjs +197 -0
- package/dist/eslint-plugin/rules/prefer-token-values.mjs +197 -0
- package/dist/eslint-plugin/rules/props-only.cjs +115 -0
- package/dist/eslint-plugin/rules/props-only.mjs +115 -0
- package/dist/eslint-plugin/rules/redundant-cx.cjs +66 -0
- package/dist/eslint-plugin/rules/redundant-cx.mjs +66 -0
- package/dist/eslint-plugin/rules/require-prop-functions.cjs +130 -0
- package/dist/eslint-plugin/rules/require-prop-functions.mjs +130 -0
- package/dist/eslint-plugin/utils/api.cjs +30 -0
- package/dist/eslint-plugin/utils/api.mjs +29 -0
- package/dist/eslint-plugin/utils/ast.cjs +119 -0
- package/dist/eslint-plugin/utils/ast.mjs +112 -0
- package/dist/eslint-plugin/utils/boss-classes.cjs +185 -0
- package/dist/eslint-plugin/utils/boss-classes.mjs +175 -0
- package/dist/eslint-plugin/utils/defaults.cjs +99 -0
- package/dist/eslint-plugin/utils/defaults.mjs +93 -0
- package/dist/eslint-plugin/utils/format.cjs +20 -0
- package/dist/eslint-plugin/utils/format.mjs +19 -0
- package/dist/eslint-plugin/utils/order.cjs +76 -0
- package/dist/eslint-plugin/utils/order.mjs +76 -0
- package/dist/eslint-plugin/utils/property-order.cjs +449 -0
- package/dist/eslint-plugin/utils/property-order.mjs +448 -0
- package/dist/eslint-plugin/utils/static.cjs +36 -0
- package/dist/eslint-plugin/utils/static.mjs +35 -0
- package/dist/fontsource/directory.cjs +39588 -0
- package/dist/fontsource/directory.mjs +39587 -0
- package/dist/fontsource/server.cjs +291 -0
- package/dist/fontsource/server.mjs +282 -0
- package/dist/index.cjs +10 -0
- package/dist/index.mjs +6 -0
- package/dist/log/browser.cjs +28 -0
- package/dist/log/browser.mjs +28 -0
- package/dist/log/server.cjs +32 -0
- package/dist/log/server.mjs +30 -0
- package/dist/merge/index.cjs +590 -0
- package/dist/merge/index.mjs +586 -0
- package/dist/native/browser.cjs +78 -0
- package/dist/native/browser.mjs +77 -0
- package/dist/native/server.cjs +180 -0
- package/dist/native/server.mjs +176 -0
- package/dist/native/styleTypes.cjs +168 -0
- package/dist/native/styleTypes.mjs +164 -0
- package/dist/parser/classname/server.cjs +239 -0
- package/dist/parser/classname/server.mjs +232 -0
- package/dist/parser/jsx/browser.cjs +66 -0
- package/dist/parser/jsx/browser.mjs +63 -0
- package/dist/parser/jsx/extractCode.cjs +99 -0
- package/dist/parser/jsx/extractCode.mjs +98 -0
- package/dist/parser/jsx/extractPrepared.cjs +123 -0
- package/dist/parser/jsx/extractPrepared.mjs +122 -0
- package/dist/parser/jsx/extractProps.cjs +234 -0
- package/dist/parser/jsx/extractProps.mjs +232 -0
- package/dist/parser/jsx/isDOMProp.cjs +17 -0
- package/dist/parser/jsx/isDOMProp.mjs +15 -0
- package/dist/parser/jsx/native.cjs +110 -0
- package/dist/parser/jsx/native.mjs +108 -0
- package/dist/parser/jsx/runtime.cjs +4 -0
- package/dist/parser/jsx/runtime.mjs +3 -0
- package/dist/parser/jsx/server.cjs +278 -0
- package/dist/parser/jsx/server.mjs +268 -0
- package/dist/postcss/index.cjs +16 -0
- package/dist/postcss/index.mjs +16 -0
- package/dist/prop/at/runtime-only.cjs +90 -0
- package/dist/prop/at/runtime-only.mjs +88 -0
- package/dist/prop/at/server.cjs +282 -0
- package/dist/prop/at/server.mjs +268 -0
- package/dist/prop/at/shared.cjs +153 -0
- package/dist/prop/at/shared.mjs +144 -0
- package/dist/prop/bosswind/browser.cjs +18 -0
- package/dist/prop/bosswind/browser.mjs +16 -0
- package/dist/prop/bosswind/runtime-only.cjs +18 -0
- package/dist/prop/bosswind/runtime-only.mjs +16 -0
- package/dist/prop/bosswind/server.cjs +81 -0
- package/dist/prop/bosswind/server.mjs +72 -0
- package/dist/prop/bosswind/shared.cjs +861 -0
- package/dist/prop/bosswind/shared.mjs +855 -0
- package/dist/prop/bosswind/tailwind-theme.cjs +703 -0
- package/dist/prop/bosswind/tailwind-theme.mjs +702 -0
- package/dist/prop/child/runtime-only.cjs +18 -0
- package/dist/prop/child/runtime-only.mjs +15 -0
- package/dist/prop/child/server.cjs +81 -0
- package/dist/prop/child/server.mjs +72 -0
- package/dist/prop/css/getDtsTemplate.cjs +65 -0
- package/dist/prop/css/getDtsTemplate.mjs +63 -0
- package/dist/prop/css/runtime-only.cjs +14 -0
- package/dist/prop/css/runtime-only.mjs +13 -0
- package/dist/prop/css/server.cjs +99 -0
- package/dist/prop/css/server.mjs +90 -0
- package/dist/prop/pseudo/runtime-only.cjs +23 -0
- package/dist/prop/pseudo/runtime-only.mjs +21 -0
- package/dist/prop/pseudo/server.cjs +91 -0
- package/dist/prop/pseudo/server.mjs +82 -0
- package/dist/prop/pseudo/shared.cjs +61 -0
- package/dist/prop/pseudo/shared.mjs +60 -0
- package/dist/reset/server.cjs +34 -0
- package/dist/reset/server.mjs +26 -0
- package/dist/runtime/index.cjs +119 -0
- package/dist/runtime/index.mjs +118 -0
- package/dist/runtime/preact.cjs +4 -0
- package/dist/runtime/preact.mjs +3 -0
- package/dist/runtime/qwik.cjs +21 -0
- package/dist/runtime/qwik.mjs +18 -0
- package/dist/runtime/react.cjs +4 -0
- package/dist/runtime/react.mjs +3 -0
- package/dist/runtime/solid.cjs +15 -0
- package/dist/runtime/solid.mjs +14 -0
- package/dist/runtime/stencil.cjs +25 -0
- package/dist/runtime/stencil.mjs +21 -0
- package/dist/runtime/style.cjs +14 -0
- package/dist/runtime/style.mjs +13 -0
- package/dist/shared/boundaries.cjs +288 -0
- package/dist/shared/boundaries.mjs +285 -0
- package/dist/shared/customCss.cjs +212 -0
- package/dist/shared/customCss.mjs +211 -0
- package/dist/shared/debug.cjs +76 -0
- package/dist/shared/debug.mjs +74 -0
- package/dist/shared/file.cjs +21 -0
- package/dist/shared/file.mjs +19 -0
- package/dist/shared/framework.cjs +10 -0
- package/dist/shared/framework.mjs +9 -0
- package/dist/shared/json.cjs +58 -0
- package/dist/shared/json.mjs +57 -0
- package/dist/shared/types.cjs +11 -0
- package/dist/shared/types.mjs +10 -0
- package/dist/strategy/classic/runtime-only.cjs +190 -0
- package/dist/strategy/classic/runtime-only.mjs +186 -0
- package/dist/strategy/classname-first/runtime-only.cjs +138 -0
- package/dist/strategy/classname-first/runtime-only.mjs +134 -0
- package/dist/strategy/classname-first/server.cjs +139 -0
- package/dist/strategy/classname-first/server.mjs +133 -0
- package/dist/strategy/classname-only/server.cjs +43 -0
- package/dist/strategy/classname-only/server.mjs +35 -0
- package/dist/strategy/inline-first/browser.cjs +61 -0
- package/dist/strategy/inline-first/browser.mjs +58 -0
- package/dist/strategy/inline-first/runtime-only.cjs +159 -0
- package/dist/strategy/inline-first/runtime-only.mjs +155 -0
- package/dist/strategy/inline-first/server.cjs +92 -0
- package/dist/strategy/inline-first/server.mjs +83 -0
- package/dist/strategy/runtime/runtime-only.cjs +24 -0
- package/dist/strategy/runtime/runtime-only.mjs +22 -0
- package/dist/strategy/runtime/server.cjs +72 -0
- package/dist/strategy/runtime/server.mjs +63 -0
- package/dist/strategy/runtime-only/css.cjs +183 -0
- package/dist/strategy/runtime-only/css.mjs +181 -0
- package/dist/tasks/build.cjs +88 -0
- package/dist/tasks/build.mjs +84 -0
- package/dist/tasks/compile.cjs +12 -0
- package/dist/tasks/compile.mjs +12 -0
- package/dist/tasks/postcss.cjs +116 -0
- package/dist/tasks/postcss.mjs +113 -0
- package/dist/tasks/session.cjs +46 -0
- package/dist/tasks/session.mjs +42 -0
- package/dist/tasks/watch.cjs +102 -0
- package/dist/tasks/watch.mjs +99 -0
- package/dist/transform/cache.cjs +24 -0
- package/dist/transform/cache.mjs +21 -0
- package/dist/transform/processFile.cjs +26 -0
- package/dist/transform/processFile.mjs +24 -0
- package/dist/use/token/browser.cjs +65 -0
- package/dist/use/token/browser.mjs +61 -0
- package/dist/use/token/runtime-only.cjs +245 -0
- package/dist/use/token/runtime-only.mjs +239 -0
- package/dist/use/token/server.cjs +325 -0
- package/dist/use/token/server.mjs +313 -0
- package/dist/use/token/vars.cjs +47 -0
- package/dist/use/token/vars.mjs +46 -0
- package/package.json +300 -4
- package/src/api/config.d.ts +1 -0
- package/src/fontsource/types.d.ts +50 -0
- package/src/packages/document-create-element/createElement.browser.js +3 -0
- package/src/packages/document-create-element/createElement.js +7 -0
- package/src/packages/document-create-element/package.json +17 -0
- package/src/packages/is-css-prop/browser.js +13 -0
- package/src/packages/is-css-prop/index.js +13 -0
- package/src/packages/is-css-prop/package-lock.json +52 -0
- package/src/packages/is-css-prop/package.json +17 -0
- package/src/prop/css/csstype.json +4387 -0
- package/src/prop/css/package.json +3 -0
- package/src/reset/reset.css +259 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_build = require('../../tasks/build.cjs');
|
|
3
|
+
require('../build.cjs');
|
|
4
|
+
let _clack_prompts = require("@clack/prompts");
|
|
5
|
+
|
|
6
|
+
//#region src/cli/tasks/build.ts
|
|
7
|
+
const build = async (config) => {
|
|
8
|
+
return [{ prompt: async () => {
|
|
9
|
+
try {
|
|
10
|
+
const result = await require_build.runBuild(config.userConfig);
|
|
11
|
+
const cssNote = result.cssPath ? `${result.cssBytes} bytes -> ${result.cssPath}` : "runtime-only (no css output)";
|
|
12
|
+
_clack_prompts.log.message(`boss build ready (${result.filesParsed} files, ${cssNote}).`);
|
|
13
|
+
return true;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
const message = error instanceof Error ? error.message : "boss build failed.";
|
|
16
|
+
_clack_prompts.log.error(message);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
} }];
|
|
20
|
+
};
|
|
21
|
+
var build_default = build;
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.default = build_default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { runBuild } from "../../tasks/build.mjs";
|
|
2
|
+
import "../build.mjs";
|
|
3
|
+
import { log } from "@clack/prompts";
|
|
4
|
+
|
|
5
|
+
//#region src/cli/tasks/build.ts
|
|
6
|
+
const build = async (config) => {
|
|
7
|
+
return [{ prompt: async () => {
|
|
8
|
+
try {
|
|
9
|
+
const result = await runBuild(config.userConfig);
|
|
10
|
+
const cssNote = result.cssPath ? `${result.cssBytes} bytes -> ${result.cssPath}` : "runtime-only (no css output)";
|
|
11
|
+
log.message(`boss build ready (${result.filesParsed} files, ${cssNote}).`);
|
|
12
|
+
return true;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
const message = error instanceof Error ? error.message : "boss build failed.";
|
|
15
|
+
log.error(message);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
} }];
|
|
19
|
+
};
|
|
20
|
+
var build_default = build;
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { build_default as default };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils = require('../utils.cjs');
|
|
3
|
+
let _clack_prompts = require("@clack/prompts");
|
|
4
|
+
|
|
5
|
+
//#region src/cli/tasks/choose.ts
|
|
6
|
+
const chooseTask = async (config) => {
|
|
7
|
+
return [{ prompt: async () => {
|
|
8
|
+
const task = await (0, _clack_prompts.select)({
|
|
9
|
+
message: "Select the task you want to run.",
|
|
10
|
+
options: [
|
|
11
|
+
{
|
|
12
|
+
value: "init",
|
|
13
|
+
label: "Init",
|
|
14
|
+
hint: "Initialize boss in an existing project."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "build",
|
|
18
|
+
label: "Build",
|
|
19
|
+
hint: "Generate boss output without PostCSS."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "watch",
|
|
23
|
+
label: "Watch",
|
|
24
|
+
hint: "Watch files and regenerate boss output."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: "compile",
|
|
28
|
+
label: "Compile",
|
|
29
|
+
hint: "Optimize source files and CSS."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: "dev",
|
|
33
|
+
label: "Dev",
|
|
34
|
+
hint: "Start the boss dev server."
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
require_utils.cancelIf(task);
|
|
39
|
+
config.argv._ = [task];
|
|
40
|
+
await require_utils.runTask(config);
|
|
41
|
+
return true;
|
|
42
|
+
} }];
|
|
43
|
+
};
|
|
44
|
+
var choose_default = chooseTask;
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.default = choose_default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cancelIf, runTask } from "../utils.mjs";
|
|
2
|
+
import { select } from "@clack/prompts";
|
|
3
|
+
|
|
4
|
+
//#region src/cli/tasks/choose.ts
|
|
5
|
+
const chooseTask = async (config) => {
|
|
6
|
+
return [{ prompt: async () => {
|
|
7
|
+
const task = await select({
|
|
8
|
+
message: "Select the task you want to run.",
|
|
9
|
+
options: [
|
|
10
|
+
{
|
|
11
|
+
value: "init",
|
|
12
|
+
label: "Init",
|
|
13
|
+
hint: "Initialize boss in an existing project."
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: "build",
|
|
17
|
+
label: "Build",
|
|
18
|
+
hint: "Generate boss output without PostCSS."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "watch",
|
|
22
|
+
label: "Watch",
|
|
23
|
+
hint: "Watch files and regenerate boss output."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "compile",
|
|
27
|
+
label: "Compile",
|
|
28
|
+
hint: "Optimize source files and CSS."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: "dev",
|
|
32
|
+
label: "Dev",
|
|
33
|
+
hint: "Start the boss dev server."
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
cancelIf(task);
|
|
38
|
+
config.argv._ = [task];
|
|
39
|
+
await runTask(config);
|
|
40
|
+
return true;
|
|
41
|
+
} }];
|
|
42
|
+
};
|
|
43
|
+
var choose_default = chooseTask;
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { choose_default as default };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_compile = require('../../tasks/compile.cjs');
|
|
3
|
+
let _clack_prompts = require("@clack/prompts");
|
|
4
|
+
|
|
5
|
+
//#region src/cli/tasks/compile.ts
|
|
6
|
+
const compile = async (config) => {
|
|
7
|
+
return [{ prompt: async () => {
|
|
8
|
+
const { argv, userConfig } = config;
|
|
9
|
+
const isProd = argv.prod === true || process.env.NODE_ENV === "production";
|
|
10
|
+
const compileConfig = { ...userConfig.compile ?? {} };
|
|
11
|
+
const reservedKeys = new Set([
|
|
12
|
+
"_",
|
|
13
|
+
"--",
|
|
14
|
+
"prod"
|
|
15
|
+
]);
|
|
16
|
+
for (const [key, value] of Object.entries(argv)) {
|
|
17
|
+
if (reservedKeys.has(key)) continue;
|
|
18
|
+
compileConfig[key] = coerceArgValue(value);
|
|
19
|
+
}
|
|
20
|
+
if (compileConfig.stats === true) compileConfig.stats = "quick";
|
|
21
|
+
_clack_prompts.log.info(`boss compile ${isProd ? "(inline)" : "(temp)"} starting...`);
|
|
22
|
+
const result = await require_compile.runCompile({
|
|
23
|
+
config: {
|
|
24
|
+
...userConfig,
|
|
25
|
+
compile: compileConfig
|
|
26
|
+
},
|
|
27
|
+
prod: isProd
|
|
28
|
+
});
|
|
29
|
+
_clack_prompts.log.message(`boss compile ${isProd ? "inline" : "temp"} output ready.`);
|
|
30
|
+
if (result.statsMode) _clack_prompts.log.message(formatStats(result.statsMode, result.stats));
|
|
31
|
+
return true;
|
|
32
|
+
} }];
|
|
33
|
+
};
|
|
34
|
+
const formatStats = (mode, stats) => {
|
|
35
|
+
const duration = formatDuration(stats.durationMs);
|
|
36
|
+
const outputMode = stats.outputMode === "prod" ? "inline" : "temp";
|
|
37
|
+
const runtimeFiles = stats.runtimeFiles.length;
|
|
38
|
+
stats.valueHelperFiles.length;
|
|
39
|
+
const lines = [
|
|
40
|
+
`boss compile stats (${mode})`,
|
|
41
|
+
`Mode: ${outputMode}`,
|
|
42
|
+
`Runtime free: ${stats.runtimeFree ? "yes" : "no"}`
|
|
43
|
+
];
|
|
44
|
+
if (mode === "quick") {
|
|
45
|
+
lines.push(`Runtime files: ${runtimeFiles}`, `Files processed: ${stats.filesProcessed}`, `Elements replaced: ${stats.elementsReplaced}`, `Time: ${duration}`);
|
|
46
|
+
return lines.join("\n");
|
|
47
|
+
}
|
|
48
|
+
lines.push(...formatList("Runtime files", stats.runtimeFiles), `Files processed: ${stats.filesProcessed}`, `Files copied: ${stats.filesCopied}`, `Files skipped: ${stats.filesSkipped}`, `Files total: ${stats.filesTotal}`, `Elements replaced: ${stats.elementsReplaced}`, ...formatList("Value helper files", stats.valueHelperFiles), `CSS output: ${stats.cssWritten ? `${stats.stylesheetPath} (${stats.cssBytes} bytes)` : "none"}`, `Output dir: ${stats.outputDir}`, `Time: ${duration}`);
|
|
49
|
+
return lines.join("\n");
|
|
50
|
+
};
|
|
51
|
+
const formatDuration = (ms) => {
|
|
52
|
+
if (ms < 1e3) return `${ms.toFixed(1)}ms`;
|
|
53
|
+
if (ms < 6e4) return `${(ms / 1e3).toFixed(2)}s`;
|
|
54
|
+
return `${(ms / 6e4).toFixed(2)}m`;
|
|
55
|
+
};
|
|
56
|
+
const formatList = (label, items) => {
|
|
57
|
+
if (!items.length) return [`${label}: none`];
|
|
58
|
+
return [`${label} (${items.length}):`, ...items.map((item) => `- ${item}`)];
|
|
59
|
+
};
|
|
60
|
+
const coerceArgValue = (value) => {
|
|
61
|
+
if (value === "true") return true;
|
|
62
|
+
if (value === "false") return false;
|
|
63
|
+
return value;
|
|
64
|
+
};
|
|
65
|
+
var compile_default = compile;
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.default = compile_default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { runCompile } from "../../tasks/compile.mjs";
|
|
2
|
+
import { log } from "@clack/prompts";
|
|
3
|
+
|
|
4
|
+
//#region src/cli/tasks/compile.ts
|
|
5
|
+
const compile = async (config) => {
|
|
6
|
+
return [{ prompt: async () => {
|
|
7
|
+
const { argv, userConfig } = config;
|
|
8
|
+
const isProd = argv.prod === true || process.env.NODE_ENV === "production";
|
|
9
|
+
const compileConfig = { ...userConfig.compile ?? {} };
|
|
10
|
+
const reservedKeys = new Set([
|
|
11
|
+
"_",
|
|
12
|
+
"--",
|
|
13
|
+
"prod"
|
|
14
|
+
]);
|
|
15
|
+
for (const [key, value] of Object.entries(argv)) {
|
|
16
|
+
if (reservedKeys.has(key)) continue;
|
|
17
|
+
compileConfig[key] = coerceArgValue(value);
|
|
18
|
+
}
|
|
19
|
+
if (compileConfig.stats === true) compileConfig.stats = "quick";
|
|
20
|
+
log.info(`boss compile ${isProd ? "(inline)" : "(temp)"} starting...`);
|
|
21
|
+
const result = await runCompile({
|
|
22
|
+
config: {
|
|
23
|
+
...userConfig,
|
|
24
|
+
compile: compileConfig
|
|
25
|
+
},
|
|
26
|
+
prod: isProd
|
|
27
|
+
});
|
|
28
|
+
log.message(`boss compile ${isProd ? "inline" : "temp"} output ready.`);
|
|
29
|
+
if (result.statsMode) log.message(formatStats(result.statsMode, result.stats));
|
|
30
|
+
return true;
|
|
31
|
+
} }];
|
|
32
|
+
};
|
|
33
|
+
const formatStats = (mode, stats) => {
|
|
34
|
+
const duration = formatDuration(stats.durationMs);
|
|
35
|
+
const outputMode = stats.outputMode === "prod" ? "inline" : "temp";
|
|
36
|
+
const runtimeFiles = stats.runtimeFiles.length;
|
|
37
|
+
stats.valueHelperFiles.length;
|
|
38
|
+
const lines = [
|
|
39
|
+
`boss compile stats (${mode})`,
|
|
40
|
+
`Mode: ${outputMode}`,
|
|
41
|
+
`Runtime free: ${stats.runtimeFree ? "yes" : "no"}`
|
|
42
|
+
];
|
|
43
|
+
if (mode === "quick") {
|
|
44
|
+
lines.push(`Runtime files: ${runtimeFiles}`, `Files processed: ${stats.filesProcessed}`, `Elements replaced: ${stats.elementsReplaced}`, `Time: ${duration}`);
|
|
45
|
+
return lines.join("\n");
|
|
46
|
+
}
|
|
47
|
+
lines.push(...formatList("Runtime files", stats.runtimeFiles), `Files processed: ${stats.filesProcessed}`, `Files copied: ${stats.filesCopied}`, `Files skipped: ${stats.filesSkipped}`, `Files total: ${stats.filesTotal}`, `Elements replaced: ${stats.elementsReplaced}`, ...formatList("Value helper files", stats.valueHelperFiles), `CSS output: ${stats.cssWritten ? `${stats.stylesheetPath} (${stats.cssBytes} bytes)` : "none"}`, `Output dir: ${stats.outputDir}`, `Time: ${duration}`);
|
|
48
|
+
return lines.join("\n");
|
|
49
|
+
};
|
|
50
|
+
const formatDuration = (ms) => {
|
|
51
|
+
if (ms < 1e3) return `${ms.toFixed(1)}ms`;
|
|
52
|
+
if (ms < 6e4) return `${(ms / 1e3).toFixed(2)}s`;
|
|
53
|
+
return `${(ms / 6e4).toFixed(2)}m`;
|
|
54
|
+
};
|
|
55
|
+
const formatList = (label, items) => {
|
|
56
|
+
if (!items.length) return [`${label}: none`];
|
|
57
|
+
return [`${label} (${items.length}):`, ...items.map((item) => `- ${item}`)];
|
|
58
|
+
};
|
|
59
|
+
const coerceArgValue = (value) => {
|
|
60
|
+
if (value === "true") return true;
|
|
61
|
+
if (value === "false") return false;
|
|
62
|
+
return value;
|
|
63
|
+
};
|
|
64
|
+
var compile_default = compile;
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { compile_default as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_shared = require('../../dev/shared.cjs');
|
|
3
|
+
const require_dev_server = require('../../dev/server.cjs');
|
|
4
|
+
const require_port = require('../../dev/port.cjs');
|
|
5
|
+
let node_fs_promises = require("node:fs/promises");
|
|
6
|
+
node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises);
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
9
|
+
let _clack_prompts = require("@clack/prompts");
|
|
10
|
+
|
|
11
|
+
//#region src/cli/tasks/dev.ts
|
|
12
|
+
const dev = async (config) => {
|
|
13
|
+
return [{ prompt: async () => {
|
|
14
|
+
const { argv, userConfig } = config;
|
|
15
|
+
const basePort = Number.isFinite(Number(argv.port)) ? Number(argv.port) : require_shared.DEFAULT_DEV_PORT;
|
|
16
|
+
const maxPort = Number.isFinite(Number(argv.maxPort)) ? Number(argv.maxPort) : basePort + 49;
|
|
17
|
+
const configDir = userConfig.configDir ?? ".bo$$";
|
|
18
|
+
const { port } = await require_dev_server.startDevServer({
|
|
19
|
+
port: basePort,
|
|
20
|
+
maxPort
|
|
21
|
+
});
|
|
22
|
+
const configPath = await resolveConfigPath(userConfig);
|
|
23
|
+
if (configPath) {
|
|
24
|
+
if (!await require_port.updateDevPort(configPath, port, port !== require_shared.DEFAULT_DEV_PORT)) _clack_prompts.log.warn(`Skipping devServer update for ${configPath}.`);
|
|
25
|
+
} else _clack_prompts.log.warn("No boss config found; skipping devServer update.");
|
|
26
|
+
const runtimeDir = userConfig.folder ?? configDir;
|
|
27
|
+
await require_port.updateRuntimePort(node_path.default.join(process.cwd(), runtimeDir, "index.js"), port);
|
|
28
|
+
_clack_prompts.log.message(`boss dev listening on ws://localhost:${port}`);
|
|
29
|
+
await new Promise(() => {});
|
|
30
|
+
return true;
|
|
31
|
+
} }];
|
|
32
|
+
};
|
|
33
|
+
const resolveConfigPath = async (userConfig) => {
|
|
34
|
+
const cwd = process.cwd();
|
|
35
|
+
const configDir = userConfig.configDir ?? ".bo$$";
|
|
36
|
+
const candidates = [node_path.default.join(cwd, configDir, "config.js")];
|
|
37
|
+
const srcCandidate = node_path.default.join(cwd, "src", configDir, "config.js");
|
|
38
|
+
if (!candidates.includes(srcCandidate)) candidates.push(srcCandidate);
|
|
39
|
+
if (userConfig.folder && userConfig.folder !== configDir) candidates.push(node_path.default.join(cwd, userConfig.folder, "config.js"));
|
|
40
|
+
for (const candidate of candidates) try {
|
|
41
|
+
await node_fs_promises.default.access(candidate);
|
|
42
|
+
return candidate;
|
|
43
|
+
} catch {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
48
|
+
var dev_default = dev;
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.default = dev_default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DEFAULT_DEV_PORT } from "../../dev/shared.mjs";
|
|
2
|
+
import { startDevServer } from "../../dev/server.mjs";
|
|
3
|
+
import { updateDevPort, updateRuntimePort } from "../../dev/port.mjs";
|
|
4
|
+
import fs from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { log } from "@clack/prompts";
|
|
7
|
+
|
|
8
|
+
//#region src/cli/tasks/dev.ts
|
|
9
|
+
const dev = async (config) => {
|
|
10
|
+
return [{ prompt: async () => {
|
|
11
|
+
const { argv, userConfig } = config;
|
|
12
|
+
const basePort = Number.isFinite(Number(argv.port)) ? Number(argv.port) : DEFAULT_DEV_PORT;
|
|
13
|
+
const maxPort = Number.isFinite(Number(argv.maxPort)) ? Number(argv.maxPort) : basePort + 49;
|
|
14
|
+
const configDir = userConfig.configDir ?? ".bo$$";
|
|
15
|
+
const { port } = await startDevServer({
|
|
16
|
+
port: basePort,
|
|
17
|
+
maxPort
|
|
18
|
+
});
|
|
19
|
+
const configPath = await resolveConfigPath(userConfig);
|
|
20
|
+
if (configPath) {
|
|
21
|
+
if (!await updateDevPort(configPath, port, port !== DEFAULT_DEV_PORT)) log.warn(`Skipping devServer update for ${configPath}.`);
|
|
22
|
+
} else log.warn("No boss config found; skipping devServer update.");
|
|
23
|
+
const runtimeDir = userConfig.folder ?? configDir;
|
|
24
|
+
await updateRuntimePort(path.join(process.cwd(), runtimeDir, "index.js"), port);
|
|
25
|
+
log.message(`boss dev listening on ws://localhost:${port}`);
|
|
26
|
+
await new Promise(() => {});
|
|
27
|
+
return true;
|
|
28
|
+
} }];
|
|
29
|
+
};
|
|
30
|
+
const resolveConfigPath = async (userConfig) => {
|
|
31
|
+
const cwd = process.cwd();
|
|
32
|
+
const configDir = userConfig.configDir ?? ".bo$$";
|
|
33
|
+
const candidates = [path.join(cwd, configDir, "config.js")];
|
|
34
|
+
const srcCandidate = path.join(cwd, "src", configDir, "config.js");
|
|
35
|
+
if (!candidates.includes(srcCandidate)) candidates.push(srcCandidate);
|
|
36
|
+
if (userConfig.folder && userConfig.folder !== configDir) candidates.push(path.join(cwd, userConfig.folder, "config.js"));
|
|
37
|
+
for (const candidate of candidates) try {
|
|
38
|
+
await fs.access(candidate);
|
|
39
|
+
return candidate;
|
|
40
|
+
} catch {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
};
|
|
45
|
+
var dev_default = dev;
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { dev_default as default };
|