@gtkx/utils 1.0.0-rc.1 → 1.0.0-rc.2
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/array/index-before-or-end.d.ts +15 -0
- package/dist/array/index-before-or-end.d.ts.map +1 -0
- package/dist/array/index-before-or-end.js +21 -0
- package/dist/array/index-before-or-end.js.map +1 -0
- package/dist/array/index.d.ts +6 -0
- package/dist/array/index.d.ts.map +1 -0
- package/dist/array/index.js +6 -0
- package/dist/array/index.js.map +1 -0
- package/dist/array/remove.d.ts +14 -0
- package/dist/array/remove.d.ts.map +1 -0
- package/dist/array/remove.js +19 -0
- package/dist/array/remove.js.map +1 -0
- package/dist/array/sort-strings-by.d.ts +15 -0
- package/dist/array/sort-strings-by.d.ts.map +1 -0
- package/dist/array/sort-strings-by.js +17 -0
- package/dist/array/sort-strings-by.js.map +1 -0
- package/dist/array/sort-strings.d.ts +12 -0
- package/dist/array/sort-strings.d.ts.map +1 -0
- package/dist/array/sort-strings.js +14 -0
- package/dist/array/sort-strings.js.map +1 -0
- package/dist/array/uniq-by.d.ts +18 -0
- package/dist/array/uniq-by.d.ts.map +1 -0
- package/dist/array/uniq-by.js +29 -0
- package/dist/array/uniq-by.js.map +1 -0
- package/dist/class/any-class.d.ts +8 -0
- package/dist/class/any-class.d.ts.map +1 -0
- package/dist/class/any-class.js +2 -0
- package/dist/class/any-class.js.map +1 -0
- package/dist/class/get-parent-class.d.ts +10 -0
- package/dist/class/get-parent-class.d.ts.map +1 -0
- package/dist/class/get-parent-class.js +12 -0
- package/dist/class/get-parent-class.js.map +1 -0
- package/dist/class/index.d.ts +4 -0
- package/dist/class/index.d.ts.map +1 -0
- package/dist/class/index.js +3 -0
- package/dist/class/index.js.map +1 -0
- package/dist/class/walk-class-chain.d.ts +13 -0
- package/dist/class/walk-class-chain.d.ts.map +1 -0
- package/dist/class/walk-class-chain.js +23 -0
- package/dist/class/walk-class-chain.js.map +1 -0
- package/dist/error/error-like.d.ts +6 -0
- package/dist/error/error-like.d.ts.map +1 -0
- package/dist/error/error-like.js +15 -0
- package/dist/error/error-like.js.map +1 -0
- package/dist/error/error-message.d.ts +13 -0
- package/dist/error/error-message.d.ts.map +1 -0
- package/dist/error/error-message.js +16 -0
- package/dist/error/error-message.js.map +1 -0
- package/dist/error/format-child-process-error.d.ts +12 -0
- package/dist/error/format-child-process-error.d.ts.map +1 -0
- package/dist/error/format-child-process-error.js +21 -0
- package/dist/error/format-child-process-error.js.map +1 -0
- package/dist/error/index.d.ts +4 -0
- package/dist/error/index.d.ts.map +1 -0
- package/dist/error/index.js +4 -0
- package/dist/error/index.js.map +1 -0
- package/dist/error/normalize-error.d.ts +13 -0
- package/dist/error/normalize-error.d.ts.map +1 -0
- package/dist/error/normalize-error.js +20 -0
- package/dist/error/normalize-error.js.map +1 -0
- package/dist/function/call-method.d.ts +3 -0
- package/dist/function/call-method.d.ts.map +1 -0
- package/dist/function/call-method.js +19 -0
- package/dist/function/call-method.js.map +1 -0
- package/dist/function/index.d.ts +2 -0
- package/dist/function/index.d.ts.map +1 -0
- package/dist/function/index.js +2 -0
- package/dist/function/index.js.map +1 -0
- package/dist/index.d.ts +13 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/log/create-logger.d.ts +15 -0
- package/dist/log/create-logger.d.ts.map +1 -0
- package/dist/log/create-logger.js +17 -0
- package/dist/log/create-logger.js.map +1 -0
- package/dist/log/default-logger.d.ts +36 -0
- package/dist/log/default-logger.d.ts.map +1 -0
- package/dist/log/default-logger.js +44 -0
- package/dist/log/default-logger.js.map +1 -0
- package/dist/log/index.d.ts +4 -0
- package/dist/log/index.d.ts.map +1 -0
- package/dist/log/index.js +4 -0
- package/dist/log/index.js.map +1 -0
- package/dist/log/logger.d.ts +64 -0
- package/dist/log/logger.d.ts.map +1 -0
- package/dist/log/logger.js +100 -0
- package/dist/log/logger.js.map +1 -0
- package/dist/map/get-or-insert.d.ts +23 -0
- package/dist/map/get-or-insert.d.ts.map +1 -0
- package/dist/map/get-or-insert.js +25 -0
- package/dist/map/get-or-insert.js.map +1 -0
- package/dist/map/index.d.ts +2 -0
- package/dist/map/index.d.ts.map +1 -0
- package/dist/map/index.js +2 -0
- package/dist/map/index.js.map +1 -0
- package/dist/object/index.d.ts +4 -0
- package/dist/object/index.d.ts.map +1 -0
- package/dist/object/index.js +4 -0
- package/dist/object/index.js.map +1 -0
- package/dist/object/omit.d.ts +15 -0
- package/dist/object/omit.d.ts.map +1 -0
- package/dist/object/omit.js +24 -0
- package/dist/object/omit.js.map +1 -0
- package/dist/object/pick-by.d.ts +15 -0
- package/dist/object/pick-by.d.ts.map +1 -0
- package/dist/object/pick-by.js +24 -0
- package/dist/object/pick-by.js.map +1 -0
- package/dist/object/structured-clone.d.ts +19 -0
- package/dist/object/structured-clone.d.ts.map +1 -0
- package/dist/object/structured-clone.js +28 -0
- package/dist/object/structured-clone.js.map +1 -0
- package/dist/predicate/are-object-keys-equal.d.ts +3 -0
- package/dist/predicate/are-object-keys-equal.d.ts.map +1 -0
- package/dist/predicate/are-object-keys-equal.js +9 -0
- package/dist/predicate/are-object-keys-equal.js.map +1 -0
- package/dist/predicate/index.d.ts +7 -0
- package/dist/predicate/index.d.ts.map +1 -0
- package/dist/predicate/index.js +7 -0
- package/dist/predicate/index.js.map +1 -0
- package/dist/predicate/is-deep-equal.d.ts +3 -0
- package/dist/predicate/is-deep-equal.d.ts.map +1 -0
- package/dist/predicate/is-deep-equal.js +35 -0
- package/dist/predicate/is-deep-equal.js.map +1 -0
- package/dist/predicate/is-plain-object.d.ts +17 -0
- package/dist/predicate/is-plain-object.d.ts.map +1 -0
- package/dist/predicate/is-plain-object.js +23 -0
- package/dist/predicate/is-plain-object.js.map +1 -0
- package/dist/predicate/is-record.d.ts +14 -0
- package/dist/predicate/is-record.d.ts.map +1 -0
- package/dist/predicate/is-record.js +16 -0
- package/dist/predicate/is-record.js.map +1 -0
- package/dist/predicate/is-same-array-by.d.ts +15 -0
- package/dist/predicate/is-same-array-by.d.ts.map +1 -0
- package/dist/predicate/is-same-array-by.js +20 -0
- package/dist/predicate/is-same-array-by.js.map +1 -0
- package/dist/predicate/is-same-array.d.ts +15 -0
- package/dist/predicate/is-same-array.d.ts.map +1 -0
- package/dist/predicate/is-same-array.js +18 -0
- package/dist/predicate/is-same-array.js.map +1 -0
- package/dist/predicate/is-shallow-equal.d.ts +3 -0
- package/dist/predicate/is-shallow-equal.d.ts.map +1 -0
- package/dist/predicate/is-shallow-equal.js +28 -0
- package/dist/predicate/is-shallow-equal.js.map +1 -0
- package/dist/process/exit-code-for-signal.d.ts +14 -0
- package/dist/process/exit-code-for-signal.d.ts.map +1 -0
- package/dist/process/exit-code-for-signal.js +19 -0
- package/dist/process/exit-code-for-signal.js.map +1 -0
- package/dist/process/index.d.ts +4 -0
- package/dist/process/index.d.ts.map +1 -0
- package/dist/process/index.js +4 -0
- package/dist/process/index.js.map +1 -0
- package/dist/process/install-graceful-shutdown.d.ts +16 -0
- package/dist/process/install-graceful-shutdown.d.ts.map +1 -0
- package/dist/{graceful-shutdown.js → process/install-graceful-shutdown.js} +28 -28
- package/dist/process/install-graceful-shutdown.js.map +1 -0
- package/dist/process/resolve-executable.d.ts +14 -0
- package/dist/process/resolve-executable.d.ts.map +1 -0
- package/dist/process/resolve-executable.js +47 -0
- package/dist/process/resolve-executable.js.map +1 -0
- package/dist/set/drain.d.ts +11 -0
- package/dist/set/drain.d.ts.map +1 -0
- package/dist/set/drain.js +16 -0
- package/dist/set/drain.js.map +1 -0
- package/dist/set/index.d.ts +2 -0
- package/dist/set/index.d.ts.map +1 -0
- package/dist/set/index.js +2 -0
- package/dist/set/index.js.map +1 -0
- package/dist/source/index.d.ts +4 -0
- package/dist/source/index.d.ts.map +1 -0
- package/dist/source/index.js +4 -0
- package/dist/source/index.js.map +1 -0
- package/dist/source/sanitize-identifier.d.ts +14 -0
- package/dist/source/sanitize-identifier.d.ts.map +1 -0
- package/dist/source/sanitize-identifier.js +65 -0
- package/dist/source/sanitize-identifier.js.map +1 -0
- package/dist/source/source-string-literal.d.ts +13 -0
- package/dist/source/source-string-literal.d.ts.map +1 -0
- package/dist/source/source-string-literal.js +24 -0
- package/dist/source/source-string-literal.js.map +1 -0
- package/dist/source/to-camel-identifier.d.ts +13 -0
- package/dist/source/to-camel-identifier.d.ts.map +1 -0
- package/dist/source/to-camel-identifier.js +17 -0
- package/dist/source/to-camel-identifier.js.map +1 -0
- package/dist/string/camel-case.d.ts +17 -0
- package/dist/string/camel-case.d.ts.map +1 -0
- package/dist/string/camel-case.js +21 -0
- package/dist/string/camel-case.js.map +1 -0
- package/dist/string/index.d.ts +6 -0
- package/dist/string/index.d.ts.map +1 -0
- package/dist/string/index.js +6 -0
- package/dist/string/index.js.map +1 -0
- package/dist/string/kebab-case.d.ts +14 -0
- package/dist/string/kebab-case.d.ts.map +1 -0
- package/dist/string/kebab-case.js +16 -0
- package/dist/string/kebab-case.js.map +1 -0
- package/dist/string/lower-first.d.ts +13 -0
- package/dist/string/lower-first.d.ts.map +1 -0
- package/dist/string/lower-first.js +15 -0
- package/dist/string/lower-first.js.map +1 -0
- package/dist/string/pascal-case.d.ts +16 -0
- package/dist/string/pascal-case.d.ts.map +1 -0
- package/dist/string/pascal-case.js +20 -0
- package/dist/string/pascal-case.js.map +1 -0
- package/dist/string/upper-first.d.ts +13 -0
- package/dist/string/upper-first.d.ts.map +1 -0
- package/dist/string/upper-first.js +15 -0
- package/dist/string/upper-first.js.map +1 -0
- package/dist/string/word-segments.d.ts +3 -0
- package/dist/string/word-segments.d.ts.map +1 -0
- package/dist/string/word-segments.js +12 -0
- package/dist/string/word-segments.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +2 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/package-version.d.ts +12 -0
- package/dist/util/package-version.d.ts.map +1 -0
- package/dist/util/package-version.js +15 -0
- package/dist/util/package-version.js.map +1 -0
- package/package.json +1 -3
- package/src/array/index-before-or-end.ts +27 -0
- package/src/array/index.ts +5 -0
- package/src/array/remove.ts +20 -0
- package/src/array/sort-strings-by.ts +17 -0
- package/src/array/sort-strings.ts +14 -0
- package/src/array/uniq-by.ts +33 -0
- package/src/class/any-class.ts +10 -0
- package/src/class/get-parent-class.ts +15 -0
- package/src/class/index.ts +3 -0
- package/src/class/walk-class-chain.ts +29 -0
- package/src/error/error-like.ts +19 -0
- package/src/error/error-message.ts +17 -0
- package/src/error/format-child-process-error.ts +24 -0
- package/src/error/index.ts +3 -0
- package/src/error/normalize-error.ts +22 -0
- package/src/function/call-method.ts +22 -0
- package/src/function/index.ts +1 -0
- package/src/index.ts +13 -19
- package/src/log/create-logger.ts +18 -0
- package/src/log/default-logger.ts +49 -0
- package/src/log/index.ts +3 -0
- package/src/log/logger.ts +142 -0
- package/src/map/get-or-insert.ts +33 -0
- package/src/map/index.ts +1 -0
- package/src/object/index.ts +3 -0
- package/src/object/omit.ts +26 -0
- package/src/object/pick-by.ts +30 -0
- package/src/object/structured-clone.ts +31 -0
- package/src/predicate/are-object-keys-equal.ts +15 -0
- package/src/predicate/index.ts +6 -0
- package/src/predicate/is-deep-equal.ts +41 -0
- package/src/predicate/is-plain-object.ts +25 -0
- package/src/predicate/is-record.ts +16 -0
- package/src/predicate/is-same-array-by.ts +21 -0
- package/src/predicate/is-same-array.ts +19 -0
- package/src/predicate/is-shallow-equal.ts +32 -0
- package/src/process/exit-code-for-signal.ts +20 -0
- package/src/process/index.ts +3 -0
- package/src/{graceful-shutdown.ts → process/install-graceful-shutdown.ts} +48 -36
- package/src/process/resolve-executable.ts +57 -0
- package/src/set/drain.ts +17 -0
- package/src/set/index.ts +1 -0
- package/src/source/index.ts +3 -0
- package/src/source/sanitize-identifier.ts +66 -0
- package/src/source/source-string-literal.ts +27 -0
- package/src/source/to-camel-identifier.ts +18 -0
- package/src/string/camel-case.ts +22 -0
- package/src/string/index.ts +5 -0
- package/src/string/kebab-case.ts +18 -0
- package/src/string/lower-first.ts +15 -0
- package/src/string/pascal-case.ts +21 -0
- package/src/string/upper-first.ts +15 -0
- package/src/string/word-segments.ts +15 -0
- package/src/util/index.ts +1 -0
- package/src/util/package-version.ts +16 -0
- package/dist/class.d.ts +0 -22
- package/dist/class.d.ts.map +0 -1
- package/dist/class.js +0 -28
- package/dist/class.js.map +0 -1
- package/dist/collection.d.ts +0 -30
- package/dist/collection.d.ts.map +0 -1
- package/dist/collection.js +0 -64
- package/dist/collection.js.map +0 -1
- package/dist/error.d.ts +0 -21
- package/dist/error.d.ts.map +0 -1
- package/dist/error.js +0 -40
- package/dist/error.js.map +0 -1
- package/dist/graceful-shutdown.d.ts +0 -22
- package/dist/graceful-shutdown.d.ts.map +0 -1
- package/dist/graceful-shutdown.js.map +0 -1
- package/dist/log.d.ts +0 -103
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -129
- package/dist/log.js.map +0 -1
- package/dist/package-version.d.ts +0 -7
- package/dist/package-version.d.ts.map +0 -1
- package/dist/package-version.js +0 -8
- package/dist/package-version.js.map +0 -1
- package/dist/reflect.d.ts +0 -11
- package/dist/reflect.d.ts.map +0 -1
- package/dist/reflect.js +0 -14
- package/dist/reflect.js.map +0 -1
- package/dist/source.d.ts +0 -21
- package/dist/source.d.ts.map +0 -1
- package/dist/source.js +0 -78
- package/dist/source.js.map +0 -1
- package/dist/string.d.ts +0 -32
- package/dist/string.d.ts.map +0 -1
- package/dist/string.js +0 -43
- package/dist/string.js.map +0 -1
- package/src/class.ts +0 -36
- package/src/collection.ts +0 -65
- package/src/error.ts +0 -42
- package/src/log.ts +0 -164
- package/src/package-version.ts +0 -9
- package/src/reflect.ts +0 -13
- package/src/source.ts +0 -84
- package/src/string.ts +0 -46
package/dist/log.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"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","sourcesContent":["import pc from \"picocolors\";\n\nconst BASE_PREFIX = \"[gtkx]\";\n\ntype Colors = ReturnType<typeof pc.createColors>;\n\n/**\n * Minimal writable-stream shape a {@link Logger} writes formatted lines to.\n */\nexport type OutputStream = {\n write(chunk: string): unknown;\n /** Whether the stream is a terminal, used to decide if colored output is emitted. */\n isTTY?: boolean | undefined;\n};\n\n/**\n * Options for constructing a {@link Logger}.\n */\nexport type LoggerOptions = {\n /** Namespace appended to the log prefix and matched against debug configuration. */\n namespace?: string | undefined;\n /** Stream to write log lines to; defaults to `process.stderr`. */\n stream?: OutputStream | undefined;\n /** Forces debug output on or off; when omitted it is resolved from `--debug` and `GTKX_DEBUG`. */\n debugEnabled?: boolean | undefined;\n};\n\nconst colorsFor = (stream: OutputStream): Colors => pc.createColors(pc.isColorSupported && stream.isTTY === true);\n\nconst formatValue = (value: unknown): string => {\n if (typeof value === \"string\") return value;\n if (value instanceof Error) return value.stack ?? value.message;\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n};\n\nconst resolveDebugEnabled = (namespace: string | undefined, argv: string[], env: NodeJS.ProcessEnv): boolean => {\n if (argv.includes(\"--debug\")) return true;\n const spec = env.GTKX_DEBUG;\n if (!spec) return false;\n const names = spec.split(/[\\s,]+/).filter((name) => name.length > 0);\n if (names.includes(\"1\") || names.includes(\"*\")) return true;\n return namespace !== undefined && names.includes(namespace);\n};\n\nconst prefixFor = (namespace: string | undefined): string =>\n namespace === undefined ? BASE_PREFIX : `[gtkx:${namespace}]`;\n\n/**\n * Writes prefixed, optionally colored log lines to an output stream, with debug lines gated by\n * command-line and environment configuration.\n */\nexport class Logger {\n private stream: OutputStream;\n private prefix: string;\n private debugEnabled: boolean;\n private colors: Colors;\n\n /**\n * @param options Namespace, target stream, and debug configuration for the logger.\n */\n constructor(options: LoggerOptions = {}) {\n this.stream = options.stream ?? process.stderr;\n this.prefix = prefixFor(options.namespace);\n this.debugEnabled = options.debugEnabled ?? resolveDebugEnabled(options.namespace, process.argv, process.env);\n this.colors = colorsFor(this.stream);\n }\n\n private write(message: string, rest: unknown[]): void {\n const suffix = rest.length === 0 ? \"\" : ` ${rest.map(formatValue).join(\" \")}`;\n this.stream.write(`${this.prefix} ${message}${suffix}\\n`);\n }\n\n /**\n * Writes an informational line.\n *\n * @param message The message text.\n * @param rest Extra values appended after the message, formatted for display.\n */\n info(message: string, ...rest: unknown[]): void {\n this.write(message, rest);\n }\n\n /**\n * Writes a line marked as a warning.\n *\n * @param message The message text.\n * @param rest Extra values appended after the message, formatted for display.\n */\n warn(message: string, ...rest: unknown[]): void {\n this.write(`${this.colors.yellow(\"warn\")} ${message}`, rest);\n }\n\n /**\n * Writes a line marked as an error.\n *\n * @param message The message text.\n * @param rest Extra values appended after the message, formatted for display.\n */\n error(message: string, ...rest: unknown[]): void {\n this.write(`${this.colors.red(\"error\")} ${message}`, rest);\n }\n\n /**\n * Writes a line only when debug output is enabled for this logger.\n *\n * @param message The message text.\n * @param rest Extra values appended after the message, formatted for display.\n */\n debug(message: string, ...rest: unknown[]): void {\n if (!this.debugEnabled) return;\n this.write(message, rest);\n }\n}\n\n/**\n * Creates a {@link Logger} scoped to the given namespace.\n *\n * @param namespace Namespace added to the log prefix and matched against debug configuration.\n * @param options Further logger options excluding the namespace.\n */\nexport const createLogger = (namespace: string, options: Omit<LoggerOptions, \"namespace\"> = {}): Logger =>\n new Logger({ ...options, namespace });\n\n/**\n * The default namespace-less {@link Logger} backing the module-level {@link info}, {@link warn},\n * {@link error}, and {@link debug} functions.\n */\nexport const logger: Logger = new Logger();\n\n/**\n * Writes an informational line through the shared {@link logger}.\n *\n * @param message The message text.\n * @param rest Extra values appended after the message, formatted for display.\n */\nexport const info = (message: string, ...rest: unknown[]): void => logger.info(message, ...rest);\n\n/**\n * Writes a warning line through the shared {@link logger}.\n *\n * @param message The message text.\n * @param rest Extra values appended after the message, formatted for display.\n */\nexport const warn = (message: string, ...rest: unknown[]): void => logger.warn(message, ...rest);\n\n/**\n * Writes an error line through the shared {@link logger}.\n *\n * @param message The message text.\n * @param rest Extra values appended after the message, formatted for display.\n */\nexport const error = (message: string, ...rest: unknown[]): void => logger.error(message, ...rest);\n\n/**\n * Writes a debug line through the shared {@link logger} when debug output is enabled.\n *\n * @param message The message text.\n * @param rest Extra values appended after the message, formatted for display.\n */\nexport const debug = (message: string, ...rest: unknown[]): void => logger.debug(message, ...rest);\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reads the `version` field from the `package.json` next to the calling module.
|
|
3
|
-
*
|
|
4
|
-
* @param importMetaUrl The caller's `import.meta.url`, used to resolve the sibling `package.json`.
|
|
5
|
-
*/
|
|
6
|
-
export declare const packageVersion: (importMetaUrl: string) => string;
|
|
7
|
-
//# sourceMappingURL=package-version.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../src/package-version.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,cAAc,kBAAmB,MAAM,KAAG,MAC6B,CAAC"}
|
package/dist/package-version.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
/**
|
|
3
|
-
* Reads the `version` field from the `package.json` next to the calling module.
|
|
4
|
-
*
|
|
5
|
-
* @param importMetaUrl The caller's `import.meta.url`, used to resolve the sibling `package.json`.
|
|
6
|
-
*/
|
|
7
|
-
export const packageVersion = (importMetaUrl) => createRequire(importMetaUrl)("../package.json").version;
|
|
8
|
-
//# sourceMappingURL=package-version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../src/package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,aAAqB,EAAU,EAAE,CAC3D,aAAa,CAAC,aAAa,CAAC,CAAC,iBAAiB,CAAyB,CAAC,OAAO,CAAC","sourcesContent":["import { createRequire } from \"node:module\";\n\n/**\n * Reads the `version` field from the `package.json` next to the calling module.\n *\n * @param importMetaUrl The caller's `import.meta.url`, used to resolve the sibling `package.json`.\n */\nexport const packageVersion = (importMetaUrl: string): string =>\n (createRequire(importMetaUrl)(\"../package.json\") as { version: string }).version;\n"]}
|
package/dist/reflect.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calls the named method on `target` with the given arguments, returning `undefined` when the
|
|
3
|
-
* property is missing or not callable.
|
|
4
|
-
*
|
|
5
|
-
* @param target The object to read the method from and bind as `this`.
|
|
6
|
-
* @param method The method name to look up.
|
|
7
|
-
* @param args Arguments passed to the method.
|
|
8
|
-
* @returns The method's return value, or `undefined` when it is not a function.
|
|
9
|
-
*/
|
|
10
|
-
export declare const callMethod: (target: object, method: string, args: unknown[]) => unknown;
|
|
11
|
-
//# sourceMappingURL=reflect.d.ts.map
|
package/dist/reflect.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reflect.d.ts","sourceRoot":"","sources":["../src/reflect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,WAAY,MAAM,UAAU,MAAM,QAAQ,OAAO,EAAE,KAAG,OAG5E,CAAC"}
|
package/dist/reflect.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calls the named method on `target` with the given arguments, returning `undefined` when the
|
|
3
|
-
* property is missing or not callable.
|
|
4
|
-
*
|
|
5
|
-
* @param target The object to read the method from and bind as `this`.
|
|
6
|
-
* @param method The method name to look up.
|
|
7
|
-
* @param args Arguments passed to the method.
|
|
8
|
-
* @returns The method's return value, or `undefined` when it is not a function.
|
|
9
|
-
*/
|
|
10
|
-
export const callMethod = (target, method, args) => {
|
|
11
|
-
const fn = Reflect.get(target, method);
|
|
12
|
-
return typeof fn === "function" ? Reflect.apply(fn, target, args) : undefined;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=reflect.js.map
|
package/dist/reflect.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reflect.js","sourceRoot":"","sources":["../src/reflect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,IAAe,EAAW,EAAE;IACnF,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,OAAO,OAAO,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAClF,CAAC,CAAC","sourcesContent":["/**\n * Calls the named method on `target` with the given arguments, returning `undefined` when the\n * property is missing or not callable.\n *\n * @param target The object to read the method from and bind as `this`.\n * @param method The method name to look up.\n * @param args Arguments passed to the method.\n * @returns The method's return value, or `undefined` when it is not a function.\n */\nexport const callMethod = (target: object, method: string, args: unknown[]): unknown => {\n const fn = Reflect.get(target, method);\n return typeof fn === \"function\" ? Reflect.apply(fn, target, args) : undefined;\n};\n"]}
|
package/dist/source.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the name unchanged, or with a trailing underscore when it collides with a reserved word,
|
|
3
|
-
* so it is safe to emit as a JavaScript identifier.
|
|
4
|
-
*
|
|
5
|
-
* @param name The candidate identifier.
|
|
6
|
-
*/
|
|
7
|
-
export declare const sanitizeIdentifier: (name: string) => string;
|
|
8
|
-
/**
|
|
9
|
-
* Converts a name to camelCase and sanitizes it into a valid JavaScript identifier.
|
|
10
|
-
*
|
|
11
|
-
* @param name The name to convert.
|
|
12
|
-
*/
|
|
13
|
-
export declare const toCamelIdentifier: (name: string) => string;
|
|
14
|
-
/**
|
|
15
|
-
* Encodes a string as a JavaScript string literal, additionally escaping characters that are unsafe
|
|
16
|
-
* to embed in generated source (angle brackets and the line and paragraph separators).
|
|
17
|
-
*
|
|
18
|
-
* @param value The string to encode.
|
|
19
|
-
*/
|
|
20
|
-
export declare const sourceStringLiteral: (value: string) => string;
|
|
21
|
-
//# sourceMappingURL=source.d.ts.map
|
package/dist/source.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAoDA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAAkD,CAAC;AAErG;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,SAAU,MAAM,KAAG,MAA+C,CAAC;AAWjG;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,MAC0C,CAAC"}
|
package/dist/source.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { toCamelCase } from "./string.js";
|
|
2
|
-
const RESERVED = new Set([
|
|
3
|
-
"arguments",
|
|
4
|
-
"await",
|
|
5
|
-
"break",
|
|
6
|
-
"case",
|
|
7
|
-
"catch",
|
|
8
|
-
"class",
|
|
9
|
-
"const",
|
|
10
|
-
"continue",
|
|
11
|
-
"debugger",
|
|
12
|
-
"default",
|
|
13
|
-
"delete",
|
|
14
|
-
"do",
|
|
15
|
-
"else",
|
|
16
|
-
"enum",
|
|
17
|
-
"eval",
|
|
18
|
-
"export",
|
|
19
|
-
"extends",
|
|
20
|
-
"false",
|
|
21
|
-
"finally",
|
|
22
|
-
"for",
|
|
23
|
-
"function",
|
|
24
|
-
"if",
|
|
25
|
-
"import",
|
|
26
|
-
"in",
|
|
27
|
-
"instanceof",
|
|
28
|
-
"interface",
|
|
29
|
-
"let",
|
|
30
|
-
"new",
|
|
31
|
-
"null",
|
|
32
|
-
"package",
|
|
33
|
-
"private",
|
|
34
|
-
"protected",
|
|
35
|
-
"public",
|
|
36
|
-
"return",
|
|
37
|
-
"static",
|
|
38
|
-
"super",
|
|
39
|
-
"switch",
|
|
40
|
-
"this",
|
|
41
|
-
"throw",
|
|
42
|
-
"true",
|
|
43
|
-
"try",
|
|
44
|
-
"typeof",
|
|
45
|
-
"var",
|
|
46
|
-
"void",
|
|
47
|
-
"while",
|
|
48
|
-
"with",
|
|
49
|
-
"yield",
|
|
50
|
-
]);
|
|
51
|
-
/**
|
|
52
|
-
* Returns the name unchanged, or with a trailing underscore when it collides with a reserved word,
|
|
53
|
-
* so it is safe to emit as a JavaScript identifier.
|
|
54
|
-
*
|
|
55
|
-
* @param name The candidate identifier.
|
|
56
|
-
*/
|
|
57
|
-
export const sanitizeIdentifier = (name) => (RESERVED.has(name) ? `${name}_` : name);
|
|
58
|
-
/**
|
|
59
|
-
* Converts a name to camelCase and sanitizes it into a valid JavaScript identifier.
|
|
60
|
-
*
|
|
61
|
-
* @param name The name to convert.
|
|
62
|
-
*/
|
|
63
|
-
export const toCamelIdentifier = (name) => sanitizeIdentifier(toCamelCase(name));
|
|
64
|
-
const SOURCE_ESCAPES = {
|
|
65
|
-
"<": "\\u003C",
|
|
66
|
-
">": "\\u003E",
|
|
67
|
-
"\u2028": "\\u2028",
|
|
68
|
-
"\u2029": "\\u2029",
|
|
69
|
-
};
|
|
70
|
-
const UNSAFE_SOURCE_CHARS = new RegExp(`[${Object.keys(SOURCE_ESCAPES).join("")}]`, "g");
|
|
71
|
-
/**
|
|
72
|
-
* Encodes a string as a JavaScript string literal, additionally escaping characters that are unsafe
|
|
73
|
-
* to embed in generated source (angle brackets and the line and paragraph separators).
|
|
74
|
-
*
|
|
75
|
-
* @param value The string to encode.
|
|
76
|
-
*/
|
|
77
|
-
export const sourceStringLiteral = (value) => JSON.stringify(value).replace(UNSAFE_SOURCE_CHARS, (char) => SOURCE_ESCAPES[char] ?? char);
|
|
78
|
-
//# sourceMappingURL=source.js.map
|
package/dist/source.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,QAAQ,GAAgB,IAAI,GAAG,CAAC;IAClC,WAAW;IACX,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,YAAY;IACZ,WAAW;IACX,KAAK;IACL,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;CACV,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAErG;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAEjG,MAAM,cAAc,GAA2B;IAC3C,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACtB,CAAC;AAEF,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE,CACzD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC","sourcesContent":["import { toCamelCase } from \"./string.js\";\n\nconst RESERVED: Set<string> = new Set([\n \"arguments\",\n \"await\",\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"enum\",\n \"eval\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"interface\",\n \"let\",\n \"new\",\n \"null\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"return\",\n \"static\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n]);\n\n/**\n * Returns the name unchanged, or with a trailing underscore when it collides with a reserved word,\n * so it is safe to emit as a JavaScript identifier.\n *\n * @param name The candidate identifier.\n */\nexport const sanitizeIdentifier = (name: string): string => (RESERVED.has(name) ? `${name}_` : name);\n\n/**\n * Converts a name to camelCase and sanitizes it into a valid JavaScript identifier.\n *\n * @param name The name to convert.\n */\nexport const toCamelIdentifier = (name: string): string => sanitizeIdentifier(toCamelCase(name));\n\nconst SOURCE_ESCAPES: Record<string, string> = {\n \"<\": \"\\\\u003C\",\n \">\": \"\\\\u003E\",\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\",\n};\n\nconst UNSAFE_SOURCE_CHARS = new RegExp(`[${Object.keys(SOURCE_ESCAPES).join(\"\")}]`, \"g\");\n\n/**\n * Encodes a string as a JavaScript string literal, additionally escaping characters that are unsafe\n * to embed in generated source (angle brackets and the line and paragraph separators).\n *\n * @param value The string to encode.\n */\nexport const sourceStringLiteral = (value: string): string =>\n JSON.stringify(value).replace(UNSAFE_SOURCE_CHARS, (char) => SOURCE_ESCAPES[char] ?? char);\n"]}
|
package/dist/string.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the string with its first character uppercased.
|
|
3
|
-
*
|
|
4
|
-
* @param value The string to transform.
|
|
5
|
-
*/
|
|
6
|
-
export declare const upperFirst: (value: string) => string;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the string with its first character lowercased.
|
|
9
|
-
*
|
|
10
|
-
* @param value The string to transform.
|
|
11
|
-
*/
|
|
12
|
-
export declare const lowerFirst: (value: string) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Converts an underscore- or hyphen-delimited string to camelCase.
|
|
15
|
-
*
|
|
16
|
-
* @param input The string to convert.
|
|
17
|
-
*/
|
|
18
|
-
export declare const toCamelCase: (input: string) => string;
|
|
19
|
-
/**
|
|
20
|
-
* Converts an underscore- or hyphen-delimited string to PascalCase.
|
|
21
|
-
*
|
|
22
|
-
* @param input The string to convert.
|
|
23
|
-
*/
|
|
24
|
-
export declare const toPascalCase: (input: string) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Converts a camelCase or PascalCase string to kebab-case by lowercasing uppercase letters and
|
|
27
|
-
* inserting hyphens before interior ones.
|
|
28
|
-
*
|
|
29
|
-
* @param input The string to convert.
|
|
30
|
-
*/
|
|
31
|
-
export declare const toKebabCase: (input: string) => string;
|
|
32
|
-
//# sourceMappingURL=string.d.ts.map
|
package/dist/string.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MAAwD,CAAC;AAEpG;;;;GAIG;AACH,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MAAwD,CAAC;AAIpG;;;;GAIG;AACH,eAAO,MAAM,WAAW,UAAW,MAAM,KAAG,MAI3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,MAI5C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,UAAW,MAAM,KAAG,MAC0E,CAAC"}
|
package/dist/string.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the string with its first character uppercased.
|
|
3
|
-
*
|
|
4
|
-
* @param value The string to transform.
|
|
5
|
-
*/
|
|
6
|
-
export const upperFirst = (value) => value.charAt(0).toUpperCase() + value.slice(1);
|
|
7
|
-
/**
|
|
8
|
-
* Returns the string with its first character lowercased.
|
|
9
|
-
*
|
|
10
|
-
* @param value The string to transform.
|
|
11
|
-
*/
|
|
12
|
-
export const lowerFirst = (value) => value.charAt(0).toLowerCase() + value.slice(1);
|
|
13
|
-
const splitWords = (input) => input.split(/[_-]/g).filter((part) => part.length > 0);
|
|
14
|
-
/**
|
|
15
|
-
* Converts an underscore- or hyphen-delimited string to camelCase.
|
|
16
|
-
*
|
|
17
|
-
* @param input The string to convert.
|
|
18
|
-
*/
|
|
19
|
-
export const toCamelCase = (input) => {
|
|
20
|
-
const parts = splitWords(input);
|
|
21
|
-
if (parts.length === 0)
|
|
22
|
-
return input;
|
|
23
|
-
return parts.map((part, index) => (index === 0 ? part : upperFirst(part))).join("");
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Converts an underscore- or hyphen-delimited string to PascalCase.
|
|
27
|
-
*
|
|
28
|
-
* @param input The string to convert.
|
|
29
|
-
*/
|
|
30
|
-
export const toPascalCase = (input) => {
|
|
31
|
-
const parts = splitWords(input);
|
|
32
|
-
if (parts.length === 0)
|
|
33
|
-
return input;
|
|
34
|
-
return parts.map(upperFirst).join("");
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Converts a camelCase or PascalCase string to kebab-case by lowercasing uppercase letters and
|
|
38
|
-
* inserting hyphens before interior ones.
|
|
39
|
-
*
|
|
40
|
-
* @param input The string to convert.
|
|
41
|
-
*/
|
|
42
|
-
export const toKebabCase = (input) => input.replaceAll(/[A-Z]/g, (char, index) => (index === 0 ? char.toLowerCase() : `-${char.toLowerCase()}`));
|
|
43
|
-
//# sourceMappingURL=string.js.map
|
package/dist/string.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEpG;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEpG,MAAM,UAAU,GAAG,CAAC,KAAa,EAAY,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAEvG;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE;IACjD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxF,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE;IAClD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE,CACjD,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAa,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Returns the string with its first character uppercased.\n *\n * @param value The string to transform.\n */\nexport const upperFirst = (value: string): string => value.charAt(0).toUpperCase() + value.slice(1);\n\n/**\n * Returns the string with its first character lowercased.\n *\n * @param value The string to transform.\n */\nexport const lowerFirst = (value: string): string => value.charAt(0).toLowerCase() + value.slice(1);\n\nconst splitWords = (input: string): string[] => input.split(/[_-]/g).filter((part) => part.length > 0);\n\n/**\n * Converts an underscore- or hyphen-delimited string to camelCase.\n *\n * @param input The string to convert.\n */\nexport const toCamelCase = (input: string): string => {\n const parts = splitWords(input);\n if (parts.length === 0) return input;\n return parts.map((part, index) => (index === 0 ? part : upperFirst(part))).join(\"\");\n};\n\n/**\n * Converts an underscore- or hyphen-delimited string to PascalCase.\n *\n * @param input The string to convert.\n */\nexport const toPascalCase = (input: string): string => {\n const parts = splitWords(input);\n if (parts.length === 0) return input;\n return parts.map(upperFirst).join(\"\");\n};\n\n/**\n * Converts a camelCase or PascalCase string to kebab-case by lowercasing uppercase letters and\n * inserting hyphens before interior ones.\n *\n * @param input The string to convert.\n */\nexport const toKebabCase = (input: string): string =>\n input.replaceAll(/[A-Z]/g, (char, index: number) => (index === 0 ? char.toLowerCase() : `-${char.toLowerCase()}`));\n"]}
|
package/src/class.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A constructor value of any (possibly abstract) class producing instances of `T`.
|
|
3
|
-
*/
|
|
4
|
-
export type AnyClass<T extends object = object> = (abstract new (
|
|
5
|
-
...args: never[]
|
|
6
|
-
) => T) & {
|
|
7
|
-
prototype: T;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Returns the direct superclass of `cls`, or `null` when it has no class ancestor.
|
|
12
|
-
*
|
|
13
|
-
* @param cls The class whose prototype parent to inspect.
|
|
14
|
-
*/
|
|
15
|
-
export function getParentClass(cls: AnyClass): AnyClass | null {
|
|
16
|
-
const parent: unknown = Object.getPrototypeOf(cls);
|
|
17
|
-
return typeof parent === "function" && parent !== Function.prototype ? (parent as AnyClass) : null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Walks the class chain from `cls` up through its ancestors, calling `visit` on each and
|
|
22
|
-
* returning the first result that is not `undefined`.
|
|
23
|
-
*
|
|
24
|
-
* @param cls The class to start from, or `null` to visit nothing.
|
|
25
|
-
* @param visit Called with each class in the chain; a defined return value stops the walk.
|
|
26
|
-
* @returns The first defined result from `visit`, or `undefined` if none was produced.
|
|
27
|
-
*/
|
|
28
|
-
export function walkClassChain<T>(cls: AnyClass | null, visit: (ancestor: AnyClass) => T | undefined): T | undefined {
|
|
29
|
-
let current = cls;
|
|
30
|
-
while (current !== null) {
|
|
31
|
-
const result = visit(current);
|
|
32
|
-
if (result !== undefined) return result;
|
|
33
|
-
current = getParentClass(current);
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
package/src/collection.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the items with duplicates removed, keeping the first item for each distinct key.
|
|
3
|
-
*
|
|
4
|
-
* @param items The items to deduplicate.
|
|
5
|
-
* @param key Computes the identity string used to detect duplicates.
|
|
6
|
-
*/
|
|
7
|
-
export const uniqBy = <T>(items: T[], key: (item: T) => string): T[] => {
|
|
8
|
-
const seen = new Set<string>();
|
|
9
|
-
const result: T[] = [];
|
|
10
|
-
for (const item of items) {
|
|
11
|
-
const identity = key(item);
|
|
12
|
-
if (seen.has(identity)) continue;
|
|
13
|
-
seen.add(identity);
|
|
14
|
-
result.push(item);
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const isSameArray = <T>(a: T[], b: T[]): boolean => {
|
|
20
|
-
if (a.length !== b.length) return false;
|
|
21
|
-
for (let index = 0; index < a.length; index++) {
|
|
22
|
-
if (a[index] !== b[index]) return false;
|
|
23
|
-
}
|
|
24
|
-
return true;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const compareStrings = (a: string, b: string): number => a.localeCompare(b);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Returns a new array of the given strings sorted with locale-aware comparison.
|
|
31
|
-
*
|
|
32
|
-
* @param values The strings to sort.
|
|
33
|
-
*/
|
|
34
|
-
export const sortStrings = (values: Iterable<string>): string[] => [...values].sort(compareStrings);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Returns a new array of the given items sorted by a locale-aware comparison of their keys.
|
|
38
|
-
*
|
|
39
|
-
* @param items The items to sort.
|
|
40
|
-
* @param key Computes the string to sort each item by.
|
|
41
|
-
*/
|
|
42
|
-
export const sortStringsBy = <T>(items: Iterable<T>, key: (item: T) => string): T[] =>
|
|
43
|
-
[...items].sort((a, b) => compareStrings(key(a), key(b)));
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Determines whether two records have the same keys and strictly equal values.
|
|
47
|
-
*
|
|
48
|
-
* @param a The first record, or `undefined`.
|
|
49
|
-
* @param b The second record, or `undefined`.
|
|
50
|
-
* @returns `true` when both are the same reference, or both are defined with identical own keys and values.
|
|
51
|
-
*/
|
|
52
|
-
export const isShallowEqual = <T extends Record<string, unknown>>(a?: T, b?: T): boolean => {
|
|
53
|
-
if (a === b) return true;
|
|
54
|
-
if (!a || !b) return false;
|
|
55
|
-
|
|
56
|
-
const keysA = Object.keys(a);
|
|
57
|
-
const keysB = Object.keys(b);
|
|
58
|
-
if (keysA.length !== keysB.length) return false;
|
|
59
|
-
|
|
60
|
-
for (const key of keysA) {
|
|
61
|
-
if (a[key] !== b[key]) return false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return true;
|
|
65
|
-
};
|
package/src/error.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const isObject = (value: unknown): value is Record<string, unknown> => typeof value === "object" && value !== null;
|
|
2
|
-
|
|
3
|
-
const isErrorLike = (value: unknown): value is { message: string } =>
|
|
4
|
-
isObject(value) && "message" in value && typeof value.message === "string";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Extracts a human-readable message from an unknown thrown value, falling back to its string form.
|
|
8
|
-
*
|
|
9
|
-
* @param error The caught value to describe.
|
|
10
|
-
*/
|
|
11
|
-
export const errorMessage = (error: unknown): string =>
|
|
12
|
-
Error.isError(error) || isErrorLike(error) ? error.message : String(error);
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Coerces an unknown thrown value into an `Error`, reusing it if it already is one and otherwise
|
|
16
|
-
* wrapping its message while copying any error-like own properties.
|
|
17
|
-
*
|
|
18
|
-
* @param error The caught value to normalize.
|
|
19
|
-
*/
|
|
20
|
-
export const normalizeError = (error: unknown): Error => {
|
|
21
|
-
if (Error.isError(error)) return error;
|
|
22
|
-
return Object.assign(new Error(errorMessage(error)), isErrorLike(error) ? error : {});
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const readStream = (value: unknown): string => {
|
|
26
|
-
if (typeof value === "string") return value;
|
|
27
|
-
if (value instanceof Uint8Array || Buffer.isBuffer(value)) return value.toString();
|
|
28
|
-
return "";
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Combines the `stderr` and `stdout` fields of a failed child-process error into a single trimmed string.
|
|
33
|
-
*
|
|
34
|
-
* @param error The child-process error to read output from.
|
|
35
|
-
* @returns The joined output, or `undefined` when neither stream carried any text.
|
|
36
|
-
*/
|
|
37
|
-
export const formatChildProcessError = (error: unknown): string | undefined => {
|
|
38
|
-
if (!isObject(error)) return undefined;
|
|
39
|
-
const { stderr, stdout } = error;
|
|
40
|
-
const details = [readStream(stderr), readStream(stdout)].filter(Boolean).join("\n").trim();
|
|
41
|
-
return details.length > 0 ? details : undefined;
|
|
42
|
-
};
|
package/src/log.ts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import pc from "picocolors";
|
|
2
|
-
|
|
3
|
-
const BASE_PREFIX = "[gtkx]";
|
|
4
|
-
|
|
5
|
-
type Colors = ReturnType<typeof pc.createColors>;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Minimal writable-stream shape a {@link Logger} writes formatted lines to.
|
|
9
|
-
*/
|
|
10
|
-
export type OutputStream = {
|
|
11
|
-
write(chunk: string): unknown;
|
|
12
|
-
/** Whether the stream is a terminal, used to decide if colored output is emitted. */
|
|
13
|
-
isTTY?: boolean | undefined;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Options for constructing a {@link Logger}.
|
|
18
|
-
*/
|
|
19
|
-
export type LoggerOptions = {
|
|
20
|
-
/** Namespace appended to the log prefix and matched against debug configuration. */
|
|
21
|
-
namespace?: string | undefined;
|
|
22
|
-
/** Stream to write log lines to; defaults to `process.stderr`. */
|
|
23
|
-
stream?: OutputStream | undefined;
|
|
24
|
-
/** Forces debug output on or off; when omitted it is resolved from `--debug` and `GTKX_DEBUG`. */
|
|
25
|
-
debugEnabled?: boolean | undefined;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const colorsFor = (stream: OutputStream): Colors => pc.createColors(pc.isColorSupported && stream.isTTY === true);
|
|
29
|
-
|
|
30
|
-
const formatValue = (value: unknown): string => {
|
|
31
|
-
if (typeof value === "string") return value;
|
|
32
|
-
if (value instanceof Error) return value.stack ?? value.message;
|
|
33
|
-
try {
|
|
34
|
-
return JSON.stringify(value);
|
|
35
|
-
} catch {
|
|
36
|
-
return String(value);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const resolveDebugEnabled = (namespace: string | undefined, argv: string[], env: NodeJS.ProcessEnv): boolean => {
|
|
41
|
-
if (argv.includes("--debug")) return true;
|
|
42
|
-
const spec = env.GTKX_DEBUG;
|
|
43
|
-
if (!spec) return false;
|
|
44
|
-
const names = spec.split(/[\s,]+/).filter((name) => name.length > 0);
|
|
45
|
-
if (names.includes("1") || names.includes("*")) return true;
|
|
46
|
-
return namespace !== undefined && names.includes(namespace);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const prefixFor = (namespace: string | undefined): string =>
|
|
50
|
-
namespace === undefined ? BASE_PREFIX : `[gtkx:${namespace}]`;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Writes prefixed, optionally colored log lines to an output stream, with debug lines gated by
|
|
54
|
-
* command-line and environment configuration.
|
|
55
|
-
*/
|
|
56
|
-
export class Logger {
|
|
57
|
-
private stream: OutputStream;
|
|
58
|
-
private prefix: string;
|
|
59
|
-
private debugEnabled: boolean;
|
|
60
|
-
private colors: Colors;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @param options Namespace, target stream, and debug configuration for the logger.
|
|
64
|
-
*/
|
|
65
|
-
constructor(options: LoggerOptions = {}) {
|
|
66
|
-
this.stream = options.stream ?? process.stderr;
|
|
67
|
-
this.prefix = prefixFor(options.namespace);
|
|
68
|
-
this.debugEnabled = options.debugEnabled ?? resolveDebugEnabled(options.namespace, process.argv, process.env);
|
|
69
|
-
this.colors = colorsFor(this.stream);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private write(message: string, rest: unknown[]): void {
|
|
73
|
-
const suffix = rest.length === 0 ? "" : ` ${rest.map(formatValue).join(" ")}`;
|
|
74
|
-
this.stream.write(`${this.prefix} ${message}${suffix}\n`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Writes an informational line.
|
|
79
|
-
*
|
|
80
|
-
* @param message The message text.
|
|
81
|
-
* @param rest Extra values appended after the message, formatted for display.
|
|
82
|
-
*/
|
|
83
|
-
info(message: string, ...rest: unknown[]): void {
|
|
84
|
-
this.write(message, rest);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Writes a line marked as a warning.
|
|
89
|
-
*
|
|
90
|
-
* @param message The message text.
|
|
91
|
-
* @param rest Extra values appended after the message, formatted for display.
|
|
92
|
-
*/
|
|
93
|
-
warn(message: string, ...rest: unknown[]): void {
|
|
94
|
-
this.write(`${this.colors.yellow("warn")} ${message}`, rest);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Writes a line marked as an error.
|
|
99
|
-
*
|
|
100
|
-
* @param message The message text.
|
|
101
|
-
* @param rest Extra values appended after the message, formatted for display.
|
|
102
|
-
*/
|
|
103
|
-
error(message: string, ...rest: unknown[]): void {
|
|
104
|
-
this.write(`${this.colors.red("error")} ${message}`, rest);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Writes a line only when debug output is enabled for this logger.
|
|
109
|
-
*
|
|
110
|
-
* @param message The message text.
|
|
111
|
-
* @param rest Extra values appended after the message, formatted for display.
|
|
112
|
-
*/
|
|
113
|
-
debug(message: string, ...rest: unknown[]): void {
|
|
114
|
-
if (!this.debugEnabled) return;
|
|
115
|
-
this.write(message, rest);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Creates a {@link Logger} scoped to the given namespace.
|
|
121
|
-
*
|
|
122
|
-
* @param namespace Namespace added to the log prefix and matched against debug configuration.
|
|
123
|
-
* @param options Further logger options excluding the namespace.
|
|
124
|
-
*/
|
|
125
|
-
export const createLogger = (namespace: string, options: Omit<LoggerOptions, "namespace"> = {}): Logger =>
|
|
126
|
-
new Logger({ ...options, namespace });
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* The default namespace-less {@link Logger} backing the module-level {@link info}, {@link warn},
|
|
130
|
-
* {@link error}, and {@link debug} functions.
|
|
131
|
-
*/
|
|
132
|
-
export const logger: Logger = new Logger();
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Writes an informational line through the shared {@link logger}.
|
|
136
|
-
*
|
|
137
|
-
* @param message The message text.
|
|
138
|
-
* @param rest Extra values appended after the message, formatted for display.
|
|
139
|
-
*/
|
|
140
|
-
export const info = (message: string, ...rest: unknown[]): void => logger.info(message, ...rest);
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Writes a warning line through the shared {@link logger}.
|
|
144
|
-
*
|
|
145
|
-
* @param message The message text.
|
|
146
|
-
* @param rest Extra values appended after the message, formatted for display.
|
|
147
|
-
*/
|
|
148
|
-
export const warn = (message: string, ...rest: unknown[]): void => logger.warn(message, ...rest);
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Writes an error line through the shared {@link logger}.
|
|
152
|
-
*
|
|
153
|
-
* @param message The message text.
|
|
154
|
-
* @param rest Extra values appended after the message, formatted for display.
|
|
155
|
-
*/
|
|
156
|
-
export const error = (message: string, ...rest: unknown[]): void => logger.error(message, ...rest);
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Writes a debug line through the shared {@link logger} when debug output is enabled.
|
|
160
|
-
*
|
|
161
|
-
* @param message The message text.
|
|
162
|
-
* @param rest Extra values appended after the message, formatted for display.
|
|
163
|
-
*/
|
|
164
|
-
export const debug = (message: string, ...rest: unknown[]): void => logger.debug(message, ...rest);
|
package/src/package-version.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Reads the `version` field from the `package.json` next to the calling module.
|
|
5
|
-
*
|
|
6
|
-
* @param importMetaUrl The caller's `import.meta.url`, used to resolve the sibling `package.json`.
|
|
7
|
-
*/
|
|
8
|
-
export const packageVersion = (importMetaUrl: string): string =>
|
|
9
|
-
(createRequire(importMetaUrl)("../package.json") as { version: string }).version;
|
package/src/reflect.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calls the named method on `target` with the given arguments, returning `undefined` when the
|
|
3
|
-
* property is missing or not callable.
|
|
4
|
-
*
|
|
5
|
-
* @param target The object to read the method from and bind as `this`.
|
|
6
|
-
* @param method The method name to look up.
|
|
7
|
-
* @param args Arguments passed to the method.
|
|
8
|
-
* @returns The method's return value, or `undefined` when it is not a function.
|
|
9
|
-
*/
|
|
10
|
-
export const callMethod = (target: object, method: string, args: unknown[]): unknown => {
|
|
11
|
-
const fn = Reflect.get(target, method);
|
|
12
|
-
return typeof fn === "function" ? Reflect.apply(fn, target, args) : undefined;
|
|
13
|
-
};
|