boss-css 0.0.23 → 0.0.25
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/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +14 -24
- package/dist/_virtual/_rolldown/runtime.mjs +14 -0
- package/dist/ai/server.cjs +15 -16
- package/dist/ai/server.mjs +4 -6
- package/dist/ai/skills.cjs +2 -3
- package/dist/ai/skills.mjs +1 -2
- package/dist/api/browser.cjs +11 -12
- package/dist/api/browser.mjs +1 -3
- package/dist/api/config.cjs +6 -7
- package/dist/api/config.mjs +1 -3
- package/dist/api/css.cjs +1 -3
- package/dist/api/css.mjs +1 -2
- package/dist/api/dictionary.cjs +1 -3
- package/dist/api/dictionary.mjs +1 -2
- package/dist/api/file/dts.cjs +2 -4
- package/dist/api/file/dts.mjs +1 -3
- package/dist/api/file/file.cjs +4 -6
- package/dist/api/file/file.mjs +1 -3
- package/dist/api/file/js.cjs +6 -8
- package/dist/api/file/js.mjs +2 -4
- package/dist/api/file/text.cjs +2 -4
- package/dist/api/file/text.mjs +1 -3
- package/dist/api/names.cjs +1 -3
- package/dist/api/names.mjs +1 -3
- package/dist/api/noopCss.cjs +2 -3
- package/dist/api/noopCss.mjs +1 -2
- package/dist/api/propTree.cjs +1 -3
- package/dist/api/propTree.mjs +1 -2
- package/dist/api/server.cjs +15 -16
- package/dist/api/server.mjs +1 -3
- package/dist/cli/build.cjs +1 -1
- package/dist/cli/build.mjs +2 -3
- package/dist/cli/index.cjs +5 -7
- package/dist/cli/index.mjs +1 -3
- package/dist/cli/tasks/build.cjs +4 -7
- package/dist/cli/tasks/build.mjs +1 -4
- package/dist/cli/tasks/choose.cjs +3 -6
- package/dist/cli/tasks/choose.mjs +1 -4
- package/dist/cli/tasks/compile.cjs +3 -6
- package/dist/cli/tasks/compile.mjs +1 -4
- package/dist/cli/tasks/dev.cjs +8 -11
- package/dist/cli/tasks/dev.mjs +2 -5
- package/dist/cli/tasks/init.cjs +163 -44
- package/dist/cli/tasks/init.mjs +135 -17
- package/dist/cli/tasks/watch.cjs +3 -6
- package/dist/cli/tasks/watch.mjs +1 -4
- package/dist/cli/templates/init.cjs +1 -3
- package/dist/cli/templates/init.mjs +1 -2
- package/dist/cli/types.cjs +2 -4
- package/dist/cli/types.mjs +2 -4
- package/dist/cli/utils.cjs +2 -4
- package/dist/cli/utils.mjs +1 -3
- package/dist/compile/classname-strategy.cjs +3 -5
- package/dist/compile/classname-strategy.mjs +1 -3
- package/dist/compile/classname.cjs +6 -8
- package/dist/compile/classname.mjs +5 -7
- package/dist/compile/index.cjs +18 -20
- package/dist/compile/index.mjs +6 -8
- package/dist/compile/jsx.cjs +8 -10
- package/dist/compile/jsx.mjs +6 -8
- package/dist/compile/prepared.cjs +3 -5
- package/dist/compile/prepared.mjs +1 -3
- package/dist/compile/runtime.cjs +4 -5
- package/dist/compile/runtime.mjs +1 -3
- package/dist/compile/transform.cjs +7 -9
- package/dist/compile/transform.mjs +3 -5
- package/dist/cx/index.cjs +6 -7
- package/dist/cx/index.mjs +3 -5
- package/dist/detect-fw/index.cjs +6 -7
- package/dist/detect-fw/index.mjs +1 -3
- package/dist/dev/client.cjs +2 -3
- package/dist/dev/client.mjs +1 -2
- package/dist/dev/plugin/browser.cjs +2 -3
- package/dist/dev/plugin/browser.mjs +1 -2
- package/dist/dev/plugin/server.cjs +13 -14
- package/dist/dev/plugin/server.mjs +3 -5
- package/dist/dev/port.cjs +3 -5
- package/dist/dev/port.mjs +1 -3
- package/dist/dev/runtime.cjs +3 -5
- package/dist/dev/runtime.mjs +1 -3
- package/dist/dev/server.cjs +12 -13
- package/dist/dev/server.mjs +15 -17
- package/dist/dev/shared.cjs +1 -3
- package/dist/dev/shared.mjs +1 -2
- package/dist/eslint-plugin/index.cjs +10 -13
- package/dist/eslint-plugin/index.mjs +1 -4
- package/dist/eslint-plugin/rules/classnames-only.cjs +4 -6
- package/dist/eslint-plugin/rules/classnames-only.mjs +1 -3
- package/dist/eslint-plugin/rules/format-classnames.cjs +8 -10
- package/dist/eslint-plugin/rules/format-classnames.mjs +1 -3
- package/dist/eslint-plugin/rules/no-unknown-classes.cjs +5 -7
- package/dist/eslint-plugin/rules/no-unknown-classes.mjs +1 -3
- package/dist/eslint-plugin/rules/prefer-classnames.cjs +5 -7
- package/dist/eslint-plugin/rules/prefer-classnames.mjs +1 -3
- package/dist/eslint-plugin/rules/prefer-token-values.cjs +6 -8
- package/dist/eslint-plugin/rules/prefer-token-values.mjs +1 -3
- package/dist/eslint-plugin/rules/prefer-unitless-values.cjs +7 -9
- package/dist/eslint-plugin/rules/prefer-unitless-values.mjs +1 -3
- package/dist/eslint-plugin/rules/props-only.cjs +5 -7
- package/dist/eslint-plugin/rules/props-only.mjs +1 -3
- package/dist/eslint-plugin/rules/redundant-cx.cjs +3 -5
- package/dist/eslint-plugin/rules/redundant-cx.mjs +1 -3
- package/dist/eslint-plugin/rules/require-prop-functions.cjs +6 -8
- package/dist/eslint-plugin/rules/require-prop-functions.mjs +1 -3
- package/dist/eslint-plugin/utils/api.cjs +3 -5
- package/dist/eslint-plugin/utils/api.mjs +1 -3
- package/dist/eslint-plugin/utils/ast.cjs +1 -3
- package/dist/eslint-plugin/utils/ast.mjs +1 -2
- package/dist/eslint-plugin/utils/boss-classes.cjs +5 -7
- package/dist/eslint-plugin/utils/boss-classes.mjs +1 -3
- package/dist/eslint-plugin/utils/context.cjs +1 -3
- package/dist/eslint-plugin/utils/context.mjs +1 -2
- package/dist/eslint-plugin/utils/defaults.cjs +1 -3
- package/dist/eslint-plugin/utils/defaults.mjs +1 -2
- package/dist/eslint-plugin/utils/format.cjs +1 -3
- package/dist/eslint-plugin/utils/format.mjs +1 -2
- package/dist/eslint-plugin/utils/order.cjs +3 -5
- package/dist/eslint-plugin/utils/order.mjs +1 -3
- package/dist/eslint-plugin/utils/property-order.cjs +1 -3
- package/dist/eslint-plugin/utils/property-order.mjs +1 -2
- package/dist/eslint-plugin/utils/static.cjs +1 -3
- package/dist/eslint-plugin/utils/static.mjs +1 -2
- package/dist/fontsource/directory.cjs +1 -3
- package/dist/fontsource/directory.mjs +1 -2
- package/dist/fontsource/server.cjs +12 -13
- package/dist/fontsource/server.mjs +2 -4
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +1 -2
- package/dist/log/browser.cjs +2 -4
- package/dist/log/browser.mjs +1 -3
- package/dist/log/server.cjs +6 -8
- package/dist/log/server.mjs +1 -3
- package/dist/merge/index.cjs +8 -9
- package/dist/merge/index.mjs +5 -7
- package/dist/native/browser.cjs +3 -4
- package/dist/native/browser.mjs +1 -3
- package/dist/native/server.cjs +7 -8
- package/dist/native/server.mjs +1 -3
- package/dist/native/styleTypes.cjs +5 -7
- package/dist/native/styleTypes.mjs +1 -3
- package/dist/parser/classname/server.cjs +17 -19
- package/dist/parser/classname/server.mjs +11 -13
- package/dist/parser/jsx/browser.cjs +7 -8
- package/dist/parser/jsx/browser.mjs +1 -3
- package/dist/parser/jsx/extractCode.cjs +2 -4
- package/dist/parser/jsx/extractCode.mjs +2 -3
- package/dist/parser/jsx/extractPrepared.cjs +3 -5
- package/dist/parser/jsx/extractPrepared.mjs +1 -3
- package/dist/parser/jsx/extractProps.cjs +3 -5
- package/dist/parser/jsx/extractProps.mjs +1 -3
- package/dist/parser/jsx/isDOMProp.cjs +3 -5
- package/dist/parser/jsx/isDOMProp.mjs +1 -3
- package/dist/parser/jsx/native.cjs +6 -7
- package/dist/parser/jsx/native.d.cts +2 -2
- package/dist/parser/jsx/native.d.mts +2 -2
- package/dist/parser/jsx/native.mjs +1 -3
- package/dist/parser/jsx/runtime.cjs +3 -3
- package/dist/parser/jsx/runtime.mjs +1 -2
- package/dist/parser/jsx/server.cjs +16 -17
- package/dist/parser/jsx/server.mjs +3 -5
- package/dist/postcss/index.cjs +2 -5
- package/dist/postcss/index.mjs +1 -4
- package/dist/prop/at/runtime-only.cjs +8 -9
- package/dist/prop/at/runtime-only.mjs +6 -8
- package/dist/prop/at/server.cjs +27 -28
- package/dist/prop/at/server.mjs +17 -19
- package/dist/prop/at/shared.cjs +1 -3
- package/dist/prop/at/shared.mjs +1 -2
- package/dist/prop/bosswind/browser.cjs +4 -5
- package/dist/prop/bosswind/browser.mjs +1 -3
- package/dist/prop/bosswind/runtime-only.cjs +4 -5
- package/dist/prop/bosswind/runtime-only.mjs +1 -3
- package/dist/prop/bosswind/selectors.cjs +1 -3
- package/dist/prop/bosswind/selectors.mjs +1 -2
- package/dist/prop/bosswind/server.cjs +12 -12
- package/dist/prop/bosswind/server.mjs +6 -7
- package/dist/prop/bosswind/shared.cjs +59 -9
- package/dist/prop/bosswind/shared.mjs +57 -8
- package/dist/prop/bosswind/tailwind-theme.cjs +2 -38
- package/dist/prop/bosswind/tailwind-theme.mjs +2 -37
- package/dist/prop/child/runtime-only.cjs +2 -3
- package/dist/prop/child/runtime-only.mjs +1 -2
- package/dist/prop/child/server.cjs +10 -11
- package/dist/prop/child/server.mjs +2 -4
- package/dist/prop/css/getDtsTemplate.cjs +7 -6
- package/dist/prop/css/getDtsTemplate.mjs +5 -4
- package/dist/prop/css/runtime-only.cjs +4 -5
- package/dist/prop/css/runtime-only.mjs +1 -3
- package/dist/prop/css/server.cjs +12 -13
- package/dist/prop/css/server.mjs +4 -6
- package/dist/prop/pseudo/runtime-only.cjs +3 -5
- package/dist/prop/pseudo/runtime-only.mjs +1 -3
- package/dist/prop/pseudo/server.cjs +19 -20
- package/dist/prop/pseudo/server.mjs +11 -13
- package/dist/prop/pseudo/shared.cjs +1 -3
- package/dist/prop/pseudo/shared.mjs +1 -2
- package/dist/reset/server.cjs +10 -11
- package/dist/reset/server.mjs +2 -4
- package/dist/runtime/index.cjs +5 -6
- package/dist/runtime/index.mjs +1 -3
- package/dist/runtime/preact.cjs +3 -3
- package/dist/runtime/preact.mjs +1 -2
- package/dist/runtime/qwik.cjs +3 -4
- package/dist/runtime/qwik.mjs +1 -3
- package/dist/runtime/react.cjs +3 -3
- package/dist/runtime/react.mjs +1 -2
- package/dist/runtime/solid.cjs +3 -4
- package/dist/runtime/solid.mjs +1 -3
- package/dist/runtime/stencil.cjs +4 -5
- package/dist/runtime/stencil.mjs +1 -3
- package/dist/runtime/style.cjs +2 -3
- package/dist/runtime/style.mjs +1 -2
- package/dist/shared/boundaries.cjs +4 -6
- package/dist/shared/boundaries.mjs +1 -3
- package/dist/shared/customCss.cjs +1 -3
- package/dist/shared/customCss.mjs +1 -2
- package/dist/shared/debug.cjs +2 -4
- package/dist/shared/debug.mjs +2 -3
- package/dist/shared/file.cjs +3 -5
- package/dist/shared/file.mjs +1 -3
- package/dist/shared/framework.cjs +1 -3
- package/dist/shared/framework.mjs +1 -2
- package/dist/shared/json.cjs +1 -3
- package/dist/shared/json.mjs +1 -2
- package/dist/shared/types.cjs +1 -3
- package/dist/shared/types.mjs +1 -2
- package/dist/strategy/classic/runtime-only.cjs +15 -16
- package/dist/strategy/classic/runtime-only.mjs +3 -5
- package/dist/strategy/classname-first/browser.cjs +7 -8
- package/dist/strategy/classname-first/browser.mjs +1 -3
- package/dist/strategy/classname-first/runtime-only.cjs +13 -14
- package/dist/strategy/classname-first/runtime-only.mjs +1 -3
- package/dist/strategy/classname-first/server.cjs +9 -11
- package/dist/strategy/classname-first/server.mjs +3 -5
- package/dist/strategy/classname-only/server.cjs +8 -10
- package/dist/strategy/classname-only/server.mjs +2 -4
- package/dist/strategy/inline-first/browser.cjs +6 -7
- package/dist/strategy/inline-first/browser.mjs +1 -3
- package/dist/strategy/inline-first/runtime-only.cjs +12 -13
- package/dist/strategy/inline-first/runtime-only.mjs +1 -3
- package/dist/strategy/inline-first/server.cjs +9 -11
- package/dist/strategy/inline-first/server.mjs +3 -5
- package/dist/strategy/runtime/runtime-only.cjs +6 -8
- package/dist/strategy/runtime/runtime-only.mjs +1 -4
- package/dist/strategy/runtime/server.cjs +11 -12
- package/dist/strategy/runtime/server.mjs +2 -4
- package/dist/strategy/runtime-only/css.cjs +5 -6
- package/dist/strategy/runtime-only/css.mjs +4 -5
- package/dist/tasks/build.cjs +8 -10
- package/dist/tasks/build.mjs +1 -3
- package/dist/tasks/compile.cjs +2 -4
- package/dist/tasks/compile.mjs +1 -3
- package/dist/tasks/postcss.cjs +11 -13
- package/dist/tasks/postcss.mjs +1 -3
- package/dist/tasks/session.cjs +4 -6
- package/dist/tasks/session.mjs +1 -3
- package/dist/tasks/watch.cjs +7 -9
- package/dist/tasks/watch.mjs +1 -3
- package/dist/transform/cache.cjs +1 -3
- package/dist/transform/cache.mjs +1 -2
- package/dist/transform/processFile.cjs +4 -6
- package/dist/transform/processFile.mjs +1 -3
- package/dist/use/token/browser.cjs +4 -5
- package/dist/use/token/browser.mjs +1 -3
- package/dist/use/token/normalize.cjs +1 -3
- package/dist/use/token/normalize.mjs +1 -2
- package/dist/use/token/propMap.cjs +1 -3
- package/dist/use/token/propMap.d.cts +1 -1
- package/dist/use/token/propMap.d.mts +1 -1
- package/dist/use/token/propMap.mjs +1 -2
- package/dist/use/token/runtime-only.cjs +5 -6
- package/dist/use/token/runtime-only.mjs +1 -3
- package/dist/use/token/server.cjs +13 -14
- package/dist/use/token/server.mjs +4 -6
- package/dist/use/token/vars.cjs +2 -4
- package/dist/use/token/vars.mjs +1 -3
- package/package.json +23 -23
- package/dist/_virtual/rolldown_runtime.mjs +0 -20
package/dist/cli/tasks/init.mjs
CHANGED
|
@@ -25,7 +25,6 @@ import fs from "node:fs/promises";
|
|
|
25
25
|
import path from "node:path";
|
|
26
26
|
import { confirm, log, multiselect, select, text } from "@clack/prompts";
|
|
27
27
|
import pluvo, { DEFAULT_COMMENT_STYLES } from "pluvo";
|
|
28
|
-
|
|
29
28
|
//#region src/cli/tasks/init.ts
|
|
30
29
|
const EXTENSIONS = "html,js,jsx,mjs,cjs,ts,tsx,mdx,md";
|
|
31
30
|
const INIT_COMMENT_STYLES = {
|
|
@@ -193,6 +192,12 @@ const POSTCSS_CONFIG_FILES = [
|
|
|
193
192
|
".postcssrc.cjs",
|
|
194
193
|
".postcssrc.mjs"
|
|
195
194
|
];
|
|
195
|
+
const VITE_CONFIG_FILES = [
|
|
196
|
+
"vite.config.ts",
|
|
197
|
+
"vite.config.js",
|
|
198
|
+
"vite.config.mjs",
|
|
199
|
+
"vite.config.cjs"
|
|
200
|
+
];
|
|
196
201
|
const ESLINT_CONFIG_FILES = [
|
|
197
202
|
{
|
|
198
203
|
file: "eslint.config.js",
|
|
@@ -368,6 +373,7 @@ const init = async (config) => {
|
|
|
368
373
|
configDir: normalizedConfigDir,
|
|
369
374
|
packageJson: packageData
|
|
370
375
|
});
|
|
376
|
+
const nitroViteUpdate = await ensureNitroViteTraceDeps(cwd);
|
|
371
377
|
const packageManager = await detectPackageManager(cwd, config.runtimeType);
|
|
372
378
|
const installCommand = packageUpdate.bossCssAdded ? formatInstallCommand(packageManager) : null;
|
|
373
379
|
logInitSummary({
|
|
@@ -383,7 +389,8 @@ const init = async (config) => {
|
|
|
383
389
|
frameworkId: framework.id,
|
|
384
390
|
selectedStrategyId,
|
|
385
391
|
cssAutoLoad,
|
|
386
|
-
installCommand
|
|
392
|
+
installCommand,
|
|
393
|
+
nitroUpdated: nitroViteUpdate.updated
|
|
387
394
|
});
|
|
388
395
|
return true;
|
|
389
396
|
} }];
|
|
@@ -1082,7 +1089,7 @@ const findExportIdentifier = (content) => {
|
|
|
1082
1089
|
};
|
|
1083
1090
|
const findArrayBoundsByIdentifier = (content, identifier) => {
|
|
1084
1091
|
const escaped = escapeRegExp(identifier);
|
|
1085
|
-
const match = content.match(
|
|
1092
|
+
const match = content.match(new RegExp(`\\b(?:const|let|var)\\s+${escaped}\\s*=\\s*\\[`));
|
|
1086
1093
|
if (!match) return null;
|
|
1087
1094
|
if (match.index == null) return null;
|
|
1088
1095
|
const startIndex = match.index + match[0].length - 1;
|
|
@@ -1095,7 +1102,7 @@ const findArrayBoundsByIdentifier = (content, identifier) => {
|
|
|
1095
1102
|
};
|
|
1096
1103
|
const findDefineConfigArrayBoundsByIdentifier = (content, identifier) => {
|
|
1097
1104
|
const escaped = escapeRegExp(identifier);
|
|
1098
|
-
const match = content.match(
|
|
1105
|
+
const match = content.match(new RegExp(`\\b(?:const|let|var)\\s+${escaped}\\s*=\\s*defineConfig\\s*\\(`));
|
|
1099
1106
|
if (!match) return null;
|
|
1100
1107
|
if (match.index == null) return null;
|
|
1101
1108
|
return findDefineConfigArrayBounds(content, match.index + match[0].length - 1);
|
|
@@ -1114,7 +1121,7 @@ const findDefineConfigArrayBounds = (content, callStart) => {
|
|
|
1114
1121
|
};
|
|
1115
1122
|
const findObjectStartByIdentifier = (content, identifier) => {
|
|
1116
1123
|
const escaped = escapeRegExp(identifier);
|
|
1117
|
-
const match = content.match(
|
|
1124
|
+
const match = content.match(new RegExp(`\\b(?:const|let|var)\\s+${escaped}\\s*=\\s*\\{`));
|
|
1118
1125
|
if (!match) return null;
|
|
1119
1126
|
if (match.index == null) return null;
|
|
1120
1127
|
return match.index + match[0].length - 1;
|
|
@@ -1207,11 +1214,11 @@ const needsArrayComma = (content, bounds) => {
|
|
|
1207
1214
|
return lastChar !== "[" && lastChar !== ",";
|
|
1208
1215
|
};
|
|
1209
1216
|
const ensureArrayEntry = (content, key, entry) => {
|
|
1210
|
-
const arrayMatch = content.match(
|
|
1211
|
-
const stringMatch = !arrayMatch ? content.match(
|
|
1217
|
+
const arrayMatch = content.match(new RegExp(`${key}\\s*:\\s*\\[`));
|
|
1218
|
+
const stringMatch = !arrayMatch ? content.match(new RegExp(`${key}\\s*:\\s*(['"][^'"]+['"])`)) : null;
|
|
1212
1219
|
if (stringMatch) {
|
|
1213
|
-
const entryValue
|
|
1214
|
-
if (stringMatch[1].replace(/^['"]|['"]$/g, "") === entryValue
|
|
1220
|
+
const entryValue = entry.replace(/^['"]|['"]$/g, "");
|
|
1221
|
+
if (stringMatch[1].replace(/^['"]|['"]$/g, "") === entryValue) return {
|
|
1215
1222
|
updated: false,
|
|
1216
1223
|
content
|
|
1217
1224
|
};
|
|
@@ -1227,10 +1234,10 @@ const ensureArrayEntry = (content, key, entry) => {
|
|
|
1227
1234
|
updated: false,
|
|
1228
1235
|
content
|
|
1229
1236
|
};
|
|
1230
|
-
const insertion
|
|
1237
|
+
const insertion = `\n${`${getIndentFromIndex(content, objectStart)} `}${key}: [${entry}],`;
|
|
1231
1238
|
return {
|
|
1232
1239
|
updated: true,
|
|
1233
|
-
content: `${content.slice(0, objectStart + 1)}${insertion
|
|
1240
|
+
content: `${content.slice(0, objectStart + 1)}${insertion}${content.slice(objectStart + 1)}`
|
|
1234
1241
|
};
|
|
1235
1242
|
}
|
|
1236
1243
|
if (arrayMatch.index == null) return {
|
|
@@ -1244,7 +1251,7 @@ const ensureArrayEntry = (content, key, entry) => {
|
|
|
1244
1251
|
content
|
|
1245
1252
|
};
|
|
1246
1253
|
const entryValue = entry.replace(/^['"]|['"]$/g, "");
|
|
1247
|
-
if (
|
|
1254
|
+
if (new RegExp(`['"]${escapeRegExp(entryValue)}['"]`).test(content.slice(startIndex, endIndex))) return {
|
|
1248
1255
|
updated: false,
|
|
1249
1256
|
content
|
|
1250
1257
|
};
|
|
@@ -1254,6 +1261,93 @@ const ensureArrayEntry = (content, key, entry) => {
|
|
|
1254
1261
|
content: `${content.slice(0, endIndex)}${insertion}${content.slice(endIndex)}`
|
|
1255
1262
|
};
|
|
1256
1263
|
};
|
|
1264
|
+
const updateNitroViteConfigContent = (content) => {
|
|
1265
|
+
const nitroPattern = /\bnitro\s*\(/g;
|
|
1266
|
+
let next = content;
|
|
1267
|
+
let updated = false;
|
|
1268
|
+
let hasNitro = false;
|
|
1269
|
+
let unsupported = false;
|
|
1270
|
+
let offset = 0;
|
|
1271
|
+
while (true) {
|
|
1272
|
+
nitroPattern.lastIndex = offset;
|
|
1273
|
+
const match = nitroPattern.exec(next);
|
|
1274
|
+
if (!match) break;
|
|
1275
|
+
hasNitro = true;
|
|
1276
|
+
const callStart = match.index + match[0].length - 1;
|
|
1277
|
+
const callEnd = findMatchingIndex(next, callStart, "(", ")");
|
|
1278
|
+
if (callEnd === -1) {
|
|
1279
|
+
unsupported = true;
|
|
1280
|
+
break;
|
|
1281
|
+
}
|
|
1282
|
+
const rawArgs = next.slice(callStart + 1, callEnd);
|
|
1283
|
+
if (!rawArgs.trim()) {
|
|
1284
|
+
next = `${next.slice(0, callStart + 1)}{ traceDeps: ['jsdom'] }${next.slice(callEnd)}`;
|
|
1285
|
+
updated = true;
|
|
1286
|
+
offset = callStart + 1 + 24;
|
|
1287
|
+
continue;
|
|
1288
|
+
}
|
|
1289
|
+
const firstArgOffset = rawArgs.search(/\S/);
|
|
1290
|
+
if (firstArgOffset === -1) {
|
|
1291
|
+
next = `${next.slice(0, callStart + 1)}{ traceDeps: ['jsdom'] }${next.slice(callEnd)}`;
|
|
1292
|
+
updated = true;
|
|
1293
|
+
offset = callStart + 1 + 24;
|
|
1294
|
+
continue;
|
|
1295
|
+
}
|
|
1296
|
+
const objectStart = callStart + 1 + firstArgOffset;
|
|
1297
|
+
if (next[objectStart] !== "{") {
|
|
1298
|
+
unsupported = true;
|
|
1299
|
+
offset = callEnd + 1;
|
|
1300
|
+
continue;
|
|
1301
|
+
}
|
|
1302
|
+
const objectEnd = findMatchingIndex(next, objectStart, "{", "}");
|
|
1303
|
+
if (objectEnd === -1 || next.slice(objectEnd + 1, callEnd).trim()) {
|
|
1304
|
+
unsupported = true;
|
|
1305
|
+
offset = callEnd + 1;
|
|
1306
|
+
continue;
|
|
1307
|
+
}
|
|
1308
|
+
const objectText = next.slice(objectStart, objectEnd + 1);
|
|
1309
|
+
const updatedObject = ensureNitroTraceDepsInObject(objectText, getIndentFromIndex(next, objectStart));
|
|
1310
|
+
if (updatedObject !== objectText) {
|
|
1311
|
+
next = `${next.slice(0, objectStart)}${updatedObject}${next.slice(objectEnd + 1)}`;
|
|
1312
|
+
updated = true;
|
|
1313
|
+
offset = objectStart + updatedObject.length;
|
|
1314
|
+
continue;
|
|
1315
|
+
}
|
|
1316
|
+
offset = callEnd + 1;
|
|
1317
|
+
}
|
|
1318
|
+
return {
|
|
1319
|
+
content: next,
|
|
1320
|
+
updated,
|
|
1321
|
+
hasNitro,
|
|
1322
|
+
unsupported
|
|
1323
|
+
};
|
|
1324
|
+
};
|
|
1325
|
+
const ensureNitroTraceDepsInObject = (objectText, baseIndent) => {
|
|
1326
|
+
if (!objectText.startsWith("{") || !objectText.endsWith("}")) return objectText;
|
|
1327
|
+
const traceMatch = objectText.match(/\btraceDeps\s*:\s*\[/);
|
|
1328
|
+
if (!traceMatch) {
|
|
1329
|
+
if (objectText.trim() === "{}") return "{ traceDeps: ['jsdom'] }";
|
|
1330
|
+
if (!objectText.includes("\n")) return `{ traceDeps: ['jsdom'], ${objectText.slice(1, -1).trim()} }`;
|
|
1331
|
+
const entryIndent = `${baseIndent} `;
|
|
1332
|
+
return objectText.replace("{", `{\n${entryIndent}traceDeps: ['jsdom'],`);
|
|
1333
|
+
}
|
|
1334
|
+
const arrayStart = (traceMatch.index ?? 0) + traceMatch[0].length - 1;
|
|
1335
|
+
const arrayEnd = findMatchingIndex(objectText, arrayStart, "[", "]");
|
|
1336
|
+
if (arrayEnd === -1) return objectText;
|
|
1337
|
+
const arrayBody = objectText.slice(arrayStart + 1, arrayEnd);
|
|
1338
|
+
if (/['"]jsdom['"]/.test(arrayBody)) return objectText;
|
|
1339
|
+
const updatedArrayBody = appendTraceDep(arrayBody, `${baseIndent} `);
|
|
1340
|
+
return `${objectText.slice(0, arrayStart + 1)}${updatedArrayBody}${objectText.slice(arrayEnd)}`;
|
|
1341
|
+
};
|
|
1342
|
+
const appendTraceDep = (arrayBody, indent) => {
|
|
1343
|
+
if (!arrayBody.trim()) {
|
|
1344
|
+
if (!arrayBody.includes("\n")) return "'jsdom'";
|
|
1345
|
+
return `\n${indent}'jsdom'\n${arrayBody.match(/\n([ \t]*)$/)?.[1] ?? indent.slice(0, -2)}`;
|
|
1346
|
+
}
|
|
1347
|
+
if (!arrayBody.includes("\n")) return `${arrayBody.trim()}, 'jsdom'`;
|
|
1348
|
+
const trimmedEnd = arrayBody.replace(/\s*$/, "");
|
|
1349
|
+
return `${trimmedEnd}${/,\s*$/.test(trimmedEnd) ? "" : ","}\n${indent}'jsdom'\n${arrayBody.match(/\n([ \t]*)$/)?.[1] ?? indent.slice(0, -2)}`;
|
|
1350
|
+
};
|
|
1257
1351
|
const ensureAllowGlobalsRule = (rules) => {
|
|
1258
1352
|
const existing = rules["react/jsx-no-undef"];
|
|
1259
1353
|
if (Array.isArray(existing)) {
|
|
@@ -1508,7 +1602,7 @@ const insertManagedBlock = (content, lines) => {
|
|
|
1508
1602
|
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1509
1603
|
const hasImportPath = (content, importPath) => {
|
|
1510
1604
|
const escaped = escapeRegExp(importPath);
|
|
1511
|
-
return
|
|
1605
|
+
return new RegExp(`['"]${escaped}['"]`).test(content);
|
|
1512
1606
|
};
|
|
1513
1607
|
const insertImports = (content, importLines) => {
|
|
1514
1608
|
const lines = content.split("\n");
|
|
@@ -1707,6 +1801,31 @@ const ensureBossImport = (content, isEsm) => {
|
|
|
1707
1801
|
if (content.includes("const boss = require")) return content;
|
|
1708
1802
|
return `const boss = require('boss-css/postcss')\n${content}`;
|
|
1709
1803
|
};
|
|
1804
|
+
const detectViteConfigPath = async (cwd) => {
|
|
1805
|
+
for (const file of VITE_CONFIG_FILES) {
|
|
1806
|
+
const fullPath = path.join(cwd, file);
|
|
1807
|
+
if (await exists(fullPath)) return fullPath;
|
|
1808
|
+
}
|
|
1809
|
+
return null;
|
|
1810
|
+
};
|
|
1811
|
+
const ensureNitroViteTraceDeps = async (cwd) => {
|
|
1812
|
+
const viteConfigPath = await detectViteConfigPath(cwd);
|
|
1813
|
+
if (!viteConfigPath) return {
|
|
1814
|
+
updated: false,
|
|
1815
|
+
hasNitro: false
|
|
1816
|
+
};
|
|
1817
|
+
const update = updateNitroViteConfigContent(await fs.readFile(viteConfigPath, "utf8"));
|
|
1818
|
+
if (update.unsupported) log.warn("Nitro detected in vite.config.*, but init could not safely add traceDeps: ['jsdom'].");
|
|
1819
|
+
if (!update.updated) return {
|
|
1820
|
+
updated: false,
|
|
1821
|
+
hasNitro: update.hasNitro
|
|
1822
|
+
};
|
|
1823
|
+
await fs.writeFile(viteConfigPath, update.content);
|
|
1824
|
+
return {
|
|
1825
|
+
updated: true,
|
|
1826
|
+
hasNitro: update.hasNitro
|
|
1827
|
+
};
|
|
1828
|
+
};
|
|
1710
1829
|
const getIndentFromIndex = (content, index) => {
|
|
1711
1830
|
const lineStart = content.lastIndexOf("\n", index);
|
|
1712
1831
|
const match = content.slice(lineStart + 1).match(/^\s+/);
|
|
@@ -1813,7 +1932,7 @@ const exists = async (filePath) => {
|
|
|
1813
1932
|
return false;
|
|
1814
1933
|
}
|
|
1815
1934
|
};
|
|
1816
|
-
const logInitSummary = ({ configDir, isNext, postcssMode, postcssDetection, configFolder, srcRoot, globalsEnabled, eslintUpdated, useEslintPlugin, frameworkId, selectedStrategyId, cssAutoLoad, installCommand }) => {
|
|
1935
|
+
const logInitSummary = ({ configDir, isNext, postcssMode, postcssDetection, configFolder, srcRoot, globalsEnabled, eslintUpdated, useEslintPlugin, frameworkId, selectedStrategyId, cssAutoLoad, installCommand, nitroUpdated }) => {
|
|
1817
1936
|
log.info("boss init complete.");
|
|
1818
1937
|
log.message(`Generated Boss CSS config in ${configDir}`);
|
|
1819
1938
|
if (selectedStrategyId === "classname-only") log.message("Classname-only does not auto-load styles. Import styles.css manually.");
|
|
@@ -1855,10 +1974,9 @@ const logInitSummary = ({ configDir, isNext, postcssMode, postcssDetection, conf
|
|
|
1855
1974
|
log.message("Stencil note:");
|
|
1856
1975
|
log.message("- PostCSS setup is skipped; run `npx boss-css watch` for CSS generation.");
|
|
1857
1976
|
}
|
|
1977
|
+
if (nitroUpdated) log.message("Updated vite.config.* Nitro plugin with traceDeps: ['jsdom'].");
|
|
1858
1978
|
if (globalsEnabled) log.message("Global $$ enabled for JSX usage.");
|
|
1859
1979
|
if (eslintUpdated) log.message(useEslintPlugin ? "ESLint updated with Boss CSS plugin." : "ESLint updated with $$ globals.");
|
|
1860
1980
|
};
|
|
1861
|
-
var init_default = init;
|
|
1862
|
-
|
|
1863
1981
|
//#endregion
|
|
1864
|
-
export {
|
|
1982
|
+
export { init as default, updateNitroViteConfigContent };
|
package/dist/cli/tasks/watch.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const require_watch = require(
|
|
1
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_watch = require("../../tasks/watch.cjs");
|
|
3
3
|
let _clack_prompts = require("@clack/prompts");
|
|
4
|
-
|
|
5
4
|
//#region src/cli/tasks/watch.ts
|
|
6
5
|
const watch = async (config) => {
|
|
7
6
|
return [{ prompt: async () => {
|
|
@@ -32,7 +31,5 @@ const watch = async (config) => {
|
|
|
32
31
|
return true;
|
|
33
32
|
} }];
|
|
34
33
|
};
|
|
35
|
-
var watch_default = watch;
|
|
36
|
-
|
|
37
34
|
//#endregion
|
|
38
|
-
exports.default =
|
|
35
|
+
exports.default = watch;
|
package/dist/cli/tasks/watch.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { runWatch } from "../../tasks/watch.mjs";
|
|
2
2
|
import { log } from "@clack/prompts";
|
|
3
|
-
|
|
4
3
|
//#region src/cli/tasks/watch.ts
|
|
5
4
|
const watch = async (config) => {
|
|
6
5
|
return [{ prompt: async () => {
|
|
@@ -31,7 +30,5 @@ const watch = async (config) => {
|
|
|
31
30
|
return true;
|
|
32
31
|
} }];
|
|
33
32
|
};
|
|
34
|
-
var watch_default = watch;
|
|
35
|
-
|
|
36
33
|
//#endregion
|
|
37
|
-
export {
|
|
34
|
+
export { watch as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/cli/templates/init.ts
|
|
3
2
|
const configTemplate = `/* eslint-disable */
|
|
4
3
|
// @ts-check
|
|
@@ -74,9 +73,8 @@ const postcssTemplate = `export default {
|
|
|
74
73
|
},
|
|
75
74
|
}
|
|
76
75
|
`;
|
|
77
|
-
|
|
78
76
|
//#endregion
|
|
79
77
|
exports.configTemplate = configTemplate;
|
|
80
78
|
exports.jsconfigTemplate = jsconfigTemplate;
|
|
81
79
|
exports.packageTemplate = packageTemplate;
|
|
82
|
-
exports.postcssTemplate = postcssTemplate;
|
|
80
|
+
exports.postcssTemplate = postcssTemplate;
|
package/dist/cli/types.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require("../shared/types.cjs");
|
|
3
2
|
//#region src/cli/types.ts
|
|
4
3
|
let PackageManagerType = /* @__PURE__ */ function(PackageManagerType) {
|
|
5
4
|
PackageManagerType["NPM"] = "npm";
|
|
@@ -8,6 +7,5 @@ let PackageManagerType = /* @__PURE__ */ function(PackageManagerType) {
|
|
|
8
7
|
PackageManagerType["BUN"] = "bun";
|
|
9
8
|
return PackageManagerType;
|
|
10
9
|
}({});
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
exports.PackageManagerType = PackageManagerType;
|
|
11
|
+
exports.PackageManagerType = PackageManagerType;
|
package/dist/cli/types.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import "../shared/types.mjs";
|
|
3
2
|
//#region src/cli/types.ts
|
|
4
3
|
let PackageManagerType = /* @__PURE__ */ function(PackageManagerType) {
|
|
5
4
|
PackageManagerType["NPM"] = "npm";
|
|
@@ -8,6 +7,5 @@ let PackageManagerType = /* @__PURE__ */ function(PackageManagerType) {
|
|
|
8
7
|
PackageManagerType["BUN"] = "bun";
|
|
9
8
|
return PackageManagerType;
|
|
10
9
|
}({});
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
|
-
export { PackageManagerType };
|
|
11
|
+
export { PackageManagerType };
|
package/dist/cli/utils.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let _clack_prompts = require("@clack/prompts");
|
|
3
|
-
|
|
4
3
|
//#region src/cli/utils.ts
|
|
5
4
|
const cancelIf = (value, message = "Operation cancelled.") => {
|
|
6
5
|
if ((0, _clack_prompts.isCancel)(value)) {
|
|
@@ -37,7 +36,6 @@ async function runTask(config) {
|
|
|
37
36
|
await prompt(config);
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
|
|
41
39
|
//#endregion
|
|
42
40
|
exports.cancelIf = cancelIf;
|
|
43
|
-
exports.runTask = runTask;
|
|
41
|
+
exports.runTask = runTask;
|
package/dist/cli/utils.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cancel, isCancel, log } from "@clack/prompts";
|
|
2
|
-
|
|
3
2
|
//#region src/cli/utils.ts
|
|
4
3
|
const cancelIf = (value, message = "Operation cancelled.") => {
|
|
5
4
|
if (isCancel(value)) {
|
|
@@ -36,6 +35,5 @@ async function runTask(config) {
|
|
|
36
35
|
await prompt(config);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
|
|
40
38
|
//#endregion
|
|
41
|
-
export { cancelIf, runTask };
|
|
39
|
+
export { cancelIf, runTask };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let _emotion_hash = require("@emotion/hash");
|
|
3
|
-
_emotion_hash =
|
|
4
|
-
|
|
3
|
+
_emotion_hash = require_runtime.__toESM(_emotion_hash);
|
|
5
4
|
//#region src/compile/classname-strategy.ts
|
|
6
5
|
const shortestAlphabet = "cCsSxyzXYZwqWQ";
|
|
7
6
|
const isUnsafeUnicode = (codePoint) => {
|
|
@@ -74,6 +73,5 @@ const createClassNameMapper = (options) => {
|
|
|
74
73
|
}
|
|
75
74
|
};
|
|
76
75
|
};
|
|
77
|
-
|
|
78
76
|
//#endregion
|
|
79
|
-
exports.createClassNameMapper = createClassNameMapper;
|
|
77
|
+
exports.createClassNameMapper = createClassNameMapper;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import hash from "@emotion/hash";
|
|
2
|
-
|
|
3
2
|
//#region src/compile/classname-strategy.ts
|
|
4
3
|
const shortestAlphabet = "cCsSxyzXYZwqWQ";
|
|
5
4
|
const isUnsafeUnicode = (codePoint) => {
|
|
@@ -72,6 +71,5 @@ const createClassNameMapper = (options) => {
|
|
|
72
71
|
}
|
|
73
72
|
};
|
|
74
73
|
};
|
|
75
|
-
|
|
76
74
|
//#endregion
|
|
77
|
-
export { createClassNameMapper };
|
|
75
|
+
export { createClassNameMapper };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
let _swc_core = require("@swc/core");
|
|
3
|
-
|
|
4
3
|
//#region src/compile/classname.ts
|
|
5
4
|
const tokenPrefix = "$$.token.";
|
|
6
5
|
const rewriteClassNameTokens = (input) => {
|
|
@@ -107,11 +106,11 @@ const isClassAttribute = (attr, classNameProp) => {
|
|
|
107
106
|
const rewriteSelector = (selector, options) => {
|
|
108
107
|
const grouped = parseGroupedSelector(selector);
|
|
109
108
|
if (grouped) {
|
|
110
|
-
const nextEntries = grouped.entries.map((entry
|
|
111
|
-
name: entry
|
|
112
|
-
rawValue: rewriteTokenValue(entry
|
|
109
|
+
const nextEntries = grouped.entries.map((entry) => ({
|
|
110
|
+
name: entry.name,
|
|
111
|
+
rawValue: rewriteTokenValue(entry.rawValue)
|
|
113
112
|
}));
|
|
114
|
-
if (nextEntries.length > 1 || options.expandSingleGroup) return [...nextEntries].sort((a, b) => a.name.localeCompare(b.name)).map((entry
|
|
113
|
+
if (nextEntries.length > 1 || options.expandSingleGroup) return [...nextEntries].sort((a, b) => a.name.localeCompare(b.name)).map((entry) => `${grouped.prefix}:${entry.name}:${entry.rawValue}`);
|
|
115
114
|
const [entry] = nextEntries;
|
|
116
115
|
return [`${grouped.prefix}:{${entry.name}:${entry.rawValue}}`];
|
|
117
116
|
}
|
|
@@ -356,11 +355,10 @@ const rewriteQuotedSegments = (input, rewrite) => {
|
|
|
356
355
|
}
|
|
357
356
|
return output;
|
|
358
357
|
};
|
|
359
|
-
|
|
360
358
|
//#endregion
|
|
361
359
|
exports.collectBossClassTokensInSource = collectBossClassTokensInSource;
|
|
362
360
|
exports.collectBossClassTokensInText = collectBossClassTokensInText;
|
|
363
361
|
exports.rewriteClassNameTokensInElement = rewriteClassNameTokensInElement;
|
|
364
362
|
exports.rewriteClassNameTokensInSource = rewriteClassNameTokensInSource;
|
|
365
363
|
exports.rewriteClassNameTokensInText = rewriteClassNameTokensInText;
|
|
366
|
-
exports.rewriteClassNameTokensWithMap = rewriteClassNameTokensWithMap;
|
|
364
|
+
exports.rewriteClassNameTokensWithMap = rewriteClassNameTokensWithMap;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { parseSync, printSync } from "@swc/core";
|
|
2
|
-
|
|
3
2
|
//#region src/compile/classname.ts
|
|
4
3
|
const tokenPrefix = "$$.token.";
|
|
5
4
|
const rewriteClassNameTokens = (input) => {
|
|
@@ -106,11 +105,11 @@ const isClassAttribute = (attr, classNameProp) => {
|
|
|
106
105
|
const rewriteSelector = (selector, options) => {
|
|
107
106
|
const grouped = parseGroupedSelector(selector);
|
|
108
107
|
if (grouped) {
|
|
109
|
-
const nextEntries = grouped.entries.map((entry
|
|
110
|
-
name: entry
|
|
111
|
-
rawValue: rewriteTokenValue(entry
|
|
108
|
+
const nextEntries = grouped.entries.map((entry) => ({
|
|
109
|
+
name: entry.name,
|
|
110
|
+
rawValue: rewriteTokenValue(entry.rawValue)
|
|
112
111
|
}));
|
|
113
|
-
if (nextEntries.length > 1 || options.expandSingleGroup) return [...nextEntries].sort((a, b) => a.name.localeCompare(b.name)).map((entry
|
|
112
|
+
if (nextEntries.length > 1 || options.expandSingleGroup) return [...nextEntries].sort((a, b) => a.name.localeCompare(b.name)).map((entry) => `${grouped.prefix}:${entry.name}:${entry.rawValue}`);
|
|
114
113
|
const [entry] = nextEntries;
|
|
115
114
|
return [`${grouped.prefix}:{${entry.name}:${entry.rawValue}}`];
|
|
116
115
|
}
|
|
@@ -355,6 +354,5 @@ const rewriteQuotedSegments = (input, rewrite) => {
|
|
|
355
354
|
}
|
|
356
355
|
return output;
|
|
357
356
|
};
|
|
358
|
-
|
|
359
357
|
//#endregion
|
|
360
|
-
export { collectBossClassTokensInSource, collectBossClassTokensInText, rewriteClassNameTokensInElement, rewriteClassNameTokensInSource, rewriteClassNameTokensInText, rewriteClassNameTokensWithMap };
|
|
358
|
+
export { collectBossClassTokensInSource, collectBossClassTokensInText, rewriteClassNameTokensInElement, rewriteClassNameTokensInSource, rewriteClassNameTokensInText, rewriteClassNameTokensWithMap };
|
package/dist/compile/index.cjs
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_api_server = require(
|
|
3
|
-
const require_file = require(
|
|
4
|
-
const require_boundaries = require(
|
|
5
|
-
const require_session = require(
|
|
6
|
-
const require_framework = require(
|
|
7
|
-
const require_classname = require(
|
|
8
|
-
const require_classname_strategy = require(
|
|
9
|
-
const require_prepared = require(
|
|
10
|
-
const require_transform = require(
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_api_server = require("../api/server.cjs");
|
|
3
|
+
const require_file = require("../shared/file.cjs");
|
|
4
|
+
const require_boundaries = require("../shared/boundaries.cjs");
|
|
5
|
+
const require_session = require("../tasks/session.cjs");
|
|
6
|
+
const require_framework = require("../shared/framework.cjs");
|
|
7
|
+
const require_classname = require("./classname.cjs");
|
|
8
|
+
const require_classname_strategy = require("./classname-strategy.cjs");
|
|
9
|
+
const require_prepared = require("./prepared.cjs");
|
|
10
|
+
const require_transform = require("./transform.cjs");
|
|
11
11
|
let node_fs_promises = require("node:fs/promises");
|
|
12
|
-
node_fs_promises =
|
|
12
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises);
|
|
13
13
|
let node_path = require("node:path");
|
|
14
|
-
node_path =
|
|
14
|
+
node_path = require_runtime.__toESM(node_path);
|
|
15
15
|
let lightningcss = require("lightningcss");
|
|
16
|
-
|
|
17
16
|
//#region src/compile/index.ts
|
|
18
17
|
const supportedExtensions = new Set([
|
|
19
18
|
".js",
|
|
@@ -206,13 +205,13 @@ async function compileProject(options) {
|
|
|
206
205
|
stylesheetPath = globalOutput?.path ?? globalOutputPath;
|
|
207
206
|
}
|
|
208
207
|
const durationMs = Number(process.hrtime.bigint() - start) / 1e6;
|
|
209
|
-
const runtimeFiles = fileResults.filter((result
|
|
210
|
-
const valueHelperFiles = fileResults.filter((result
|
|
211
|
-
const filesProcessed = fileResults.filter((result
|
|
212
|
-
const filesCopied = fileResults.filter((result
|
|
208
|
+
const runtimeFiles = fileResults.filter((result) => result.needsRuntime).map((result) => result.file);
|
|
209
|
+
const valueHelperFiles = fileResults.filter((result) => result.needsValueHelper).map((result) => result.file);
|
|
210
|
+
const filesProcessed = fileResults.filter((result) => result.processed).length;
|
|
211
|
+
const filesCopied = fileResults.filter((result) => result.copied).length;
|
|
213
212
|
const filesTotal = fileResults.length;
|
|
214
213
|
const filesSkipped = filesTotal - filesProcessed - filesCopied;
|
|
215
|
-
const elementsReplaced = fileResults.reduce((total, result
|
|
214
|
+
const elementsReplaced = fileResults.reduce((total, result) => total + result.replacedElements, 0);
|
|
216
215
|
const result = {
|
|
217
216
|
statsMode,
|
|
218
217
|
stats: {
|
|
@@ -235,6 +234,5 @@ async function compileProject(options) {
|
|
|
235
234
|
await require_session.emitSession(api, await require_session.resolveSessionPayload(baseDir, config, "compile", "stop"));
|
|
236
235
|
return result;
|
|
237
236
|
}
|
|
238
|
-
|
|
239
237
|
//#endregion
|
|
240
|
-
exports.compileProject = compileProject;
|
|
238
|
+
exports.compileProject = compileProject;
|
package/dist/compile/index.mjs
CHANGED
|
@@ -10,7 +10,6 @@ import { transformSource } from "./transform.mjs";
|
|
|
10
10
|
import fs from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { transform } from "lightningcss";
|
|
13
|
-
|
|
14
13
|
//#region src/compile/index.ts
|
|
15
14
|
const supportedExtensions = new Set([
|
|
16
15
|
".js",
|
|
@@ -203,13 +202,13 @@ async function compileProject(options) {
|
|
|
203
202
|
stylesheetPath = globalOutput?.path ?? globalOutputPath;
|
|
204
203
|
}
|
|
205
204
|
const durationMs = Number(process.hrtime.bigint() - start) / 1e6;
|
|
206
|
-
const runtimeFiles = fileResults.filter((result
|
|
207
|
-
const valueHelperFiles = fileResults.filter((result
|
|
208
|
-
const filesProcessed = fileResults.filter((result
|
|
209
|
-
const filesCopied = fileResults.filter((result
|
|
205
|
+
const runtimeFiles = fileResults.filter((result) => result.needsRuntime).map((result) => result.file);
|
|
206
|
+
const valueHelperFiles = fileResults.filter((result) => result.needsValueHelper).map((result) => result.file);
|
|
207
|
+
const filesProcessed = fileResults.filter((result) => result.processed).length;
|
|
208
|
+
const filesCopied = fileResults.filter((result) => result.copied).length;
|
|
210
209
|
const filesTotal = fileResults.length;
|
|
211
210
|
const filesSkipped = filesTotal - filesProcessed - filesCopied;
|
|
212
|
-
const elementsReplaced = fileResults.reduce((total, result
|
|
211
|
+
const elementsReplaced = fileResults.reduce((total, result) => total + result.replacedElements, 0);
|
|
213
212
|
const result = {
|
|
214
213
|
statsMode,
|
|
215
214
|
stats: {
|
|
@@ -232,6 +231,5 @@ async function compileProject(options) {
|
|
|
232
231
|
await emitSession(api, await resolveSessionPayload(baseDir, config, "compile", "stop"));
|
|
233
232
|
return result;
|
|
234
233
|
}
|
|
235
|
-
|
|
236
234
|
//#endregion
|
|
237
|
-
export { compileProject };
|
|
235
|
+
export { compileProject };
|
package/dist/compile/jsx.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const require_vars = require(
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_vars = require("../use/token/vars.cjs");
|
|
3
3
|
let _swc_core = require("@swc/core");
|
|
4
|
-
|
|
5
4
|
//#region src/compile/jsx.ts
|
|
6
5
|
const preservedAttrs = new Set(["key", "ref"]);
|
|
7
6
|
const fallbackSpan = {
|
|
@@ -199,15 +198,15 @@ const buildPropTree = async (attributes, asAttribute, state, classNameProp, tag,
|
|
|
199
198
|
if (!name) continue;
|
|
200
199
|
if (name === "style" || preservedAttrs.has(name) || name === classNameProp) continue;
|
|
201
200
|
if (name === "tokens") {
|
|
202
|
-
const parsed
|
|
203
|
-
if (parsed
|
|
201
|
+
const parsed = parseAttributeValue(attr.value);
|
|
202
|
+
if (parsed) tokensProp = tokensProp ? mergePropValues(tokensProp, parsed) : parsed;
|
|
204
203
|
continue;
|
|
205
204
|
}
|
|
206
205
|
if (!state.api.dictionary.resolve(name).descriptor) {
|
|
207
|
-
const parsed
|
|
208
|
-
const compileAttrs = parsed
|
|
206
|
+
const parsed = parseAttributeValue(attr.value);
|
|
207
|
+
const compileAttrs = parsed ? await applyCompileProp({
|
|
209
208
|
name,
|
|
210
|
-
parsed
|
|
209
|
+
parsed,
|
|
211
210
|
attr,
|
|
212
211
|
state,
|
|
213
212
|
tag
|
|
@@ -870,8 +869,7 @@ const wrapDynamicAs = (node, asExpression, span, context) => {
|
|
|
870
869
|
};
|
|
871
870
|
return iife;
|
|
872
871
|
};
|
|
873
|
-
|
|
874
872
|
//#endregion
|
|
875
873
|
exports.buildPreparedDefinition = buildPreparedDefinition;
|
|
876
874
|
exports.isPreparedDefinitionStatic = isPreparedDefinitionStatic;
|
|
877
|
-
exports.transformJsxElement = transformJsxElement;
|
|
875
|
+
exports.transformJsxElement = transformJsxElement;
|
package/dist/compile/jsx.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createTokenVars } from "../use/token/vars.mjs";
|
|
2
2
|
import { printSync } from "@swc/core";
|
|
3
|
-
|
|
4
3
|
//#region src/compile/jsx.ts
|
|
5
4
|
const preservedAttrs = new Set(["key", "ref"]);
|
|
6
5
|
const fallbackSpan = {
|
|
@@ -198,15 +197,15 @@ const buildPropTree = async (attributes, asAttribute, state, classNameProp, tag,
|
|
|
198
197
|
if (!name) continue;
|
|
199
198
|
if (name === "style" || preservedAttrs.has(name) || name === classNameProp) continue;
|
|
200
199
|
if (name === "tokens") {
|
|
201
|
-
const parsed
|
|
202
|
-
if (parsed
|
|
200
|
+
const parsed = parseAttributeValue(attr.value);
|
|
201
|
+
if (parsed) tokensProp = tokensProp ? mergePropValues(tokensProp, parsed) : parsed;
|
|
203
202
|
continue;
|
|
204
203
|
}
|
|
205
204
|
if (!state.api.dictionary.resolve(name).descriptor) {
|
|
206
|
-
const parsed
|
|
207
|
-
const compileAttrs = parsed
|
|
205
|
+
const parsed = parseAttributeValue(attr.value);
|
|
206
|
+
const compileAttrs = parsed ? await applyCompileProp({
|
|
208
207
|
name,
|
|
209
|
-
parsed
|
|
208
|
+
parsed,
|
|
210
209
|
attr,
|
|
211
210
|
state,
|
|
212
211
|
tag
|
|
@@ -869,6 +868,5 @@ const wrapDynamicAs = (node, asExpression, span, context) => {
|
|
|
869
868
|
};
|
|
870
869
|
return iife;
|
|
871
870
|
};
|
|
872
|
-
|
|
873
871
|
//#endregion
|
|
874
|
-
export { buildPreparedDefinition, isPreparedDefinitionStatic, transformJsxElement };
|
|
872
|
+
export { buildPreparedDefinition, isPreparedDefinitionStatic, transformJsxElement };
|