@subf/config 0.4.0 → 0.5.0
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/bin/subf.js +0 -0
- package/dist/cli.d.mts +8 -0
- package/dist/oxfmt.d.mts +6 -0
- package/dist/oxlint.d.mts +22 -0
- package/dist/{oxlint.js → oxlint.mjs} +6 -2
- package/package.json +17 -19
- package/dist/cli.d.ts +0 -9
- package/dist/oxfmt.d.ts +0 -6
- package/dist/oxlint.d.ts +0 -22
- package/dist/tsdown.d.ts +0 -52
- package/dist/tsdown.js +0 -67
- /package/dist/{cli.js → cli.mjs} +0 -0
- /package/dist/{oxfmt.js → oxfmt.mjs} +0 -0
package/bin/subf.js
CHANGED
|
File without changes
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/utils/tsconfig.d.ts
|
|
2
|
+
declare const TSCONFIG_TYPE: readonly ['node', 'lib', 'solid', 'solid-lib'];
|
|
3
|
+
type TsconfigType = (typeof TSCONFIG_TYPE)[number];
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/cli.d.ts
|
|
6
|
+
export declare function parseType(argv: readonly string[]): TsconfigType;
|
|
7
|
+
export declare function main(argv?: readonly string[]): Promise<number>;
|
|
8
|
+
//#endregion
|
package/dist/oxfmt.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FILES_TS_TSX, solidConfig as solid } from "@subf/oxlint-plugin/config";
|
|
2
|
+
import { OxlintConfig, OxlintOverride } from "oxlint";
|
|
3
|
+
//#region src/oxlint.d.ts
|
|
4
|
+
export declare const baseConfig: OxlintConfig;
|
|
5
|
+
export declare const baseRules: OxlintConfig;
|
|
6
|
+
export declare const ts: OxlintOverride;
|
|
7
|
+
export declare const vitest: OxlintOverride;
|
|
8
|
+
export declare const markdownOverrideConfig: OxlintOverride;
|
|
9
|
+
export declare const overrides: OxlintOverride[];
|
|
10
|
+
export declare const CONFIG: OxlintConfig;
|
|
11
|
+
export declare const unocss: OxlintOverride;
|
|
12
|
+
export interface SubfOptions extends OxlintConfig {
|
|
13
|
+
/**
|
|
14
|
+
* Used for lib, force to explicit function return type
|
|
15
|
+
*/
|
|
16
|
+
lib?: boolean;
|
|
17
|
+
solid?: boolean;
|
|
18
|
+
unocss?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function subfLint(options?: SubfOptions): OxlintConfig;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { CONFIG as default, FILES_TS_TSX, type OxlintConfig, type OxlintOverride, solid };
|
|
@@ -335,7 +335,10 @@ const ts = {
|
|
|
335
335
|
"typescript/prefer-literal-enum-member": "error",
|
|
336
336
|
"typescript/prefer-namespace-keyword": "error",
|
|
337
337
|
"typescript/prefer-ts-expect-error": "error",
|
|
338
|
-
"typescript/switch-exhaustiveness-check": "error",
|
|
338
|
+
"typescript/switch-exhaustiveness-check": ["error", {
|
|
339
|
+
allowDefaultCaseForExhaustiveSwitch: true,
|
|
340
|
+
considerDefaultExhaustiveForUnions: true
|
|
341
|
+
}],
|
|
339
342
|
"typescript/consistent-type-imports": ["error", {
|
|
340
343
|
disallowTypeAnnotations: false,
|
|
341
344
|
prefer: "type-imports"
|
|
@@ -399,7 +402,7 @@ const unocss = {
|
|
|
399
402
|
}
|
|
400
403
|
};
|
|
401
404
|
function subfLint(options = {}) {
|
|
402
|
-
const { lib, unocss: enableUnocss, solid: enableSolid, ...oxlint } = options;
|
|
405
|
+
const { lib, unocss: enableUnocss, solid: enableSolid, overrides, ...oxlint } = options;
|
|
403
406
|
const ovr = [vitest, markdownOverrideConfig];
|
|
404
407
|
if (lib) ovr.push({
|
|
405
408
|
...ts,
|
|
@@ -415,6 +418,7 @@ function subfLint(options = {}) {
|
|
|
415
418
|
else ovr.push(ts);
|
|
416
419
|
if (enableUnocss) ovr.push(unocss);
|
|
417
420
|
if (enableSolid) ovr.push(solidConfig);
|
|
421
|
+
if (overrides) ovr.push(...overrides);
|
|
418
422
|
return defu(oxlint, baseConfig, baseRules, { overrides: ovr });
|
|
419
423
|
}
|
|
420
424
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subf/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Universal configuration for TypeScript, oxlint (+unocss, +solid), oxfmt, and tsdown.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -34,38 +34,36 @@
|
|
|
34
34
|
],
|
|
35
35
|
"type": "module",
|
|
36
36
|
"exports": {
|
|
37
|
-
"./oxfmt": "./dist/oxfmt.
|
|
38
|
-
"./oxlint": "./dist/oxlint.
|
|
39
|
-
"./tsdown": "./dist/tsdown.js",
|
|
37
|
+
"./oxfmt": "./dist/oxfmt.mjs",
|
|
38
|
+
"./oxlint": "./dist/oxlint.mjs",
|
|
40
39
|
"./package.json": "./package.json"
|
|
41
40
|
},
|
|
42
41
|
"publishConfig": {
|
|
43
42
|
"access": "public"
|
|
44
43
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "tsdown",
|
|
47
|
-
"dev": "tsdown --watch",
|
|
48
|
-
"typecheck": "tsc --noEmit",
|
|
49
|
-
"lint": "oxlint --fix",
|
|
50
|
-
"format": "oxfmt",
|
|
51
|
-
"release": "bumpp --all",
|
|
52
|
-
"qa": "nub run lint && nub run format && nub run typecheck",
|
|
53
|
-
"prepublishOnly": "nub run build"
|
|
54
|
-
},
|
|
55
44
|
"dependencies": {
|
|
56
45
|
"@subf/oxlint-plugin": "^0.3.0"
|
|
57
46
|
},
|
|
58
47
|
"devDependencies": {
|
|
59
48
|
"@types/node": "^24",
|
|
60
49
|
"bumpp": "^11.1.0",
|
|
61
|
-
"oxfmt": "^0.
|
|
62
|
-
"oxlint": "^1.
|
|
63
|
-
"tsdown": "^0.
|
|
50
|
+
"oxfmt": "^0.71.0",
|
|
51
|
+
"oxlint": "^1.86.0",
|
|
52
|
+
"tsdown": "^0.23.0",
|
|
64
53
|
"typescript": "^7.0.2"
|
|
65
54
|
},
|
|
66
55
|
"peerDependencies": {
|
|
67
|
-
"defu": "6.1.7",
|
|
56
|
+
"defu": "^6.1.7",
|
|
68
57
|
"oxfmt": "^0",
|
|
69
58
|
"oxlint": "^1"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsdown",
|
|
62
|
+
"dev": "tsdown --watch",
|
|
63
|
+
"typecheck": "tsc --noEmit",
|
|
64
|
+
"lint": "oxlint --fix",
|
|
65
|
+
"format": "oxfmt",
|
|
66
|
+
"release": "bumpp --all",
|
|
67
|
+
"qa": "pnpm run lint && pnpm run format && pnpm run typecheck"
|
|
70
68
|
}
|
|
71
|
-
}
|
|
69
|
+
}
|
package/dist/cli.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
//#region src/utils/tsconfig.d.ts
|
|
2
|
-
declare const TSCONFIG_TYPE: readonly ["node", "lib", "solid", "solid-lib"];
|
|
3
|
-
type TsconfigType = (typeof TSCONFIG_TYPE)[number];
|
|
4
|
-
//#endregion
|
|
5
|
-
//#region src/cli.d.ts
|
|
6
|
-
declare function parseType(argv: readonly string[]): TsconfigType;
|
|
7
|
-
declare function main(argv?: readonly string[]): Promise<number>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { main, parseType };
|
package/dist/oxfmt.d.ts
DELETED
package/dist/oxlint.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { FILES_TS_TSX, solidConfig as solid } from "@subf/oxlint-plugin/config";
|
|
2
|
-
import { OxlintConfig, OxlintOverride } from "oxlint";
|
|
3
|
-
//#region src/oxlint.d.ts
|
|
4
|
-
declare const baseConfig: OxlintConfig;
|
|
5
|
-
declare const baseRules: OxlintConfig;
|
|
6
|
-
declare const ts: OxlintOverride;
|
|
7
|
-
declare const vitest: OxlintOverride;
|
|
8
|
-
declare const markdownOverrideConfig: OxlintOverride;
|
|
9
|
-
declare const overrides: OxlintOverride[];
|
|
10
|
-
declare const CONFIG: OxlintConfig;
|
|
11
|
-
declare const unocss: OxlintOverride;
|
|
12
|
-
interface SubfOptions extends OxlintConfig {
|
|
13
|
-
/**
|
|
14
|
-
* Used for lib, force to explicit function return type
|
|
15
|
-
*/
|
|
16
|
-
lib?: boolean;
|
|
17
|
-
solid?: boolean;
|
|
18
|
-
unocss?: boolean;
|
|
19
|
-
}
|
|
20
|
-
declare function subfLint(options?: SubfOptions): OxlintConfig;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { CONFIG, CONFIG as default, FILES_TS_TSX, type OxlintConfig, type OxlintOverride, SubfOptions, baseConfig, baseRules, markdownOverrideConfig, overrides, solid, subfLint, ts, unocss, vitest };
|
package/dist/tsdown.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { DepsConfig, DtsOptions, ExportsOptions, TsdownInputOption, UserConfig } from "tsdown";
|
|
2
|
-
//#region src/tsdown.d.ts
|
|
3
|
-
interface DepsOptions {
|
|
4
|
-
/**
|
|
5
|
-
* tsdown's deps option, which controls which dependency to bundle.
|
|
6
|
-
*/
|
|
7
|
-
bundled?: DepsConfig["alwaysBundle"];
|
|
8
|
-
/**
|
|
9
|
-
* tsdown's deps option, which controls which dependency to exclude.
|
|
10
|
-
*/
|
|
11
|
-
unbundled?: DepsConfig["neverBundle"];
|
|
12
|
-
}
|
|
13
|
-
interface LibOptions extends DepsOptions {
|
|
14
|
-
/**
|
|
15
|
-
* The entry point for the library.
|
|
16
|
-
* - 'index' (default): Only include `src/index.ts`.
|
|
17
|
-
* - 'shallow': Include all `.ts` files directly under `src/`.
|
|
18
|
-
* - 'all': Include all `.ts` files under `src/` recursively.
|
|
19
|
-
* - Custom glob pattern or array of file paths.
|
|
20
|
-
*
|
|
21
|
-
* @default 'index'
|
|
22
|
-
*/
|
|
23
|
-
entry?: "index" | "shallow" | "all" | Exclude<TsdownInputOption, string>;
|
|
24
|
-
/**
|
|
25
|
-
* tsdown's `customExports` option, which controls how the exports field is generated in package.json.
|
|
26
|
-
*
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
29
|
-
extraExports?: ExportsOptions["customExports"];
|
|
30
|
-
dts?: DtsOptions & DepsOptions;
|
|
31
|
-
plugins?: UserConfig["plugins"];
|
|
32
|
-
overrides?: UserConfig;
|
|
33
|
-
}
|
|
34
|
-
declare function lib(options?: LibOptions): UserConfig;
|
|
35
|
-
declare function nodeLib(options?: LibOptions): UserConfig;
|
|
36
|
-
interface SolidLibOptions extends LibOptions {
|
|
37
|
-
/**
|
|
38
|
-
* Options to pass to the `vite-plugin-solid` plugin. This is useful if you want to customize the solid plugin options, such as enabling hot module replacement (HMR) or configuring the Solid compiler.
|
|
39
|
-
*/
|
|
40
|
-
solid?: Record<string, any>;
|
|
41
|
-
/**
|
|
42
|
-
* Overrides for the js output config. This is useful if you want to customize the js output config, such as adding additional plugins or changing the output format.
|
|
43
|
-
*/
|
|
44
|
-
jsOverride?: UserConfig;
|
|
45
|
-
/**
|
|
46
|
-
* Overrides for the jsx output config. This is useful if you want to customize the jsx output config, such as adding additional plugins or changing the output format.
|
|
47
|
-
*/
|
|
48
|
-
jsxOverride?: UserConfig;
|
|
49
|
-
}
|
|
50
|
-
declare function solidLib(options: SolidLibOptions): Promise<UserConfig[]>;
|
|
51
|
-
//#endregion
|
|
52
|
-
export { LibOptions, SolidLibOptions, lib, nodeLib, solidLib };
|
package/dist/tsdown.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { mergeConfig } from "tsdown/config";
|
|
2
|
-
//#region src/tsdown.ts
|
|
3
|
-
function lib(options = {}) {
|
|
4
|
-
const { entry = "index", extraExports, bundled, unbundled, plugins, dts = { oxc: true }, overrides = {} } = options;
|
|
5
|
-
return mergeConfig({
|
|
6
|
-
entry: entry === "index" ? "src/index.ts" : entry === "shallow" ? "src/*.ts" : entry === "all" ? "src/**/*.ts" : entry,
|
|
7
|
-
dts,
|
|
8
|
-
platform: "neutral",
|
|
9
|
-
plugins,
|
|
10
|
-
deps: {
|
|
11
|
-
alwaysBundle: bundled,
|
|
12
|
-
neverBundle: unbundled,
|
|
13
|
-
dts: {
|
|
14
|
-
alwaysBundle: dts.bundled,
|
|
15
|
-
neverBundle: dts.unbundled
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
exports: { customExports: extraExports }
|
|
19
|
-
}, overrides);
|
|
20
|
-
}
|
|
21
|
-
function nodeLib(options = {}) {
|
|
22
|
-
return lib({
|
|
23
|
-
...options,
|
|
24
|
-
overrides: {
|
|
25
|
-
platform: "node",
|
|
26
|
-
...options.overrides
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
async function loadSolidPlugin(options) {
|
|
31
|
-
let solid;
|
|
32
|
-
try {
|
|
33
|
-
solid = await import("vite-plugin-solid").then((m) => m.default || m);
|
|
34
|
-
} catch {
|
|
35
|
-
throw new Error("`vite-plugin-solid` is required for solidLib.");
|
|
36
|
-
}
|
|
37
|
-
return solid(options);
|
|
38
|
-
}
|
|
39
|
-
async function solidLib(options) {
|
|
40
|
-
const { entry, solid: solidOptions, extraExports, overrides = {}, jsOverride = {}, jsxOverride = {} } = options;
|
|
41
|
-
return [mergeConfig({
|
|
42
|
-
entry,
|
|
43
|
-
platform: "browser",
|
|
44
|
-
plugins: [loadSolidPlugin(solidOptions)],
|
|
45
|
-
dts: true
|
|
46
|
-
}, overrides, jsOverride), mergeConfig({
|
|
47
|
-
entry,
|
|
48
|
-
platform: "neutral",
|
|
49
|
-
outExtensions: () => ({ js: ".jsx" }),
|
|
50
|
-
dts: false,
|
|
51
|
-
exports: { customExports(exports, context) {
|
|
52
|
-
for (const [key, val] of Object.entries(exports)) if (val.endsWith(".jsx")) exports[key] = {
|
|
53
|
-
solid: val,
|
|
54
|
-
default: val.replace(".jsx", ".mjs"),
|
|
55
|
-
type: val.replace(".jsx", ".d.mts")
|
|
56
|
-
};
|
|
57
|
-
if (!extraExports) return exports;
|
|
58
|
-
else if (typeof extraExports === "function") return extraExports(exports, context);
|
|
59
|
-
else return {
|
|
60
|
-
...exports,
|
|
61
|
-
...extraExports
|
|
62
|
-
};
|
|
63
|
-
} }
|
|
64
|
-
}, overrides, jsxOverride)];
|
|
65
|
-
}
|
|
66
|
-
//#endregion
|
|
67
|
-
export { lib, nodeLib, solidLib };
|
/package/dist/{cli.js → cli.mjs}
RENAMED
|
File without changes
|
|
File without changes
|