@inlang/paraglide-js 1.11.2 → 2.0.0-prerelease.0
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/README.md +5 -5
- package/bin/run.js +2 -2
- package/default/index.d.ts +1 -1
- package/default/index.js +1 -1
- package/default/why.txt +1 -2
- package/dist/adapter-utils/index.d.ts +6 -5
- package/dist/adapter-utils/index.d.ts.map +1 -0
- package/dist/adapter-utils/index.js +5 -422
- package/dist/adapter-utils/negotiation/language.d.ts +1 -0
- package/dist/adapter-utils/negotiation/language.d.ts.map +1 -0
- package/dist/adapter-utils/negotiation/language.js +137 -0
- package/dist/adapter-utils/negotiation/language.test.d.ts +1 -0
- package/dist/adapter-utils/negotiation/language.test.d.ts.map +1 -0
- package/dist/adapter-utils/negotiation/language.test.js +24 -0
- package/dist/adapter-utils/routing/detectLanguage.d.ts +1 -0
- package/dist/adapter-utils/routing/detectLanguage.d.ts.map +1 -0
- package/dist/adapter-utils/routing/detectLanguage.js +32 -0
- package/dist/adapter-utils/routing/detectLanguage.test.d.ts +1 -0
- package/dist/adapter-utils/routing/detectLanguage.test.d.ts.map +1 -0
- package/dist/adapter-utils/routing/detectLanguage.test.js +37 -0
- package/dist/adapter-utils/routing/resolveUserPathDefinition.test.d.ts +1 -0
- package/dist/adapter-utils/routing/resolveUserPathDefinition.test.d.ts.map +1 -0
- package/dist/adapter-utils/routing/resolveUserPathDefinition.test.js +35 -0
- package/dist/adapter-utils/routing/resolveUserPathDefinitions.d.ts +3 -3
- package/dist/adapter-utils/routing/resolveUserPathDefinitions.d.ts.map +1 -0
- package/dist/adapter-utils/routing/resolveUserPathDefinitions.js +22 -0
- package/dist/adapter-utils/routing/routeDefinitions.d.ts +1 -0
- package/dist/adapter-utils/routing/routeDefinitions.d.ts.map +1 -0
- package/dist/adapter-utils/routing/routeDefinitions.js +224 -0
- package/dist/adapter-utils/routing/routeDefinitions.test.d.ts +1 -0
- package/dist/adapter-utils/routing/routeDefinitions.test.d.ts.map +1 -0
- package/dist/adapter-utils/routing/routeDefinitions.test.js +234 -0
- package/dist/adapter-utils/routing/sortRoutes.d.ts +1 -0
- package/dist/adapter-utils/routing/sortRoutes.d.ts.map +1 -0
- package/dist/adapter-utils/routing/sortRoutes.js +135 -0
- package/dist/adapter-utils/routing/validatePathTranslations.d.ts +2 -2
- package/dist/adapter-utils/routing/validatePathTranslations.d.ts.map +1 -0
- package/dist/adapter-utils/routing/validatePathTranslations.js +98 -0
- package/dist/adapter-utils/routing/validatePathTranslations.test.d.ts +1 -0
- package/dist/adapter-utils/routing/validatePathTranslations.test.d.ts.map +1 -0
- package/dist/adapter-utils/routing/validatePathTranslations.test.js +121 -0
- package/dist/cli/commands/compile/command.d.ts +2 -2
- package/dist/cli/commands/compile/command.d.ts.map +1 -0
- package/dist/cli/commands/compile/command.js +38 -0
- package/dist/cli/commands/init/command.d.ts +8 -8
- package/dist/cli/commands/init/command.d.ts.map +1 -0
- package/dist/cli/commands/init/command.js +122 -0
- package/dist/cli/defaults.d.ts +4 -3
- package/dist/cli/defaults.d.ts.map +1 -0
- package/dist/cli/defaults.js +29 -0
- package/dist/cli/index.d.ts +11 -5
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +16 -34838
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts +3 -3
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts.map +1 -0
- package/dist/cli/steps/check-for-uncomitted-changes.js +36 -0
- package/dist/cli/steps/initialize-inlang-project.d.ts +16 -12
- package/dist/cli/steps/initialize-inlang-project.d.ts.map +1 -0
- package/dist/cli/steps/initialize-inlang-project.js +190 -0
- package/dist/cli/steps/maybe-add-sherlock.d.ts +6 -6
- package/dist/cli/steps/maybe-add-sherlock.d.ts.map +1 -0
- package/dist/cli/steps/maybe-add-sherlock.js +35 -0
- package/dist/cli/steps/prompt-for-outdir.d.ts +3 -3
- package/dist/cli/steps/prompt-for-outdir.d.ts.map +1 -0
- package/dist/cli/steps/prompt-for-outdir.js +18 -0
- package/dist/cli/steps/run-compiler.d.ts +5 -5
- package/dist/cli/steps/run-compiler.d.ts.map +1 -0
- package/dist/cli/steps/run-compiler.js +13 -0
- package/dist/cli/steps/update-package-json.d.ts +5 -5
- package/dist/cli/steps/update-package-json.d.ts.map +1 -0
- package/dist/cli/steps/update-package-json.js +33 -0
- package/dist/cli/steps/update-ts-config.d.ts +7 -7
- package/dist/cli/steps/update-ts-config.d.ts.map +1 -0
- package/dist/cli/steps/update-ts-config.js +132 -0
- package/dist/cli/utils.d.ts +2 -2
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +19 -0
- package/dist/compiler/compile.d.ts +17 -22
- package/dist/compiler/compile.d.ts.map +1 -0
- package/dist/compiler/compile.js +31 -0
- package/dist/compiler/compile.test.d.ts +1 -0
- package/dist/compiler/compile.test.d.ts.map +1 -0
- package/dist/compiler/compile.test.js +29 -0
- package/dist/compiler/compileBundle.d.ts +20 -0
- package/dist/compiler/compileBundle.d.ts.map +1 -0
- package/dist/compiler/compileBundle.js +55 -0
- package/dist/compiler/compileExpression.d.ts +5 -0
- package/dist/compiler/compileExpression.d.ts.map +1 -0
- package/dist/compiler/compileExpression.js +41 -0
- package/dist/compiler/compileMessage.d.ts +7 -33
- package/dist/compiler/compileMessage.d.ts.map +1 -0
- package/dist/compiler/compileMessage.js +64 -0
- package/dist/compiler/compileMessage.test.d.ts +1 -0
- package/dist/compiler/compileMessage.test.d.ts.map +1 -0
- package/dist/compiler/compileMessage.test.js +74 -0
- package/dist/compiler/compilePattern.d.ts +6 -7
- package/dist/compiler/compilePattern.d.ts.map +1 -0
- package/dist/compiler/compilePattern.js +28 -0
- package/dist/compiler/compilePattern.test.d.ts +1 -0
- package/dist/compiler/compilePattern.test.d.ts.map +1 -0
- package/dist/compiler/compilePattern.test.js +67 -0
- package/dist/compiler/compileProject.d.ts +43 -0
- package/dist/compiler/compileProject.d.ts.map +1 -0
- package/dist/compiler/compileProject.js +204 -0
- package/dist/compiler/compileProject.test.d.ts +2 -0
- package/dist/compiler/compileProject.test.d.ts.map +1 -0
- package/dist/compiler/compileProject.test.js +638 -0
- package/dist/compiler/emit-dts.d.ts +6 -0
- package/dist/compiler/emit-dts.d.ts.map +1 -0
- package/dist/compiler/emit-dts.js +50 -0
- package/dist/compiler/emit-dts.test.d.ts +2 -0
- package/dist/compiler/emit-dts.test.d.ts.map +1 -0
- package/dist/compiler/emit-dts.test.js +40 -0
- package/dist/compiler/index.d.ts +7 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +6 -0
- package/dist/compiler/jsDocComment.d.ts +9 -0
- package/dist/compiler/jsDocComment.d.ts.map +1 -0
- package/dist/compiler/jsDocComment.js +29 -0
- package/dist/compiler/registry.d.ts +14 -0
- package/dist/compiler/registry.d.ts.map +1 -0
- package/dist/compiler/registry.js +55 -0
- package/dist/compiler/runtime.d.ts +3 -3
- package/dist/compiler/runtime.d.ts.map +1 -0
- package/dist/compiler/runtime.js +199 -0
- package/dist/compiler/types.d.ts +11 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/types.js +28 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -11381
- package/dist/services/codegen/escape.d.ts +1 -0
- package/dist/services/codegen/escape.d.ts.map +1 -0
- package/dist/services/codegen/escape.js +18 -0
- package/dist/services/codegen/identifier.d.ts +2 -3
- package/dist/services/codegen/identifier.d.ts.map +1 -0
- package/dist/services/codegen/identifier.js +11 -0
- package/dist/services/codegen/indentifier.test.d.ts +1 -0
- package/dist/services/codegen/indentifier.test.d.ts.map +1 -0
- package/dist/services/codegen/indentifier.test.js +8 -0
- package/dist/services/codegen/quotes.d.ts +3 -1
- package/dist/services/codegen/quotes.d.ts.map +1 -0
- package/dist/services/codegen/quotes.js +4 -0
- package/dist/services/env-variables/index.d.ts +6 -0
- package/dist/services/env-variables/index.d.ts.map +1 -0
- package/dist/services/env-variables/index.js +5 -0
- package/dist/services/environment/package.d.ts +3 -4
- package/dist/services/environment/package.d.ts.map +1 -0
- package/dist/services/environment/package.js +30 -0
- package/dist/services/environment/package.test.d.ts +1 -0
- package/dist/services/environment/package.test.d.ts.map +1 -0
- package/dist/services/environment/package.test.js +20 -0
- package/dist/services/error-handling.d.ts +4 -4
- package/dist/services/error-handling.d.ts.map +1 -0
- package/dist/services/error-handling.js +19 -0
- package/dist/services/error-handling.test.d.ts +1 -0
- package/dist/services/error-handling.test.d.ts.map +1 -0
- package/dist/services/error-handling.test.js +9 -0
- package/dist/services/file-handling/exists.d.ts +2 -3
- package/dist/services/file-handling/exists.d.ts.map +1 -0
- package/dist/services/file-handling/exists.js +23 -0
- package/dist/services/file-handling/exists.test.d.ts +1 -0
- package/dist/services/file-handling/exists.test.d.ts.map +1 -0
- package/dist/services/file-handling/exists.test.js +26 -0
- package/dist/services/file-handling/types.d.ts +5 -0
- package/dist/services/file-handling/types.d.ts.map +1 -0
- package/dist/services/file-handling/write-output.d.ts +3 -3
- package/dist/services/file-handling/write-output.d.ts.map +1 -0
- package/dist/services/file-handling/write-output.js +37 -0
- package/dist/services/file-handling/write-output.test.d.ts +1 -0
- package/dist/services/file-handling/write-output.test.d.ts.map +1 -0
- package/dist/services/file-handling/write-output.test.js +57 -0
- package/dist/services/logger/index.d.ts +1 -0
- package/dist/services/logger/index.d.ts.map +1 -0
- package/dist/services/logger/index.js +60 -0
- package/dist/services/lookup.d.ts +15 -0
- package/dist/services/lookup.d.ts.map +1 -0
- package/dist/services/lookup.js +23 -0
- package/dist/services/telemetry/capture.d.ts +16 -0
- package/dist/services/telemetry/capture.d.ts.map +1 -0
- package/dist/services/telemetry/capture.js +71 -0
- package/dist/services/telemetry/capture.test.d.ts +2 -0
- package/dist/services/telemetry/capture.test.d.ts.map +1 -0
- package/dist/services/telemetry/capture.test.js +40 -0
- package/dist/services/telemetry/events.d.ts +2 -1
- package/dist/services/telemetry/events.d.ts.map +1 -0
- package/dist/services/telemetry/stack-detection.d.ts +1 -0
- package/dist/services/telemetry/stack-detection.d.ts.map +1 -0
- package/dist/services/telemetry/stack-detection.js +82 -0
- package/dist/services/telemetry/stack-detection.test.d.ts +1 -0
- package/dist/services/telemetry/stack-detection.test.d.ts.map +1 -0
- package/dist/services/telemetry/stack-detection.test.js +39 -0
- package/dist/services/valid-js-identifier/index.d.ts +1 -0
- package/dist/services/valid-js-identifier/index.d.ts.map +1 -0
- package/dist/services/valid-js-identifier/index.js +24 -0
- package/dist/services/valid-js-identifier/index.test.d.ts +1 -0
- package/dist/services/valid-js-identifier/index.test.d.ts.map +1 -0
- package/dist/services/valid-js-identifier/index.test.js +30 -0
- package/dist/services/valid-js-identifier/reservedWords.d.ts +1 -0
- package/dist/services/valid-js-identifier/reservedWords.d.ts.map +1 -0
- package/dist/services/valid-js-identifier/reservedWords.js +50 -0
- package/dist/utilities/detect-json-formatting.d.ts +11 -0
- package/dist/utilities/detect-json-formatting.d.ts.map +1 -0
- package/dist/utilities/detect-json-formatting.js +79 -0
- package/node_modules/@inlang/sdk/LICENSE +201 -0
- package/node_modules/@inlang/sdk/README.md +16 -0
- package/node_modules/@inlang/sdk/dist/database/initDb.d.ts +7 -0
- package/node_modules/@inlang/sdk/dist/database/initDb.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/initDb.js +36 -0
- package/node_modules/@inlang/sdk/dist/database/initDb.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/initDbAndSchema.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/database/initDbAndSchema.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/initDbAndSchema.test.js +110 -0
- package/node_modules/@inlang/sdk/dist/database/initDbAndSchema.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.d.ts +20 -0
- package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.js +183 -0
- package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.test.js +119 -0
- package/node_modules/@inlang/sdk/dist/database/jsonbPlugin.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/schema.d.ts +74 -0
- package/node_modules/@inlang/sdk/dist/database/schema.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/database/schema.js +45 -0
- package/node_modules/@inlang/sdk/dist/database/schema.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/helper.d.ts +71 -0
- package/node_modules/@inlang/sdk/dist/helper.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/helper.js +91 -0
- package/node_modules/@inlang/sdk/dist/helper.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/human-id/human-id.d.ts +3 -0
- package/node_modules/@inlang/sdk/dist/human-id/human-id.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/human-id/human-id.js +12 -0
- package/node_modules/@inlang/sdk/dist/human-id/human-id.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/human-id/words.d.ts +5 -0
- package/node_modules/@inlang/sdk/dist/human-id/words.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/human-id/words.js +1036 -0
- package/node_modules/@inlang/sdk/dist/human-id/words.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/human-id/words.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/human-id/words.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/human-id/words.test.js +29 -0
- package/node_modules/@inlang/sdk/dist/human-id/words.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/exportFiles.d.ts +11 -0
- package/node_modules/@inlang/sdk/dist/import-export/exportFiles.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/exportFiles.js +26 -0
- package/node_modules/@inlang/sdk/dist/import-export/exportFiles.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/importFiles.d.ts +13 -0
- package/node_modules/@inlang/sdk/dist/import-export/importFiles.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/importFiles.js +124 -0
- package/node_modules/@inlang/sdk/dist/import-export/importFiles.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/importFiles.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/import-export/importFiles.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/importFiles.test.js +179 -0
- package/node_modules/@inlang/sdk/dist/import-export/importFiles.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/roundtrip.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/import-export/roundtrip.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/roundtrip.test.js +273 -0
- package/node_modules/@inlang/sdk/dist/import-export/roundtrip.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/upsertBundleNestedMatchByProperties.d.ts +4 -0
- package/node_modules/@inlang/sdk/dist/import-export/upsertBundleNestedMatchByProperties.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/import-export/upsertBundleNestedMatchByProperties.js +58 -0
- package/node_modules/@inlang/sdk/dist/import-export/upsertBundleNestedMatchByProperties.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/index.d.ts +24 -0
- package/node_modules/@inlang/sdk/dist/index.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/index.js +22 -0
- package/node_modules/@inlang/sdk/dist/index.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.d.ts +9 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.js +84 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.test.js +85 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/fromMessageV1.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/schemaV1.d.ts +86 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/schemaV1.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/schemaV1.js +35 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/schemaV1.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.d.ts +9 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.js +67 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.test.js +85 -0
- package/node_modules/@inlang/sdk/dist/json-schema/old-v1-message/toMessageV1.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/pattern.d.ts +190 -0
- package/node_modules/@inlang/sdk/dist/json-schema/pattern.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/pattern.js +43 -0
- package/node_modules/@inlang/sdk/dist/json-schema/pattern.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/settings.d.ts +31 -0
- package/node_modules/@inlang/sdk/dist/json-schema/settings.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/settings.js +96 -0
- package/node_modules/@inlang/sdk/dist/json-schema/settings.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/settings.test-d.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/json-schema/settings.test-d.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/json-schema/settings.test-d.js +20 -0
- package/node_modules/@inlang/sdk/dist/json-schema/settings.test-d.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.d.ts +3 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.js +127 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.test.js +135 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/applyChanges.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.d.ts +3 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.js +47 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.test.js +251 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/detectConflicts.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.d.ts +8 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.js +109 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.test.js +418 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/inlangLixPluginV1.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/merge.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/merge.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/merge.test.js +120 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/merge.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/resolveConflictBySelecting.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/resolveConflictBySelecting.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/resolveConflictBySelecting.test.js +176 -0
- package/node_modules/@inlang/sdk/dist/lix-plugin/resolveConflictBySelecting.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/createMessageV1.d.ts +28 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/createMessageV1.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/createMessageV1.js +31 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/createMessageV1.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts +9 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.js +31 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js +45 -0
- package/node_modules/@inlang/sdk/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/cache.d.ts +6 -0
- package/node_modules/@inlang/sdk/dist/plugin/cache.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/cache.js +59 -0
- package/node_modules/@inlang/sdk/dist/plugin/cache.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/cache.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/plugin/cache.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/cache.test.js +61 -0
- package/node_modules/@inlang/sdk/dist/plugin/cache.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/errors.d.ts +41 -0
- package/node_modules/@inlang/sdk/dist/plugin/errors.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/errors.js +48 -0
- package/node_modules/@inlang/sdk/dist/plugin/errors.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/importPlugins.d.ts +19 -0
- package/node_modules/@inlang/sdk/dist/plugin/importPlugins.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/importPlugins.js +43 -0
- package/node_modules/@inlang/sdk/dist/plugin/importPlugins.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/importPlugins.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/plugin/importPlugins.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/importPlugins.test.js +95 -0
- package/node_modules/@inlang/sdk/dist/plugin/importPlugins.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/meta/ideExtension.d.ts +54 -0
- package/node_modules/@inlang/sdk/dist/plugin/meta/ideExtension.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/meta/ideExtension.js +5 -0
- package/node_modules/@inlang/sdk/dist/plugin/meta/ideExtension.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/schema.d.ts +152 -0
- package/node_modules/@inlang/sdk/dist/plugin/schema.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/plugin/schema.js +5 -0
- package/node_modules/@inlang/sdk/dist/plugin/schema.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/api.d.ts +78 -0
- package/node_modules/@inlang/sdk/dist/project/api.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/api.js +5 -0
- package/node_modules/@inlang/sdk/dist/project/api.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/initHandleSaveToLixOnChange.d.ts +14 -0
- package/node_modules/@inlang/sdk/dist/project/initHandleSaveToLixOnChange.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/initHandleSaveToLixOnChange.js +81 -0
- package/node_modules/@inlang/sdk/dist/project/initHandleSaveToLixOnChange.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProject.d.ts +43 -0
- package/node_modules/@inlang/sdk/dist/project/loadProject.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProject.js +105 -0
- package/node_modules/@inlang/sdk/dist/project/loadProject.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProject.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/loadProject.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProject.test.js +123 -0
- package/node_modules/@inlang/sdk/dist/project/loadProject.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.d.ts +87 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.js +593 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.test.js +642 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectFromDirectory.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.d.ts +8 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.js +31 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.test.js +27 -0
- package/node_modules/@inlang/sdk/dist/project/loadProjectInMemory.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.d.ts +9 -0
- package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.js +46 -0
- package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.test.js +60 -0
- package/node_modules/@inlang/sdk/dist/project/maybeCaptureTelemetry.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/newProject.d.ts +17 -0
- package/node_modules/@inlang/sdk/dist/project/newProject.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/newProject.js +70 -0
- package/node_modules/@inlang/sdk/dist/project/newProject.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/newProject.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/newProject.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/newProject.test.js +37 -0
- package/node_modules/@inlang/sdk/dist/project/newProject.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.d.ts +8 -0
- package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.js +86 -0
- package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.test.js +245 -0
- package/node_modules/@inlang/sdk/dist/project/saveProjectToDirectory.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/id$.d.ts +6 -0
- package/node_modules/@inlang/sdk/dist/project/state/id$.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/id$.js +19 -0
- package/node_modules/@inlang/sdk/dist/project/state/id$.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/id$.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/state/id$.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/id$.test.js +36 -0
- package/node_modules/@inlang/sdk/dist/project/state/id$.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/setSettings.d.ts +7 -0
- package/node_modules/@inlang/sdk/dist/project/state/setSettings.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/setSettings.js +16 -0
- package/node_modules/@inlang/sdk/dist/project/state/setSettings.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/setSettings.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/state/setSettings.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/setSettings.test.js +58 -0
- package/node_modules/@inlang/sdk/dist/project/state/setSettings.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/settings$.d.ts +7 -0
- package/node_modules/@inlang/sdk/dist/project/state/settings$.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/settings$.js +21 -0
- package/node_modules/@inlang/sdk/dist/project/state/settings$.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/settings$.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/state/settings$.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/settings$.test.js +51 -0
- package/node_modules/@inlang/sdk/dist/project/state/settings$.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/state.d.ts +58 -0
- package/node_modules/@inlang/sdk/dist/project/state/state.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/state.js +67 -0
- package/node_modules/@inlang/sdk/dist/project/state/state.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/state.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/project/state/state.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/project/state/state.test.js +103 -0
- package/node_modules/@inlang/sdk/dist/project/state/state.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/index.d.ts +6 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/index.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/index.js +9 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/index.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/insertBundleNested.d.ts +4 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/insertBundleNested.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/insertBundleNested.js +39 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/insertBundleNested.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.d.ts +14 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.js +22 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.test.js +67 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/pollQuery.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/selectBundleNested.d.ts +107 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/selectBundleNested.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/selectBundleNested.js +43 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/selectBundleNested.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/updateBundleNested.d.ts +12 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/updateBundleNested.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/updateBundleNested.js +25 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/updateBundleNested.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/upsertBundleNested.d.ts +4 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/upsertBundleNested.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/upsertBundleNested.js +50 -0
- package/node_modules/@inlang/sdk/dist/query-utilities/upsertBundleNested.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/services/env-variables/index.d.ts +6 -0
- package/node_modules/@inlang/sdk/dist/services/env-variables/index.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/services/env-variables/index.js +9 -0
- package/node_modules/@inlang/sdk/dist/services/env-variables/index.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/services/error-reporting/index.d.ts +15 -0
- package/node_modules/@inlang/sdk/dist/services/error-reporting/index.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/services/error-reporting/index.js +30 -0
- package/node_modules/@inlang/sdk/dist/services/error-reporting/index.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/services/telemetry/capture.d.ts +23 -0
- package/node_modules/@inlang/sdk/dist/services/telemetry/capture.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/services/telemetry/capture.js +77 -0
- package/node_modules/@inlang/sdk/dist/services/telemetry/capture.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/services/telemetry/capture.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/services/telemetry/capture.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/services/telemetry/capture.test.js +44 -0
- package/node_modules/@inlang/sdk/dist/services/telemetry/capture.test.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.d.ts +11 -0
- package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.js +83 -0
- package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.js.map +1 -0
- package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.test.d.ts +2 -0
- package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.test.d.ts.map +1 -0
- package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.test.js +33 -0
- package/node_modules/@inlang/sdk/dist/utilities/detectJsonFormatting.test.js.map +1 -0
- package/node_modules/@inlang/sdk/package.json +64 -0
- package/node_modules/@inlang/sdk/src/database/initDb.ts +34 -0
- package/node_modules/@inlang/sdk/src/database/initDbAndSchema.test.ts +125 -0
- package/node_modules/@inlang/sdk/src/database/jsonbPlugin.test.ts +154 -0
- package/node_modules/@inlang/sdk/src/database/jsonbPlugin.ts +215 -0
- package/node_modules/@inlang/sdk/src/database/schema.ts +127 -0
- package/node_modules/@inlang/sdk/src/helper.ts +113 -0
- package/node_modules/@inlang/sdk/src/human-id/human-id.ts +14 -0
- package/node_modules/@inlang/sdk/src/human-id/words.test.ts +27 -0
- package/node_modules/@inlang/sdk/src/human-id/words.ts +1035 -0
- package/node_modules/@inlang/sdk/src/import-export/exportFiles.ts +36 -0
- package/node_modules/@inlang/sdk/src/import-export/importFiles.test.ts +211 -0
- package/node_modules/@inlang/sdk/src/import-export/importFiles.ts +142 -0
- package/node_modules/@inlang/sdk/src/import-export/roundtrip.test.ts +313 -0
- package/node_modules/@inlang/sdk/src/import-export/upsertBundleNestedMatchByProperties.ts +74 -0
- package/node_modules/@inlang/sdk/src/index.ts +32 -0
- package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/README.md +1 -0
- package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/fromMessageV1.test.ts +87 -0
- package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/fromMessageV1.ts +99 -0
- package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/schemaV1.ts +66 -0
- package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/toMessageV1.test.ts +87 -0
- package/node_modules/@inlang/sdk/src/json-schema/old-v1-message/toMessageV1.ts +79 -0
- package/node_modules/@inlang/sdk/src/json-schema/pattern.ts +59 -0
- package/node_modules/@inlang/sdk/src/json-schema/settings.test-d.ts +21 -0
- package/node_modules/@inlang/sdk/src/json-schema/settings.ts +138 -0
- package/node_modules/@inlang/sdk/src/lix-plugin/applyChanges.test.ts +150 -0
- package/node_modules/@inlang/sdk/src/lix-plugin/applyChanges.ts +171 -0
- package/node_modules/@inlang/sdk/src/lix-plugin/detectConflicts.test.ts +286 -0
- package/node_modules/@inlang/sdk/src/lix-plugin/detectConflicts.ts +62 -0
- package/node_modules/@inlang/sdk/src/lix-plugin/inlangLixPluginV1.test.ts +439 -0
- package/node_modules/@inlang/sdk/src/lix-plugin/inlangLixPluginV1.ts +132 -0
- package/node_modules/@inlang/sdk/src/lix-plugin/merge.test.ts +133 -0
- package/node_modules/@inlang/sdk/src/lix-plugin/resolveConflictBySelecting.test.ts +188 -0
- package/node_modules/@inlang/sdk/src/migrations/v2/createMessageV1.ts +37 -0
- package/node_modules/@inlang/sdk/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts +51 -0
- package/node_modules/@inlang/sdk/src/migrations/v2/withLanguageTagToLocaleMigration.ts +31 -0
- package/node_modules/@inlang/sdk/src/plugin/cache.test.ts +83 -0
- package/node_modules/@inlang/sdk/src/plugin/cache.ts +79 -0
- package/node_modules/@inlang/sdk/src/plugin/errors.ts +67 -0
- package/node_modules/@inlang/sdk/src/plugin/importPlugins.test.ts +107 -0
- package/node_modules/@inlang/sdk/src/plugin/importPlugins.ts +60 -0
- package/node_modules/@inlang/sdk/src/plugin/meta/ideExtension.ts +56 -0
- package/node_modules/@inlang/sdk/src/plugin/schema.ts +165 -0
- package/node_modules/@inlang/sdk/src/project/api.ts +81 -0
- package/node_modules/@inlang/sdk/src/project/initHandleSaveToLixOnChange.ts +88 -0
- package/node_modules/@inlang/sdk/src/project/loadProject.test.ts +148 -0
- package/node_modules/@inlang/sdk/src/project/loadProject.ts +153 -0
- package/node_modules/@inlang/sdk/src/project/loadProjectFromDirectory.test.ts +819 -0
- package/node_modules/@inlang/sdk/src/project/loadProjectFromDirectory.ts +767 -0
- package/node_modules/@inlang/sdk/src/project/loadProjectInMemory.test.ts +29 -0
- package/node_modules/@inlang/sdk/src/project/loadProjectInMemory.ts +35 -0
- package/node_modules/@inlang/sdk/src/project/maybeCaptureTelemetry.test.ts +65 -0
- package/node_modules/@inlang/sdk/src/project/maybeCaptureTelemetry.ts +51 -0
- package/node_modules/@inlang/sdk/src/project/newProject.test.ts +36 -0
- package/node_modules/@inlang/sdk/src/project/newProject.ts +77 -0
- package/node_modules/@inlang/sdk/src/project/saveProjectToDirectory.test.ts +310 -0
- package/node_modules/@inlang/sdk/src/project/saveProjectToDirectory.ts +100 -0
- package/node_modules/@inlang/sdk/src/project/state/README.md +22 -0
- package/node_modules/@inlang/sdk/src/project/state/id$.test.ts +40 -0
- package/node_modules/@inlang/sdk/src/project/state/id$.ts +21 -0
- package/node_modules/@inlang/sdk/src/project/state/setSettings.test.ts +73 -0
- package/node_modules/@inlang/sdk/src/project/state/setSettings.ts +19 -0
- package/node_modules/@inlang/sdk/src/project/state/settings$.test.ts +63 -0
- package/node_modules/@inlang/sdk/src/project/state/settings$.ts +26 -0
- package/node_modules/@inlang/sdk/src/project/state/state.test.ts +128 -0
- package/node_modules/@inlang/sdk/src/project/state/state.ts +94 -0
- package/node_modules/@inlang/sdk/src/query-utilities/index.ts +5 -0
- package/node_modules/@inlang/sdk/src/query-utilities/insertBundleNested.ts +46 -0
- package/node_modules/@inlang/sdk/src/query-utilities/pollQuery.test.ts +88 -0
- package/node_modules/@inlang/sdk/src/query-utilities/pollQuery.ts +26 -0
- package/node_modules/@inlang/sdk/src/query-utilities/selectBundleNested.ts +46 -0
- package/node_modules/@inlang/sdk/src/query-utilities/updateBundleNested.ts +35 -0
- package/node_modules/@inlang/sdk/src/query-utilities/upsertBundleNested.ts +61 -0
- package/node_modules/@inlang/sdk/src/services/env-variables/createIndexFile.js +40 -0
- package/node_modules/@inlang/sdk/src/services/env-variables/index.d.ts +16 -0
- package/node_modules/@inlang/sdk/src/services/env-variables/index.ts +6 -0
- package/node_modules/@inlang/sdk/src/services/error-reporting/index.ts +28 -0
- package/node_modules/@inlang/sdk/src/services/telemetry/capture.test.ts +48 -0
- package/node_modules/@inlang/sdk/src/services/telemetry/capture.ts +98 -0
- package/node_modules/@inlang/sdk/src/utilities/detectJsonFormatting.test.ts +38 -0
- package/node_modules/@inlang/sdk/src/utilities/detectJsonFormatting.ts +109 -0
- package/package.json +41 -41
- package/dist/cli/steps/initialize-inlang-project.test.d.ts +0 -1
- package/dist/cli/steps/maybe-add-ninja.d.ts +0 -10
- package/dist/cli/steps.d.ts +0 -8
- package/dist/compiler/aliases.d.ts +0 -9
- package/dist/compiler/messageIndex.d.ts +0 -8
- package/dist/compiler/optionsType.d.ts +0 -3
- package/dist/compiler/optionsType.test.d.ts +0 -1
- package/dist/compiler/paramsType.d.ts +0 -11
- package/dist/compiler/paramsType.test.d.ts +0 -1
- package/dist/index-9cf8cd4d.js +0 -431
- package/dist/packfile-8529df01.js +0 -92
- package/dist/services/codegen/string-union.d.ts +0 -1
- package/dist/services/telemetry/implementation.d.ts +0 -24
- package/dist/services/telemetry/index.d.ts +0 -1
- /package/dist/{cli/commands/compile/command.test.d.ts → services/file-handling/types.js} +0 -0
- /package/dist/{cli/commands/init/command.test.d.ts → services/telemetry/events.js} +0 -0
package/README.md
CHANGED
|
@@ -42,15 +42,15 @@ If you are using a Bundler use one of the [Bundler Plugins](usage#usage-with-a-b
|
|
|
42
42
|
After running the compiler import the messages with `import * as m from "./paraglide/messages"`. By convention, a wildcard import is used.
|
|
43
43
|
|
|
44
44
|
```js
|
|
45
|
-
import * as m from "./paraglide/messages.js"
|
|
45
|
+
import * as m from "./paraglide/messages.js";
|
|
46
46
|
|
|
47
|
-
m.hello() // Hello world!
|
|
48
|
-
m.loginHeader({ name: "Samuel" }) // Hello Samuel, please login to continue.
|
|
47
|
+
m.hello(); // Hello world!
|
|
48
|
+
m.loginHeader({ name: "Samuel" }); // Hello Samuel, please login to continue.
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
# Playground
|
|
52
52
|
|
|
53
|
-
Find examples of how to use Paraglide on CodeSandbox or in [our GitHub repository](https://github.com/opral/monorepo/tree/main/inlang/
|
|
53
|
+
Find examples of how to use Paraglide on CodeSandbox or in [our GitHub repository](https://github.com/opral/monorepo/tree/main/inlang/packages/paraglide).
|
|
54
54
|
|
|
55
55
|
<doc-links>
|
|
56
56
|
<doc-link title="NextJS + Paraglide JS" icon="lucide:codesandbox" href="https://stackblitz.com/~/LorisSigrist/paraglide-next-app-router-example" description="Play around with NextJS and Paraglide JS"></doc-link>
|
|
@@ -66,7 +66,7 @@ Of course, we're not done yet! We plan on adding the following features to Parag
|
|
|
66
66
|
- [ ] Formatting of numbers and dates ([Join the Discussion](https://github.com/opral/monorepo/discussions/992))
|
|
67
67
|
- [ ] Markup Placeholders ([Join the Discussion](https://github.com/opral/monorepo/discussions/913))
|
|
68
68
|
- [ ] Component Interpolation
|
|
69
|
-
- [ ] Per-Language Splitting without Lazy-Loading
|
|
69
|
+
- [ ] Per-Language Splitting without Lazy-Loading
|
|
70
70
|
- [ ] Even Smaller Output
|
|
71
71
|
|
|
72
72
|
# Talks
|
package/bin/run.js
CHANGED
package/default/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {};
|
package/default/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {};
|
package/default/why.txt
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
Paraglide is a CLI at it's heart & therefore doesn't have a real JS entry point. This
|
|
2
2
|
means that NPM doesn't show the TS icon on the package, which may lead people to believe
|
|
3
|
-
it's not typesafe. To sidestep this we added an empty export.
|
|
4
|
-
because both paraglide's source code and it's output are fully typed.
|
|
3
|
+
it's not typesafe. To sidestep this we added an empty export.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { negotiateLanguagePreferences } from
|
|
2
|
-
export { detectLanguageFromPath } from
|
|
3
|
-
export { bestMatch, resolveRoute, parseRouteDefinition, type PathDefinitionTranslations, type ParamMatcher, type RouteParam, } from
|
|
4
|
-
export { validatePathTranslations, prettyPrintPathDefinitionIssues, } from
|
|
5
|
-
export { resolveUserPathDefinitions, type UserPathDefinitionTranslations, } from
|
|
1
|
+
export { negotiateLanguagePreferences } from "./negotiation/language.js";
|
|
2
|
+
export { detectLanguageFromPath } from "./routing/detectLanguage.js";
|
|
3
|
+
export { bestMatch, resolveRoute, parseRouteDefinition, type PathDefinitionTranslations, type ParamMatcher, type RouteParam, } from "./routing/routeDefinitions.js";
|
|
4
|
+
export { validatePathTranslations, prettyPrintPathDefinitionIssues, } from "./routing/validatePathTranslations.js";
|
|
5
|
+
export { resolveUserPathDefinitions, type UserPathDefinitionTranslations, } from "./routing/resolveUserPathDefinitions.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,UAAU,GACf,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,wBAAwB,EACxB,+BAA+B,GAC/B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,0BAA0B,EAC1B,KAAK,8BAA8B,GACnC,MAAM,yCAAyC,CAAC"}
|
|
@@ -1,422 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
);
|
|
7
|
-
return priorities.filter((prio) => prio.quality > 0).sort(bySpecificity).sort(byQuality).map((priority) => priority.languageTag);
|
|
8
|
-
}
|
|
9
|
-
function parseAcceptLanguageHeader(acceptLanguage) {
|
|
10
|
-
return acceptLanguage.split(",").map((dfn) => dfn.trim()).map((dfn, index) => parseLanguage(dfn, index)).filter((maybeSpec) => Boolean(maybeSpec));
|
|
11
|
-
}
|
|
12
|
-
function parseLanguage(languageTag, index) {
|
|
13
|
-
const LANGUAGE_REGEXP = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;
|
|
14
|
-
const match = LANGUAGE_REGEXP.exec(languageTag);
|
|
15
|
-
if (!match)
|
|
16
|
-
return void 0;
|
|
17
|
-
const [, prefix, suffix, qualityMatch] = match;
|
|
18
|
-
if (!prefix)
|
|
19
|
-
throw new Error(`Invalid language tag: ${languageTag}`);
|
|
20
|
-
const full = suffix ? `${prefix}-${suffix}` : prefix;
|
|
21
|
-
const quality = parseQuality(qualityMatch ?? "") ?? 1;
|
|
22
|
-
return {
|
|
23
|
-
prefix,
|
|
24
|
-
suffix,
|
|
25
|
-
quality,
|
|
26
|
-
index,
|
|
27
|
-
full
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function parseQuality(qualityMatch) {
|
|
31
|
-
return qualityMatch.split(";").map((param) => param.split("=")).filter((p) => p[0] == "q" && !!p[1]).map(([, value]) => parseFloat(value))[0];
|
|
32
|
-
}
|
|
33
|
-
function getHighestLanguagePriority(languageTag, acceptableLanguages, index) {
|
|
34
|
-
const priorities = acceptableLanguages.map((spec) => calculatePriority(languageTag, spec, index)).filter((prio) => Boolean(prio));
|
|
35
|
-
const highestPriority = priorities.sort(bySpecificity)[0] || {
|
|
36
|
-
languageTag,
|
|
37
|
-
index: 0,
|
|
38
|
-
order: -1,
|
|
39
|
-
quality: 0,
|
|
40
|
-
specificity: 0
|
|
41
|
-
};
|
|
42
|
-
return highestPriority;
|
|
43
|
-
}
|
|
44
|
-
function calculatePriority(languageTag, spec, index) {
|
|
45
|
-
const parsed = parseLanguage(languageTag, 0);
|
|
46
|
-
if (!parsed)
|
|
47
|
-
return void 0;
|
|
48
|
-
let specificity = 0;
|
|
49
|
-
if (spec.full.toLowerCase() === parsed.full.toLowerCase()) {
|
|
50
|
-
specificity = 4;
|
|
51
|
-
} else if (spec.prefix.toLowerCase() === parsed.full.toLowerCase()) {
|
|
52
|
-
specificity = 2;
|
|
53
|
-
} else if (spec.full.toLowerCase() === parsed.prefix.toLowerCase()) {
|
|
54
|
-
specificity = 1;
|
|
55
|
-
}
|
|
56
|
-
if (specificity === 0 && spec.full !== "*")
|
|
57
|
-
return void 0;
|
|
58
|
-
return {
|
|
59
|
-
languageTag,
|
|
60
|
-
index,
|
|
61
|
-
order: spec.index,
|
|
62
|
-
quality: spec.quality,
|
|
63
|
-
specificity
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const byQuality = (a, b) => b.quality - a.quality;
|
|
67
|
-
const bySpecificity = (a, b) => b.specificity - a.specificity || a.order - b.order || a.index - b.index;
|
|
68
|
-
function detectLanguageFromPath({
|
|
69
|
-
path,
|
|
70
|
-
availableLanguageTags,
|
|
71
|
-
base
|
|
72
|
-
}) {
|
|
73
|
-
base ??= "";
|
|
74
|
-
if (base === "/")
|
|
75
|
-
base = "";
|
|
76
|
-
if (!path.startsWith(base))
|
|
77
|
-
return void 0;
|
|
78
|
-
const pathWithoutBase = path.replace(base, "");
|
|
79
|
-
const maybeLang = pathWithoutBase.split("/")[1];
|
|
80
|
-
if (!maybeLang)
|
|
81
|
-
return void 0;
|
|
82
|
-
return availableLanguageTags.map(lower).includes(lower(maybeLang)) ? maybeLang : void 0;
|
|
83
|
-
}
|
|
84
|
-
const lower = (s) => s.toLowerCase();
|
|
85
|
-
const STATIC = 0;
|
|
86
|
-
const OPTIONAL = 1;
|
|
87
|
-
const REST = 2;
|
|
88
|
-
const REQUIRED = 4;
|
|
89
|
-
const PART_TYPE = 0;
|
|
90
|
-
const PART_CONTENT = 1;
|
|
91
|
-
const PART_MATCHED = 2;
|
|
92
|
-
function sort_routes(routes) {
|
|
93
|
-
const get_parts = cached(split);
|
|
94
|
-
return routes.sort((route_a, route_b) => {
|
|
95
|
-
var _a, _b, _c, _d, _e, _f;
|
|
96
|
-
const segments_a = split_route_id(route_a).map(get_parts);
|
|
97
|
-
const segments_b = split_route_id(route_b).map(get_parts);
|
|
98
|
-
for (let i = 0; i < Math.max(segments_a.length, segments_b.length); i += 1) {
|
|
99
|
-
const segment_a = segments_a[i];
|
|
100
|
-
const segment_b = segments_b[i];
|
|
101
|
-
if (!segment_a)
|
|
102
|
-
return -1;
|
|
103
|
-
if (!segment_b)
|
|
104
|
-
return 1;
|
|
105
|
-
for (let j = 0; j < Math.max(segment_a.length, segment_b.length); j += 1) {
|
|
106
|
-
const a = segment_a[j];
|
|
107
|
-
const b = segment_b[j];
|
|
108
|
-
const dynamic = (a == null ? void 0 : a[PART_TYPE]) || (b == null ? void 0 : b[PART_TYPE]);
|
|
109
|
-
if (dynamic) {
|
|
110
|
-
if (!a)
|
|
111
|
-
return -1;
|
|
112
|
-
if (!b)
|
|
113
|
-
return 1;
|
|
114
|
-
const next_a = ((_a = segment_a[j + 1]) == null ? void 0 : _a[PART_CONTENT]) || ((_c = (_b = segments_a[i + 1]) == null ? void 0 : _b[0]) == null ? void 0 : _c[PART_CONTENT]);
|
|
115
|
-
const next_b = ((_d = segment_b[j + 1]) == null ? void 0 : _d[PART_CONTENT]) || ((_f = (_e = segments_b[i + 1]) == null ? void 0 : _e[0]) == null ? void 0 : _f[PART_CONTENT]);
|
|
116
|
-
const both_have_next = next_a && next_b;
|
|
117
|
-
const only_a_has_next = next_a && !next_b;
|
|
118
|
-
const only_b_has_next = !next_a && next_b;
|
|
119
|
-
if ((a[PART_TYPE] && b[PART_TYPE]) === REST) {
|
|
120
|
-
if (both_have_next)
|
|
121
|
-
continue;
|
|
122
|
-
if (only_a_has_next)
|
|
123
|
-
return -1;
|
|
124
|
-
if (only_b_has_next)
|
|
125
|
-
return 1;
|
|
126
|
-
}
|
|
127
|
-
if (a[PART_TYPE] === REST)
|
|
128
|
-
return only_a_has_next ? -1 : 1;
|
|
129
|
-
if (b[PART_TYPE] === REST)
|
|
130
|
-
return only_b_has_next ? 1 : -1;
|
|
131
|
-
if (a[PART_MATCHED] !== b[PART_MATCHED])
|
|
132
|
-
return (-1) ** +a[PART_MATCHED];
|
|
133
|
-
if (a[PART_TYPE] !== b[PART_TYPE]) {
|
|
134
|
-
return (-1) ** +(a[PART_TYPE] > b[PART_TYPE]);
|
|
135
|
-
}
|
|
136
|
-
} else if ((a == null ? void 0 : a[PART_CONTENT]) !== (b == null ? void 0 : b[PART_CONTENT])) {
|
|
137
|
-
return sort_static(a[PART_CONTENT], b[PART_CONTENT]);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return route_a < route_b ? 1 : -1;
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function cached(fn) {
|
|
145
|
-
const cache = /* @__PURE__ */ new Map();
|
|
146
|
-
return (arg) => {
|
|
147
|
-
if (!cache.has(arg))
|
|
148
|
-
cache.set(arg, fn(arg));
|
|
149
|
-
return cache.get(arg);
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function split(id) {
|
|
153
|
-
const parts = [];
|
|
154
|
-
let i = 0;
|
|
155
|
-
while (i <= id.length) {
|
|
156
|
-
const start = id.indexOf("[", i);
|
|
157
|
-
const entirelyStatic = start === -1;
|
|
158
|
-
parts.push([STATIC, id.slice(i, entirelyStatic ? void 0 : start), false]);
|
|
159
|
-
if (entirelyStatic)
|
|
160
|
-
break;
|
|
161
|
-
const type = id[start + 1] === "[" ? OPTIONAL : id[start + 1] === "." ? REST : REQUIRED;
|
|
162
|
-
const endBrackets = type === OPTIONAL ? "]]" : "]";
|
|
163
|
-
const endBracketIdx = id.indexOf(endBrackets, start);
|
|
164
|
-
if (endBracketIdx === -1)
|
|
165
|
-
throw new Error(`Invalid route definition ${id}`);
|
|
166
|
-
const content = id.slice(start, i = endBracketIdx + endBrackets.length);
|
|
167
|
-
parts.push([type, content, content.includes("=")]);
|
|
168
|
-
}
|
|
169
|
-
return parts;
|
|
170
|
-
}
|
|
171
|
-
const split_route_id = (id) => id.replace(/\[\[[^\]]+\]\](?!$)/g, "").split("/").filter(Boolean);
|
|
172
|
-
function sort_static(a, b) {
|
|
173
|
-
if (a === b)
|
|
174
|
-
return 0;
|
|
175
|
-
let idx = 0;
|
|
176
|
-
while (a[idx] === b[idx])
|
|
177
|
-
idx++;
|
|
178
|
-
return !a[idx] ? 1 : !b[idx] ? -1 : a[idx] < b[idx] ? -1 : 1;
|
|
179
|
-
}
|
|
180
|
-
const param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
181
|
-
function parseRouteDefinition(id) {
|
|
182
|
-
const params = [];
|
|
183
|
-
const pattern = id === "/" ? /^\/$/ : new RegExp(
|
|
184
|
-
`^${get_route_segments(id).map((segment) => {
|
|
185
|
-
const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
|
186
|
-
if (rest_match) {
|
|
187
|
-
params.push({
|
|
188
|
-
name: rest_match[1],
|
|
189
|
-
matcher: rest_match[2],
|
|
190
|
-
optional: false,
|
|
191
|
-
rest: true,
|
|
192
|
-
chained: true
|
|
193
|
-
});
|
|
194
|
-
return "(?:/(.*))?";
|
|
195
|
-
}
|
|
196
|
-
const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
|
|
197
|
-
if (optional_match) {
|
|
198
|
-
params.push({
|
|
199
|
-
name: optional_match[1],
|
|
200
|
-
matcher: optional_match[2],
|
|
201
|
-
optional: true,
|
|
202
|
-
rest: false,
|
|
203
|
-
chained: true
|
|
204
|
-
});
|
|
205
|
-
return "(?:/([^/]+))?";
|
|
206
|
-
}
|
|
207
|
-
if (!segment) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const parts = segment.split(/\[(.+?)\](?!\])/);
|
|
211
|
-
const result = parts.map((content, i) => {
|
|
212
|
-
if (i % 2) {
|
|
213
|
-
if (content.startsWith("x+")) {
|
|
214
|
-
return escape(String.fromCharCode(parseInt(content.slice(2), 16)));
|
|
215
|
-
}
|
|
216
|
-
if (content.startsWith("u+")) {
|
|
217
|
-
return escape(
|
|
218
|
-
String.fromCharCode(
|
|
219
|
-
...content.slice(2).split("-").map((code) => parseInt(code, 16))
|
|
220
|
-
)
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
const match = (
|
|
224
|
-
/** @type {RegExpExecArray} */
|
|
225
|
-
param_pattern.exec(content)
|
|
226
|
-
);
|
|
227
|
-
if (!match) {
|
|
228
|
-
throw new Error(`Invalid param: ${content}`);
|
|
229
|
-
}
|
|
230
|
-
const [, is_optional, is_rest, name, matcher] = match;
|
|
231
|
-
params.push({
|
|
232
|
-
name,
|
|
233
|
-
matcher,
|
|
234
|
-
optional: !!is_optional,
|
|
235
|
-
rest: !!is_rest,
|
|
236
|
-
chained: is_rest ? i === 1 && parts[0] === "" : false
|
|
237
|
-
});
|
|
238
|
-
return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
|
|
239
|
-
}
|
|
240
|
-
return escape(content);
|
|
241
|
-
}).join("");
|
|
242
|
-
return "/" + result;
|
|
243
|
-
}).join("")}/?$`
|
|
244
|
-
);
|
|
245
|
-
return { pattern, params };
|
|
246
|
-
}
|
|
247
|
-
function exec(match, params, matchers) {
|
|
248
|
-
const result = {};
|
|
249
|
-
const values = match.slice(1);
|
|
250
|
-
const values_needing_match = values.filter((v) => v !== void 0);
|
|
251
|
-
let buffered = 0;
|
|
252
|
-
for (const [i, param] of params.entries()) {
|
|
253
|
-
let value = values[i - buffered];
|
|
254
|
-
if (param.chained && param.rest && buffered) {
|
|
255
|
-
value = values.slice(i - buffered, i + 1).filter((s) => s).join("/");
|
|
256
|
-
buffered = 0;
|
|
257
|
-
}
|
|
258
|
-
if (value === void 0) {
|
|
259
|
-
if (param.rest)
|
|
260
|
-
result[param.name] = "";
|
|
261
|
-
continue;
|
|
262
|
-
}
|
|
263
|
-
if (param.matcher && !matchers[param.matcher])
|
|
264
|
-
return void 0;
|
|
265
|
-
const matcher = matchers[param.matcher] ?? (() => true);
|
|
266
|
-
if (matcher(value)) {
|
|
267
|
-
result[param.name] = value;
|
|
268
|
-
const next_param = params[i + 1];
|
|
269
|
-
const next_value = values[i + 1];
|
|
270
|
-
if (next_param && !next_param.rest && next_param.optional && next_value && param.chained) {
|
|
271
|
-
buffered = 0;
|
|
272
|
-
}
|
|
273
|
-
if (!next_param && !next_value && Object.keys(result).length === values_needing_match.length) {
|
|
274
|
-
buffered = 0;
|
|
275
|
-
}
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
if (param.optional && param.chained) {
|
|
279
|
-
buffered++;
|
|
280
|
-
continue;
|
|
281
|
-
}
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
if (buffered)
|
|
285
|
-
return;
|
|
286
|
-
return result;
|
|
287
|
-
}
|
|
288
|
-
function escape(str) {
|
|
289
|
-
return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
|
|
290
|
-
}
|
|
291
|
-
const basic_param_pattern = /\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;
|
|
292
|
-
function resolveRoute(id, params) {
|
|
293
|
-
return "/" + get_route_segments(id).map(
|
|
294
|
-
(segment) => segment.replace(basic_param_pattern, (_, optional, rest, name) => {
|
|
295
|
-
const param_value = params[name];
|
|
296
|
-
if (!param_value) {
|
|
297
|
-
if (optional || rest && param_value !== void 0)
|
|
298
|
-
return "";
|
|
299
|
-
else
|
|
300
|
-
throw new Error(`Missing parameter '${name}' in route ${id}`);
|
|
301
|
-
}
|
|
302
|
-
if (param_value[0] == "/" || param_value.endsWith("/"))
|
|
303
|
-
throw new Error(`Parameter '${name}' in route ${id} cannot start or end with a slash`);
|
|
304
|
-
return param_value;
|
|
305
|
-
})
|
|
306
|
-
).filter(Boolean).join("/");
|
|
307
|
-
}
|
|
308
|
-
function bestMatch(canonicalPath, pathDefinitions, matchers) {
|
|
309
|
-
const sorted = sort_routes(pathDefinitions);
|
|
310
|
-
for (const pathDefinition of sorted) {
|
|
311
|
-
const route = parseRouteDefinition(pathDefinition);
|
|
312
|
-
const match = route.pattern.exec(removeTrailingSlash(canonicalPath));
|
|
313
|
-
if (!match)
|
|
314
|
-
continue;
|
|
315
|
-
const params = exec(match, route.params, matchers);
|
|
316
|
-
if (params)
|
|
317
|
-
return { params, id: pathDefinition };
|
|
318
|
-
}
|
|
319
|
-
return void 0;
|
|
320
|
-
}
|
|
321
|
-
const removeTrailingSlash = (path) => path.endsWith("/") ? path.slice(0, -1) : path;
|
|
322
|
-
const get_route_segments = (route) => route.slice(1).split("/");
|
|
323
|
-
function validatePathTranslations(pathTranslations, availableLanguageTags, matchers) {
|
|
324
|
-
const issues = [];
|
|
325
|
-
const expectedLanguages = new Set(availableLanguageTags);
|
|
326
|
-
const availableMatchers = new Set(Object.keys(matchers));
|
|
327
|
-
for (const path in pathTranslations) {
|
|
328
|
-
if (!isValidPath(path)) {
|
|
329
|
-
issues.push({
|
|
330
|
-
path,
|
|
331
|
-
message: "Path must start with a slash."
|
|
332
|
-
});
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
const { params: expectedParams } = parseRouteDefinition(path);
|
|
336
|
-
const expectedMatchers = expectedParams.map((param) => param.matcher).filter(Boolean);
|
|
337
|
-
for (const matcher of expectedMatchers) {
|
|
338
|
-
if (!availableMatchers.has(matcher)) {
|
|
339
|
-
issues.push({
|
|
340
|
-
path,
|
|
341
|
-
message: `Matcher ${matcher} is used but not available. Did you forget to pass it to createI18n?`
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
const translations = pathTranslations[path];
|
|
346
|
-
if (!translations)
|
|
347
|
-
continue;
|
|
348
|
-
for (const [lang, translatedPath] of Object.entries(translations)) {
|
|
349
|
-
if (!isValidPath(translatedPath)) {
|
|
350
|
-
issues.push({
|
|
351
|
-
path,
|
|
352
|
-
message: `The translation for language ${lang} must start with a slash.`
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
const { params: actualParams } = parseRouteDefinition(translatedPath);
|
|
356
|
-
let paramsDontMatch = false;
|
|
357
|
-
for (const param of expectedParams) {
|
|
358
|
-
if (!actualParams.some((actualParam) => paramsAreEqual(param, actualParam))) {
|
|
359
|
-
paramsDontMatch = true;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (expectedParams.length !== actualParams.length) {
|
|
363
|
-
paramsDontMatch = true;
|
|
364
|
-
}
|
|
365
|
-
if (paramsDontMatch) {
|
|
366
|
-
issues.push({
|
|
367
|
-
path,
|
|
368
|
-
message: `The translation for language ${lang} must have the same parameters as the canonical path.`
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
const translatedLanguages = new Set(Object.keys(translations));
|
|
373
|
-
if (!isSubset(expectedLanguages, translatedLanguages)) {
|
|
374
|
-
const missingLanguages = new Set(expectedLanguages);
|
|
375
|
-
for (const lang of translatedLanguages) {
|
|
376
|
-
missingLanguages.delete(lang);
|
|
377
|
-
}
|
|
378
|
-
issues.push({
|
|
379
|
-
path,
|
|
380
|
-
message: `The following languages are missing translations: ${[...missingLanguages].join(
|
|
381
|
-
", "
|
|
382
|
-
)}`
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
return issues;
|
|
387
|
-
}
|
|
388
|
-
function paramsAreEqual(param1, param2) {
|
|
389
|
-
return param1.chained == param2.chained && param1.matcher == param2.matcher && param1.name == param2.name && param1.optional == param2.optional && param1.rest == param2.rest;
|
|
390
|
-
}
|
|
391
|
-
function isValidPath(maybePath) {
|
|
392
|
-
return maybePath.startsWith("/");
|
|
393
|
-
}
|
|
394
|
-
function isSubset(a, b) {
|
|
395
|
-
for (const value of a) {
|
|
396
|
-
if (!b.has(value))
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
return true;
|
|
400
|
-
}
|
|
401
|
-
function prettyPrintPathDefinitionIssues(issues) {
|
|
402
|
-
return issues.map((issue) => `${issue.path}: ${issue.message}`).join("\n");
|
|
403
|
-
}
|
|
404
|
-
const resolveUserPathDefinitions = (userTranslations, availableLanguageTags) => Object.fromEntries(
|
|
405
|
-
Object.entries(userTranslations).map(([path, translation]) => [
|
|
406
|
-
path,
|
|
407
|
-
typeof translation === "object" ? translation : fromMessage(translation, availableLanguageTags)
|
|
408
|
-
])
|
|
409
|
-
);
|
|
410
|
-
const fromMessage = (message, availableLanguageTags) => Object.fromEntries(
|
|
411
|
-
availableLanguageTags.map((languageTag) => [languageTag, message({}, { languageTag })])
|
|
412
|
-
);
|
|
413
|
-
export {
|
|
414
|
-
bestMatch,
|
|
415
|
-
detectLanguageFromPath,
|
|
416
|
-
negotiateLanguagePreferences,
|
|
417
|
-
parseRouteDefinition,
|
|
418
|
-
prettyPrintPathDefinitionIssues,
|
|
419
|
-
resolveRoute,
|
|
420
|
-
resolveUserPathDefinitions,
|
|
421
|
-
validatePathTranslations
|
|
422
|
-
};
|
|
1
|
+
export { negotiateLanguagePreferences } from "./negotiation/language.js";
|
|
2
|
+
export { detectLanguageFromPath } from "./routing/detectLanguage.js";
|
|
3
|
+
export { bestMatch, resolveRoute, parseRouteDefinition, } from "./routing/routeDefinitions.js";
|
|
4
|
+
export { validatePathTranslations, prettyPrintPathDefinitionIssues, } from "./routing/validatePathTranslations.js";
|
|
5
|
+
export { resolveUserPathDefinitions, } from "./routing/resolveUserPathDefinitions.js";
|
|
@@ -7,3 +7,4 @@
|
|
|
7
7
|
* @returns The acceptable available language tags in descending order of preference
|
|
8
8
|
*/
|
|
9
9
|
export declare function negotiateLanguagePreferences<T extends string = string>(accept: string | undefined | null, availableLanguageTags: readonly T[]): T[];
|
|
10
|
+
//# sourceMappingURL=language.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../src/adapter-utils/negotiation/language.ts"],"names":[],"mappings":"AA+EA;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACrE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACjC,qBAAqB,EAAE,SAAS,CAAC,EAAE,GACjC,CAAC,EAAE,CAkBL"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Vendored in from https://github.com/jshttp/negotiator
|
|
2
|
+
// Rewritten in Typescript & annotated by Loris Sigrist
|
|
3
|
+
/**
|
|
4
|
+
* Negotiates which of the provided language tags is preferred from an Accept-Language header
|
|
5
|
+
*
|
|
6
|
+
* @param accept The value of the Accept-Language header. If it's missing, it defaults to "*" as per RFC 2616 sec 14.4
|
|
7
|
+
* @param availableLanguageTags The BCP 47 language tags that are available
|
|
8
|
+
*
|
|
9
|
+
* @returns The acceptable available language tags in descending order of preference
|
|
10
|
+
*/
|
|
11
|
+
export function negotiateLanguagePreferences(accept, availableLanguageTags) {
|
|
12
|
+
// No accept-language header -> default to * as per RFC 2616 sec 14.4
|
|
13
|
+
accept ||= "*";
|
|
14
|
+
const acceptLanguageSpecs = parseAcceptLanguageHeader(accept);
|
|
15
|
+
// compare each avaibale language to each language in the Accept-Language header
|
|
16
|
+
// and find the one with the highest priority
|
|
17
|
+
const priorities = availableLanguageTags.map((languageTag, index) => getHighestLanguagePriority(languageTag, acceptLanguageSpecs, index));
|
|
18
|
+
// sorted list of accepted languages
|
|
19
|
+
return priorities
|
|
20
|
+
.filter((prio) => prio.quality > 0) //filter out all languages that didn't match any of the headers whatsoever
|
|
21
|
+
.sort(bySpecificity)
|
|
22
|
+
.sort(byQuality)
|
|
23
|
+
.map((priority) => priority.languageTag);
|
|
24
|
+
}
|
|
25
|
+
function parseAcceptLanguageHeader(acceptLanguage) {
|
|
26
|
+
return acceptLanguage
|
|
27
|
+
.split(",")
|
|
28
|
+
.map((dfn) => dfn.trim())
|
|
29
|
+
.map((dfn, index) => parseLanguage(dfn, index))
|
|
30
|
+
.filter((maybeSpec) => Boolean(maybeSpec)); //filter out malformed entries
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse a single language from the Accept-Language header.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* parseLanguage("en-GB;q=0.8", 6) //{ prefix: "en", suffix: "GB", full: "en-GB", quality: 0.8, index: 6 }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param languageTag The string to parse
|
|
41
|
+
* @param index The index of the language in the Accept-Language header
|
|
42
|
+
*/
|
|
43
|
+
function parseLanguage(languageTag, index) {
|
|
44
|
+
const LANGUAGE_REGEXP = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;
|
|
45
|
+
const match = LANGUAGE_REGEXP.exec(languageTag);
|
|
46
|
+
//Bail if the string is malformed
|
|
47
|
+
if (!match)
|
|
48
|
+
return undefined;
|
|
49
|
+
const [, prefix, suffix, qualityMatch] = match;
|
|
50
|
+
//shoud never happen given that the regex forces it to be there
|
|
51
|
+
if (!prefix)
|
|
52
|
+
throw new Error(`Invalid language tag: ${languageTag}`);
|
|
53
|
+
const full = suffix ? `${prefix}-${suffix}` : prefix;
|
|
54
|
+
/**
|
|
55
|
+
* If the language specifies a quality, parse it, otherwise default to 1
|
|
56
|
+
* as per RFC 2616
|
|
57
|
+
*/
|
|
58
|
+
const quality = parseQuality(qualityMatch ?? "") ?? 1;
|
|
59
|
+
return {
|
|
60
|
+
prefix,
|
|
61
|
+
suffix,
|
|
62
|
+
quality,
|
|
63
|
+
index,
|
|
64
|
+
full,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function parseQuality(qualityMatch) {
|
|
68
|
+
return qualityMatch
|
|
69
|
+
.split(";")
|
|
70
|
+
.map((param) => param.split("="))
|
|
71
|
+
.filter((p) => p[0] == "q" && !!p[1]) //filter out everything that's malformed or not a quality
|
|
72
|
+
.map(([, value]) => parseFloat(value))[0]; //parse the quality value & return the first one
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Calculates the LanguagePriority of the availableLanguageTag
|
|
76
|
+
* relative to all acceptableLanguages and returns the greatest one
|
|
77
|
+
*/
|
|
78
|
+
function getHighestLanguagePriority(
|
|
79
|
+
/**
|
|
80
|
+
* A language tag that's available in the project
|
|
81
|
+
*/
|
|
82
|
+
languageTag,
|
|
83
|
+
/**
|
|
84
|
+
* The langauges from the Accept-Language header
|
|
85
|
+
*/
|
|
86
|
+
acceptableLanguages,
|
|
87
|
+
/**
|
|
88
|
+
* The index of the available language among the available languages
|
|
89
|
+
*/
|
|
90
|
+
index) {
|
|
91
|
+
const priorities = acceptableLanguages
|
|
92
|
+
.map((spec) => calculatePriority(languageTag, spec, index))
|
|
93
|
+
.filter((prio) => Boolean(prio));
|
|
94
|
+
const highestPriority = priorities.sort(bySpecificity)[0] || {
|
|
95
|
+
languageTag,
|
|
96
|
+
index: 0,
|
|
97
|
+
order: -1,
|
|
98
|
+
quality: 0,
|
|
99
|
+
specificity: 0,
|
|
100
|
+
};
|
|
101
|
+
return highestPriority;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Calculates the priority of an available language relative to an acceptable language
|
|
105
|
+
* @param languageTag A language that is available in the project
|
|
106
|
+
* @param spec A parsed language from the Accept-Language header
|
|
107
|
+
* @param index The index of the available language
|
|
108
|
+
* @returns The priority of the language
|
|
109
|
+
*/
|
|
110
|
+
function calculatePriority(languageTag, spec, index) {
|
|
111
|
+
const parsed = parseLanguage(languageTag, 0);
|
|
112
|
+
if (!parsed)
|
|
113
|
+
return undefined;
|
|
114
|
+
let specificity = 0b000;
|
|
115
|
+
if (spec.full.toLowerCase() === parsed.full.toLowerCase()) {
|
|
116
|
+
specificity = 0b100;
|
|
117
|
+
}
|
|
118
|
+
else if (spec.prefix.toLowerCase() === parsed.full.toLowerCase()) {
|
|
119
|
+
specificity = 0b010;
|
|
120
|
+
}
|
|
121
|
+
else if (spec.full.toLowerCase() === parsed.prefix.toLowerCase()) {
|
|
122
|
+
specificity = 0b001;
|
|
123
|
+
}
|
|
124
|
+
// if there is no specificity at all _and_ we're not considering a wildcard
|
|
125
|
+
// then we bail
|
|
126
|
+
if (specificity === 0 && spec.full !== "*")
|
|
127
|
+
return undefined;
|
|
128
|
+
return {
|
|
129
|
+
languageTag,
|
|
130
|
+
index,
|
|
131
|
+
order: spec.index,
|
|
132
|
+
quality: spec.quality,
|
|
133
|
+
specificity,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const byQuality = (a, b) => b.quality - a.quality;
|
|
137
|
+
const bySpecificity = (a, b) => b.specificity - a.specificity || a.order - b.order || a.index - b.index;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.test.d.ts","sourceRoot":"","sources":["../../../src/adapter-utils/negotiation/language.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { negotiateLanguagePreferences } from "./language.js";
|
|
3
|
+
describe("preferredLanguages", () => {
|
|
4
|
+
it("should return the acceptable languages", () => {
|
|
5
|
+
expect(negotiateLanguagePreferences("de-CH", ["de", "de-CH"])).toEqual([
|
|
6
|
+
"de-CH",
|
|
7
|
+
"de",
|
|
8
|
+
]);
|
|
9
|
+
});
|
|
10
|
+
it("should return an empty array if there are no acceptable languages", () => {
|
|
11
|
+
expect(negotiateLanguagePreferences("de-CH", [])).toEqual([]);
|
|
12
|
+
});
|
|
13
|
+
it("should sort the matches by quality", () => {
|
|
14
|
+
const headerValue = "fr-CH, fr;q=0.6, en;q=0.8, de;q=0.7, *;q=0.5";
|
|
15
|
+
expect(negotiateLanguagePreferences(headerValue, ["fr-CH", "fr", "en", "de"])).toEqual(["fr-CH", "en", "de", "fr"]);
|
|
16
|
+
});
|
|
17
|
+
it("should return the available languages if the accept header is missing", () => {
|
|
18
|
+
expect(negotiateLanguagePreferences(undefined, ["en-US", "en-GB", "de"])).toEqual(["en-US", "en-GB", "de"]);
|
|
19
|
+
});
|
|
20
|
+
it("should use the index of the language as a tie-breaker if the quality is the same", () => {
|
|
21
|
+
const headerValue = "fr-CH, fr;q=0.8, en;q=0.8, de;q=0.7, *;q=0.5";
|
|
22
|
+
expect(negotiateLanguagePreferences(headerValue, ["fr-CH", "fr", "en", "de"])).toEqual(["fr-CH", "fr", "en", "de"]);
|
|
23
|
+
});
|
|
24
|
+
});
|