@subf/config 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,46 +22,6 @@ subf --type web # SolidJS apps
22
22
 
23
23
  When `tsconfig.json` already exists, missing settings are added while existing settings are preserved. Use `--force` to overwrite generated settings. Legacy `@subf/config` entries in `extends` are removed automatically.
24
24
 
25
- ### `tsdown`
26
-
27
- Helpers to create `tsdown` build configs.
28
-
29
- Example: use `lib()` in your `tsdown.config.ts`:
30
-
31
- ```ts
32
- import { lib } from '@subf/config/tsdown'
33
- import { defineConfig } from 'tsdown'
34
-
35
- export default lib({
36
- entry: 'shallow',
37
- excludeDeps: ['oxlint', 'oxfmt', 'tsdown'],
38
- overrides: {
39
- exports: {
40
- customExports(exports) {
41
- exports['./custom'] = './you-custom-file.js'
42
- return exports
43
- },
44
- },
45
- },
46
- })
47
- ```
48
-
49
- For Node builds use `nodeLib()`:
50
-
51
- ```ts
52
- import { nodeLib } from '@subf/config/tsdown'
53
- export default nodeLib({ entry: 'src/index.ts' })
54
- ```
55
-
56
- For Solid builds (requires `vite-plugin-solid`) use `solidLib()`:
57
-
58
- ```ts
59
- import { solidLib } from '@subf/config/tsdown'
60
- import { defineConfig } from 'tsdown'
61
-
62
- export default solidLib({ entry: 'src/index.tsx' })
63
- ```
64
-
65
25
  ### `oxfmt`
66
26
 
67
27
  In `oxfmt.config.ts`:
package/dist/oxlint.d.mts CHANGED
@@ -8,6 +8,24 @@ export declare const typeAware: OxlintConfig;
8
8
  export declare const markdownOverrideConfig: OxlintOverride;
9
9
  export declare const overrides: Array<OxlintOverride>;
10
10
  export declare const CONFIG: OxlintConfig;
11
+ export type UnoCSSOption = {
12
+ /**
13
+ * @default true
14
+ */
15
+ enable?: boolean;
16
+ order?: {
17
+ /**
18
+ * Package name
19
+ * @default '@subf/unocss/oxlint-plugin'
20
+ */
21
+ package?: string;
22
+ /**
23
+ * @default ['cn', 'cva']
24
+ */
25
+ unoFunctions?: Array<string>;
26
+ unoVariables?: Array<string>;
27
+ };
28
+ };
11
29
  export declare const unocss: OxlintOverride;
12
30
  export type SolidPreset = 'v1' | 'v2' | 'v2strict';
13
31
  export interface SubfOptions extends OxlintConfig {
@@ -20,7 +38,7 @@ export interface SubfOptions extends OxlintConfig {
20
38
  */
21
39
  solid?: boolean | SolidPreset;
22
40
  typeAware?: boolean;
23
- unocss?: boolean;
41
+ unocss?: boolean | UnoCSSOption;
24
42
  }
25
43
  export declare function subfLint(options?: SubfOptions): OxlintConfig;
26
44
  export { CONFIG as default, FILES_TS_TSX, type OxlintConfig, type OxlintOverride, solid, solidV2, solidV2Strict };
package/dist/oxlint.mjs CHANGED
@@ -512,19 +512,25 @@ const CONFIG = {
512
512
  ...baseRules,
513
513
  overrides
514
514
  };
515
- const unocss = {
516
- files: FILES_TS_TSX$1,
517
- jsPlugins: [{
518
- name: "uno",
519
- specifier: "@subf/unocss/oxlint-plugin"
520
- }],
521
- rules: {
522
- "uno/order": ["warn", { unoFunctions: ["cn", "cva"] }],
523
- "uno/blocklist": "error"
524
- }
525
- };
515
+ function getUnocssOverride(option = {}) {
516
+ return {
517
+ files: FILES_TS_TSX$1,
518
+ jsPlugins: [{
519
+ name: "uno",
520
+ specifier: option.package || "@subf/unocss/oxlint-plugin"
521
+ }],
522
+ rules: {
523
+ "uno/order": ["warn", {
524
+ unoFunctions: option?.unoFunctions || ["cn", "cva"],
525
+ unoVariables: option?.unoVariables
526
+ }],
527
+ "uno/blocklist": "error"
528
+ }
529
+ };
530
+ }
531
+ const unocss = getUnocssOverride();
526
532
  function subfLint(options = {}) {
527
- const { lib, unocss: enableUnocss, solid: enableSolid, typeAware: enableTypeAware, overrides, extends: userExtends, ...oxlint } = options;
533
+ const { lib, unocss: unocssConfig, solid: enableSolid, typeAware: enableTypeAware, overrides, extends: userExtends, ...oxlint } = options;
528
534
  const ovr = [];
529
535
  let solidSettings;
530
536
  if (lib) ovr.push({
@@ -540,7 +546,8 @@ function subfLint(options = {}) {
540
546
  });
541
547
  else ovr.push(ts);
542
548
  ovr.push(vitest, markdownOverrideConfig);
543
- if (enableUnocss) ovr.push(unocss);
549
+ if (unocssConfig === true) ovr.push(unocss);
550
+ else if (typeof unocssConfig === "object" && unocssConfig.enable !== false) ovr.push(getUnocssOverride(unocssConfig.order));
544
551
  if (enableSolid) {
545
552
  const solidPreset = enableSolid === true ? "v2strict" : enableSolid;
546
553
  if (solidPreset === "v1") ovr.push(solidConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subf/config",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Universal configuration for TypeScript, oxlint (+unocss, +solid), oxfmt, and tsdown.",
5
5
  "keywords": [
6
6
  "config",