@conorroberts/utils 0.0.45 → 0.0.46

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/env.mjs CHANGED
@@ -13,7 +13,7 @@ const createEnv = (args) => {
13
13
  const serverEnv = /* @__PURE__ */ new Map();
14
14
  const invalidKeys = [];
15
15
  for (const [key, value] of pairs) {
16
- const result = v.safeParse(value, args.env[key] ?? null);
16
+ const result = v.safeParse(value, args.env[key]);
17
17
  if (!result.success) invalidKeys.push(key);
18
18
  serverEnv.set(key, result.output);
19
19
  }
package/dist/env.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.mjs","names":["invalidKeys: string[]","pairs"],"sources":["../src/env.ts"],"sourcesContent":["import { pipe } from \"remeda\";\nimport * as v from \"valibot\";\n\nconst PUBLIC_ENV_PREFIX = \"PUBLIC_\" as const;\n\n/**\n * Validates your environment variables against the given Valibot schema;\n * @param args\n * @returns An object containing client environment variables and another containing server environment variables\n */\nexport const createEnv = <\n Schema extends Record<string, v.GenericSchema>,\n Env = {\n [K in keyof Schema]: v.InferOutput<Schema[K]>;\n },\n>(args: {\n schema: Schema;\n // oxlint-disable-next-line no-explicit-any\n env: any;\n}) => {\n const pairs = Object.entries(args.schema);\n const serverEnv = new Map();\n const invalidKeys: string[] = [];\n\n for (const [key, value] of pairs) {\n const result = v.safeParse(value, args.env[key] ?? null);\n\n if (!result.success) {\n invalidKeys.push(key);\n }\n\n serverEnv.set(key, result.output);\n }\n\n if (invalidKeys.length > 0) {\n console.error(`Invalid environment variable(s): ${invalidKeys.map((e) => `\"${e}\"`).join(\", \")}`);\n process.exit(1);\n }\n\n type ClientEnvKeys = Exclude<\n {\n [K in keyof Env]: K extends `${typeof PUBLIC_ENV_PREFIX}${string}` ? K : never;\n }[keyof Env],\n undefined\n >;\n\n type ClientEnv = {\n [B in ClientEnvKeys]: Env[B];\n };\n\n const clientEnv = pipe(\n serverEnv,\n (obj) => Array.from(obj.entries()),\n (pairs) => pairs.filter(([k]) => k.startsWith(PUBLIC_ENV_PREFIX)),\n (pairs) => Object.fromEntries(pairs),\n ) as ClientEnv;\n\n return {\n client: clientEnv,\n server: Object.fromEntries(serverEnv.entries()) as Env,\n };\n};\n"],"mappings":";;;;AAGA,MAAM,oBAAoB;;;;;;AAO1B,MAAa,aAKX,SAII;CACJ,MAAM,QAAQ,OAAO,QAAQ,KAAK,OAAO;CACzC,MAAM,4BAAY,IAAI,KAAK;CAC3B,MAAMA,cAAwB,EAAE;AAEhC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO;EAChC,MAAM,SAAS,EAAE,UAAU,OAAO,KAAK,IAAI,QAAQ,KAAK;AAExD,MAAI,CAAC,OAAO,QACV,aAAY,KAAK,IAAI;AAGvB,YAAU,IAAI,KAAK,OAAO,OAAO;;AAGnC,KAAI,YAAY,SAAS,GAAG;AAC1B,UAAQ,MAAM,oCAAoC,YAAY,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,GAAG;AAChG,UAAQ,KAAK,EAAE;;AAqBjB,QAAO;EACL,QARgB,KAChB,YACC,QAAQ,MAAM,KAAK,IAAI,SAAS,CAAC,GACjC,YAAUC,QAAM,QAAQ,CAAC,OAAO,EAAE,WAAW,kBAAkB,CAAC,GAChE,YAAU,OAAO,YAAYA,QAAM,CACrC;EAIC,QAAQ,OAAO,YAAY,UAAU,SAAS,CAAC;EAChD"}
1
+ {"version":3,"file":"env.mjs","names":["invalidKeys: string[]","pairs"],"sources":["../src/env.ts"],"sourcesContent":["import { pipe } from \"remeda\";\nimport * as v from \"valibot\";\n\nconst PUBLIC_ENV_PREFIX = \"PUBLIC_\" as const;\n\n/**\n * Validates your environment variables against the given Valibot schema;\n * @param args\n * @returns An object containing client environment variables and another containing server environment variables\n */\nexport const createEnv = <\n Schema extends Record<string, v.GenericSchema>,\n Env = {\n [K in keyof Schema]: v.InferOutput<Schema[K]>;\n },\n>(args: {\n schema: Schema;\n // oxlint-disable-next-line no-explicit-any\n env: any;\n}) => {\n const pairs = Object.entries(args.schema);\n const serverEnv = new Map();\n const invalidKeys: string[] = [];\n\n for (const [key, value] of pairs) {\n const result = v.safeParse(value, args.env[key]);\n\n if (!result.success) {\n invalidKeys.push(key);\n }\n\n serverEnv.set(key, result.output);\n }\n\n if (invalidKeys.length > 0) {\n console.error(`Invalid environment variable(s): ${invalidKeys.map((e) => `\"${e}\"`).join(\", \")}`);\n process.exit(1);\n }\n\n type ClientEnvKeys = Exclude<\n {\n [K in keyof Env]: K extends `${typeof PUBLIC_ENV_PREFIX}${string}` ? K : never;\n }[keyof Env],\n undefined\n >;\n\n type ClientEnv = {\n [B in ClientEnvKeys]: Env[B];\n };\n\n const clientEnv = pipe(\n serverEnv,\n (obj) => Array.from(obj.entries()),\n (pairs) => pairs.filter(([k]) => k.startsWith(PUBLIC_ENV_PREFIX)),\n (pairs) => Object.fromEntries(pairs),\n ) as ClientEnv;\n\n return {\n client: clientEnv,\n server: Object.fromEntries(serverEnv.entries()) as Env,\n };\n};\n"],"mappings":";;;;AAGA,MAAM,oBAAoB;;;;;;AAO1B,MAAa,aAKX,SAII;CACJ,MAAM,QAAQ,OAAO,QAAQ,KAAK,OAAO;CACzC,MAAM,4BAAY,IAAI,KAAK;CAC3B,MAAMA,cAAwB,EAAE;AAEhC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO;EAChC,MAAM,SAAS,EAAE,UAAU,OAAO,KAAK,IAAI,KAAK;AAEhD,MAAI,CAAC,OAAO,QACV,aAAY,KAAK,IAAI;AAGvB,YAAU,IAAI,KAAK,OAAO,OAAO;;AAGnC,KAAI,YAAY,SAAS,GAAG;AAC1B,UAAQ,MAAM,oCAAoC,YAAY,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,GAAG;AAChG,UAAQ,KAAK,EAAE;;AAqBjB,QAAO;EACL,QARgB,KAChB,YACC,QAAQ,MAAM,KAAK,IAAI,SAAS,CAAC,GACjC,YAAUC,QAAM,QAAQ,CAAC,OAAO,EAAE,WAAW,kBAAkB,CAAC,GAChE,YAAU,OAAO,YAAYA,QAAM,CACrC;EAIC,QAAQ,OAAO,YAAY,UAAU,SAAS,CAAC;EAChD"}
@@ -1,20 +1,20 @@
1
- import * as oxlint29 from "oxlint";
1
+ import * as oxlint4 from "oxlint";
2
2
 
3
3
  //#region src/oxlint-plugins/jsx-component-pascal-case.d.ts
4
- declare const jsxComponentPascalCaseRule: oxlint29.Rule;
4
+ declare const jsxComponentPascalCaseRule: oxlint4.Rule;
5
5
  declare namespace _default {
6
6
  namespace meta {
7
7
  let name: string;
8
8
  }
9
9
  let rules: {
10
- "jsx-component-pascal-case": oxlint29.Rule;
10
+ "jsx-component-pascal-case": oxlint4.Rule;
11
11
  };
12
12
  }
13
- type RuleContext = oxlint29.Context;
14
- type ESTNode = oxlint29.ESTree.Node;
15
- type ESTExpression = oxlint29.ESTree.Expression;
16
- type ReturnStatementNode = oxlint29.ESTree.ReturnStatement;
17
- type FunctionLikeNode = oxlint29.ESTree.Function | oxlint29.ESTree.ArrowFunctionExpression;
13
+ type RuleContext = oxlint4.Context;
14
+ type ESTNode = oxlint4.ESTree.Node;
15
+ type ESTExpression = oxlint4.ESTree.Expression;
16
+ type ReturnStatementNode = oxlint4.ESTree.ReturnStatement;
17
+ type FunctionLikeNode = oxlint4.ESTree.Function | oxlint4.ESTree.ArrowFunctionExpression;
18
18
  type FunctionContext = {
19
19
  node: FunctionLikeNode;
20
20
  name: string;
@@ -1,20 +1,20 @@
1
- import * as oxlint7 from "oxlint";
1
+ import * as oxlint12 from "oxlint";
2
2
 
3
3
  //#region src/oxlint-plugins/no-component-date-instantiation.d.ts
4
- declare const noComponentDateInstantiationRule: oxlint7.Rule;
4
+ declare const noComponentDateInstantiationRule: oxlint12.Rule;
5
5
  declare namespace _default {
6
6
  namespace meta {
7
7
  let name: string;
8
8
  }
9
9
  let rules: {
10
- "no-component-date-instantiation": oxlint7.Rule;
10
+ "no-component-date-instantiation": oxlint12.Rule;
11
11
  };
12
12
  }
13
- type RuleContext = oxlint7.Context;
14
- type ESTNode = oxlint7.ESTree.Node;
15
- type NewExpressionNode = oxlint7.ESTree.NewExpression;
16
- type ReturnStatementNode = oxlint7.ESTree.ReturnStatement;
17
- type FunctionLikeNode = oxlint7.ESTree.Function | oxlint7.ESTree.ArrowFunctionExpression;
13
+ type RuleContext = oxlint12.Context;
14
+ type ESTNode = oxlint12.ESTree.Node;
15
+ type NewExpressionNode = oxlint12.ESTree.NewExpression;
16
+ type ReturnStatementNode = oxlint12.ESTree.ReturnStatement;
17
+ type FunctionLikeNode = oxlint12.ESTree.Function | oxlint12.ESTree.ArrowFunctionExpression;
18
18
  type FunctionContext = {
19
19
  node: FunctionLikeNode;
20
20
  parent: FunctionContext | null;
@@ -1,16 +1,16 @@
1
- import * as oxlint4 from "oxlint";
1
+ import * as oxlint40 from "oxlint";
2
2
 
3
3
  //#region src/oxlint-plugins/no-emoji.d.ts
4
- declare const noEmojiRule: oxlint4.Rule;
4
+ declare const noEmojiRule: oxlint40.Rule;
5
5
  declare namespace _default {
6
6
  namespace meta {
7
7
  let name: string;
8
8
  }
9
9
  let rules: {
10
- "no-emoji": oxlint4.Rule;
10
+ "no-emoji": oxlint40.Rule;
11
11
  };
12
12
  }
13
- type ESTNode = oxlint4.ESTree.Node;
13
+ type ESTNode = oxlint40.ESTree.Node;
14
14
  //#endregion
15
15
  export { ESTNode, _default as default, noEmojiRule };
16
16
  //# sourceMappingURL=no-emoji.d.mts.map
@@ -1,16 +1,16 @@
1
- import * as oxlint26 from "oxlint";
1
+ import * as oxlint34 from "oxlint";
2
2
 
3
3
  //#region src/oxlint-plugins/no-finally.d.ts
4
- declare const noFinallyRule: oxlint26.Rule;
4
+ declare const noFinallyRule: oxlint34.Rule;
5
5
  declare namespace _default {
6
6
  namespace meta {
7
7
  let name: string;
8
8
  }
9
9
  let rules: {
10
- "no-finally": oxlint26.Rule;
10
+ "no-finally": oxlint34.Rule;
11
11
  };
12
12
  }
13
- type ESTNode = oxlint26.ESTree.Node;
13
+ type ESTNode = oxlint34.ESTree.Node;
14
14
  //#endregion
15
15
  export { ESTNode, _default as default, noFinallyRule };
16
16
  //# sourceMappingURL=no-finally.d.mts.map
@@ -1,27 +1,27 @@
1
- import * as oxlint15 from "oxlint";
1
+ import * as oxlint23 from "oxlint";
2
2
 
3
3
  //#region src/oxlint-plugins/no-inline-components.d.ts
4
4
  declare function isComponentName(name: unknown): name is string;
5
5
  declare function isHookName(name: unknown): name is string;
6
6
  declare function getEnclosingFunction(node: ESTNode | null | undefined): FunctionLikeNode | null;
7
7
  declare function getFunctionName(node: FunctionLikeNode): string;
8
- declare const noInlineComponentsRule: oxlint15.Rule;
8
+ declare const noInlineComponentsRule: oxlint23.Rule;
9
9
  declare namespace _default {
10
10
  namespace meta {
11
11
  let name: string;
12
12
  }
13
13
  let rules: {
14
- "no-inline-components": oxlint15.Rule;
14
+ "no-inline-components": oxlint23.Rule;
15
15
  };
16
16
  }
17
- type RuleContext = oxlint15.Context;
18
- type ESTNode = oxlint15.ESTree.Node;
19
- type ESTExpression = oxlint15.ESTree.Expression;
20
- type ESTPattern = oxlint15.ESTree.Pattern;
21
- type ReturnStatementNode = oxlint15.ESTree.ReturnStatement;
22
- type VariableDeclaratorNode = oxlint15.ESTree.VariableDeclarator;
23
- type AssignmentExpressionNode = oxlint15.ESTree.AssignmentExpression;
24
- type FunctionLikeNode = oxlint15.ESTree.Function | oxlint15.ESTree.ArrowFunctionExpression;
17
+ type RuleContext = oxlint23.Context;
18
+ type ESTNode = oxlint23.ESTree.Node;
19
+ type ESTExpression = oxlint23.ESTree.Expression;
20
+ type ESTPattern = oxlint23.ESTree.Pattern;
21
+ type ReturnStatementNode = oxlint23.ESTree.ReturnStatement;
22
+ type VariableDeclaratorNode = oxlint23.ESTree.VariableDeclarator;
23
+ type AssignmentExpressionNode = oxlint23.ESTree.AssignmentExpression;
24
+ type FunctionLikeNode = oxlint23.ESTree.Function | oxlint23.ESTree.ArrowFunctionExpression;
25
25
  type RecordedAssignment = {
26
26
  node: ESTExpression;
27
27
  names: string[];
@@ -1,16 +1,16 @@
1
- import * as oxlint40 from "oxlint";
1
+ import * as oxlint0 from "oxlint";
2
2
 
3
3
  //#region src/oxlint-plugins/no-react-namespace.d.ts
4
- declare const noReactNamespaceRule: oxlint40.Rule;
4
+ declare const noReactNamespaceRule: oxlint0.Rule;
5
5
  declare namespace _default {
6
6
  namespace meta {
7
7
  let name: string;
8
8
  }
9
9
  let rules: {
10
- "no-react-namespace": oxlint40.Rule;
10
+ "no-react-namespace": oxlint0.Rule;
11
11
  };
12
12
  }
13
- type ESTNode = oxlint40.ESTree.Node;
13
+ type ESTNode = oxlint0.ESTree.Node;
14
14
  //#endregion
15
15
  export { ESTNode, _default as default, noReactNamespaceRule };
16
16
  //# sourceMappingURL=no-react-namespace.d.mts.map
@@ -1,4 +1,4 @@
1
- import * as oxlint0 from "oxlint";
1
+ import * as oxlint2 from "oxlint";
2
2
 
3
3
  //#region src/oxlint-plugins/no-switch-plugin.d.ts
4
4
  declare namespace _default {
@@ -6,10 +6,10 @@ declare namespace _default {
6
6
  let name: string;
7
7
  }
8
8
  let rules: {
9
- "no-switch": oxlint0.Rule;
9
+ "no-switch": oxlint2.Rule;
10
10
  };
11
11
  }
12
- type ESTNode = oxlint0.ESTree.Node;
12
+ type ESTNode = oxlint2.ESTree.Node;
13
13
  //#endregion
14
14
  export { ESTNode, _default as default };
15
15
  //# sourceMappingURL=no-switch-plugin.d.mts.map
@@ -1,16 +1,16 @@
1
- import * as oxlint1 from "oxlint";
1
+ import * as oxlint20 from "oxlint";
2
2
 
3
3
  //#region src/oxlint-plugins/no-top-level-let.d.ts
4
- declare const noTopLevelLetRule: oxlint1.Rule;
4
+ declare const noTopLevelLetRule: oxlint20.Rule;
5
5
  declare namespace _default {
6
6
  namespace meta {
7
7
  let name: string;
8
8
  }
9
9
  let rules: {
10
- "no-top-level-let": oxlint1.Rule;
10
+ "no-top-level-let": oxlint20.Rule;
11
11
  };
12
12
  }
13
- type ESTNode = oxlint1.ESTree.Node;
13
+ type ESTNode = oxlint20.ESTree.Node;
14
14
  //#endregion
15
15
  export { ESTNode, _default as default, noTopLevelLetRule };
16
16
  //# sourceMappingURL=no-top-level-let.d.mts.map
package/package.json CHANGED
@@ -82,7 +82,7 @@
82
82
  "typescript": "5.9.3",
83
83
  "vitest": "4.0.15"
84
84
  },
85
- "version": "0.0.45",
85
+ "version": "0.0.46",
86
86
  "scripts": {
87
87
  "dev": "tsdown --watch",
88
88
  "build": "tsc --noEmit && tsdown",