@fbincon/claude-code-statusline 0.0.0-stage → 3.0.0-beta.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.
- package/LICENSE +21 -0
- package/LICENSE-Unicode.txt +39 -0
- package/LICENSE-Wcwidth.txt +27 -0
- package/README.md +90 -2
- package/bin/claude-statusline.js +2 -0
- package/candidate.json +1238 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.d.ts +35 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js +228 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/backend-preferences.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/backend-preferences.js +72 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/backend-preferences.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js +140 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/host.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/host.js +101 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/host.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.js +96 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/preferences.d.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/preferences.js +80 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/preferences.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.d.ts +45 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js +99 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/storage.d.ts +30 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/storage.js +134 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/storage.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js +89 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/context.d.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/context.js +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/context.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/entry.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/entry.js +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/errors.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/errors.js +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/errors.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +67 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.js +40 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +63 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js +153 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor.d.ts +14 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor.js +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js +142 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/launcher.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/launcher.js +91 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/launcher.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mod-ownership.d.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mod-ownership.js +109 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mod-ownership.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.d.ts +60 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.js +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js +234 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/ownership.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/ownership.js +41 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/ownership.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/paths.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/paths.js +14 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/paths.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/plan.d.ts +13 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/plan.js +92 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/plan.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.d.ts +19 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.js +91 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/resources.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/slash-hook.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/slash-hook.js +94 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/slash-hook.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/transaction.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/transaction.js +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/transaction.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/main.d.ts +22 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +197 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/files.d.ts +7 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/files.js +134 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/files.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.d.ts +58 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js +144 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/official.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/official.js +125 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/official.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/service.d.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/service.js +55 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.js +95 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.js +48 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.d.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js +13 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/context.d.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/context.js +11 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/context.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.d.ts +19 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js +162 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/git.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/hook.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/hook.js +19 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/hook.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/io.d.ts +37 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/io.js +75 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/io.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/json-data.d.ts +9 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/json-data.js +241 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/json-data.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/collect.d.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/collect.js +14 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/collect.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/durations.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/durations.js +69 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/durations.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/protocol.d.ts +16 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/protocol.js +90 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/protocol.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/store.d.ts +25 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/store.js +80 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/store.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/registry.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/registry.js +40 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/registry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/collect.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/collect.js +59 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/collect.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/service.d.ts +17 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/service.js +69 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/store.d.ts +17 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/store.js +70 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/store.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/submissions.d.ts +13 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/submissions.js +75 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/tasks/submissions.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.d.ts +33 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.js +227 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +144 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/package.json +17 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-config/SKILL.md +80 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-configure/SKILL.md +19 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +37 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/hooks.json +6 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +820 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +503 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/forms.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +198 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/messages.ts +101 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +218 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/appearance.ts +29 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +254 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/forms.ts +167 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/guidance.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/import-review.ts +55 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/instances.ts +30 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/navigation.ts +98 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/numeric.ts +42 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/search.ts +114 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +276 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-unicode.ts +92 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +6842 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/index.ts +40 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/messages.ts +33 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/presentation.ts +62 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/launch.ts +25 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/preferences.ts +61 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/preview-preferences.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/session.ts +124 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/unicode.ts +121 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +47 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +159 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +84 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/surface.ts +89 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/catalog.ts +23 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/preview.ts +45 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/section.ts +49 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/components/shortcuts.ts +83 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/layout.ts +49 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/styled-text.ts +56 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/text.ts +23 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/theme.ts +27 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +49 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/hooks/hooks.json +1 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/hooks/observe.ts +279 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/checklists.ts +45 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/costs.ts +23 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/generated-contracts.ts +18 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/identity.ts +14 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/launch.ts +25 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/queue.ts +68 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/streams.ts +28 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/timing.ts +11 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +19 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/backend-preferences.d.ts +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/backend-preferences.js +72 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/backend-preferences.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.d.ts +86 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js +3462 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog.js +17 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js +19 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +232 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/draft.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/draft.js +48 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/draft.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js +104 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.d.ts +11 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js +99 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/generated-constants.d.ts +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/generated-constants.js +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/generated-constants.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js +80 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.d.ts +29 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js +159 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js +34 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.js +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/validation.d.ts +15 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/validation.js +55 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/validation.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.d.ts +33 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/runtime.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/runtime.js +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/runtime.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +663 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +401 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +73 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +251 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js +146 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/guidance.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/guidance.js +17 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/guidance.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.d.ts +19 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.js +53 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/import-review.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/instances.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/instances.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/instances.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/navigation.d.ts +37 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/navigation.js +73 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/navigation.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/numeric.d.ts +11 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/numeric.js +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/numeric.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/search.d.ts +22 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/search.js +122 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/search.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text.js +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +6841 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +6841 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/messages.d.ts +16 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/messages.js +38 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/messages.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/registry.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/registry.js +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/registry.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-Hant.d.ts +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-Hant.js +224 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-Hant.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/integration/binding.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/integration/binding.js +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/integration/binding.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-equality.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-equality.js +31 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-equality.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-read.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-read.js +137 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-read.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-text.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-text.js +56 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json-text.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json.js +165 -0
- package/node_modules/@fbincon/statusline-core/dist/src/json.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/numbers.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/numbers.js +47 -0
- package/node_modules/@fbincon/statusline-core/dist/src/numbers.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/ordered-record.d.ts +21 -0
- package/node_modules/@fbincon/statusline-core/dist/src/ordered-record.js +105 -0
- package/node_modules/@fbincon/statusline-core/dist/src/ordered-record.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/release.js +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/release.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js +73 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/coercion.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/coercion.js +50 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/coercion.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/colors.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/colors.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/colors.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js +49 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.d.ts +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.js +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/formatters.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/formatters.js +58 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/formatters.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/git.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/git.js +34 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/git.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.d.ts +49 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +399 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/language.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/language.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/language.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.d.ts +19 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js +176 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/live.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/live.js +29 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/live.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/metrics.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/metrics.js +93 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/metrics.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/numeric-format.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/numeric-format.js +46 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/numeric-format.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/palette.d.ts +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/palette.js +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/palette.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +76 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.d.ts +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js +98 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.d.ts +67 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.js +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/styles.d.ts +24 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/styles.js +116 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/styles.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +305 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/timer.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/timer.js +33 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/timer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/visibility.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/visibility.js +52 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/visibility.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.js +115 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/git.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/bindings.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/bindings.js +104 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/bindings.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.d.ts +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.js +196 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/ownership.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/ownership.js +45 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/ownership.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/reducer.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/reducer.js +228 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/reducer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.d.ts +24 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.js +145 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.js +70 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/state.d.ts +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/state.js +110 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/state.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/agents.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/agents.js +75 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/agents.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/hooks.d.ts +10 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/hooks.js +121 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/hooks.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/model.d.ts +43 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/model.js +198 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/model.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/native.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/native.js +192 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/native.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/transitions.d.ts +16 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/transitions.js +245 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/transitions.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/view.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/view.js +28 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/view.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/transcript.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/transcript.js +183 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/transcript.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.d.ts +64 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.js +263 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/values.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/values.js +103 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/values.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/key.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/key.js +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/key.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/spans.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/spans.js +50 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/spans.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/sample.d.ts +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/sample.js +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/sample.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/timer.d.ts +22 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/timer.js +75 -0
- package/node_modules/@fbincon/statusline-core/dist/src/timing/timer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/generated-unicode.d.ts +12 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/generated-unicode.js +93 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/generated-unicode.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/index.d.ts +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/index.js +178 -0
- package/node_modules/@fbincon/statusline-core/dist/src/unicode/index.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/package.json +8 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/languages.json +7 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +1367 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +1367 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +1367 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +1367 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-Hant.json +1367 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/architecture.d.ts +15 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/architecture.js +22 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/architecture.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/clocks.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/clocks.js +102 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/clocks.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/command.d.ts +16 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/command.js +18 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/command.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/commands.d.ts +12 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/commands.js +160 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/commands.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/errors.d.ts +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/errors.js +19 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/errors.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/files.d.ts +8 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js +164 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/hash.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/hash.js +5 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/hash.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/input.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/input.js +14 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/input.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/launch.d.ts +12 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/launch.js +21 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/launch.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/line-cursor.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/line-cursor.js +31 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/line-cursor.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/native.d.ts +15 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/native.js +36 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/native.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/plugin-host.d.ts +17 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/plugin-host.js +44 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/plugin-host.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/presentation.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/presentation.js +48 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/presentation.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/processes.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/processes.js +67 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/processes.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/bridge.d.ts +42 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/bridge.js +180 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/bridge.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.d.ts +11 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.js +81 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/launchers.d.ts +32 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/launchers.js +157 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/launchers.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.d.ts +18 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js +150 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/session.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.d.ts +6 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js +39 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/utf8.d.ts +5 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/utf8.js +82 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/utf8.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/package.json +8 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.d.ts +16 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +213 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/layout.d.ts +30 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/layout.js +34 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/layout.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +28 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +126 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +52 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +352 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/package.json +16 -0
- package/node_modules/@koromix/koffi-darwin-arm64/README.md +6 -0
- package/node_modules/@koromix/koffi-darwin-arm64/darwin_arm64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-darwin-arm64/index.js +1 -0
- package/node_modules/@koromix/koffi-darwin-arm64/package.json +24 -0
- package/node_modules/@koromix/koffi-darwin-x64/README.md +6 -0
- package/node_modules/@koromix/koffi-darwin-x64/darwin_x64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-darwin-x64/index.js +1 -0
- package/node_modules/@koromix/koffi-darwin-x64/package.json +24 -0
- package/node_modules/@koromix/koffi-linux-x64/README.md +6 -0
- package/node_modules/@koromix/koffi-linux-x64/index.js +198 -0
- package/node_modules/@koromix/koffi-linux-x64/linux_x64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-linux-x64/musl_x64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-linux-x64/package.json +24 -0
- package/node_modules/@koromix/koffi-win32-x64/README.md +6 -0
- package/node_modules/@koromix/koffi-win32-x64/index.js +1 -0
- package/node_modules/@koromix/koffi-win32-x64/package.json +24 -0
- package/node_modules/@koromix/koffi-win32-x64/win32_x64/koffi.lib +0 -0
- package/node_modules/@koromix/koffi-win32-x64/win32_x64/koffi.node +0 -0
- package/node_modules/koffi/LICENSE.txt +22 -0
- package/node_modules/koffi/README.md +46 -0
- package/node_modules/koffi/index.cjs +1 -0
- package/node_modules/koffi/index.d.ts +390 -0
- package/node_modules/koffi/index.js +2 -0
- package/node_modules/koffi/indirect.cjs +1 -0
- package/node_modules/koffi/indirect.js +2 -0
- package/node_modules/koffi/package.json +73 -0
- package/node_modules/koffi/src/koffi/index.cjs +327 -0
- package/node_modules/koffi/src/koffi/index.js +312 -0
- package/node_modules/koffi/src/koffi/indirect.cjs +326 -0
- package/node_modules/koffi/src/koffi/indirect.js +311 -0
- package/node_modules/koffi/src/koffi/src/static.cjs +170 -0
- package/node_modules/koffi/src/koffi/src/static.js +173 -0
- package/node_modules/lossless-json/LICENSE.md +9 -0
- package/node_modules/lossless-json/README.md +549 -0
- package/node_modules/lossless-json/lib/esm/LosslessNumber.js +92 -0
- package/node_modules/lossless-json/lib/esm/LosslessNumber.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/config.js +9 -0
- package/node_modules/lossless-json/lib/esm/config.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/index.js +9 -0
- package/node_modules/lossless-json/lib/esm/index.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/numberParsers.js +9 -0
- package/node_modules/lossless-json/lib/esm/numberParsers.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/package.json +3 -0
- package/node_modules/lossless-json/lib/esm/parse.js +346 -0
- package/node_modules/lossless-json/lib/esm/parse.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/revive.js +57 -0
- package/node_modules/lossless-json/lib/esm/revive.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/reviveDate.js +10 -0
- package/node_modules/lossless-json/lib/esm/reviveDate.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/stringify.js +166 -0
- package/node_modules/lossless-json/lib/esm/stringify.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/types.js +2 -0
- package/node_modules/lossless-json/lib/esm/types.js.map +1 -0
- package/node_modules/lossless-json/lib/esm/utils.js +236 -0
- package/node_modules/lossless-json/lib/esm/utils.js.map +1 -0
- package/node_modules/lossless-json/lib/types/LosslessNumber.d.ts +40 -0
- package/node_modules/lossless-json/lib/types/LosslessNumber.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/config.d.ts +13 -0
- package/node_modules/lossless-json/lib/types/config.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/index.d.ts +9 -0
- package/node_modules/lossless-json/lib/types/index.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/numberParsers.d.ts +4 -0
- package/node_modules/lossless-json/lib/types/numberParsers.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/parse.d.ts +33 -0
- package/node_modules/lossless-json/lib/types/parse.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/revive.d.ts +13 -0
- package/node_modules/lossless-json/lib/types/revive.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/reviveDate.d.ts +5 -0
- package/node_modules/lossless-json/lib/types/reviveDate.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/stringify.d.ts +37 -0
- package/node_modules/lossless-json/lib/types/stringify.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/types.d.ts +61 -0
- package/node_modules/lossless-json/lib/types/types.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/types/utils.d.ts +79 -0
- package/node_modules/lossless-json/lib/types/utils.d.ts.map +1 -0
- package/node_modules/lossless-json/lib/umd/lossless-json.js +1 -0
- package/node_modules/lossless-json/lib/umd/lossless-json.js.map +1 -0
- package/node_modules/lossless-json/lib/umd/package.json +3 -0
- package/node_modules/lossless-json/package.json +89 -0
- package/package.json +57 -4
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { isNumber } from './utils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The LosslessJSON.stringify() method converts a JavaScript value to a JSON string,
|
|
5
|
+
* optionally replacing values if a replacer function is specified, or
|
|
6
|
+
* optionally including only the specified properties if a replacer array is specified.
|
|
7
|
+
*
|
|
8
|
+
* @param value
|
|
9
|
+
* The value to convert to a JSON string.
|
|
10
|
+
*
|
|
11
|
+
* @param [replacer]
|
|
12
|
+
* A function that alters the behavior of the stringification process,
|
|
13
|
+
* or an array of String and Number objects that serve as a whitelist for
|
|
14
|
+
* selecting the properties of the value object to be included in the JSON string.
|
|
15
|
+
* If this value is null or not provided, all properties of the object are
|
|
16
|
+
* included in the resulting JSON string.
|
|
17
|
+
*
|
|
18
|
+
* @param [space]
|
|
19
|
+
* A String or Number object that's used to insert white space into the output
|
|
20
|
+
* JSON string for readability purposes. If this is a Number, it indicates the
|
|
21
|
+
* number of space characters to use as white space; this number is capped at 10
|
|
22
|
+
* if it's larger than that. Values less than 1 indicate that no space should be
|
|
23
|
+
* used. If this is a String, the string (or the first 10 characters of the string,
|
|
24
|
+
* if it's longer than that) is used as white space. If this parameter is not
|
|
25
|
+
* provided (or is null), no white space is used.
|
|
26
|
+
*
|
|
27
|
+
* @param [numberStringifiers]
|
|
28
|
+
* An optional list with additional number stringifiers, for example to serialize
|
|
29
|
+
* a BigNumber. The output of the function must be valid stringified JSON.
|
|
30
|
+
* When `undefined` is returned, the property will be deleted from the object.
|
|
31
|
+
* The difference with using a `replacer` is that the output of a `replacer`
|
|
32
|
+
* must be JSON and will be stringified afterwards, whereas the output of the
|
|
33
|
+
* `numberStringifiers` is already stringified JSON.
|
|
34
|
+
*
|
|
35
|
+
* @returns Returns the string representation of the JSON object.
|
|
36
|
+
*/
|
|
37
|
+
export function stringify(value, replacer, space, numberStringifiers) {
|
|
38
|
+
const resolvedSpace = resolveSpace(space);
|
|
39
|
+
const replacedValue = typeof replacer === 'function' ? replacer.call({
|
|
40
|
+
'': value
|
|
41
|
+
}, '', value) : value;
|
|
42
|
+
return stringifyValue(replacedValue, '');
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Stringify a value
|
|
46
|
+
*/
|
|
47
|
+
function stringifyValue(value, indent) {
|
|
48
|
+
if (Array.isArray(numberStringifiers)) {
|
|
49
|
+
const stringifier = numberStringifiers.find(item => item.test(value));
|
|
50
|
+
if (stringifier) {
|
|
51
|
+
const str = stringifier.stringify(value);
|
|
52
|
+
if (typeof str !== 'string' || !isNumber(str)) {
|
|
53
|
+
throw new Error(`Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${str})`);
|
|
54
|
+
}
|
|
55
|
+
return str;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// boolean, null, number, string, or date
|
|
60
|
+
if (typeof value === 'boolean' || typeof value === 'number' || typeof value === 'string' || value === null || value instanceof Date || value instanceof Boolean || value instanceof Number || value instanceof String) {
|
|
61
|
+
return JSON.stringify(value);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// lossless number, the secret ingredient :)
|
|
65
|
+
// @ts-expect-error
|
|
66
|
+
if (value?.isLosslessNumber) {
|
|
67
|
+
return value.toString();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// BigInt
|
|
71
|
+
if (typeof value === 'bigint') {
|
|
72
|
+
return value.toString();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Array
|
|
76
|
+
if (Array.isArray(value)) {
|
|
77
|
+
return stringifyArray(value, indent);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Object (test lastly!)
|
|
81
|
+
if (value && typeof value === 'object') {
|
|
82
|
+
return stringifyObject(value, indent);
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Stringify an array
|
|
89
|
+
*/
|
|
90
|
+
function stringifyArray(array, indent) {
|
|
91
|
+
if (array.length === 0) {
|
|
92
|
+
return '[]';
|
|
93
|
+
}
|
|
94
|
+
const childIndent = resolvedSpace ? indent + resolvedSpace : undefined;
|
|
95
|
+
let str = resolvedSpace ? '[\n' : '[';
|
|
96
|
+
for (let i = 0; i < array.length; i++) {
|
|
97
|
+
const item = typeof replacer === 'function' ? replacer.call(array, String(i), array[i]) : array[i];
|
|
98
|
+
if (resolvedSpace) {
|
|
99
|
+
str += childIndent;
|
|
100
|
+
}
|
|
101
|
+
if (typeof item !== 'undefined' && typeof item !== 'function') {
|
|
102
|
+
str += stringifyValue(item, childIndent);
|
|
103
|
+
} else {
|
|
104
|
+
str += 'null';
|
|
105
|
+
}
|
|
106
|
+
if (i < array.length - 1) {
|
|
107
|
+
str += resolvedSpace ? ',\n' : ',';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
str += resolvedSpace ? `\n${indent}]` : ']';
|
|
111
|
+
return str;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Stringify an object
|
|
116
|
+
*/
|
|
117
|
+
function stringifyObject(object, indent) {
|
|
118
|
+
if (typeof object.toJSON === 'function') {
|
|
119
|
+
return stringify(object.toJSON(), replacer, space, undefined);
|
|
120
|
+
}
|
|
121
|
+
const keys = Array.isArray(replacer) ? replacer.map(String) : Object.keys(object);
|
|
122
|
+
if (keys.length === 0) {
|
|
123
|
+
return '{}';
|
|
124
|
+
}
|
|
125
|
+
const childIndent = resolvedSpace ? indent + resolvedSpace : undefined;
|
|
126
|
+
let first = true;
|
|
127
|
+
let str = resolvedSpace ? '{\n' : '{';
|
|
128
|
+
for (const key of keys) {
|
|
129
|
+
const value = typeof replacer === 'function' ? replacer.call(object, key, object[key]) : object[key];
|
|
130
|
+
if (includeProperty(key, value)) {
|
|
131
|
+
if (first) {
|
|
132
|
+
first = false;
|
|
133
|
+
} else {
|
|
134
|
+
str += resolvedSpace ? ',\n' : ',';
|
|
135
|
+
}
|
|
136
|
+
const keyStr = JSON.stringify(key);
|
|
137
|
+
str += resolvedSpace ? `${childIndent + keyStr}: ` : `${keyStr}:`;
|
|
138
|
+
str += stringifyValue(value, childIndent);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
str += resolvedSpace ? `\n${indent}}` : '}';
|
|
142
|
+
return str;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Test whether to include a property in a stringified object or not.
|
|
147
|
+
*/
|
|
148
|
+
function includeProperty(_key, value) {
|
|
149
|
+
return typeof value !== 'undefined' && typeof value !== 'function' && typeof value !== 'symbol';
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Resolve a JSON stringify space:
|
|
155
|
+
* replace a number with a string containing that number of spaces
|
|
156
|
+
*/
|
|
157
|
+
function resolveSpace(space) {
|
|
158
|
+
if (typeof space === 'number') {
|
|
159
|
+
return ' '.repeat(space);
|
|
160
|
+
}
|
|
161
|
+
if (typeof space === 'string' && space !== '') {
|
|
162
|
+
return space;
|
|
163
|
+
}
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=stringify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify.js","names":["isNumber","stringify","value","replacer","space","numberStringifiers","resolvedSpace","resolveSpace","replacedValue","call","stringifyValue","indent","Array","isArray","stringifier","find","item","test","str","Error","Date","Boolean","Number","String","JSON","isLosslessNumber","toString","stringifyArray","stringifyObject","undefined","array","length","childIndent","i","object","toJSON","keys","map","Object","first","key","includeProperty","keyStr","_key","repeat"],"sources":["../../src/stringify.ts"],"sourcesContent":["import type { GenericObject, NumberStringifier, Replacer } from './types'\nimport { isNumber } from './utils.js'\n\n/**\n * The LosslessJSON.stringify() method converts a JavaScript value to a JSON string,\n * optionally replacing values if a replacer function is specified, or\n * optionally including only the specified properties if a replacer array is specified.\n *\n * @param value\n * The value to convert to a JSON string.\n *\n * @param [replacer]\n * A function that alters the behavior of the stringification process,\n * or an array of String and Number objects that serve as a whitelist for\n * selecting the properties of the value object to be included in the JSON string.\n * If this value is null or not provided, all properties of the object are\n * included in the resulting JSON string.\n *\n * @param [space]\n * A String or Number object that's used to insert white space into the output\n * JSON string for readability purposes. If this is a Number, it indicates the\n * number of space characters to use as white space; this number is capped at 10\n * if it's larger than that. Values less than 1 indicate that no space should be\n * used. If this is a String, the string (or the first 10 characters of the string,\n * if it's longer than that) is used as white space. If this parameter is not\n * provided (or is null), no white space is used.\n *\n * @param [numberStringifiers]\n * An optional list with additional number stringifiers, for example to serialize\n * a BigNumber. The output of the function must be valid stringified JSON.\n * When `undefined` is returned, the property will be deleted from the object.\n * The difference with using a `replacer` is that the output of a `replacer`\n * must be JSON and will be stringified afterwards, whereas the output of the\n * `numberStringifiers` is already stringified JSON.\n *\n * @returns Returns the string representation of the JSON object.\n */\nexport function stringify(\n value: unknown,\n replacer?: Replacer | null,\n space?: number | string,\n numberStringifiers?: NumberStringifier[]\n): string | undefined {\n const resolvedSpace = resolveSpace(space)\n\n const replacedValue =\n typeof replacer === 'function' ? replacer.call({ '': value }, '', value) : value\n\n return stringifyValue(replacedValue, '')\n\n /**\n * Stringify a value\n */\n function stringifyValue(value: unknown, indent: string | undefined): string | undefined {\n if (Array.isArray(numberStringifiers)) {\n const stringifier = numberStringifiers.find((item) => item.test(value))\n if (stringifier) {\n const str: unknown = stringifier.stringify(value)\n if (typeof str !== 'string' || !isNumber(str)) {\n throw new Error(\n `Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${str})`\n )\n }\n return str\n }\n }\n\n // boolean, null, number, string, or date\n if (\n typeof value === 'boolean' ||\n typeof value === 'number' ||\n typeof value === 'string' ||\n value === null ||\n value instanceof Date ||\n value instanceof Boolean ||\n value instanceof Number ||\n value instanceof String\n ) {\n return JSON.stringify(value)\n }\n\n // lossless number, the secret ingredient :)\n // @ts-expect-error\n if (value?.isLosslessNumber) {\n return value.toString()\n }\n\n // BigInt\n if (typeof value === 'bigint') {\n return value.toString()\n }\n\n // Array\n if (Array.isArray(value)) {\n return stringifyArray(value, indent)\n }\n\n // Object (test lastly!)\n if (value && typeof value === 'object') {\n return stringifyObject(value as GenericObject<unknown>, indent)\n }\n\n return undefined\n }\n\n /**\n * Stringify an array\n */\n function stringifyArray(array: Array<unknown>, indent: string | undefined): string {\n if (array.length === 0) {\n return '[]'\n }\n\n const childIndent = resolvedSpace ? indent + resolvedSpace : undefined\n let str = resolvedSpace ? '[\\n' : '['\n\n for (let i = 0; i < array.length; i++) {\n const item =\n typeof replacer === 'function' ? replacer.call(array, String(i), array[i]) : array[i]\n\n if (resolvedSpace) {\n str += childIndent\n }\n\n if (typeof item !== 'undefined' && typeof item !== 'function') {\n str += stringifyValue(item, childIndent)\n } else {\n str += 'null'\n }\n\n if (i < array.length - 1) {\n str += resolvedSpace ? ',\\n' : ','\n }\n }\n\n str += resolvedSpace ? `\\n${indent}]` : ']'\n return str\n }\n\n /**\n * Stringify an object\n */\n function stringifyObject(\n object: GenericObject<unknown>,\n indent: string | undefined\n ): string | undefined {\n if (typeof object.toJSON === 'function') {\n return stringify(object.toJSON(), replacer, space, undefined)\n }\n\n const keys: string[] = Array.isArray(replacer) ? replacer.map(String) : Object.keys(object)\n\n if (keys.length === 0) {\n return '{}'\n }\n\n const childIndent = resolvedSpace ? indent + resolvedSpace : undefined\n let first = true\n let str = resolvedSpace ? '{\\n' : '{'\n\n for (const key of keys) {\n const value =\n typeof replacer === 'function' ? replacer.call(object, key, object[key]) : object[key]\n\n if (includeProperty(key, value)) {\n if (first) {\n first = false\n } else {\n str += resolvedSpace ? ',\\n' : ','\n }\n\n const keyStr = JSON.stringify(key)\n str += resolvedSpace ? `${childIndent + keyStr}: ` : `${keyStr}:`\n\n str += stringifyValue(value, childIndent)\n }\n }\n\n str += resolvedSpace ? `\\n${indent}}` : '}'\n return str\n }\n\n /**\n * Test whether to include a property in a stringified object or not.\n */\n function includeProperty(_key: string, value: unknown): boolean {\n return typeof value !== 'undefined' && typeof value !== 'function' && typeof value !== 'symbol'\n }\n}\n\n/**\n * Resolve a JSON stringify space:\n * replace a number with a string containing that number of spaces\n */\nfunction resolveSpace(space: number | string | undefined): string | undefined {\n if (typeof space === 'number') {\n return ' '.repeat(space)\n }\n\n if (typeof space === 'string' && space !== '') {\n return space\n }\n\n return undefined\n}\n"],"mappings":"AACA,SAASA,QAAQ,QAAQ,YAAY;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CACvBC,KAAc,EACdC,QAA0B,EAC1BC,KAAuB,EACvBC,kBAAwC,EACpB;EACpB,MAAMC,aAAa,GAAGC,YAAY,CAACH,KAAK,CAAC;EAEzC,MAAMI,aAAa,GACjB,OAAOL,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACM,IAAI,CAAC;IAAE,EAAE,EAAEP;EAAM,CAAC,EAAE,EAAE,EAAEA,KAAK,CAAC,GAAGA,KAAK;EAElF,OAAOQ,cAAc,CAACF,aAAa,EAAE,EAAE,CAAC;;EAExC;AACF;AACA;EACE,SAASE,cAAcA,CAACR,KAAc,EAAES,MAA0B,EAAsB;IACtF,IAAIC,KAAK,CAACC,OAAO,CAACR,kBAAkB,CAAC,EAAE;MACrC,MAAMS,WAAW,GAAGT,kBAAkB,CAACU,IAAI,CAAEC,IAAI,IAA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ACA;AACA,SAASK,YAAYA,CAACH,KAAkC,EAAsB;EAC5E,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO,GAAG,CAACwC,MAAM,CAACxC,KAAK,CAAC;EAC1B;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,EAAE,EAAE;IAC7C,OAAOA,KAAK;EACd;EAEA,OAAOyB,SAAS;AAClB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["export type Reviver = (key: string, value: unknown) => unknown\n\nexport interface ParseOptions {\n parseNumber?: NumberParser\n onDuplicateKey?: OnDuplicateKey\n}\n\nexport type NumberParser = (value: string) => unknown\n\nexport interface DuplicateKeyInfo {\n key: string\n position: number\n oldValue: unknown\n newValue: unknown\n}\n\nexport type OnDuplicateKey = (info: DuplicateKeyInfo) => unknown | undefined\n\nexport type Replacer =\n | ((key: string, value: unknown) => unknown | undefined)\n | Array<string | number>\n\nexport interface NumberStringifier {\n test: (value: unknown) => boolean\n stringify: (value: unknown) => string\n}\n\nexport type GenericObject<T> = Record<string, T>\n\nexport interface NumberSplit {\n sign: '-' | ''\n digits: string\n exponent: number\n}\n\n/**\n * @deprecated use `unknown` or `string | number | boolean | null` instead\n */\nexport type JSONPrimitive = string | number | boolean | null\n\n/**\n * @deprecated use `unknown` instead\n */\nexport type JSONValue =\n | { [key: string]: JSONValue } // object\n | JSONValue[] // array\n | JSONPrimitive\n\n/**\n * @deprecated use `unknown` or a Record instead\n */\nexport type JSONObject = { [key: string]: JSONValue }\n\n/**\n * @deprecated use `unknown` or an Array instead\n */\nexport type JSONArray = JSONValue[]\n\n/**\n * @deprecated use `unknown` instead\n */\nexport type JavaScriptPrimitive = unknown\n\n/**\n * @deprecated use `unknown` instead\n */\nexport type JavaScriptValue = unknown\n\n/**\n * @deprecated use `unknown` instead\n */\nexport type JavaScriptObject = unknown\n\n/**\n * @deprecated use `unknown` instead\n */\nexport type JavaScriptArray = unknown\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test whether a string contains an integer number
|
|
3
|
+
*/
|
|
4
|
+
export function isInteger(value) {
|
|
5
|
+
return INTEGER_REGEX.test(value);
|
|
6
|
+
}
|
|
7
|
+
const INTEGER_REGEX = /^-?[0-9]+$/;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Test whether a string contains a number
|
|
11
|
+
* http://stackoverflow.com/questions/13340717/json-numbers-regular-expression
|
|
12
|
+
*/
|
|
13
|
+
export function isNumber(value) {
|
|
14
|
+
return NUMBER_REGEX.test(value);
|
|
15
|
+
}
|
|
16
|
+
const NUMBER_REGEX = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Test whether a string can be safely represented with a number
|
|
20
|
+
* without information loss.
|
|
21
|
+
*
|
|
22
|
+
* When approx is true, floating point numbers that lose a few digits but
|
|
23
|
+
* are still approximately equal in value are considered safe too.
|
|
24
|
+
* Integer numbers must still be exactly equal.
|
|
25
|
+
*/
|
|
26
|
+
export function isSafeNumber(value, config) {
|
|
27
|
+
if (isInteger(value)) {
|
|
28
|
+
return Number.isSafeInteger(Number.parseInt(value, 10));
|
|
29
|
+
}
|
|
30
|
+
const num = Number.parseFloat(value);
|
|
31
|
+
const parsed = String(num);
|
|
32
|
+
if (value === parsed) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
const valueDigits = extractSignificantDigits(value);
|
|
36
|
+
const parsedDigits = extractSignificantDigits(parsed);
|
|
37
|
+
if (valueDigits === parsedDigits) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if (config?.approx === true) {
|
|
41
|
+
// A value is approximately equal when:
|
|
42
|
+
// 1. it is a floating point number, not an integer
|
|
43
|
+
// 2. it has at least 14 digits
|
|
44
|
+
// 3. the first 14 digits are equal
|
|
45
|
+
const requiredDigits = 14;
|
|
46
|
+
if (!isInteger(value) && parsedDigits.length >= requiredDigits && valueDigits.startsWith(parsedDigits.substring(0, requiredDigits))) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
export let UnsafeNumberReason = /*#__PURE__*/function (UnsafeNumberReason) {
|
|
53
|
+
UnsafeNumberReason["underflow"] = "underflow";
|
|
54
|
+
UnsafeNumberReason["overflow"] = "overflow";
|
|
55
|
+
UnsafeNumberReason["truncate_integer"] = "truncate_integer";
|
|
56
|
+
UnsafeNumberReason["truncate_float"] = "truncate_float";
|
|
57
|
+
return UnsafeNumberReason;
|
|
58
|
+
}({});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* When the provided value is an unsafe number, describe what the reason is:
|
|
62
|
+
* overflow, underflow, truncate_integer, or truncate_float.
|
|
63
|
+
* Returns undefined when the value is safe.
|
|
64
|
+
*/
|
|
65
|
+
export function getUnsafeNumberReason(value) {
|
|
66
|
+
if (isSafeNumber(value, {
|
|
67
|
+
approx: false
|
|
68
|
+
})) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
if (isInteger(value)) {
|
|
72
|
+
return UnsafeNumberReason.truncate_integer;
|
|
73
|
+
}
|
|
74
|
+
const num = Number.parseFloat(value);
|
|
75
|
+
if (!Number.isFinite(num)) {
|
|
76
|
+
return UnsafeNumberReason.overflow;
|
|
77
|
+
}
|
|
78
|
+
if (num === 0) {
|
|
79
|
+
return UnsafeNumberReason.underflow;
|
|
80
|
+
}
|
|
81
|
+
return UnsafeNumberReason.truncate_float;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Convert a string into a number when it is safe to do so.
|
|
86
|
+
* Throws an error otherwise, explaining the reason.
|
|
87
|
+
*/
|
|
88
|
+
export function toSafeNumberOrThrow(value, config) {
|
|
89
|
+
const number = Number.parseFloat(value);
|
|
90
|
+
const unsafeReason = getUnsafeNumberReason(value);
|
|
91
|
+
if (config?.approx === true ? unsafeReason && unsafeReason !== UnsafeNumberReason.truncate_float : unsafeReason) {
|
|
92
|
+
const unsafeReasonText = unsafeReason?.replace(/_\w+$/, '');
|
|
93
|
+
throw new Error(`Cannot safely convert to number: the value '${value}' would ${unsafeReasonText} and become ${number}`);
|
|
94
|
+
}
|
|
95
|
+
return number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Split a number into sign, digits, and exponent.
|
|
100
|
+
* Leading zeros and non-canonical zeros are normalized.
|
|
101
|
+
*
|
|
102
|
+
* The value can be constructed again from a split number by inserting a dot
|
|
103
|
+
* at the second character of the digits if there is more than one digit,
|
|
104
|
+
* prepending it with the sign, and appending an "e" and the exponent as follows:
|
|
105
|
+
*
|
|
106
|
+
* const reconstructed = `${sign}${digits[0]}.${digits.slice(1)}e${exponent}`
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
109
|
+
export function splitNumber(value) {
|
|
110
|
+
const match = value.match(/^(-?)(\d+\.?\d*)([eE]([+-]?\d+))?$/);
|
|
111
|
+
if (!match) {
|
|
112
|
+
throw new SyntaxError(`Invalid number: ${value}`);
|
|
113
|
+
}
|
|
114
|
+
const sign = match[1];
|
|
115
|
+
const digitsStr = match[2];
|
|
116
|
+
let exponent = match[4] !== undefined ? Number.parseInt(match[4], 10) : 0;
|
|
117
|
+
const dot = digitsStr.indexOf('.');
|
|
118
|
+
exponent += dot !== -1 ? dot - 1 : digitsStr.length - 1;
|
|
119
|
+
const digits = digitsStr.replace('.', '') // remove the dot (must be removed before removing leading zeros)
|
|
120
|
+
.replace(/^0*/, zeros => {
|
|
121
|
+
// remove leading zeros, add their count to the exponent
|
|
122
|
+
exponent -= zeros.length;
|
|
123
|
+
return '';
|
|
124
|
+
}).replace(/0*$/, ''); // remove trailing zeros
|
|
125
|
+
|
|
126
|
+
// normalize zero, for example normalizes 0e5 or -0 into 0
|
|
127
|
+
return digits.length > 0 ? {
|
|
128
|
+
sign,
|
|
129
|
+
digits,
|
|
130
|
+
exponent
|
|
131
|
+
} : {
|
|
132
|
+
sign: '',
|
|
133
|
+
digits: '0',
|
|
134
|
+
exponent: 0
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Compare two strings containing a numeric value
|
|
140
|
+
* Returns 1 when a is larger than b, 0 when they are equal,
|
|
141
|
+
* and -1 when a is smaller than b.
|
|
142
|
+
*/
|
|
143
|
+
export function compareNumber(a, b) {
|
|
144
|
+
if (a === b) {
|
|
145
|
+
return 0;
|
|
146
|
+
}
|
|
147
|
+
const aa = splitNumber(a);
|
|
148
|
+
const bb = splitNumber(b);
|
|
149
|
+
const sign = aa.sign === '-' ? -1 : 1;
|
|
150
|
+
if (aa.sign !== bb.sign) {
|
|
151
|
+
return sign;
|
|
152
|
+
}
|
|
153
|
+
if (aa.exponent !== bb.exponent) {
|
|
154
|
+
return aa.exponent > bb.exponent ? sign : aa.exponent < bb.exponent ? -sign : 0;
|
|
155
|
+
}
|
|
156
|
+
return aa.digits > bb.digits ? sign : aa.digits < bb.digits ? -sign : 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Count the significant digits of a number.
|
|
161
|
+
*
|
|
162
|
+
* For example:
|
|
163
|
+
* '2.34' returns 3
|
|
164
|
+
* '-77' returns 2
|
|
165
|
+
* '0.003400' returns 2
|
|
166
|
+
* '120.5e+30' returns 4
|
|
167
|
+
**/
|
|
168
|
+
export function countSignificantDigits(value) {
|
|
169
|
+
const {
|
|
170
|
+
start,
|
|
171
|
+
end
|
|
172
|
+
} = getSignificantDigitRange(value);
|
|
173
|
+
const dot = value.indexOf('.');
|
|
174
|
+
if (dot === -1 || dot < start || dot > end) {
|
|
175
|
+
return end - start;
|
|
176
|
+
}
|
|
177
|
+
return end - start - 1;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Get the significant digits of a number.
|
|
182
|
+
*
|
|
183
|
+
* For example:
|
|
184
|
+
* '2.34' returns '234'
|
|
185
|
+
* '-77' returns '77'
|
|
186
|
+
* '0.003400' returns '34'
|
|
187
|
+
* '120.5e+30' returns '1205'
|
|
188
|
+
**/
|
|
189
|
+
export function extractSignificantDigits(value) {
|
|
190
|
+
const {
|
|
191
|
+
start,
|
|
192
|
+
end
|
|
193
|
+
} = getSignificantDigitRange(value);
|
|
194
|
+
const digits = value.substring(start, end);
|
|
195
|
+
const dot = digits.indexOf('.');
|
|
196
|
+
if (dot === -1) {
|
|
197
|
+
return digits;
|
|
198
|
+
}
|
|
199
|
+
return digits.substring(0, dot) + digits.substring(dot + 1);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Returns the range (start to end) of the significant digits of a value.
|
|
204
|
+
* Note that this range _may_ contain the decimal dot.
|
|
205
|
+
*
|
|
206
|
+
* For example:
|
|
207
|
+
*
|
|
208
|
+
* getSignificantDigitRange('0.0325900') // { start: 3, end: 7 }
|
|
209
|
+
* getSignificantDigitRange('2.0300') // { start: 0, end: 3 }
|
|
210
|
+
* getSignificantDigitRange('0.0') // { start: 3, end: 3 }
|
|
211
|
+
*
|
|
212
|
+
*/
|
|
213
|
+
function getSignificantDigitRange(value) {
|
|
214
|
+
let start = 0;
|
|
215
|
+
if (value[0] === '-') {
|
|
216
|
+
start++;
|
|
217
|
+
}
|
|
218
|
+
while (value[start] === '0' || value[start] === '.') {
|
|
219
|
+
start++;
|
|
220
|
+
}
|
|
221
|
+
let end = value.lastIndexOf('e');
|
|
222
|
+
if (end === -1) {
|
|
223
|
+
end = value.lastIndexOf('E');
|
|
224
|
+
}
|
|
225
|
+
if (end === -1) {
|
|
226
|
+
end = value.length;
|
|
227
|
+
}
|
|
228
|
+
while ((value[end - 1] === '0' || value[end - 1] === '.') && end > start) {
|
|
229
|
+
end--;
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
start,
|
|
233
|
+
end
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["isInteger","value","INTEGER_REGEX","test","isNumber","NUMBER_REGEX","isSafeNumber","config","Number","isSafeInteger","parseInt","num","parseFloat","parsed","String","valueDigits","extractSignificantDigits","parsedDigits","approx","requiredDigits","length","startsWith","substring","UnsafeNumberReason","getUnsafeNumberReason","undefined","truncate_integer","isFinite","overflow","underflow","truncate_float","toSafeNumberOrThrow","number","unsafeReason","unsafeReasonText","replace","Error","splitNumber","match","SyntaxError","sign","digitsStr","exponent","dot","indexOf","digits","zeros","compareNumber","a","b","aa","bb","countSignificantDigits","start","end","getSignificantDigitRange","lastIndexOf"],"sources":["../../src/utils.ts"],"sourcesContent":["import type { NumberSplit } from './types'\n\n/**\n * Test whether a string contains an integer number\n */\nexport function isInteger(value: string): boolean {\n return INTEGER_REGEX.test(value)\n}\n\nconst INTEGER_REGEX = /^-?[0-9]+$/\n\n/**\n * Test whether a string contains a number\n * http://stackoverflow.com/questions/13340717/json-numbers-regular-expression\n */\nexport function isNumber(value: string): boolean {\n return NUMBER_REGEX.test(value)\n}\n\nconst NUMBER_REGEX = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$/\n\n/**\n * Test whether a string can be safely represented with a number\n * without information loss.\n *\n * When approx is true, floating point numbers that lose a few digits but\n * are still approximately equal in value are considered safe too.\n * Integer numbers must still be exactly equal.\n */\nexport function isSafeNumber(\n value: string,\n config?: {\n approx: boolean\n }\n): boolean {\n if (isInteger(value)) {\n return Number.isSafeInteger(Number.parseInt(value, 10))\n }\n\n const num = Number.parseFloat(value)\n const parsed = String(num)\n\n if (value === parsed) {\n return true\n }\n\n const valueDigits = extractSignificantDigits(value)\n const parsedDigits = extractSignificantDigits(parsed)\n\n if (valueDigits === parsedDigits) {\n return true\n }\n\n if (config?.approx === true) {\n // A value is approximately equal when:\n // 1. it is a floating point number, not an integer\n // 2. it has at least 14 digits\n // 3. the first 14 digits are equal\n const requiredDigits = 14\n if (\n !isInteger(value) &&\n parsedDigits.length >= requiredDigits &&\n valueDigits.startsWith(parsedDigits.substring(0, requiredDigits))\n ) {\n return true\n }\n }\n\n return false\n}\n\nexport enum UnsafeNumberReason {\n underflow = 'underflow',\n overflow = 'overflow',\n truncate_integer = 'truncate_integer',\n truncate_float = 'truncate_float'\n}\n\n/**\n * When the provided value is an unsafe number, describe what the reason is:\n * overflow, underflow, truncate_integer, or truncate_float.\n * Returns undefined when the value is safe.\n */\nexport function getUnsafeNumberReason(value: string): UnsafeNumberReason | undefined {\n if (isSafeNumber(value, { approx: false })) {\n return undefined\n }\n\n if (isInteger(value)) {\n return UnsafeNumberReason.truncate_integer\n }\n\n const num = Number.parseFloat(value)\n if (!Number.isFinite(num)) {\n return UnsafeNumberReason.overflow\n }\n\n if (num === 0) {\n return UnsafeNumberReason.underflow\n }\n\n return UnsafeNumberReason.truncate_float\n}\n\n/**\n * Convert a string into a number when it is safe to do so.\n * Throws an error otherwise, explaining the reason.\n */\nexport function toSafeNumberOrThrow(\n value: string,\n config?: {\n approx: boolean\n }\n): number {\n const number = Number.parseFloat(value)\n\n const unsafeReason = getUnsafeNumberReason(value)\n if (\n config?.approx === true\n ? unsafeReason && unsafeReason !== UnsafeNumberReason.truncate_float\n : unsafeReason\n ) {\n const unsafeReasonText = unsafeReason?.replace(/_\\w+$/, '')\n throw new Error(\n `Cannot safely convert to number: the value '${value}' would ${unsafeReasonText} and become ${number}`\n )\n }\n\n return number\n}\n\n/**\n * Split a number into sign, digits, and exponent.\n * Leading zeros and non-canonical zeros are normalized.\n *\n * The value can be constructed again from a split number by inserting a dot\n * at the second character of the digits if there is more than one digit,\n * prepending it with the sign, and appending an \"e\" and the exponent as follows:\n *\n * const reconstructed = `${sign}${digits[0]}.${digits.slice(1)}e${exponent}`\n *\n */\nexport function splitNumber(value: string): NumberSplit {\n const match = value.match(/^(-?)(\\d+\\.?\\d*)([eE]([+-]?\\d+))?$/)\n if (!match) {\n throw new SyntaxError(`Invalid number: ${value}`)\n }\n\n const sign = match[1] as '-' | ''\n const digitsStr = match[2]\n let exponent = match[4] !== undefined ? Number.parseInt(match[4], 10) : 0\n\n const dot = digitsStr.indexOf('.')\n exponent += dot !== -1 ? dot - 1 : digitsStr.length - 1\n\n const digits = digitsStr\n .replace('.', '') // remove the dot (must be removed before removing leading zeros)\n .replace(/^0*/, (zeros: string) => {\n // remove leading zeros, add their count to the exponent\n exponent -= zeros.length\n return ''\n })\n .replace(/0*$/, '') // remove trailing zeros\n\n // normalize zero, for example normalizes 0e5 or -0 into 0\n return digits.length > 0 ? { sign, digits, exponent } : { sign: '', digits: '0', exponent: 0 }\n}\n\n/**\n * Compare two strings containing a numeric value\n * Returns 1 when a is larger than b, 0 when they are equal,\n * and -1 when a is smaller than b.\n */\nexport function compareNumber(a: string, b: string): 1 | 0 | -1 {\n if (a === b) {\n return 0\n }\n\n const aa = splitNumber(a)\n const bb = splitNumber(b)\n\n type Sign = -1 | 1\n\n const sign: Sign = aa.sign === '-' ? -1 : 1\n\n if (aa.sign !== bb.sign) {\n return sign\n }\n\n if (aa.exponent !== bb.exponent) {\n return aa.exponent > bb.exponent ? sign : aa.exponent < bb.exponent ? (-sign as Sign) : 0\n }\n\n return aa.digits > bb.digits ? sign : aa.digits < bb.digits ? (-sign as Sign) : 0\n}\n\n/**\n * Count the significant digits of a number.\n *\n * For example:\n * '2.34' returns 3\n * '-77' returns 2\n * '0.003400' returns 2\n * '120.5e+30' returns 4\n **/\nexport function countSignificantDigits(value: string): number {\n const { start, end } = getSignificantDigitRange(value)\n\n const dot = value.indexOf('.')\n if (dot === -1 || dot < start || dot > end) {\n return end - start\n }\n\n return end - start - 1\n}\n\n/**\n * Get the significant digits of a number.\n *\n * For example:\n * '2.34' returns '234'\n * '-77' returns '77'\n * '0.003400' returns '34'\n * '120.5e+30' returns '1205'\n **/\nexport function extractSignificantDigits(value: string): string {\n const { start, end } = getSignificantDigitRange(value)\n\n const digits = value.substring(start, end)\n\n const dot = digits.indexOf('.')\n if (dot === -1) {\n return digits\n }\n\n return digits.substring(0, dot) + digits.substring(dot + 1)\n}\n\n/**\n * Returns the range (start to end) of the significant digits of a value.\n * Note that this range _may_ contain the decimal dot.\n *\n * For example:\n *\n * getSignificantDigitRange('0.0325900') // { start: 3, end: 7 }\n * getSignificantDigitRange('2.0300') // { start: 0, end: 3 }\n * getSignificantDigitRange('0.0') // { start: 3, end: 3 }\n *\n */\nfunction getSignificantDigitRange(value: string): { start: number; end: number } {\n let start = 0\n if (value[0] === '-') {\n start++\n }\n while (value[start] === '0' || value[start] === '.') {\n start++\n }\n\n let end = value.lastIndexOf('e')\n if (end === -1) {\n end = value.lastIndexOf('E')\n }\n if (end === -1) {\n end = value.length\n }\n while ((value[end - 1] === '0' || value[end - 1] === '.') && end > start) {\n end--\n }\n\n return { start, end }\n}\n"],"mappings":"AAEA;AACA;AACA;AACA,OAAO,SAASA,SAASA,CAACC,KAAa,EAAW;EAChD,OAAOC,aAAa,CAACC,IAAI,CAACF,KAAK,CAAC;AAClC;AAEA,MAAMC,aAAa,GAAG,YAAY;;AAElC;AACA;AACA;AACA;AACA,OAAO,SAASE,QAAQA,CAACH,KAAa,EAAW;EAC/C,OAAOI,YAAY,CAACF,IAAI,CAACF,KAAK,CAAC;AACjC;AAEA,MAAMI,YAAY,GAAG,+CAA+C;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAC1BL,KAAa,EACbM,MAEC,EACQ;EACT,IAAIP,SAAS,CAACC,KAAK,CAAC,EAAE;IACpB,OAAOO,MAAM,CAACC,aAAa,CAACD,MAAM,CAACE,QAAQ,CAACT,KAAK,EAAE,EAAE,CAAC,CAAC;EACzD;EAEA,MAAMU,GAAG,GAA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,KAAK,GAAG,EAAE;IACpBoD,KAAK,EAAE;EACT;EACA,OAAOpD,KAAK,CAACoD,KAAK,CAAC,KAAK,GAAG,IAAIpD,KAAK,CAACoD,KAAK,CAAC,KAAK,GAAG,EAAE;IACnDA,KAAK,EAAE;EACT;EAEA,IAAIC,GAAG,GAAGrD,KAAK,CAACuD,WAAW,CAAC,GAAG,CAAC;EAChC,IAAIF,GAAG,KAAK,CAAC,CAAC,EAAE;IACdA,GAAG,GAAGrD,KAAK,CAACuD,WAAW,CAAC,GAAG,CAAC;EAC9B;EACA,IAAIF,GAAG,KAAK,CAAC,CAAC,EAAE;IACdA,GAAG,GAAGrD,KAAK,CAACmB,MAAM;EACpB;EACA,OAAO,CAACnB,KAAK,CAACqD,GAAG,GAAG,CAAC,CAAC,KAAK,GAAG,IAAIrD,KAAK,CAACqD,GAAG,GAAG,CAAC,CAAC,KAAK,GAAG,KAAKA,GAAG,GAAGD,KAAK,EAAE;IACxEC,GAAG,EAAE;EACP;EAEA,OAAO;IAAED,KAAK;IAAEC;EAAI,CAAC;AACvB","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A lossless number. Stores its numeric value as string
|
|
3
|
+
*/
|
|
4
|
+
export declare class LosslessNumber {
|
|
5
|
+
value: string;
|
|
6
|
+
isLosslessNumber: boolean;
|
|
7
|
+
constructor(value: string);
|
|
8
|
+
/**
|
|
9
|
+
* Get the value of the LosslessNumber as number or bigint.
|
|
10
|
+
*
|
|
11
|
+
* - a number is returned for safe numbers and decimal values that only lose some insignificant digits
|
|
12
|
+
* - a bigint is returned for big integer numbers
|
|
13
|
+
* - an Error is thrown for values that will overflow or underflow
|
|
14
|
+
*
|
|
15
|
+
* Note that you can implement your own strategy for conversion by just getting the value as string
|
|
16
|
+
* via .toString(), and using util functions like isInteger, isSafeNumber, getUnsafeNumberReason,
|
|
17
|
+
* and toSafeNumberOrThrow to convert it to a numeric value.
|
|
18
|
+
*/
|
|
19
|
+
valueOf(): number | bigint;
|
|
20
|
+
/**
|
|
21
|
+
* Get the value of the LosslessNumber as string.
|
|
22
|
+
*/
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Test whether a value is a LosslessNumber
|
|
27
|
+
*/
|
|
28
|
+
export declare function isLosslessNumber(value: unknown): value is LosslessNumber;
|
|
29
|
+
/**
|
|
30
|
+
* Convert a number into a LosslessNumber if this is possible in a safe way
|
|
31
|
+
* If the value has too many digits, or is NaN or Infinity, an error will be thrown
|
|
32
|
+
*/
|
|
33
|
+
export declare function toLosslessNumber(value: number): LosslessNumber;
|
|
34
|
+
/**
|
|
35
|
+
* Compare two lossless numbers.
|
|
36
|
+
* Returns 1 when a is larger than b, 0 when they are equal,
|
|
37
|
+
* and -1 when a is smaller than b.
|
|
38
|
+
*/
|
|
39
|
+
export declare function compareLosslessNumber(a: LosslessNumber, b: LosslessNumber): 1 | 0 | -1;
|
|
40
|
+
//# sourceMappingURL=LosslessNumber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LosslessNumber.d.ts","sourceRoot":"","sources":["../../src/LosslessNumber.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,qBAAa,cAAc;IAEzB,KAAK,EAAE,MAAM,CAAA;IAGb,gBAAgB,UAAO;gBAEX,KAAK,EAAE,MAAM;IAQzB;;;;;;;;;;OAUG;IACH,OAAO,IAAI,MAAM,GAAG,MAAM;IAmB1B;;OAEG;IACH,QAAQ,IAAI,MAAM;CAOnB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAGxE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAiB9D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAEtF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ConfigOptional {
|
|
2
|
+
circularRefs?: boolean;
|
|
3
|
+
}
|
|
4
|
+
interface Config extends ConfigOptional {
|
|
5
|
+
circularRefs: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get and/or set configuration options
|
|
9
|
+
* @deprecated There is no config anymore
|
|
10
|
+
*/
|
|
11
|
+
export declare function config(_options?: ConfigOptional): Config;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,UAAU,cAAc;IACtB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,UAAU,MAAO,SAAQ,cAAc;IACrC,YAAY,EAAE,OAAO,CAAA;CACtB;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAQxD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { config } from './config.js';
|
|
2
|
+
export { compareLosslessNumber, isLosslessNumber, LosslessNumber, toLosslessNumber } from './LosslessNumber.js';
|
|
3
|
+
export { parseLosslessNumber, parseNumberAndBigInt } from './numberParsers.js';
|
|
4
|
+
export { parse } from './parse.js';
|
|
5
|
+
export { reviveDate } from './reviveDate.js';
|
|
6
|
+
export { stringify } from './stringify.js';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export { compareNumber, getUnsafeNumberReason, isInteger, isNumber, isSafeNumber, splitNumber, toSafeNumberOrThrow, UnsafeNumberReason } from './utils.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,cAAc,YAAY,CAAA;AAC1B,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numberParsers.d.ts","sourceRoot":"","sources":["../../src/numberParsers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAEjE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEnE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { NumberParser, ParseOptions, Reviver } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The LosslessJSON.parse() method parses a string as JSON, optionally transforming
|
|
4
|
+
* the value produced by parsing.
|
|
5
|
+
*
|
|
6
|
+
* The parser is based on the parser of Tan Li Hou shared in
|
|
7
|
+
* https://lihautan.com/json-parser-with-javascript/
|
|
8
|
+
*
|
|
9
|
+
* @param text
|
|
10
|
+
* The string to parse as JSON. See the JSON object for a description of JSON syntax.
|
|
11
|
+
*
|
|
12
|
+
* @param [reviver]
|
|
13
|
+
* If a function, prescribes how the value originally produced by parsing is
|
|
14
|
+
* transformed, before being returned.
|
|
15
|
+
*
|
|
16
|
+
* @param [options=ParseOptions | NumberParserArgument]
|
|
17
|
+
* Pass a custom number parser. Input is a string, and the output can be unknown
|
|
18
|
+
* numeric value: number, bigint, LosslessNumber, or a custom BigNumber library.
|
|
19
|
+
*
|
|
20
|
+
* @returns Returns the Object corresponding to the given JSON text.
|
|
21
|
+
*
|
|
22
|
+
* @throws Throws a SyntaxError exception if the string to parse is not valid JSON.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parse(text: string, reviver?: Reviver | null, options?: ParseOptions | NumberParser): unknown;
|
|
25
|
+
export declare function isValidStringCharacter(code: number): boolean;
|
|
26
|
+
export declare function isDeepEqual(a: unknown, b: unknown): boolean;
|
|
27
|
+
export declare const codeUppercaseA = 65;
|
|
28
|
+
export declare const codeLowercaseA = 97;
|
|
29
|
+
export declare const codeUppercaseE = 69;
|
|
30
|
+
export declare const codeLowercaseE = 101;
|
|
31
|
+
export declare const codeUppercaseF = 70;
|
|
32
|
+
export declare const codeLowercaseF = 102;
|
|
33
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/parse.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmC,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEnG;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,EACxB,OAAO,CAAC,EAAE,YAAY,GAAG,YAAY,GACpC,OAAO,CA+ST;AAsBD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAe3D;AAqCD,eAAO,MAAM,cAAc,KAAO,CAAA;AAClC,eAAO,MAAM,cAAc,KAAO,CAAA;AAClC,eAAO,MAAM,cAAc,KAAO,CAAA;AAClC,eAAO,MAAM,cAAc,MAAO,CAAA;AAClC,eAAO,MAAM,cAAc,KAAO,CAAA;AAClC,eAAO,MAAM,cAAc,MAAO,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Reviver } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Revive a json object.
|
|
4
|
+
* Applies the reviver function recursively on all values in the JSON object.
|
|
5
|
+
* @param json A JSON Object, Array, or value
|
|
6
|
+
* @param reviver
|
|
7
|
+
* A reviver function invoked with arguments `key` and `value`,
|
|
8
|
+
* which must return a replacement value. The function context
|
|
9
|
+
* (`this`) is the Object or Array that contains the currently
|
|
10
|
+
* handled value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function revive(json: unknown, reviver: Reviver): unknown;
|
|
13
|
+
//# sourceMappingURL=revive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revive.d.ts","sourceRoot":"","sources":["../../src/revive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,SAAS,CAAA;AAErD;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAE/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviveDate.d.ts","sourceRoot":"","sources":["../../src/reviveDate.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAEvE"}
|