golar 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/builtin-rules.d.ts +2 -3
  2. package/dist/builtin-rules.generated.d.ts +3 -3
  3. package/dist/codegen-plugin.js +0 -1
  4. package/dist/config.js +32 -15
  5. package/dist/internal/linter/rule-creator.d.ts +3 -2
  6. package/dist/internal/linter/rule-creator.js +10 -10
  7. package/dist/internal/linter/rules/explicit-anys/config.js +3 -3
  8. package/dist/node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.d.ts +1430 -0
  9. package/dist/node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js +658 -0
  10. package/dist/packages/golar/package.js +3 -2
  11. package/dist/workspace.js +2 -2
  12. package/package.json +10 -9
  13. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.d.ts +0 -22
  14. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js +0 -29
  15. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js +0 -37
  16. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.d.ts +0 -16
  17. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js +0 -19
  18. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.d.ts +0 -208
  19. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js +0 -578
  20. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.d.ts +0 -32
  21. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js +0 -470
  22. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts +0 -64
  23. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js +0 -225
  24. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts +0 -47
  25. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +0 -61
  26. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js +0 -33
  27. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts +0 -127
  28. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +0 -62
  29. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js +0 -214
  30. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts +0 -69
  31. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +0 -109
  32. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js +0 -58
  33. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts +0 -31
  34. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js +0 -49
  35. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts +0 -805
  36. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js +0 -1096
  37. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts +0 -120
  38. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts +0 -96
  39. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js +0 -289
  40. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts +0 -41
  41. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +0 -304
  42. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts +0 -8
  43. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js +0 -9
@@ -1,10 +1,9 @@
1
- import { input } from "./node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js";
2
- import { ZodObject } from "./node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js";
1
+ import { InferInput, ObjectEntries, ObjectSchema } from "./node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js";
3
2
  import { GolarBrand } from "./internal/linter/rule-creator.js";
4
3
  import { LintConfiguredRule } from "./config.js";
5
4
  import { rules as rules$1 } from "./builtin-rules.generated.js";
6
5
 
7
6
  //#region src/builtin-rules.d.ts
8
- declare const rules: (configs: { [TRule in keyof typeof rules$1]?: true | undefined | input<ZodObject<(typeof rules$1)[TRule][typeof GolarBrand]['options']>> }) => LintConfiguredRule[];
7
+ declare const rules: (configs: { [TRule in keyof typeof rules$1]?: true | undefined | InferInput<ObjectSchema<(typeof rules$1)[TRule][typeof GolarBrand]['options'] & ObjectEntries, undefined>> }) => LintConfiguredRule[];
9
8
  //#endregion
10
9
  export { rules };
@@ -1,11 +1,11 @@
1
- import { ZodBoolean, ZodDefault } from "./node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js";
1
+ import { BooleanSchema, DescriptionAction, OptionalSchema, SchemaWithPipe } from "./node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js";
2
2
  import { RuleDefinition } from "./internal/linter/rule-creator.js";
3
3
 
4
4
  //#region src/builtin-rules.generated.d.ts
5
5
  declare const rules: {
6
6
  readonly 'explicit-anys': RuleDefinition<{
7
- fixToUnknown: ZodDefault<ZodBoolean>;
8
- ignoreRestArgs: ZodDefault<ZodBoolean>;
7
+ fixToUnknown: OptionalSchema<SchemaWithPipe<readonly [BooleanSchema<undefined>, DescriptionAction<boolean, "Whether to enable auto-fixing in which the `any` type is converted to the `unknown` type.">]>, false>;
8
+ ignoreRestArgs: OptionalSchema<SchemaWithPipe<readonly [BooleanSchema<undefined>, DescriptionAction<boolean, "Whether to ignore rest parameter arrays.">]>, false>;
9
9
  }>;
10
10
  };
11
11
  //#endregion
@@ -20,7 +20,6 @@ const stateSymbol = Symbol.for("golar-global-state");
20
20
  const globalTyped = globalThis;
21
21
  const globalState = globalTyped[stateSymbol] ??= { codegenPlugins: /* @__PURE__ */ new Map() };
22
22
  function registerCodegenPlugin(plugin) {
23
- if (globalState.codegenPlugins.get(plugin.id)) throw new Error(`Duplicate ${plugin.id} codegen plugin`);
24
23
  globalState.codegenPlugins.set(plugin.id, plugin);
25
24
  }
26
25
  var JsCodegenPlugin = class JsCodegenPlugin {
package/dist/config.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { globalState } from "./codegen-plugin.js";
2
- import path from "node:path";
2
+ import { execSync } from "node:child_process";
3
3
  import url from "node:url";
4
- import fs from "node:fs";
5
4
  import util from "node:util";
5
+ import { escapePath, globSync } from "tinyglobby";
6
6
  import { Debug } from "@golar/util";
7
7
 
8
8
  //#region src/config.ts
@@ -19,10 +19,10 @@ function resolveConfig(cwd, config) {
19
19
  const builtinEffectiveRulesByFile = /* @__PURE__ */ new Map();
20
20
  const jsEffectiveRulesByFile = /* @__PURE__ */ new Map();
21
21
  const nativeEffectiveRulesByFile = /* @__PURE__ */ new Map();
22
- for (const group of config.lint?.use ?? []) for (const file of new Set(fs.globSync(group.files, {
22
+ for (const group of config.lint?.use ?? []) for (const file of globSync(group.files, {
23
23
  cwd,
24
- withFileTypes: true
25
- }).filter((entry) => entry.isFile()).map((entry) => path.resolve(cwd, entry.parentPath, entry.name)))) {
24
+ absolute: true
25
+ })) {
26
26
  allFiles.add(file);
27
27
  for (const rule of group.rules) {
28
28
  let rulesByFile;
@@ -44,17 +44,19 @@ function resolveConfig(cwd, config) {
44
44
  const nativeRulesByFile = new Map(nativeEffectiveRulesByFile.entries().map(([file, rulesById]) => [file, Array.from(rulesById.values())]));
45
45
  let typecheckFiles = null;
46
46
  const typecheckInclude = config.typecheck == null ? ["**/*.{ts,tsx}", ...globalState.codegenPlugins.values().flatMap((plugin) => plugin.extensions).map(({ extension }) => `**/*${extension}`).toArray()] : config.typecheck.include;
47
- const typecheckExclude = [
48
- ...config.typecheck?.exclude ?? [],
49
- "**/node_modules",
50
- "**/.git",
51
- "**/.jj"
52
- ];
53
- typecheckFiles = fs.globSync(typecheckInclude, {
47
+ const gitignorePaths = lsGitignorePaths(cwd);
48
+ debug.print(".gitignore paths:", gitignorePaths.join(", ") || "(none)");
49
+ typecheckFiles = globSync(typecheckInclude, {
54
50
  cwd,
55
- exclude: typecheckExclude,
56
- withFileTypes: true
57
- }).filter((entry) => entry.isFile()).map((entry) => path.resolve(cwd, entry.parentPath, entry.name));
51
+ ignore: [
52
+ ...gitignorePaths,
53
+ ...config.typecheck?.exclude ?? [],
54
+ "**/node_modules",
55
+ "**/.git",
56
+ "**/.jj"
57
+ ],
58
+ absolute: true
59
+ });
58
60
  for (const file of typecheckFiles) allFiles.add(file);
59
61
  debug.print("typecheck files:\n" + typecheckFiles.join("\n"));
60
62
  return {
@@ -66,6 +68,21 @@ function resolveConfig(cwd, config) {
66
68
  typecheckFiles
67
69
  };
68
70
  }
71
+ function lsGitignorePaths(cwd) {
72
+ try {
73
+ return execSync("git ls-files --others --ignored --exclude-standard --directory", {
74
+ cwd,
75
+ encoding: "utf-8",
76
+ stdio: [
77
+ "ignore",
78
+ "pipe",
79
+ "ignore"
80
+ ]
81
+ }).split("\n").filter(Boolean).map((p) => escapePath(p));
82
+ } catch {
83
+ return [];
84
+ }
85
+ }
69
86
 
70
87
  //#endregion
71
88
  export { defineConfig, loadConfig, resolveConfig };
@@ -1,8 +1,9 @@
1
- import { ZodDefault } from "../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js";
1
+ import { GenericSchema, OptionalSchema } from "../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js";
2
2
 
3
3
  //#region ../../internal/linter/rule-creator.d.ts
4
4
  declare const GolarBrand: unique symbol;
5
- type RuleDefinition<TOptions extends Record<string, ZodDefault>> = {
5
+ type SchemaWithDefault = OptionalSchema<GenericSchema, unknown>;
6
+ type RuleDefinition<TOptions extends Record<string, SchemaWithDefault>> = {
6
7
  [GolarBrand]: {
7
8
  options: TOptions;
8
9
  };
@@ -1,4 +1,4 @@
1
- import { array, discriminatedUnion, literal, strictObject, string, union } from "../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js";
1
+ import { array, literal, optional, pipe, strictObject, string, transform, union, variant } from "../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js";
2
2
  import path from "node:path";
3
3
 
4
4
  //#region ../../internal/linter/rule-creator.ts
@@ -9,11 +9,11 @@ function ruleConfig(config) {
9
9
  name: path.basename(config.dirname)
10
10
  };
11
11
  }
12
- const typeOrValueSpecifier = array(discriminatedUnion("from", [
12
+ const typeOrValueSpecifier = pipe(array(variant("from", [
13
13
  strictObject({
14
14
  from: literal("file"),
15
15
  name: union([string(), array(string())]),
16
- path: string().optional()
16
+ path: optional(string())
17
17
  }),
18
18
  strictObject({
19
19
  from: literal("lib"),
@@ -24,23 +24,23 @@ const typeOrValueSpecifier = array(discriminatedUnion("from", [
24
24
  name: union([string(), array(string())]),
25
25
  package: string()
26
26
  })
27
- ]).transform((v) => {
27
+ ])), transform((items) => items.map((item) => {
28
28
  const res = {
29
- from: v.from,
30
- name: Array.isArray(v.name) ? v.name : [v.name]
29
+ from: item.from,
30
+ name: Array.isArray(item.name) ? item.name : [item.name]
31
31
  };
32
- switch (v.from) {
32
+ switch (item.from) {
33
33
  case "file": return {
34
34
  ...res,
35
- filePath: v.path ?? ""
35
+ filePath: item.path ?? ""
36
36
  };
37
37
  case "lib": return res;
38
38
  case "package": return {
39
39
  ...res,
40
- package: v.package ?? ""
40
+ package: item.package ?? ""
41
41
  };
42
42
  }
43
- }));
43
+ })));
44
44
 
45
45
  //#endregion
46
46
  export { ruleConfig };
@@ -1,12 +1,12 @@
1
- import { boolean } from "../../../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js";
1
+ import { boolean, description, optional, pipe } from "../../../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js";
2
2
  import { ruleConfig } from "../../rule-creator.js";
3
3
 
4
4
  //#region ../../internal/linter/rules/explicit-anys/config.ts
5
5
  const rule = ruleConfig({
6
6
  dirname: import.meta.dirname,
7
7
  options: {
8
- fixToUnknown: boolean().default(false).describe("Whether to enable auto-fixing in which the `any` type is converted to the `unknown` type."),
9
- ignoreRestArgs: boolean().default(false).describe("Whether to ignore rest parameter arrays.")
8
+ fixToUnknown: optional(pipe(boolean(), description("Whether to enable auto-fixing in which the `any` type is converted to the `unknown` type.")), false),
9
+ ignoreRestArgs: optional(pipe(boolean(), description("Whether to ignore rest parameter arrays.")), false)
10
10
  }
11
11
  });
12
12