@willbooster/shared-lib 10.0.0 → 10.1.1

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.
@@ -0,0 +1,2 @@
1
+ "use strict";function e(){return typeof process>`u`?void 0:process.env.WB_ENV}exports.getAppEnv=e;
2
+ //# sourceMappingURL=appEnv.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appEnv.cjs","names":[],"sources":["../src/appEnv.ts"],"sourcesContent":["export type AppEnv = 'development' | 'test' | 'staging' | 'production';\n\n/**\n * The runtime `WB_ENV` widened to the full domain wb standardizes.\n *\n * `wrangler types` narrows `process.env.WB_ENV` to the literal values the wrangler configuration\n * declares (typically staging and production only), while local development, E2E, and scripts\n * supply `development` and `test` through fnox (`wb gen-dev-vars` writes them into the gitignored\n * `.dev.vars` that `wrangler dev` reads). This accessor widens the generated type back to the real\n * runtime domain so environment detection stays in one place.\n *\n * Exposed as a function rather than a constant because Cloudflare Workers may not provide\n * environment variables during module evaluation; callers choose when to read. Returns undefined\n * where `process` does not exist (e.g. browsers).\n */\nexport function getAppEnv(): AppEnv | undefined {\n return typeof process === 'undefined' ? undefined : (process.env.WB_ENV as AppEnv | undefined);\n}\n"],"mappings":"aAeA,SAAgB,GAAgC,CAC9C,OAAO,OAAO,QAAY,IAAc,IAAA,GAAa,QAAQ,IAAI,MACnE"}
@@ -0,0 +1,15 @@
1
+ export type AppEnv = 'development' | 'test' | 'staging' | 'production';
2
+ /**
3
+ * The runtime `WB_ENV` widened to the full domain wb standardizes.
4
+ *
5
+ * `wrangler types` narrows `process.env.WB_ENV` to the literal values the wrangler configuration
6
+ * declares (typically staging and production only), while local development, E2E, and scripts
7
+ * supply `development` and `test` through fnox (`wb gen-dev-vars` writes them into the gitignored
8
+ * `.dev.vars` that `wrangler dev` reads). This accessor widens the generated type back to the real
9
+ * runtime domain so environment detection stays in one place.
10
+ *
11
+ * Exposed as a function rather than a constant because Cloudflare Workers may not provide
12
+ * environment variables during module evaluation; callers choose when to read. Returns undefined
13
+ * where `process` does not exist (e.g. browsers).
14
+ */
15
+ export declare function getAppEnv(): AppEnv | undefined;
package/dist/appEnv.js ADDED
@@ -0,0 +1,2 @@
1
+ function e(){return typeof process>`u`?void 0:process.env.WB_ENV}export{e as getAppEnv};
2
+ //# sourceMappingURL=appEnv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appEnv.js","names":[],"sources":["../src/appEnv.ts"],"sourcesContent":["export type AppEnv = 'development' | 'test' | 'staging' | 'production';\n\n/**\n * The runtime `WB_ENV` widened to the full domain wb standardizes.\n *\n * `wrangler types` narrows `process.env.WB_ENV` to the literal values the wrangler configuration\n * declares (typically staging and production only), while local development, E2E, and scripts\n * supply `development` and `test` through fnox (`wb gen-dev-vars` writes them into the gitignored\n * `.dev.vars` that `wrangler dev` reads). This accessor widens the generated type back to the real\n * runtime domain so environment detection stays in one place.\n *\n * Exposed as a function rather than a constant because Cloudflare Workers may not provide\n * environment variables during module evaluation; callers choose when to read. Returns undefined\n * where `process` does not exist (e.g. browsers).\n */\nexport function getAppEnv(): AppEnv | undefined {\n return typeof process === 'undefined' ? undefined : (process.env.WB_ENV as AppEnv | undefined);\n}\n"],"mappings":"AAeA,SAAgB,GAAgC,CAC9C,OAAO,OAAO,QAAY,IAAc,IAAA,GAAa,QAAQ,IAAI,MACnE"}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./assert.cjs"),t=require("./sleep.cjs"),n=require("./error.cjs"),r=require("./humanize.cjs"),i=require("./mail.cjs"),a=require("./parseCommandLineArgs.cjs"),o=require("./shuffle.cjs"),s=require("./sqlite.cjs"),c=require("./zenkaku.cjs");exports.ensureTruthy=e.ensureTruthy,exports.errorify=n.errorify,exports.getConnectionLevelSqlitePragmas=s.getConnectionLevelSqlitePragmas,exports.getPersistentSqlitePragmas=s.getPersistentSqlitePragmas,exports.humanizeNumber=r.humanizeNumber,exports.ignoreEnoent=n.ignoreEnoent,exports.ignoreEnoentAsync=n.ignoreEnoentAsync,exports.ignoreError=n.ignoreError,exports.ignoreErrorAsync=n.ignoreErrorAsync,exports.mailTemplates=i.mailTemplates,exports.parseCommandLineArgs=a.parseCommandLineArgs,exports.shuffle=o.shuffle,exports.sleep=t.sleep,exports.withRetry=n.withRetry,exports.zenkakuAlphanumericalsToHankaku=c.zenkakuAlphanumericalsToHankaku;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./appEnv.cjs"),t=require("./assert.cjs"),n=require("./sleep.cjs"),r=require("./error.cjs"),i=require("./humanize.cjs"),a=require("./mail.cjs"),o=require("./parseCommandLineArgs.cjs"),s=require("./shuffle.cjs"),c=require("./sqlite.cjs"),l=require("./zenkaku.cjs");exports.ensureTruthy=t.ensureTruthy,exports.errorify=r.errorify,exports.getAppEnv=e.getAppEnv,exports.getConnectionLevelSqlitePragmas=c.getConnectionLevelSqlitePragmas,exports.getPersistentSqlitePragmas=c.getPersistentSqlitePragmas,exports.humanizeNumber=i.humanizeNumber,exports.ignoreEnoent=r.ignoreEnoent,exports.ignoreEnoentAsync=r.ignoreEnoentAsync,exports.ignoreError=r.ignoreError,exports.ignoreErrorAsync=r.ignoreErrorAsync,exports.mailTemplates=a.mailTemplates,exports.parseCommandLineArgs=o.parseCommandLineArgs,exports.shuffle=s.shuffle,exports.sleep=n.sleep,exports.withRetry=r.withRetry,exports.zenkakuAlphanumericalsToHankaku=l.zenkakuAlphanumericalsToHankaku;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { getAppEnv } from './appEnv.js';
1
2
  export { ensureTruthy } from './assert.js';
2
3
  export { errorify, ignoreError, ignoreEnoent, ignoreErrorAsync, ignoreEnoentAsync, withRetry } from './error.js';
3
4
  export { humanizeNumber } from './humanize.js';
@@ -7,4 +8,5 @@ export { shuffle } from './shuffle.js';
7
8
  export { sleep } from './sleep.js';
8
9
  export { getConnectionLevelSqlitePragmas, getPersistentSqlitePragmas } from './sqlite.js';
9
10
  export { zenkakuAlphanumericalsToHankaku } from './zenkaku.js';
11
+ export type { AppEnv } from './appEnv.js';
10
12
  export type { RetryOptions } from './error.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{ensureTruthy as e}from"./assert.js";import{sleep as t}from"./sleep.js";import{errorify as n,ignoreEnoent as r,ignoreEnoentAsync as i,ignoreError as a,ignoreErrorAsync as o,withRetry as s}from"./error.js";import{humanizeNumber as c}from"./humanize.js";import{mailTemplates as l}from"./mail.js";import{parseCommandLineArgs as u}from"./parseCommandLineArgs.js";import{shuffle as d}from"./shuffle.js";import{getConnectionLevelSqlitePragmas as f,getPersistentSqlitePragmas as p}from"./sqlite.js";import{zenkakuAlphanumericalsToHankaku as m}from"./zenkaku.js";export{e as ensureTruthy,n as errorify,f as getConnectionLevelSqlitePragmas,p as getPersistentSqlitePragmas,c as humanizeNumber,r as ignoreEnoent,i as ignoreEnoentAsync,a as ignoreError,o as ignoreErrorAsync,l as mailTemplates,u as parseCommandLineArgs,d as shuffle,t as sleep,s as withRetry,m as zenkakuAlphanumericalsToHankaku};
1
+ import{getAppEnv as e}from"./appEnv.js";import{ensureTruthy as t}from"./assert.js";import{sleep as n}from"./sleep.js";import{errorify as r,ignoreEnoent as i,ignoreEnoentAsync as a,ignoreError as o,ignoreErrorAsync as s,withRetry as c}from"./error.js";import{humanizeNumber as l}from"./humanize.js";import{mailTemplates as u}from"./mail.js";import{parseCommandLineArgs as d}from"./parseCommandLineArgs.js";import{shuffle as f}from"./shuffle.js";import{getConnectionLevelSqlitePragmas as p,getPersistentSqlitePragmas as m}from"./sqlite.js";import{zenkakuAlphanumericalsToHankaku as h}from"./zenkaku.js";export{t as ensureTruthy,r as errorify,e as getAppEnv,p as getConnectionLevelSqlitePragmas,m as getPersistentSqlitePragmas,l as humanizeNumber,i as ignoreEnoent,a as ignoreEnoentAsync,o as ignoreError,s as ignoreErrorAsync,u as mailTemplates,d as parseCommandLineArgs,f as shuffle,n as sleep,c as withRetry,h as zenkakuAlphanumericalsToHankaku};
@@ -1 +1 @@
1
- {"version":3,"file":"parseCommandLineArgs.cjs","names":[],"sources":["../src/parseCommandLineArgs.ts"],"sourcesContent":["/**\n * Parses a command line string into an array of arguments, preserving quoted strings.\n *\n * This function handles:\n * - Space-separated arguments\n * - Double-quoted strings (preserves spaces within)\n * - Single-quoted strings (preserves spaces within)\n *\n * @param argsString The command line string to parse\n * @returns An array of parsed arguments\n */\nexport function parseCommandLineArgs(argsString: string): string[] {\n if (!argsString) return [];\n\n const result: string[] = [];\n let current = '';\n let inDoubleQuote = false;\n let inSingleQuote = false;\n\n for (const char of argsString) {\n // Handle quotes\n if (char === '\"' && !inSingleQuote) {\n inDoubleQuote = !inDoubleQuote;\n continue;\n }\n\n if (char === \"'\" && !inDoubleQuote) {\n inSingleQuote = !inSingleQuote;\n continue;\n }\n\n // Handle spaces (only split on spaces outside of quotes)\n if (char === ' ' && !inDoubleQuote && !inSingleQuote) {\n if (current) {\n result.push(current);\n current = '';\n }\n continue;\n }\n\n // Add character to current argument\n current += char;\n }\n\n // Add the last argument if there is one\n if (current) {\n result.push(current);\n }\n\n return result;\n}\n"],"mappings":"aAWA,SAAgB,EAAqB,EAA8B,CACjE,GAAI,CAAC,EAAY,MAAO,CAAC,EAEzB,IAAM,EAAmB,CAAC,EACtB,EAAU,GACV,EAAgB,GAChB,EAAgB,GAEpB,IAAK,IAAM,KAAQ,EAAY,CAE7B,GAAI,IAAS,KAAO,CAAC,EAAe,CAClC,EAAgB,CAAC,EACjB,QACF,CAEA,GAAI,IAAS,KAAO,CAAC,EAAe,CAClC,EAAgB,CAAC,EACjB,QACF,CAGA,GAAI,IAAS,KAAO,CAAC,GAAiB,CAAC,EAAe,CACpD,AAEE,KADA,EAAO,KAAK,CAAO,EACT,IAEZ,QACF,CAGA,GAAW,CACb,CAOA,OAJI,GACF,EAAO,KAAK,CAAO,EAGd,CACT"}
1
+ {"version":3,"file":"parseCommandLineArgs.cjs","names":[],"sources":["../src/parseCommandLineArgs.ts"],"sourcesContent":["/**\n * Parses a command line string into an array of arguments, preserving quoted strings.\n *\n * This function handles:\n * - Space-separated arguments\n * - Double-quoted strings (preserves spaces within)\n * - Single-quoted strings (preserves spaces within)\n *\n * @param argsString The command line string to parse\n * @returns An array of parsed arguments\n */\nexport function parseCommandLineArgs(argsString: string): string[] {\n if (!argsString) return [];\n\n const result: string[] = [];\n let current = '';\n let inDoubleQuote = false;\n let inSingleQuote = false;\n\n for (const char of argsString) {\n if (char === '\"' && !inSingleQuote) {\n inDoubleQuote = !inDoubleQuote;\n continue;\n }\n\n if (char === \"'\" && !inDoubleQuote) {\n inSingleQuote = !inSingleQuote;\n continue;\n }\n\n if (char === ' ' && !inDoubleQuote && !inSingleQuote) {\n if (current) {\n result.push(current);\n current = '';\n }\n continue;\n }\n\n current += char;\n }\n\n if (current) {\n result.push(current);\n }\n\n return result;\n}\n"],"mappings":"aAWA,SAAgB,EAAqB,EAA8B,CACjE,GAAI,CAAC,EAAY,MAAO,CAAC,EAEzB,IAAM,EAAmB,CAAC,EACtB,EAAU,GACV,EAAgB,GAChB,EAAgB,GAEpB,IAAK,IAAM,KAAQ,EAAY,CAC7B,GAAI,IAAS,KAAO,CAAC,EAAe,CAClC,EAAgB,CAAC,EACjB,QACF,CAEA,GAAI,IAAS,KAAO,CAAC,EAAe,CAClC,EAAgB,CAAC,EACjB,QACF,CAEA,GAAI,IAAS,KAAO,CAAC,GAAiB,CAAC,EAAe,CACpD,AAEE,KADA,EAAO,KAAK,CAAO,EACT,IAEZ,QACF,CAEA,GAAW,CACb,CAMA,OAJI,GACF,EAAO,KAAK,CAAO,EAGd,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseCommandLineArgs.js","names":[],"sources":["../src/parseCommandLineArgs.ts"],"sourcesContent":["/**\n * Parses a command line string into an array of arguments, preserving quoted strings.\n *\n * This function handles:\n * - Space-separated arguments\n * - Double-quoted strings (preserves spaces within)\n * - Single-quoted strings (preserves spaces within)\n *\n * @param argsString The command line string to parse\n * @returns An array of parsed arguments\n */\nexport function parseCommandLineArgs(argsString: string): string[] {\n if (!argsString) return [];\n\n const result: string[] = [];\n let current = '';\n let inDoubleQuote = false;\n let inSingleQuote = false;\n\n for (const char of argsString) {\n // Handle quotes\n if (char === '\"' && !inSingleQuote) {\n inDoubleQuote = !inDoubleQuote;\n continue;\n }\n\n if (char === \"'\" && !inDoubleQuote) {\n inSingleQuote = !inSingleQuote;\n continue;\n }\n\n // Handle spaces (only split on spaces outside of quotes)\n if (char === ' ' && !inDoubleQuote && !inSingleQuote) {\n if (current) {\n result.push(current);\n current = '';\n }\n continue;\n }\n\n // Add character to current argument\n current += char;\n }\n\n // Add the last argument if there is one\n if (current) {\n result.push(current);\n }\n\n return result;\n}\n"],"mappings":"AAWA,SAAgB,EAAqB,EAA8B,CACjE,GAAI,CAAC,EAAY,MAAO,CAAC,EAEzB,IAAM,EAAmB,CAAC,EACtB,EAAU,GACV,EAAgB,GAChB,EAAgB,GAEpB,IAAK,IAAM,KAAQ,EAAY,CAE7B,GAAI,IAAS,KAAO,CAAC,EAAe,CAClC,EAAgB,CAAC,EACjB,QACF,CAEA,GAAI,IAAS,KAAO,CAAC,EAAe,CAClC,EAAgB,CAAC,EACjB,QACF,CAGA,GAAI,IAAS,KAAO,CAAC,GAAiB,CAAC,EAAe,CACpD,AAEE,KADA,EAAO,KAAK,CAAO,EACT,IAEZ,QACF,CAGA,GAAW,CACb,CAOA,OAJI,GACF,EAAO,KAAK,CAAO,EAGd,CACT"}
1
+ {"version":3,"file":"parseCommandLineArgs.js","names":[],"sources":["../src/parseCommandLineArgs.ts"],"sourcesContent":["/**\n * Parses a command line string into an array of arguments, preserving quoted strings.\n *\n * This function handles:\n * - Space-separated arguments\n * - Double-quoted strings (preserves spaces within)\n * - Single-quoted strings (preserves spaces within)\n *\n * @param argsString The command line string to parse\n * @returns An array of parsed arguments\n */\nexport function parseCommandLineArgs(argsString: string): string[] {\n if (!argsString) return [];\n\n const result: string[] = [];\n let current = '';\n let inDoubleQuote = false;\n let inSingleQuote = false;\n\n for (const char of argsString) {\n if (char === '\"' && !inSingleQuote) {\n inDoubleQuote = !inDoubleQuote;\n continue;\n }\n\n if (char === \"'\" && !inDoubleQuote) {\n inSingleQuote = !inSingleQuote;\n continue;\n }\n\n if (char === ' ' && !inDoubleQuote && !inSingleQuote) {\n if (current) {\n result.push(current);\n current = '';\n }\n continue;\n }\n\n current += char;\n }\n\n if (current) {\n result.push(current);\n }\n\n return result;\n}\n"],"mappings":"AAWA,SAAgB,EAAqB,EAA8B,CACjE,GAAI,CAAC,EAAY,MAAO,CAAC,EAEzB,IAAM,EAAmB,CAAC,EACtB,EAAU,GACV,EAAgB,GAChB,EAAgB,GAEpB,IAAK,IAAM,KAAQ,EAAY,CAC7B,GAAI,IAAS,KAAO,CAAC,EAAe,CAClC,EAAgB,CAAC,EACjB,QACF,CAEA,GAAI,IAAS,KAAO,CAAC,EAAe,CAClC,EAAgB,CAAC,EACjB,QACF,CAEA,GAAI,IAAS,KAAO,CAAC,GAAiB,CAAC,EAAe,CACpD,AAEE,KADA,EAAO,KAAK,CAAO,EACT,IAEZ,QACF,CAEA,GAAW,CACb,CAMA,OAJI,GACF,EAAO,KAAK,CAAO,EAGd,CACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/shared-lib",
3
- "version": "10.0.0",
3
+ "version": "10.1.1",
4
4
  "description": "Shared library for WillBooster projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,17 +46,17 @@
46
46
  "@tsconfig/node-lts": "24.0.0",
47
47
  "@tsconfig/node-ts": "23.6.4",
48
48
  "@types/bun": "1.3.14",
49
- "@types/node": "25.6.0",
49
+ "@types/node": "26.2.0",
50
50
  "@willbooster/oxfmt-config": "1.2.2",
51
51
  "@willbooster/oxlint-config": "1.4.8",
52
- "@willbooster/wb": "19.0.0",
53
- "build-ts": "20.0.0",
54
- "oxfmt": "0.60.0",
55
- "oxlint": "1.75.0",
52
+ "@willbooster/wb": "21.7.2",
53
+ "build-ts": "21.0.6",
54
+ "oxfmt": "0.62.0",
55
+ "oxlint": "1.77.0",
56
56
  "oxlint-tsgolint": "7.0.2001",
57
57
  "sort-package-json": "4.0.0",
58
58
  "typescript": "7.0.2",
59
- "vitest": "4.1.5"
59
+ "vitest": "4.1.10"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public",