@inlang/sdk 0.36.4 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/database/initDb.d.ts +7 -0
- package/dist/database/initDb.d.ts.map +1 -0
- package/dist/database/initDb.js +36 -0
- package/dist/database/initDb.js.map +1 -0
- package/dist/database/initDbAndSchema.test.d.ts +2 -0
- package/dist/database/initDbAndSchema.test.d.ts.map +1 -0
- package/dist/database/initDbAndSchema.test.js +110 -0
- package/dist/database/initDbAndSchema.test.js.map +1 -0
- package/dist/database/jsonbPlugin.d.ts +20 -0
- package/dist/database/jsonbPlugin.d.ts.map +1 -0
- package/dist/database/jsonbPlugin.js +183 -0
- package/dist/database/jsonbPlugin.js.map +1 -0
- package/dist/database/jsonbPlugin.test.d.ts +2 -0
- package/dist/database/jsonbPlugin.test.d.ts.map +1 -0
- package/dist/database/jsonbPlugin.test.js +119 -0
- package/dist/database/jsonbPlugin.test.js.map +1 -0
- package/dist/database/schema.d.ts +74 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +45 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/helper.d.ts +71 -0
- package/dist/helper.d.ts.map +1 -0
- package/dist/helper.js +91 -0
- package/dist/helper.js.map +1 -0
- package/dist/human-id/human-id.d.ts +3 -0
- package/dist/human-id/human-id.d.ts.map +1 -0
- package/dist/human-id/human-id.js +12 -0
- package/dist/human-id/human-id.js.map +1 -0
- package/dist/human-id/words.d.ts.map +1 -0
- package/dist/{storage/human-id → human-id}/words.js +4 -0
- package/dist/human-id/words.js.map +1 -0
- package/dist/human-id/words.test.d.ts.map +1 -0
- package/dist/{storage/human-id → human-id}/words.test.js +4 -0
- package/dist/human-id/words.test.js.map +1 -0
- package/dist/import-export/exportFiles.d.ts +11 -0
- package/dist/import-export/exportFiles.d.ts.map +1 -0
- package/dist/import-export/exportFiles.js +26 -0
- package/dist/import-export/exportFiles.js.map +1 -0
- package/dist/import-export/importFiles.d.ts +13 -0
- package/dist/import-export/importFiles.d.ts.map +1 -0
- package/dist/import-export/importFiles.js +124 -0
- package/dist/import-export/importFiles.js.map +1 -0
- package/dist/import-export/importFiles.test.d.ts +2 -0
- package/dist/import-export/importFiles.test.d.ts.map +1 -0
- package/dist/import-export/importFiles.test.js +179 -0
- package/dist/import-export/importFiles.test.js.map +1 -0
- package/dist/import-export/roundtrip.test.d.ts +2 -0
- package/dist/import-export/roundtrip.test.d.ts.map +1 -0
- package/dist/import-export/roundtrip.test.js +273 -0
- package/dist/import-export/roundtrip.test.js.map +1 -0
- package/dist/import-export/upsertBundleNestedMatchByProperties.d.ts +4 -0
- package/dist/import-export/upsertBundleNestedMatchByProperties.d.ts.map +1 -0
- package/dist/import-export/upsertBundleNestedMatchByProperties.js +58 -0
- package/dist/import-export/upsertBundleNestedMatchByProperties.js.map +1 -0
- package/dist/index.d.ts +21 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -17
- package/dist/index.js.map +1 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.d.ts +9 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.js +84 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.js.map +1 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts +2 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.test.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.test.js +85 -0
- package/dist/json-schema/old-v1-message/fromMessageV1.test.js.map +1 -0
- package/dist/json-schema/old-v1-message/schemaV1.d.ts +86 -0
- package/dist/json-schema/old-v1-message/schemaV1.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/schemaV1.js +35 -0
- package/dist/json-schema/old-v1-message/schemaV1.js.map +1 -0
- package/dist/json-schema/old-v1-message/toMessageV1.d.ts +9 -0
- package/dist/json-schema/old-v1-message/toMessageV1.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/toMessageV1.js +67 -0
- package/dist/json-schema/old-v1-message/toMessageV1.js.map +1 -0
- package/dist/json-schema/old-v1-message/toMessageV1.test.d.ts +2 -0
- package/dist/json-schema/old-v1-message/toMessageV1.test.d.ts.map +1 -0
- package/dist/json-schema/old-v1-message/toMessageV1.test.js +85 -0
- package/dist/json-schema/old-v1-message/toMessageV1.test.js.map +1 -0
- package/dist/json-schema/pattern.d.ts +190 -0
- package/dist/json-schema/pattern.d.ts.map +1 -0
- package/dist/json-schema/pattern.js +43 -0
- package/dist/json-schema/pattern.js.map +1 -0
- package/dist/json-schema/settings.d.ts +31 -0
- package/dist/json-schema/settings.d.ts.map +1 -0
- package/dist/json-schema/settings.js +96 -0
- package/dist/json-schema/settings.js.map +1 -0
- package/dist/json-schema/settings.test-d.d.ts +2 -0
- package/dist/json-schema/settings.test-d.d.ts.map +1 -0
- package/dist/json-schema/settings.test-d.js +20 -0
- package/dist/json-schema/settings.test-d.js.map +1 -0
- package/dist/lix-plugin/applyChanges.d.ts +3 -0
- package/dist/lix-plugin/applyChanges.d.ts.map +1 -0
- package/dist/lix-plugin/applyChanges.js +127 -0
- package/dist/lix-plugin/applyChanges.js.map +1 -0
- package/dist/lix-plugin/applyChanges.test.d.ts +2 -0
- package/dist/lix-plugin/applyChanges.test.d.ts.map +1 -0
- package/dist/lix-plugin/applyChanges.test.js +135 -0
- package/dist/lix-plugin/applyChanges.test.js.map +1 -0
- package/dist/lix-plugin/detectConflicts.d.ts +3 -0
- package/dist/lix-plugin/detectConflicts.d.ts.map +1 -0
- package/dist/lix-plugin/detectConflicts.js +47 -0
- package/dist/lix-plugin/detectConflicts.js.map +1 -0
- package/dist/lix-plugin/detectConflicts.test.d.ts +2 -0
- package/dist/lix-plugin/detectConflicts.test.d.ts.map +1 -0
- package/dist/lix-plugin/detectConflicts.test.js +251 -0
- package/dist/lix-plugin/detectConflicts.test.js.map +1 -0
- package/dist/lix-plugin/inlangLixPluginV1.d.ts +8 -0
- package/dist/lix-plugin/inlangLixPluginV1.d.ts.map +1 -0
- package/dist/lix-plugin/inlangLixPluginV1.js +109 -0
- package/dist/lix-plugin/inlangLixPluginV1.js.map +1 -0
- package/dist/lix-plugin/inlangLixPluginV1.test.d.ts +2 -0
- package/dist/lix-plugin/inlangLixPluginV1.test.d.ts.map +1 -0
- package/dist/lix-plugin/inlangLixPluginV1.test.js +418 -0
- package/dist/lix-plugin/inlangLixPluginV1.test.js.map +1 -0
- package/dist/lix-plugin/merge.test.d.ts +2 -0
- package/dist/lix-plugin/merge.test.d.ts.map +1 -0
- package/dist/lix-plugin/merge.test.js +120 -0
- package/dist/lix-plugin/merge.test.js.map +1 -0
- package/dist/lix-plugin/resolveConflictBySelecting.test.d.ts +2 -0
- package/dist/lix-plugin/resolveConflictBySelecting.test.d.ts.map +1 -0
- package/dist/lix-plugin/resolveConflictBySelecting.test.js +176 -0
- package/dist/lix-plugin/resolveConflictBySelecting.test.js.map +1 -0
- package/dist/migrations/v2/createMessageV1.d.ts +28 -0
- package/dist/migrations/v2/createMessageV1.d.ts.map +1 -0
- package/dist/migrations/v2/createMessageV1.js +31 -0
- package/dist/migrations/v2/createMessageV1.js.map +1 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts +9 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.d.ts.map +1 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.js +31 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.js.map +1 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts +2 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.d.ts.map +1 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js +45 -0
- package/dist/migrations/v2/withLanguageTagToLocaleMigration.test.js.map +1 -0
- package/dist/plugin/cache.d.ts +6 -0
- package/dist/plugin/cache.d.ts.map +1 -0
- package/dist/plugin/cache.js +59 -0
- package/dist/plugin/cache.js.map +1 -0
- package/dist/plugin/cache.test.d.ts +2 -0
- package/dist/plugin/cache.test.d.ts.map +1 -0
- package/dist/plugin/cache.test.js +61 -0
- package/dist/plugin/cache.test.js.map +1 -0
- package/dist/plugin/errors.d.ts +41 -0
- package/dist/plugin/errors.d.ts.map +1 -0
- package/dist/plugin/errors.js +48 -0
- package/dist/plugin/errors.js.map +1 -0
- package/dist/plugin/importPlugins.d.ts +19 -0
- package/dist/plugin/importPlugins.d.ts.map +1 -0
- package/dist/plugin/importPlugins.js +43 -0
- package/dist/plugin/importPlugins.js.map +1 -0
- package/dist/plugin/importPlugins.test.d.ts +2 -0
- package/dist/plugin/importPlugins.test.d.ts.map +1 -0
- package/dist/plugin/importPlugins.test.js +95 -0
- package/dist/plugin/importPlugins.test.js.map +1 -0
- package/dist/plugin/meta/ideExtension.d.ts +54 -0
- package/dist/plugin/meta/ideExtension.d.ts.map +1 -0
- package/dist/plugin/meta/ideExtension.js +5 -0
- package/dist/plugin/meta/ideExtension.js.map +1 -0
- package/dist/plugin/schema.d.ts +152 -0
- package/dist/plugin/schema.d.ts.map +1 -0
- package/dist/plugin/schema.js +5 -0
- package/dist/plugin/schema.js.map +1 -0
- package/dist/project/api.d.ts +74 -0
- package/dist/project/api.d.ts.map +1 -0
- package/dist/project/api.js +5 -0
- package/dist/project/api.js.map +1 -0
- package/dist/project/initHandleSaveToLixOnChange.d.ts +14 -0
- package/dist/project/initHandleSaveToLixOnChange.d.ts.map +1 -0
- package/dist/project/initHandleSaveToLixOnChange.js +87 -0
- package/dist/project/initHandleSaveToLixOnChange.js.map +1 -0
- package/dist/project/loadProject.d.ts +53 -0
- package/dist/project/loadProject.d.ts.map +1 -0
- package/dist/project/loadProject.js +168 -0
- package/dist/project/loadProject.js.map +1 -0
- package/dist/project/loadProject.test.d.ts.map +1 -0
- package/dist/project/loadProject.test.js +146 -0
- package/dist/project/loadProject.test.js.map +1 -0
- package/dist/project/loadProjectFromDirectory.d.ts +77 -0
- package/dist/project/loadProjectFromDirectory.d.ts.map +1 -0
- package/dist/project/loadProjectFromDirectory.js +584 -0
- package/dist/project/loadProjectFromDirectory.js.map +1 -0
- package/dist/project/loadProjectFromDirectory.test.d.ts +2 -0
- package/dist/project/loadProjectFromDirectory.test.d.ts.map +1 -0
- package/dist/project/loadProjectFromDirectory.test.js +663 -0
- package/dist/project/loadProjectFromDirectory.test.js.map +1 -0
- package/dist/project/loadProjectInMemory.d.ts +8 -0
- package/dist/project/loadProjectInMemory.d.ts.map +1 -0
- package/dist/project/loadProjectInMemory.js +32 -0
- package/dist/project/loadProjectInMemory.js.map +1 -0
- package/dist/project/loadProjectInMemory.test.d.ts +2 -0
- package/dist/project/loadProjectInMemory.test.d.ts.map +1 -0
- package/dist/project/loadProjectInMemory.test.js +27 -0
- package/dist/project/loadProjectInMemory.test.js.map +1 -0
- package/dist/project/maybeCaptureTelemetry.d.ts +15 -0
- package/dist/project/maybeCaptureTelemetry.d.ts.map +1 -0
- package/dist/project/maybeCaptureTelemetry.js +58 -0
- package/dist/project/maybeCaptureTelemetry.js.map +1 -0
- package/dist/project/maybeCaptureTelemetry.test.d.ts +2 -0
- package/dist/project/maybeCaptureTelemetry.test.d.ts.map +1 -0
- package/dist/project/maybeCaptureTelemetry.test.js +71 -0
- package/dist/project/maybeCaptureTelemetry.test.js.map +1 -0
- package/dist/project/newProject.d.ts +17 -0
- package/dist/project/newProject.d.ts.map +1 -0
- package/dist/project/newProject.js +71 -0
- package/dist/project/newProject.js.map +1 -0
- package/dist/project/newProject.test.d.ts +2 -0
- package/dist/project/newProject.test.d.ts.map +1 -0
- package/dist/project/newProject.test.js +37 -0
- package/dist/project/newProject.test.js.map +1 -0
- package/dist/project/saveProjectToDirectory.d.ts +8 -0
- package/dist/project/saveProjectToDirectory.d.ts.map +1 -0
- package/dist/project/saveProjectToDirectory.js +86 -0
- package/dist/project/saveProjectToDirectory.js.map +1 -0
- package/dist/project/saveProjectToDirectory.test.d.ts +2 -0
- package/dist/project/saveProjectToDirectory.test.d.ts.map +1 -0
- package/dist/project/saveProjectToDirectory.test.js +245 -0
- package/dist/project/saveProjectToDirectory.test.js.map +1 -0
- package/dist/project/state/id$.d.ts +6 -0
- package/dist/project/state/id$.d.ts.map +1 -0
- package/dist/project/state/id$.js +19 -0
- package/dist/project/state/id$.js.map +1 -0
- package/dist/project/state/id$.test.d.ts +2 -0
- package/dist/project/state/id$.test.d.ts.map +1 -0
- package/dist/project/state/id$.test.js +36 -0
- package/dist/project/state/id$.test.js.map +1 -0
- package/dist/project/state/setSettings.d.ts +7 -0
- package/dist/project/state/setSettings.d.ts.map +1 -0
- package/dist/project/state/setSettings.js +16 -0
- package/dist/project/state/setSettings.js.map +1 -0
- package/dist/project/state/setSettings.test.d.ts +2 -0
- package/dist/project/state/setSettings.test.d.ts.map +1 -0
- package/dist/project/state/setSettings.test.js +58 -0
- package/dist/project/state/setSettings.test.js.map +1 -0
- package/dist/project/state/settings$.d.ts +7 -0
- package/dist/project/state/settings$.d.ts.map +1 -0
- package/dist/project/state/settings$.js +21 -0
- package/dist/project/state/settings$.js.map +1 -0
- package/dist/project/state/settings$.test.d.ts +2 -0
- package/dist/project/state/settings$.test.d.ts.map +1 -0
- package/dist/project/state/settings$.test.js +51 -0
- package/dist/project/state/settings$.test.js.map +1 -0
- package/dist/project/state/state.d.ts +58 -0
- package/dist/project/state/state.d.ts.map +1 -0
- package/dist/project/state/state.js +67 -0
- package/dist/project/state/state.js.map +1 -0
- package/dist/project/state/state.test.d.ts +2 -0
- package/dist/project/state/state.test.d.ts.map +1 -0
- package/dist/project/state/state.test.js +103 -0
- package/dist/project/state/state.test.js.map +1 -0
- package/dist/query-utilities/index.d.ts +5 -0
- package/dist/query-utilities/index.d.ts.map +1 -0
- package/dist/query-utilities/index.js +8 -0
- package/dist/query-utilities/index.js.map +1 -0
- package/dist/query-utilities/insertBundleNested.d.ts +4 -0
- package/dist/query-utilities/insertBundleNested.d.ts.map +1 -0
- package/dist/query-utilities/insertBundleNested.js +39 -0
- package/dist/query-utilities/insertBundleNested.js.map +1 -0
- package/dist/query-utilities/pollQuery.d.ts +14 -0
- package/dist/query-utilities/pollQuery.d.ts.map +1 -0
- package/dist/query-utilities/pollQuery.js +22 -0
- package/dist/query-utilities/pollQuery.js.map +1 -0
- package/dist/query-utilities/pollQuery.test.d.ts +2 -0
- package/dist/query-utilities/pollQuery.test.d.ts.map +1 -0
- package/dist/query-utilities/pollQuery.test.js +67 -0
- package/dist/query-utilities/pollQuery.test.js.map +1 -0
- package/dist/query-utilities/selectBundleNested.d.ts +107 -0
- package/dist/query-utilities/selectBundleNested.d.ts.map +1 -0
- package/dist/query-utilities/selectBundleNested.js +43 -0
- package/dist/query-utilities/selectBundleNested.js.map +1 -0
- package/dist/query-utilities/updateBundleNested.d.ts +12 -0
- package/dist/query-utilities/updateBundleNested.d.ts.map +1 -0
- package/dist/query-utilities/updateBundleNested.js +25 -0
- package/dist/query-utilities/updateBundleNested.js.map +1 -0
- package/dist/query-utilities/upsertBundleNested.d.ts +4 -0
- package/dist/query-utilities/upsertBundleNested.d.ts.map +1 -0
- package/dist/query-utilities/upsertBundleNested.js +50 -0
- package/dist/query-utilities/upsertBundleNested.js.map +1 -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 +9 -0
- package/dist/services/env-variables/index.js.map +1 -0
- package/dist/services/error-reporting/index.d.ts +15 -0
- package/dist/services/error-reporting/index.d.ts.map +1 -0
- package/dist/services/error-reporting/index.js +30 -0
- package/dist/services/error-reporting/index.js.map +1 -0
- package/dist/{telemetry → services/telemetry}/capture.d.ts +5 -2
- package/dist/services/telemetry/capture.d.ts.map +1 -0
- package/dist/services/telemetry/capture.js +76 -0
- package/dist/services/telemetry/capture.js.map +1 -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 +46 -0
- package/dist/services/telemetry/capture.test.js.map +1 -0
- package/dist/utilities/detectJsonFormatting.d.ts +11 -0
- package/dist/utilities/detectJsonFormatting.d.ts.map +1 -0
- package/dist/utilities/detectJsonFormatting.js +83 -0
- package/dist/utilities/detectJsonFormatting.js.map +1 -0
- package/dist/utilities/detectJsonFormatting.test.d.ts +2 -0
- package/dist/utilities/detectJsonFormatting.test.d.ts.map +1 -0
- package/dist/utilities/detectJsonFormatting.test.js +33 -0
- package/dist/utilities/detectJsonFormatting.test.js.map +1 -0
- package/package.json +32 -40
- package/src/database/initDb.ts +34 -0
- package/src/database/initDbAndSchema.test.ts +125 -0
- package/src/database/jsonbPlugin.test.ts +154 -0
- package/src/database/jsonbPlugin.ts +215 -0
- package/src/database/schema.ts +127 -0
- package/src/helper.ts +113 -0
- package/src/human-id/human-id.ts +14 -0
- package/src/{storage/human-id → human-id}/words.test.ts +14 -14
- package/src/{storage/human-id → human-id}/words.ts +4 -4
- package/src/import-export/exportFiles.ts +36 -0
- package/src/import-export/importFiles.test.ts +211 -0
- package/src/import-export/importFiles.ts +142 -0
- package/src/import-export/roundtrip.test.ts +313 -0
- package/src/import-export/upsertBundleNestedMatchByProperties.ts +74 -0
- package/src/index.ts +29 -37
- package/src/json-schema/old-v1-message/README.md +1 -0
- package/src/json-schema/old-v1-message/fromMessageV1.test.ts +87 -0
- package/src/json-schema/old-v1-message/fromMessageV1.ts +99 -0
- package/src/json-schema/old-v1-message/schemaV1.ts +66 -0
- package/src/json-schema/old-v1-message/toMessageV1.test.ts +87 -0
- package/src/json-schema/old-v1-message/toMessageV1.ts +79 -0
- package/src/json-schema/pattern.ts +59 -0
- package/src/json-schema/settings.test-d.ts +21 -0
- package/src/json-schema/settings.ts +138 -0
- package/src/lix-plugin/applyChanges.test.ts +150 -0
- package/src/lix-plugin/applyChanges.ts +171 -0
- package/src/lix-plugin/detectConflicts.test.ts +286 -0
- package/src/lix-plugin/detectConflicts.ts +62 -0
- package/src/lix-plugin/inlangLixPluginV1.test.ts +439 -0
- package/src/lix-plugin/inlangLixPluginV1.ts +132 -0
- package/src/lix-plugin/merge.test.ts +133 -0
- package/src/lix-plugin/resolveConflictBySelecting.test.ts +188 -0
- package/src/migrations/v2/createMessageV1.ts +37 -0
- package/src/migrations/v2/withLanguageTagToLocaleMigration.test.ts +51 -0
- package/src/migrations/v2/withLanguageTagToLocaleMigration.ts +31 -0
- package/src/plugin/cache.test.ts +83 -0
- package/src/plugin/cache.ts +79 -0
- package/src/plugin/errors.ts +67 -0
- package/src/plugin/importPlugins.test.ts +107 -0
- package/src/plugin/importPlugins.ts +60 -0
- package/src/plugin/meta/ideExtension.ts +56 -0
- package/src/plugin/schema.ts +165 -0
- package/src/project/api.ts +77 -0
- package/src/project/initHandleSaveToLixOnChange.ts +93 -0
- package/src/project/loadProject.test.ts +176 -0
- package/src/project/loadProject.ts +246 -0
- package/src/project/loadProjectFromDirectory.test.ts +854 -0
- package/src/project/loadProjectFromDirectory.ts +752 -0
- package/src/project/loadProjectInMemory.test.ts +29 -0
- package/src/project/loadProjectInMemory.ts +36 -0
- package/src/project/maybeCaptureTelemetry.test.ts +79 -0
- package/src/project/maybeCaptureTelemetry.ts +69 -0
- package/src/project/newProject.test.ts +36 -0
- package/src/project/newProject.ts +78 -0
- package/src/project/saveProjectToDirectory.test.ts +310 -0
- package/src/project/saveProjectToDirectory.ts +100 -0
- package/src/query-utilities/index.ts +4 -0
- package/src/query-utilities/insertBundleNested.ts +46 -0
- package/src/query-utilities/selectBundleNested.ts +46 -0
- package/src/query-utilities/updateBundleNested.ts +35 -0
- package/src/query-utilities/upsertBundleNested.ts +61 -0
- package/src/services/env-variables/createIndexFile.js +40 -0
- package/src/{env-variables → services/env-variables}/index.d.ts +8 -5
- package/src/services/error-reporting/index.ts +28 -0
- package/src/services/telemetry/capture.test.ts +50 -0
- package/src/services/telemetry/capture.ts +99 -0
- package/src/utilities/detectJsonFormatting.test.ts +38 -0
- package/src/utilities/detectJsonFormatting.ts +109 -0
- package/dist/adapter/solidAdapter.d.ts +0 -33
- package/dist/adapter/solidAdapter.d.ts.map +0 -1
- package/dist/adapter/solidAdapter.js +0 -40
- package/dist/adapter/solidAdapter.test.d.ts +0 -2
- package/dist/adapter/solidAdapter.test.d.ts.map +0 -1
- package/dist/adapter/solidAdapter.test.js +0 -356
- package/dist/api.d.ts +0 -113
- package/dist/api.d.ts.map +0 -1
- package/dist/api.js +0 -1
- package/dist/api.test-d.d.ts +0 -2
- package/dist/api.test-d.d.ts.map +0 -1
- package/dist/api.test-d.js +0 -4
- package/dist/createMessageLintReportsQuery.d.ts +0 -12
- package/dist/createMessageLintReportsQuery.d.ts.map +0 -1
- package/dist/createMessageLintReportsQuery.js +0 -176
- package/dist/createMessagesQuery.d.ts +0 -19
- package/dist/createMessagesQuery.d.ts.map +0 -1
- package/dist/createMessagesQuery.js +0 -451
- package/dist/createMessagesQuery.test.d.ts +0 -2
- package/dist/createMessagesQuery.test.d.ts.map +0 -1
- package/dist/createMessagesQuery.test.js +0 -402
- package/dist/createNewProject.d.ts +0 -12
- package/dist/createNewProject.d.ts.map +0 -1
- package/dist/createNewProject.js +0 -38
- package/dist/createNewProject.test.d.ts +0 -2
- package/dist/createNewProject.test.d.ts.map +0 -1
- package/dist/createNewProject.test.js +0 -91
- package/dist/createNodeishFsWithAbsolutePaths.d.ts +0 -12
- package/dist/createNodeishFsWithAbsolutePaths.d.ts.map +0 -1
- package/dist/createNodeishFsWithAbsolutePaths.js +0 -38
- package/dist/createNodeishFsWithAbsolutePaths.test.d.ts +0 -2
- package/dist/createNodeishFsWithAbsolutePaths.test.d.ts.map +0 -1
- package/dist/createNodeishFsWithAbsolutePaths.test.js +0 -44
- package/dist/createNodeishFsWithWatcher.d.ts +0 -14
- package/dist/createNodeishFsWithWatcher.d.ts.map +0 -1
- package/dist/createNodeishFsWithWatcher.js +0 -75
- package/dist/createNodeishFsWithWatcher.test.d.ts +0 -2
- package/dist/createNodeishFsWithWatcher.test.d.ts.map +0 -1
- package/dist/createNodeishFsWithWatcher.test.js +0 -38
- package/dist/defaultProjectSettings.d.ts +0 -14
- package/dist/defaultProjectSettings.d.ts.map +0 -1
- package/dist/defaultProjectSettings.js +0 -22
- package/dist/env-variables/index.d.ts +0 -4
- package/dist/env-variables/index.d.ts.map +0 -1
- package/dist/env-variables/index.js +0 -3
- package/dist/errors.d.ts +0 -48
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -62
- package/dist/lint/index.d.ts +0 -3
- package/dist/lint/index.d.ts.map +0 -1
- package/dist/lint/index.js +0 -2
- package/dist/lint/message/errors.d.ts +0 -7
- package/dist/lint/message/errors.d.ts.map +0 -1
- package/dist/lint/message/errors.js +0 -9
- package/dist/lint/message/lintMessages.d.ts +0 -13
- package/dist/lint/message/lintMessages.d.ts.map +0 -1
- package/dist/lint/message/lintMessages.js +0 -12
- package/dist/lint/message/lintMessages.test.d.ts +0 -2
- package/dist/lint/message/lintMessages.test.d.ts.map +0 -1
- package/dist/lint/message/lintMessages.test.js +0 -107
- package/dist/lint/message/lintSingleMessage.d.ts +0 -19
- package/dist/lint/message/lintSingleMessage.d.ts.map +0 -1
- package/dist/lint/message/lintSingleMessage.js +0 -38
- package/dist/lint/message/lintSingleMessage.test.d.ts +0 -2
- package/dist/lint/message/lintSingleMessage.test.d.ts.map +0 -1
- package/dist/lint/message/lintSingleMessage.test.js +0 -161
- package/dist/listProjects.d.ts +0 -5
- package/dist/listProjects.d.ts.map +0 -1
- package/dist/listProjects.js +0 -38
- package/dist/listProjects.test.d.ts +0 -2
- package/dist/listProjects.test.d.ts.map +0 -1
- package/dist/listProjects.test.js +0 -72
- package/dist/loadProject.d.ts +0 -19
- package/dist/loadProject.d.ts.map +0 -1
- package/dist/loadProject.js +0 -343
- package/dist/loadProject.test.d.ts.map +0 -1
- package/dist/loadProject.test.js +0 -975
- package/dist/messages/errors.d.ts +0 -13
- package/dist/messages/errors.d.ts.map +0 -1
- package/dist/messages/errors.js +0 -18
- package/dist/messages/index.d.ts +0 -3
- package/dist/messages/index.d.ts.map +0 -1
- package/dist/messages/index.js +0 -2
- package/dist/messages/variant.d.ts +0 -46
- package/dist/messages/variant.d.ts.map +0 -1
- package/dist/messages/variant.js +0 -176
- package/dist/messages/variant.test.d.ts +0 -2
- package/dist/messages/variant.test.d.ts.map +0 -1
- package/dist/messages/variant.test.js +0 -439
- package/dist/migrations/maybeAddModuleCache.d.ts +0 -6
- package/dist/migrations/maybeAddModuleCache.d.ts.map +0 -1
- package/dist/migrations/maybeAddModuleCache.js +0 -62
- package/dist/migrations/maybeCreateFirstProjectId.d.ts +0 -16
- package/dist/migrations/maybeCreateFirstProjectId.d.ts.map +0 -1
- package/dist/migrations/maybeCreateFirstProjectId.js +0 -46
- package/dist/migrations/maybeCreateFirstProjectId.test.d.ts +0 -2
- package/dist/migrations/maybeCreateFirstProjectId.test.d.ts.map +0 -1
- package/dist/migrations/maybeCreateFirstProjectId.test.js +0 -24
- package/dist/migrations/migrateToDirectory.d.ts +0 -10
- package/dist/migrations/migrateToDirectory.d.ts.map +0 -1
- package/dist/migrations/migrateToDirectory.js +0 -48
- package/dist/migrations/migrateToDirectory.test.d.ts +0 -2
- package/dist/migrations/migrateToDirectory.test.d.ts.map +0 -1
- package/dist/migrations/migrateToDirectory.test.js +0 -48
- package/dist/parseConfig.d.ts +0 -8
- package/dist/parseConfig.d.ts.map +0 -1
- package/dist/parseConfig.js +0 -26
- package/dist/persistence/batchedIO.d.ts +0 -11
- package/dist/persistence/batchedIO.d.ts.map +0 -1
- package/dist/persistence/batchedIO.js +0 -49
- package/dist/persistence/batchedIO.test.d.ts +0 -2
- package/dist/persistence/batchedIO.test.d.ts.map +0 -1
- package/dist/persistence/batchedIO.test.js +0 -56
- package/dist/persistence/filelock/acquireFileLock.d.ts +0 -3
- package/dist/persistence/filelock/acquireFileLock.d.ts.map +0 -1
- package/dist/persistence/filelock/acquireFileLock.js +0 -111
- package/dist/persistence/filelock/releaseLock.d.ts +0 -3
- package/dist/persistence/filelock/releaseLock.d.ts.map +0 -1
- package/dist/persistence/filelock/releaseLock.js +0 -24
- package/dist/persistence/store.d.ts +0 -107
- package/dist/persistence/store.d.ts.map +0 -1
- package/dist/persistence/store.js +0 -99
- package/dist/persistence/store.test.d.ts +0 -2
- package/dist/persistence/store.test.d.ts.map +0 -1
- package/dist/persistence/store.test.js +0 -79
- package/dist/persistence/storeApi.d.ts +0 -22
- package/dist/persistence/storeApi.d.ts.map +0 -1
- package/dist/persistence/storeApi.js +0 -1
- package/dist/reactivity/map.d.ts +0 -67
- package/dist/reactivity/map.d.ts.map +0 -1
- package/dist/reactivity/map.js +0 -143
- package/dist/reactivity/solid.d.ts +0 -14
- package/dist/reactivity/solid.d.ts.map +0 -1
- package/dist/reactivity/solid.js +0 -15
- package/dist/reactivity/solid.test.d.ts +0 -2
- package/dist/reactivity/solid.test.d.ts.map +0 -1
- package/dist/reactivity/solid.test.js +0 -189
- package/dist/reactivity/trigger.d.ts +0 -11
- package/dist/reactivity/trigger.d.ts.map +0 -1
- package/dist/reactivity/trigger.js +0 -46
- package/dist/resolve-modules/cache.d.ts +0 -6
- package/dist/resolve-modules/cache.d.ts.map +0 -1
- package/dist/resolve-modules/cache.js +0 -58
- package/dist/resolve-modules/errors.d.ts +0 -41
- package/dist/resolve-modules/errors.d.ts.map +0 -1
- package/dist/resolve-modules/errors.js +0 -45
- package/dist/resolve-modules/import.d.ts +0 -19
- package/dist/resolve-modules/import.d.ts.map +0 -1
- package/dist/resolve-modules/import.js +0 -102
- package/dist/resolve-modules/import.test.d.ts +0 -2
- package/dist/resolve-modules/import.test.d.ts.map +0 -1
- package/dist/resolve-modules/import.test.js +0 -47
- package/dist/resolve-modules/index.d.ts +0 -3
- package/dist/resolve-modules/index.d.ts.map +0 -1
- package/dist/resolve-modules/index.js +0 -2
- package/dist/resolve-modules/message-lint-rules/errors.d.ts +0 -9
- package/dist/resolve-modules/message-lint-rules/errors.d.ts.map +0 -1
- package/dist/resolve-modules/message-lint-rules/errors.js +0 -6
- package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.d.ts +0 -9
- package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.d.ts.map +0 -1
- package/dist/resolve-modules/message-lint-rules/resolveMessageLintRules.js +0 -24
- package/dist/resolve-modules/plugins/errors.d.ts +0 -33
- package/dist/resolve-modules/plugins/errors.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/errors.js +0 -38
- package/dist/resolve-modules/plugins/resolvePlugins.d.ts +0 -3
- package/dist/resolve-modules/plugins/resolvePlugins.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/resolvePlugins.js +0 -92
- package/dist/resolve-modules/plugins/resolvePlugins.test.d.ts +0 -2
- package/dist/resolve-modules/plugins/resolvePlugins.test.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/resolvePlugins.test.js +0 -252
- package/dist/resolve-modules/plugins/types.d.ts +0 -57
- package/dist/resolve-modules/plugins/types.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/types.js +0 -1
- package/dist/resolve-modules/plugins/types.test.d.ts +0 -2
- package/dist/resolve-modules/plugins/types.test.d.ts.map +0 -1
- package/dist/resolve-modules/plugins/types.test.js +0 -45
- package/dist/resolve-modules/resolveModules.d.ts +0 -3
- package/dist/resolve-modules/resolveModules.d.ts.map +0 -1
- package/dist/resolve-modules/resolveModules.js +0 -80
- package/dist/resolve-modules/resolveModules.test.d.ts +0 -2
- package/dist/resolve-modules/resolveModules.test.d.ts.map +0 -1
- package/dist/resolve-modules/resolveModules.test.js +0 -185
- package/dist/resolve-modules/types.d.ts +0 -63
- package/dist/resolve-modules/types.d.ts.map +0 -1
- package/dist/resolve-modules/types.js +0 -1
- package/dist/resolve-modules/validateModuleSettings.test.d.ts +0 -2
- package/dist/resolve-modules/validateModuleSettings.test.d.ts.map +0 -1
- package/dist/resolve-modules/validateModuleSettings.test.js +0 -71
- package/dist/resolve-modules/validatedModuleSettings.d.ts +0 -7
- package/dist/resolve-modules/validatedModuleSettings.d.ts.map +0 -1
- package/dist/resolve-modules/validatedModuleSettings.js +0 -11
- package/dist/storage/helper.d.ts +0 -11
- package/dist/storage/helper.d.ts.map +0 -1
- package/dist/storage/helper.js +0 -63
- package/dist/storage/helpers.test.d.ts +0 -2
- package/dist/storage/helpers.test.d.ts.map +0 -1
- package/dist/storage/helpers.test.js +0 -84
- package/dist/storage/human-id/human-readable-id.d.ts +0 -3
- package/dist/storage/human-id/human-readable-id.d.ts.map +0 -1
- package/dist/storage/human-id/human-readable-id.js +0 -20
- package/dist/storage/human-id/words.d.ts.map +0 -1
- package/dist/storage/human-id/words.test.d.ts.map +0 -1
- package/dist/telemetry/capture.d.ts.map +0 -1
- package/dist/telemetry/capture.js +0 -39
- package/dist/telemetry/groupIdentify.d.ts +0 -13
- package/dist/telemetry/groupIdentify.d.ts.map +0 -1
- package/dist/telemetry/groupIdentify.js +0 -35
- package/dist/test-utilities/createMessage.d.ts +0 -18
- package/dist/test-utilities/createMessage.d.ts.map +0 -1
- package/dist/test-utilities/createMessage.js +0 -17
- package/dist/test-utilities/createMessage.test.d.ts +0 -2
- package/dist/test-utilities/createMessage.test.d.ts.map +0 -1
- package/dist/test-utilities/createMessage.test.js +0 -106
- package/dist/test-utilities/index.d.ts +0 -3
- package/dist/test-utilities/index.d.ts.map +0 -1
- package/dist/test-utilities/index.js +0 -2
- package/dist/test-utilities/sleep.d.ts +0 -4
- package/dist/test-utilities/sleep.d.ts.map +0 -1
- package/dist/test-utilities/sleep.js +0 -9
- package/dist/v2/helper.d.ts +0 -43
- package/dist/v2/helper.d.ts.map +0 -1
- package/dist/v2/helper.js +0 -75
- package/dist/v2/helper.test.d.ts +0 -2
- package/dist/v2/helper.test.d.ts.map +0 -1
- package/dist/v2/helper.test.js +0 -92
- package/dist/v2/index.d.ts +0 -4
- package/dist/v2/index.d.ts.map +0 -1
- package/dist/v2/index.js +0 -2
- package/dist/v2/mocks/index.d.ts +0 -3
- package/dist/v2/mocks/index.d.ts.map +0 -1
- package/dist/v2/mocks/index.js +0 -2
- package/dist/v2/mocks/multipleMatcher/bundle.d.ts +0 -3
- package/dist/v2/mocks/multipleMatcher/bundle.d.ts.map +0 -1
- package/dist/v2/mocks/multipleMatcher/bundle.js +0 -194
- package/dist/v2/mocks/multipleMatcher/bundle.test.d.ts +0 -2
- package/dist/v2/mocks/multipleMatcher/bundle.test.d.ts.map +0 -1
- package/dist/v2/mocks/multipleMatcher/bundle.test.js +0 -10
- package/dist/v2/mocks/plural/bundle.d.ts +0 -3
- package/dist/v2/mocks/plural/bundle.d.ts.map +0 -1
- package/dist/v2/mocks/plural/bundle.js +0 -162
- package/dist/v2/mocks/plural/bundle.test.d.ts +0 -2
- package/dist/v2/mocks/plural/bundle.test.d.ts.map +0 -1
- package/dist/v2/mocks/plural/bundle.test.js +0 -15
- package/dist/v2/shim.d.ts +0 -12
- package/dist/v2/shim.d.ts.map +0 -1
- package/dist/v2/shim.js +0 -151
- package/dist/v2/shim.test.d.ts +0 -2
- package/dist/v2/shim.test.d.ts.map +0 -1
- package/dist/v2/shim.test.js +0 -49
- package/dist/v2/stubQueryApi.d.ts +0 -9
- package/dist/v2/stubQueryApi.d.ts.map +0 -1
- package/dist/v2/stubQueryApi.js +0 -38
- package/dist/v2/types.d.ts +0 -521
- package/dist/v2/types.d.ts.map +0 -1
- package/dist/v2/types.js +0 -78
- package/dist/validateProjectPath.d.ts +0 -17
- package/dist/validateProjectPath.d.ts.map +0 -1
- package/dist/validateProjectPath.js +0 -31
- package/dist/validateProjectPath.test.d.ts +0 -2
- package/dist/validateProjectPath.test.d.ts.map +0 -1
- package/dist/validateProjectPath.test.js +0 -40
- package/dist/versionedInterfaces.d.ts +0 -8
- package/dist/versionedInterfaces.d.ts.map +0 -1
- package/dist/versionedInterfaces.js +0 -8
- package/src/adapter/solidAdapter.test.ts +0 -472
- package/src/adapter/solidAdapter.ts +0 -79
- package/src/api.test-d.ts +0 -8
- package/src/api.ts +0 -116
- package/src/createMessageLintReportsQuery.ts +0 -225
- package/src/createMessagesQuery.test.ts +0 -538
- package/src/createMessagesQuery.ts +0 -635
- package/src/createNewProject.test.ts +0 -105
- package/src/createNewProject.ts +0 -46
- package/src/createNodeishFsWithAbsolutePaths.test.ts +0 -55
- package/src/createNodeishFsWithAbsolutePaths.ts +0 -52
- package/src/createNodeishFsWithWatcher.test.ts +0 -50
- package/src/createNodeishFsWithWatcher.ts +0 -85
- package/src/defaultProjectSettings.ts +0 -26
- package/src/env-variables/.prettierignore +0 -1
- package/src/env-variables/createIndexFile.js +0 -28
- package/src/errors.ts +0 -84
- package/src/lint/index.ts +0 -2
- package/src/lint/message/errors.ts +0 -9
- package/src/lint/message/lintMessages.test.ts +0 -126
- package/src/lint/message/lintMessages.ts +0 -25
- package/src/lint/message/lintSingleMessage.test.ts +0 -191
- package/src/lint/message/lintSingleMessage.ts +0 -57
- package/src/listProjects.test.ts +0 -91
- package/src/listProjects.ts +0 -48
- package/src/loadProject.test.ts +0 -1173
- package/src/loadProject.ts +0 -460
- package/src/messages/errors.ts +0 -25
- package/src/messages/index.ts +0 -2
- package/src/messages/variant.test.ts +0 -511
- package/src/messages/variant.ts +0 -247
- package/src/migrations/maybeAddModuleCache.ts +0 -68
- package/src/migrations/maybeCreateFirstProjectId.test.ts +0 -31
- package/src/migrations/maybeCreateFirstProjectId.ts +0 -51
- package/src/migrations/migrateToDirectory.test.ts +0 -54
- package/src/migrations/migrateToDirectory.ts +0 -62
- package/src/parseConfig.ts +0 -35
- package/src/persistence/batchedIO.test.ts +0 -63
- package/src/persistence/batchedIO.ts +0 -64
- package/src/persistence/filelock/acquireFileLock.ts +0 -129
- package/src/persistence/filelock/releaseLock.ts +0 -29
- package/src/persistence/store.test.ts +0 -102
- package/src/persistence/store.ts +0 -119
- package/src/persistence/storeApi.ts +0 -19
- package/src/reactivity/map.ts +0 -135
- package/src/reactivity/solid.test.ts +0 -222
- package/src/reactivity/solid.ts +0 -42
- package/src/reactivity/trigger.ts +0 -46
- package/src/resolve-modules/cache.ts +0 -89
- package/src/resolve-modules/errors.ts +0 -69
- package/src/resolve-modules/import.test.ts +0 -62
- package/src/resolve-modules/import.ts +0 -133
- package/src/resolve-modules/index.ts +0 -2
- package/src/resolve-modules/message-lint-rules/errors.ts +0 -9
- package/src/resolve-modules/message-lint-rules/resolveMessageLintRules.ts +0 -27
- package/src/resolve-modules/plugins/errors.ts +0 -56
- package/src/resolve-modules/plugins/resolvePlugins.test.ts +0 -301
- package/src/resolve-modules/plugins/resolvePlugins.ts +0 -129
- package/src/resolve-modules/plugins/types.test.ts +0 -53
- package/src/resolve-modules/plugins/types.ts +0 -76
- package/src/resolve-modules/resolveModules.test.ts +0 -224
- package/src/resolve-modules/resolveModules.ts +0 -113
- package/src/resolve-modules/types.ts +0 -72
- package/src/resolve-modules/validateModuleSettings.test.ts +0 -85
- package/src/resolve-modules/validatedModuleSettings.ts +0 -19
- package/src/storage/helper.ts +0 -74
- package/src/storage/helpers.test.ts +0 -95
- package/src/storage/human-id/human-readable-id.ts +0 -27
- package/src/telemetry/capture.ts +0 -49
- package/src/telemetry/groupIdentify.ts +0 -41
- package/src/test-utilities/createMessage.test.ts +0 -118
- package/src/test-utilities/createMessage.ts +0 -21
- package/src/test-utilities/index.ts +0 -2
- package/src/test-utilities/sleep.ts +0 -11
- package/src/v2/helper.test.ts +0 -95
- package/src/v2/helper.ts +0 -98
- package/src/v2/index.ts +0 -3
- package/src/v2/mocks/index.ts +0 -2
- package/src/v2/mocks/multipleMatcher/bundle.test.ts +0 -11
- package/src/v2/mocks/multipleMatcher/bundle.ts +0 -196
- package/src/v2/mocks/plural/bundle.test.ts +0 -18
- package/src/v2/mocks/plural/bundle.ts +0 -164
- package/src/v2/shim.test.ts +0 -56
- package/src/v2/shim.ts +0 -173
- package/src/v2/stubQueryApi.ts +0 -43
- package/src/v2/types.ts +0 -159
- package/src/validateProjectPath.test.ts +0 -50
- package/src/validateProjectPath.ts +0 -38
- package/src/versionedInterfaces.ts +0 -9
- /package/dist/{storage/human-id → human-id}/words.d.ts +0 -0
- /package/dist/{storage/human-id → human-id}/words.test.d.ts +0 -0
- /package/dist/{loadProject.test.d.ts → project/loadProject.test.d.ts} +0 -0
package/dist/loadProject.test.js
DELETED
|
@@ -1,975 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { describe, it, expect, vi } from "vitest";
|
|
3
|
-
import { loadProject } from "./loadProject.js";
|
|
4
|
-
import { ProjectSettingsFileJSONSyntaxError, ProjectSettingsFileNotFoundError, ProjectSettingsInvalidError, } from "./errors.js";
|
|
5
|
-
import { normalizePath } from "@lix-js/fs";
|
|
6
|
-
import { createMessage } from "./test-utilities/createMessage.js";
|
|
7
|
-
import { tryCatch } from "@inlang/result";
|
|
8
|
-
import { mockRepo } from "@lix-js/client";
|
|
9
|
-
import {} from "@lix-js/fs";
|
|
10
|
-
// eslint-disable-next-line no-restricted-imports -- test
|
|
11
|
-
import { readFileSync } from "node:fs";
|
|
12
|
-
// eslint-disable-next-line no-restricted-imports -- test
|
|
13
|
-
import { resolve } from "node:path";
|
|
14
|
-
// ------------------------------------------------------------------------------------------------
|
|
15
|
-
const getValue = (subscribable) => {
|
|
16
|
-
let value;
|
|
17
|
-
subscribable.subscribe((v) => void (value = v));
|
|
18
|
-
return value;
|
|
19
|
-
};
|
|
20
|
-
const settings = {
|
|
21
|
-
sourceLanguageTag: "en",
|
|
22
|
-
languageTags: ["en"],
|
|
23
|
-
modules: ["plugin.js", "lintRule.js"],
|
|
24
|
-
messageLintRuleLevels: {
|
|
25
|
-
"messageLintRule.project.missingTranslation": "error",
|
|
26
|
-
},
|
|
27
|
-
"plugin.project.i18next": {
|
|
28
|
-
pathPattern: "./examples/example01/{languageTag}.json",
|
|
29
|
-
variableReferencePattern: ["{", "}"],
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
const mockPlugin = {
|
|
33
|
-
id: "plugin.project.i18next",
|
|
34
|
-
description: { en: "Mock plugin description" },
|
|
35
|
-
displayName: { en: "Mock Plugin" },
|
|
36
|
-
loadMessages: () => exampleMessages,
|
|
37
|
-
saveMessages: () => undefined,
|
|
38
|
-
addCustomApi: () => ({
|
|
39
|
-
"app.project.ideExtension": {
|
|
40
|
-
messageReferenceMatcher: (text) => text,
|
|
41
|
-
},
|
|
42
|
-
}),
|
|
43
|
-
};
|
|
44
|
-
// TODO: use `createMessage` utility
|
|
45
|
-
const exampleMessages = [
|
|
46
|
-
{
|
|
47
|
-
id: "a",
|
|
48
|
-
alias: {},
|
|
49
|
-
selectors: [],
|
|
50
|
-
variants: [
|
|
51
|
-
{
|
|
52
|
-
languageTag: "en",
|
|
53
|
-
match: [],
|
|
54
|
-
pattern: [
|
|
55
|
-
{
|
|
56
|
-
type: "Text",
|
|
57
|
-
value: "test",
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: "b",
|
|
65
|
-
alias: {},
|
|
66
|
-
selectors: [],
|
|
67
|
-
variants: [
|
|
68
|
-
{
|
|
69
|
-
languageTag: "en",
|
|
70
|
-
match: [],
|
|
71
|
-
pattern: [
|
|
72
|
-
{
|
|
73
|
-
type: "Text",
|
|
74
|
-
value: "test",
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
];
|
|
81
|
-
const exampleAliasedMessages = [
|
|
82
|
-
{
|
|
83
|
-
id: "raw_tapir_pause_grateful",
|
|
84
|
-
alias: {
|
|
85
|
-
default: "a",
|
|
86
|
-
},
|
|
87
|
-
selectors: [],
|
|
88
|
-
variants: [
|
|
89
|
-
{
|
|
90
|
-
languageTag: "en",
|
|
91
|
-
match: [],
|
|
92
|
-
pattern: [
|
|
93
|
-
{
|
|
94
|
-
type: "Text",
|
|
95
|
-
value: "test",
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "dizzy_halibut_dial_vaguely",
|
|
103
|
-
alias: {
|
|
104
|
-
default: "b",
|
|
105
|
-
},
|
|
106
|
-
selectors: [],
|
|
107
|
-
variants: [
|
|
108
|
-
{
|
|
109
|
-
languageTag: "en",
|
|
110
|
-
match: [],
|
|
111
|
-
pattern: [
|
|
112
|
-
{
|
|
113
|
-
type: "Text",
|
|
114
|
-
value: "test",
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
];
|
|
121
|
-
const mockMessageLintRule = {
|
|
122
|
-
id: "messageLintRule.project.mock",
|
|
123
|
-
description: { en: "Mock lint rule description" },
|
|
124
|
-
displayName: { en: "Mock Lint Rule" },
|
|
125
|
-
run: () => undefined,
|
|
126
|
-
};
|
|
127
|
-
const _import = async (name) => ({
|
|
128
|
-
default: name === "plugin.js" ? mockPlugin : mockMessageLintRule,
|
|
129
|
-
});
|
|
130
|
-
const ciTestRepoSnapshot = JSON.parse(readFileSync(resolve(__dirname, "../mocks/ci-test-repo-no-shallow.json"), {
|
|
131
|
-
encoding: "utf-8",
|
|
132
|
-
}));
|
|
133
|
-
// ------------------------------------------------------------------------------------------------
|
|
134
|
-
/**
|
|
135
|
-
* Dear Developers,
|
|
136
|
-
*
|
|
137
|
-
* Inlang projects (folders) are not like .vscode, .git, or .github folders. Treat em
|
|
138
|
-
* like files: they can be renamed and moved around.
|
|
139
|
-
*/
|
|
140
|
-
it("should throw if a project (path) does not have a name", async () => {
|
|
141
|
-
const repo = await mockRepo();
|
|
142
|
-
const project = await tryCatch(() => loadProject({
|
|
143
|
-
projectPath: "/source-code/.inlang",
|
|
144
|
-
repo,
|
|
145
|
-
_import,
|
|
146
|
-
}));
|
|
147
|
-
expect(project?.error?.message).toMatch('Expected a path ending in "{name}.inlang" but received ');
|
|
148
|
-
});
|
|
149
|
-
it("should throw if a project path does not end with .inlang", async () => {
|
|
150
|
-
const repo = await mockRepo();
|
|
151
|
-
const invalidPaths = [
|
|
152
|
-
"/source-code/frontend.inlang/settings",
|
|
153
|
-
"/source-code/frontend.inlang/settings.json",
|
|
154
|
-
"/source-code/frontend.inlang.md",
|
|
155
|
-
];
|
|
156
|
-
for (const invalidPath of invalidPaths) {
|
|
157
|
-
const project = await tryCatch(() => loadProject({
|
|
158
|
-
projectPath: invalidPath,
|
|
159
|
-
repo,
|
|
160
|
-
_import,
|
|
161
|
-
}));
|
|
162
|
-
expect(project.error?.message).toMatch('Expected a path ending in "{name}.inlang" but received ');
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
describe("initialization", () => {
|
|
166
|
-
it("should throw if projectPath is not an absolute path", async () => {
|
|
167
|
-
const repo = await mockRepo();
|
|
168
|
-
const result = await tryCatch(() => loadProject({
|
|
169
|
-
projectPath: "relative/path",
|
|
170
|
-
repo,
|
|
171
|
-
_import,
|
|
172
|
-
}));
|
|
173
|
-
expect(result.error?.message).toBe('Expected an absolute path but received "relative/path".');
|
|
174
|
-
expect(result.data).toBeUndefined();
|
|
175
|
-
});
|
|
176
|
-
it("should generate projectId on missing projectid", async () => {
|
|
177
|
-
const repo = await mockRepo({ fromSnapshot: ciTestRepoSnapshot });
|
|
178
|
-
const existing = await repo.nodeishFs
|
|
179
|
-
.readFile("/project.inlang/project_id", {
|
|
180
|
-
encoding: "utf-8",
|
|
181
|
-
})
|
|
182
|
-
.catch((error) => {
|
|
183
|
-
return { error };
|
|
184
|
-
});
|
|
185
|
-
// @ts-ignore
|
|
186
|
-
expect(existing.error.code).toBe("ENOENT");
|
|
187
|
-
const result = await tryCatch(() => loadProject({
|
|
188
|
-
projectPath: "/project.inlang",
|
|
189
|
-
repo,
|
|
190
|
-
_import,
|
|
191
|
-
}));
|
|
192
|
-
const newId = await repo.nodeishFs
|
|
193
|
-
.readFile("/project.inlang/project_id", {
|
|
194
|
-
encoding: "utf-8",
|
|
195
|
-
})
|
|
196
|
-
.catch((error) => {
|
|
197
|
-
return { error };
|
|
198
|
-
});
|
|
199
|
-
expect(newId).toBe("aef225403be8b526dfb492a4617fd59d8181e8fef2c7f4aff56ab299046e36ed");
|
|
200
|
-
expect(result.error).toBeUndefined();
|
|
201
|
-
expect(result.data).toBeDefined();
|
|
202
|
-
});
|
|
203
|
-
it("should reuse projectId on existing projectid", async () => {
|
|
204
|
-
const repo = await mockRepo({ fromSnapshot: ciTestRepoSnapshot });
|
|
205
|
-
await repo.nodeishFs.writeFile("/project.inlang/project_id", "testId");
|
|
206
|
-
const result = await tryCatch(() => loadProject({
|
|
207
|
-
projectPath: "/project.inlang",
|
|
208
|
-
repo,
|
|
209
|
-
_import,
|
|
210
|
-
}));
|
|
211
|
-
const newId = await repo.nodeishFs
|
|
212
|
-
.readFile("/project.inlang/project_id", {
|
|
213
|
-
encoding: "utf-8",
|
|
214
|
-
})
|
|
215
|
-
.catch((error) => {
|
|
216
|
-
return { error };
|
|
217
|
-
});
|
|
218
|
-
expect(newId).toBe("testId");
|
|
219
|
-
expect(result.error).toBeUndefined();
|
|
220
|
-
expect(result.data).toBeDefined();
|
|
221
|
-
});
|
|
222
|
-
it.skipIf(() => process.platform !== "win32")("should resolve from a windows path", async () => {
|
|
223
|
-
const repo = await mockRepo();
|
|
224
|
-
const fs = repo.nodeishFs;
|
|
225
|
-
await fs.mkdir("C:\\Users\\user\\project.inlang", { recursive: true });
|
|
226
|
-
await fs.writeFile("C:\\Users\\user\\project.inlang\\settings.json", JSON.stringify(settings));
|
|
227
|
-
const project = await loadProject({
|
|
228
|
-
projectPath: "C:\\Users\\user\\project.inlang",
|
|
229
|
-
repo,
|
|
230
|
-
_import,
|
|
231
|
-
});
|
|
232
|
-
expect(project.errors()).toEqual([]);
|
|
233
|
-
});
|
|
234
|
-
describe("settings", () => {
|
|
235
|
-
it("should return an error if settings file is not found", async () => {
|
|
236
|
-
const repo = await mockRepo();
|
|
237
|
-
const fs = repo.nodeishFs;
|
|
238
|
-
fs.mkdir("/user/project", { recursive: true });
|
|
239
|
-
const project = await loadProject({
|
|
240
|
-
projectPath: "/user/non-existend-project.inlang",
|
|
241
|
-
repo,
|
|
242
|
-
_import,
|
|
243
|
-
});
|
|
244
|
-
expect(project.errors()[0]).toBeInstanceOf(ProjectSettingsFileNotFoundError);
|
|
245
|
-
});
|
|
246
|
-
it("should return an error if settings file is not a valid JSON", async () => {
|
|
247
|
-
const repo = await mockRepo();
|
|
248
|
-
const fs = repo.nodeishFs;
|
|
249
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
250
|
-
await fs.writeFile("/user/project.inlang/settings.json", "invalid json");
|
|
251
|
-
const project = await loadProject({
|
|
252
|
-
projectPath: "/user/project.inlang",
|
|
253
|
-
repo,
|
|
254
|
-
_import,
|
|
255
|
-
});
|
|
256
|
-
expect(project.errors()[0]).toBeInstanceOf(ProjectSettingsFileJSONSyntaxError);
|
|
257
|
-
});
|
|
258
|
-
it("should return an error if settings file is does not match schema", async () => {
|
|
259
|
-
const repo = await mockRepo();
|
|
260
|
-
const fs = repo.nodeishFs;
|
|
261
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
262
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify({}));
|
|
263
|
-
const project = await loadProject({
|
|
264
|
-
projectPath: "/user/project.inlang",
|
|
265
|
-
repo,
|
|
266
|
-
_import,
|
|
267
|
-
});
|
|
268
|
-
expect(project.errors()[0]).toBeInstanceOf(ProjectSettingsInvalidError);
|
|
269
|
-
});
|
|
270
|
-
it("should return the parsed settings", async () => {
|
|
271
|
-
const repo = await mockRepo();
|
|
272
|
-
const fs = repo.nodeishFs;
|
|
273
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
274
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
275
|
-
const project = await loadProject({
|
|
276
|
-
projectPath: "/user/project.inlang",
|
|
277
|
-
repo,
|
|
278
|
-
_import,
|
|
279
|
-
});
|
|
280
|
-
expect(project.settings()).toStrictEqual(settings);
|
|
281
|
-
});
|
|
282
|
-
it("should not re-write the settings to disk when initializing", async () => {
|
|
283
|
-
const repo = await mockRepo();
|
|
284
|
-
const fs = repo.nodeishFs;
|
|
285
|
-
const settingsWithDifferentFormatting = JSON.stringify(settings, undefined, 4);
|
|
286
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
287
|
-
await fs.writeFile("/user/project.inlang/settings.json", settingsWithDifferentFormatting);
|
|
288
|
-
const project = await loadProject({
|
|
289
|
-
projectPath: "/user/project.inlang",
|
|
290
|
-
repo,
|
|
291
|
-
_import,
|
|
292
|
-
});
|
|
293
|
-
const settingsOnDisk = await fs.readFile("/user/project.inlang/settings.json", {
|
|
294
|
-
encoding: "utf-8",
|
|
295
|
-
});
|
|
296
|
-
expect(settingsOnDisk).toBe(settingsWithDifferentFormatting);
|
|
297
|
-
project.setSettings(project.settings());
|
|
298
|
-
// TODO: how can we await `setsettings` correctly
|
|
299
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
300
|
-
const newsettingsOnDisk = await fs.readFile("/user/project.inlang/settings.json", {
|
|
301
|
-
encoding: "utf-8",
|
|
302
|
-
});
|
|
303
|
-
expect(newsettingsOnDisk).not.toBe(settingsWithDifferentFormatting);
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
|
-
describe("modules", () => {
|
|
307
|
-
it("should return an error if an error occurs while resolving a plugin", async () => {
|
|
308
|
-
const $badImport = async () => ({
|
|
309
|
-
default: {},
|
|
310
|
-
});
|
|
311
|
-
const repo = await mockRepo();
|
|
312
|
-
const fs = repo.nodeishFs;
|
|
313
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
314
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
315
|
-
const project = await loadProject({
|
|
316
|
-
projectPath: "/user/project.inlang",
|
|
317
|
-
repo,
|
|
318
|
-
_import: $badImport,
|
|
319
|
-
});
|
|
320
|
-
expect(project.errors()).not.toHaveLength(0);
|
|
321
|
-
});
|
|
322
|
-
// it.todo("should throw if lintRules contain errors ???")
|
|
323
|
-
// it.todo("should return meta data")
|
|
324
|
-
// it.todo("should return plugins")
|
|
325
|
-
// it.todo("should return lint rules")
|
|
326
|
-
});
|
|
327
|
-
describe("flow", () => {
|
|
328
|
-
it.todo("should not call functions multiple times");
|
|
329
|
-
it.todo("should load modules after settings");
|
|
330
|
-
it.todo("should not load messages");
|
|
331
|
-
it.todo("should not call lint");
|
|
332
|
-
});
|
|
333
|
-
describe("instance object", () => {
|
|
334
|
-
it.todo("should contain all fields");
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
describe("functionality", () => {
|
|
338
|
-
describe("settings", () => {
|
|
339
|
-
it("should return the settings", async () => {
|
|
340
|
-
const repo = await mockRepo();
|
|
341
|
-
const fs = repo.nodeishFs;
|
|
342
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
343
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
344
|
-
const project = await loadProject({
|
|
345
|
-
projectPath: "/user/project.inlang",
|
|
346
|
-
repo,
|
|
347
|
-
_import,
|
|
348
|
-
});
|
|
349
|
-
expect(getValue(project.settings)).toStrictEqual(settings);
|
|
350
|
-
});
|
|
351
|
-
it("should set a new settings", async () => {
|
|
352
|
-
const repo = await mockRepo();
|
|
353
|
-
const fs = repo.nodeishFs;
|
|
354
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
355
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
356
|
-
const project = await loadProject({
|
|
357
|
-
projectPath: "/user/project.inlang",
|
|
358
|
-
repo,
|
|
359
|
-
_import,
|
|
360
|
-
});
|
|
361
|
-
expect(project.settings()).toStrictEqual(settings);
|
|
362
|
-
project.setSettings({ ...settings, languageTags: ["en", "de"] });
|
|
363
|
-
expect(getValue(project.settings)).toStrictEqual({ ...settings, languageTags: ["en", "de"] });
|
|
364
|
-
expect(project.settings().languageTags).toStrictEqual(["en", "de"]);
|
|
365
|
-
project.setSettings({ ...settings, languageTags: ["en", "de", "fr"] });
|
|
366
|
-
expect(getValue(project.settings)).toStrictEqual({
|
|
367
|
-
...settings,
|
|
368
|
-
languageTags: ["en", "de", "fr"],
|
|
369
|
-
});
|
|
370
|
-
expect(project.settings().languageTags).toStrictEqual(["en", "de", "fr"]);
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
describe("setSettings", () => {
|
|
374
|
-
it("should fail if settings are not valid", async () => {
|
|
375
|
-
const repo = await mockRepo();
|
|
376
|
-
const fs = repo.nodeishFs;
|
|
377
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
378
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
379
|
-
const project = await loadProject({
|
|
380
|
-
projectPath: "/user/project.inlang",
|
|
381
|
-
repo,
|
|
382
|
-
_import,
|
|
383
|
-
});
|
|
384
|
-
const result = project.setSettings({});
|
|
385
|
-
expect(result.data).toBeUndefined();
|
|
386
|
-
expect(result.error).toBeInstanceOf(ProjectSettingsInvalidError);
|
|
387
|
-
});
|
|
388
|
-
it("should throw an error if sourceLanguageTag is not in languageTags", async () => {
|
|
389
|
-
const repo = await mockRepo();
|
|
390
|
-
const fs = repo.nodeishFs;
|
|
391
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
392
|
-
const settings = {
|
|
393
|
-
sourceLanguageTag: "en",
|
|
394
|
-
languageTags: ["de"],
|
|
395
|
-
modules: [],
|
|
396
|
-
};
|
|
397
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
398
|
-
const project = await loadProject({
|
|
399
|
-
projectPath: "/user/project.inlang",
|
|
400
|
-
repo,
|
|
401
|
-
_import,
|
|
402
|
-
});
|
|
403
|
-
expect(project.errors()).toHaveLength(1);
|
|
404
|
-
expect(project.errors()[0]).toBeInstanceOf(ProjectSettingsInvalidError);
|
|
405
|
-
});
|
|
406
|
-
it("should write settings to disk", async () => {
|
|
407
|
-
const repo = await mockRepo();
|
|
408
|
-
const fs = repo.nodeishFs;
|
|
409
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
410
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
411
|
-
const project = await loadProject({
|
|
412
|
-
projectPath: "/user/project.inlang",
|
|
413
|
-
repo,
|
|
414
|
-
_import,
|
|
415
|
-
});
|
|
416
|
-
const before = await fs.readFile("/user/project.inlang/settings.json", { encoding: "utf-8" });
|
|
417
|
-
expect(before).toBeDefined();
|
|
418
|
-
const result = project.setSettings({ ...settings, languageTags: ["en", "nl", "de"] });
|
|
419
|
-
expect(result.data).toBeUndefined();
|
|
420
|
-
expect(result.error).toBeUndefined();
|
|
421
|
-
// TODO: how to wait for fs.writeFile to finish?
|
|
422
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
423
|
-
const after = await fs.readFile("/user/project.inlang/settings.json", { encoding: "utf-8" });
|
|
424
|
-
expect(after).toBeDefined();
|
|
425
|
-
expect(after).not.toBe(before);
|
|
426
|
-
});
|
|
427
|
-
});
|
|
428
|
-
describe("installed", () => {
|
|
429
|
-
it("should return the installed items", async () => {
|
|
430
|
-
const repo = await mockRepo();
|
|
431
|
-
const fs = repo.nodeishFs;
|
|
432
|
-
const settings = {
|
|
433
|
-
sourceLanguageTag: "en",
|
|
434
|
-
languageTags: ["en"],
|
|
435
|
-
modules: ["plugin.js", "lintRule.js"],
|
|
436
|
-
};
|
|
437
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
438
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
439
|
-
const project = await loadProject({
|
|
440
|
-
projectPath: "/user/project.inlang",
|
|
441
|
-
repo,
|
|
442
|
-
_import,
|
|
443
|
-
});
|
|
444
|
-
expect(project.installed.plugins()[0]).toStrictEqual({
|
|
445
|
-
id: mockPlugin.id,
|
|
446
|
-
description: mockPlugin.description,
|
|
447
|
-
displayName: mockPlugin.displayName,
|
|
448
|
-
module: settings.modules[0],
|
|
449
|
-
settingsSchema: mockPlugin.settingsSchema,
|
|
450
|
-
});
|
|
451
|
-
expect(project.installed.messageLintRules()[0]).toEqual({
|
|
452
|
-
id: mockMessageLintRule.id,
|
|
453
|
-
description: mockMessageLintRule.description,
|
|
454
|
-
displayName: mockMessageLintRule.displayName,
|
|
455
|
-
module: settings.modules[1],
|
|
456
|
-
level: "warning",
|
|
457
|
-
settingsSchema: mockMessageLintRule.settingsSchema,
|
|
458
|
-
});
|
|
459
|
-
});
|
|
460
|
-
it("should apply 'warning' as default lint level to lint rules that have no lint level defined in the settings", async () => {
|
|
461
|
-
const repo = await mockRepo();
|
|
462
|
-
const fs = repo.nodeishFs;
|
|
463
|
-
const settings = {
|
|
464
|
-
sourceLanguageTag: "en",
|
|
465
|
-
languageTags: ["en"],
|
|
466
|
-
modules: ["plugin.js", "lintRule.js"],
|
|
467
|
-
};
|
|
468
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
469
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
470
|
-
const project = await loadProject({
|
|
471
|
-
projectPath: "/user/project.inlang",
|
|
472
|
-
repo,
|
|
473
|
-
_import,
|
|
474
|
-
});
|
|
475
|
-
expect(project.installed.messageLintRules()[0]?.level).toBe("warning");
|
|
476
|
-
});
|
|
477
|
-
// yep, this is a typical "hm, we have a bug here, let's write a test for it" test
|
|
478
|
-
it("should return lint reports if disabled is not set", async () => {
|
|
479
|
-
const _mockLintRule = {
|
|
480
|
-
id: "messageLintRule.namespace.mock",
|
|
481
|
-
description: { en: "Mock lint rule description" },
|
|
482
|
-
displayName: { en: "Mock Lint Rule" },
|
|
483
|
-
run: ({ report }) => {
|
|
484
|
-
report({
|
|
485
|
-
messageId: "some-message-1",
|
|
486
|
-
languageTag: "en",
|
|
487
|
-
body: { en: "lintrule1" },
|
|
488
|
-
});
|
|
489
|
-
},
|
|
490
|
-
};
|
|
491
|
-
const _mockPlugin = {
|
|
492
|
-
id: "plugin.project.i18next",
|
|
493
|
-
description: { en: "Mock plugin description" },
|
|
494
|
-
displayName: { en: "Mock Plugin" },
|
|
495
|
-
loadMessages: () => [{ id: "some-message", alias: {}, selectors: [], variants: [] }],
|
|
496
|
-
saveMessages: () => undefined,
|
|
497
|
-
};
|
|
498
|
-
const repo = await mockRepo();
|
|
499
|
-
const fs = repo.nodeishFs;
|
|
500
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
501
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify({
|
|
502
|
-
sourceLanguageTag: "en",
|
|
503
|
-
languageTags: ["en"],
|
|
504
|
-
modules: ["plugin.js", "lintRule.js"],
|
|
505
|
-
}));
|
|
506
|
-
const _import = async (name) => {
|
|
507
|
-
return {
|
|
508
|
-
default: name === "plugin.js" ? _mockPlugin : _mockLintRule,
|
|
509
|
-
};
|
|
510
|
-
};
|
|
511
|
-
const project = await loadProject({
|
|
512
|
-
projectPath: "/user/project.inlang",
|
|
513
|
-
repo,
|
|
514
|
-
_import,
|
|
515
|
-
});
|
|
516
|
-
await new Promise((resolve) => setTimeout(resolve, 510));
|
|
517
|
-
expect(await project.query.messageLintReports.getAll.settled()).toHaveLength(1);
|
|
518
|
-
expect((await project.query.messageLintReports.getAll.settled())?.[0]?.ruleId).toBe(_mockLintRule.id);
|
|
519
|
-
expect(project.installed.messageLintRules()).toHaveLength(1);
|
|
520
|
-
});
|
|
521
|
-
it("should return lint reports for a single message", async () => {
|
|
522
|
-
const _mockLintRule = {
|
|
523
|
-
id: "messageLintRule.namepsace.mock",
|
|
524
|
-
description: { en: "Mock lint rule description" },
|
|
525
|
-
displayName: { en: "Mock Lint Rule" },
|
|
526
|
-
run: ({ report }) => {
|
|
527
|
-
report({
|
|
528
|
-
messageId: "some-message",
|
|
529
|
-
languageTag: "en",
|
|
530
|
-
body: { en: "lintrule1" },
|
|
531
|
-
});
|
|
532
|
-
},
|
|
533
|
-
};
|
|
534
|
-
const _mockPlugin = {
|
|
535
|
-
id: "plugin.project.i18next",
|
|
536
|
-
description: { en: "Mock plugin description" },
|
|
537
|
-
displayName: { en: "Mock Plugin" },
|
|
538
|
-
loadMessages: () => [{ id: "some-message", alias: {}, selectors: [], variants: [] }],
|
|
539
|
-
saveMessages: () => undefined,
|
|
540
|
-
};
|
|
541
|
-
const repo = await mockRepo();
|
|
542
|
-
const fs = repo.nodeishFs;
|
|
543
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
544
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify({
|
|
545
|
-
sourceLanguageTag: "en",
|
|
546
|
-
languageTags: ["en"],
|
|
547
|
-
modules: ["plugin.js", "lintRule.js"],
|
|
548
|
-
}));
|
|
549
|
-
const _import = async (name) => {
|
|
550
|
-
return {
|
|
551
|
-
default: name === "plugin.js" ? _mockPlugin : _mockLintRule,
|
|
552
|
-
};
|
|
553
|
-
};
|
|
554
|
-
const project = await loadProject({
|
|
555
|
-
projectPath: "/user/project.inlang",
|
|
556
|
-
repo,
|
|
557
|
-
_import,
|
|
558
|
-
});
|
|
559
|
-
await new Promise((resolve) => setTimeout(resolve, 510));
|
|
560
|
-
expect(await project.query.messageLintReports.get({ where: { messageId: "some-message" } })).toHaveLength(1);
|
|
561
|
-
});
|
|
562
|
-
});
|
|
563
|
-
describe("errors", () => {
|
|
564
|
-
it("should return the errors", async () => {
|
|
565
|
-
const repo = await mockRepo();
|
|
566
|
-
const fs = repo.nodeishFs;
|
|
567
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
568
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
569
|
-
const project = await loadProject({
|
|
570
|
-
projectPath: "/user/project.inlang",
|
|
571
|
-
repo,
|
|
572
|
-
_import,
|
|
573
|
-
});
|
|
574
|
-
project.errors.subscribe((errors) => {
|
|
575
|
-
expect(errors).toStrictEqual([]);
|
|
576
|
-
});
|
|
577
|
-
});
|
|
578
|
-
});
|
|
579
|
-
describe("customApi", () => {
|
|
580
|
-
it("should return the app specific api", async () => {
|
|
581
|
-
const repo = await mockRepo();
|
|
582
|
-
const fs = repo.nodeishFs;
|
|
583
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
584
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
585
|
-
const project = await loadProject({
|
|
586
|
-
projectPath: "/user/project.inlang",
|
|
587
|
-
repo,
|
|
588
|
-
_import,
|
|
589
|
-
});
|
|
590
|
-
project.customApi.subscribe((api) => {
|
|
591
|
-
expect(api["app.project.ideExtension"]).toBeDefined();
|
|
592
|
-
});
|
|
593
|
-
});
|
|
594
|
-
});
|
|
595
|
-
describe("messages", () => {
|
|
596
|
-
it("should return the messages", async () => {
|
|
597
|
-
const repo = await mockRepo();
|
|
598
|
-
const fs = repo.nodeishFs;
|
|
599
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
600
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
601
|
-
const project = await loadProject({
|
|
602
|
-
projectPath: "/user/project.inlang",
|
|
603
|
-
repo,
|
|
604
|
-
_import,
|
|
605
|
-
});
|
|
606
|
-
expect(Object.values(project.query.messages.getAll())).toEqual(exampleMessages);
|
|
607
|
-
});
|
|
608
|
-
});
|
|
609
|
-
describe("messages with aliases", () => {
|
|
610
|
-
it("should return the messages", async () => {
|
|
611
|
-
const repo = await mockRepo();
|
|
612
|
-
const fs = repo.nodeishFs;
|
|
613
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
614
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify({ ...settings, experimental: { aliases: true } }));
|
|
615
|
-
const project = await loadProject({
|
|
616
|
-
projectPath: "/user/project.inlang",
|
|
617
|
-
repo,
|
|
618
|
-
_import,
|
|
619
|
-
});
|
|
620
|
-
expect(Object.values(project.query.messages.getAll())).toEqual(exampleAliasedMessages);
|
|
621
|
-
});
|
|
622
|
-
});
|
|
623
|
-
describe("query", () => {
|
|
624
|
-
it("should call saveMessages() on updates", async () => {
|
|
625
|
-
const repo = await mockRepo();
|
|
626
|
-
const fs = repo.nodeishFs;
|
|
627
|
-
const settings = {
|
|
628
|
-
sourceLanguageTag: "en",
|
|
629
|
-
languageTags: ["en", "de"],
|
|
630
|
-
modules: ["plugin.js"],
|
|
631
|
-
"plugin.project.json": {
|
|
632
|
-
pathPattern: "./resources/{languageTag}.json",
|
|
633
|
-
},
|
|
634
|
-
};
|
|
635
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
636
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
637
|
-
await fs.mkdir("./resources");
|
|
638
|
-
const mockSaveFn = vi.fn();
|
|
639
|
-
const _mockPlugin = {
|
|
640
|
-
id: "plugin.project.json",
|
|
641
|
-
description: { en: "Mock plugin description" },
|
|
642
|
-
displayName: { en: "Mock Plugin" },
|
|
643
|
-
loadMessages: () => exampleMessages,
|
|
644
|
-
saveMessages: mockSaveFn,
|
|
645
|
-
};
|
|
646
|
-
const _import = async () => {
|
|
647
|
-
return {
|
|
648
|
-
default: _mockPlugin,
|
|
649
|
-
};
|
|
650
|
-
};
|
|
651
|
-
const project = await loadProject({
|
|
652
|
-
projectPath: "/user/project.inlang",
|
|
653
|
-
repo,
|
|
654
|
-
_import,
|
|
655
|
-
});
|
|
656
|
-
await project.query.messages.upsert({
|
|
657
|
-
where: { id: "a" },
|
|
658
|
-
data: {
|
|
659
|
-
id: "a",
|
|
660
|
-
alias: {},
|
|
661
|
-
selectors: [],
|
|
662
|
-
variants: [
|
|
663
|
-
{
|
|
664
|
-
languageTag: "en",
|
|
665
|
-
match: [],
|
|
666
|
-
pattern: [
|
|
667
|
-
{
|
|
668
|
-
type: "Text",
|
|
669
|
-
value: "a en",
|
|
670
|
-
},
|
|
671
|
-
],
|
|
672
|
-
},
|
|
673
|
-
{
|
|
674
|
-
languageTag: "de",
|
|
675
|
-
match: [],
|
|
676
|
-
pattern: [
|
|
677
|
-
{
|
|
678
|
-
type: "Text",
|
|
679
|
-
value: "a de",
|
|
680
|
-
},
|
|
681
|
-
],
|
|
682
|
-
},
|
|
683
|
-
],
|
|
684
|
-
},
|
|
685
|
-
});
|
|
686
|
-
await project.query.messages.upsert({
|
|
687
|
-
where: { id: "b" },
|
|
688
|
-
data: {
|
|
689
|
-
id: "b",
|
|
690
|
-
alias: {},
|
|
691
|
-
selectors: [],
|
|
692
|
-
variants: [
|
|
693
|
-
{
|
|
694
|
-
languageTag: "en",
|
|
695
|
-
match: [],
|
|
696
|
-
pattern: [
|
|
697
|
-
{
|
|
698
|
-
type: "Text",
|
|
699
|
-
value: "b en",
|
|
700
|
-
},
|
|
701
|
-
],
|
|
702
|
-
},
|
|
703
|
-
{
|
|
704
|
-
languageTag: "de",
|
|
705
|
-
match: [],
|
|
706
|
-
pattern: [
|
|
707
|
-
{
|
|
708
|
-
type: "Text",
|
|
709
|
-
value: "b de",
|
|
710
|
-
},
|
|
711
|
-
],
|
|
712
|
-
},
|
|
713
|
-
],
|
|
714
|
-
},
|
|
715
|
-
});
|
|
716
|
-
// lets wait for the next tick
|
|
717
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
718
|
-
expect(mockSaveFn.mock.calls.length).toBe(1);
|
|
719
|
-
expect(mockSaveFn.mock.calls[0][0].settings).toStrictEqual(settings);
|
|
720
|
-
expect(Object.values(mockSaveFn.mock.calls[0][0].messages)).toStrictEqual([
|
|
721
|
-
{
|
|
722
|
-
id: "a",
|
|
723
|
-
alias: {},
|
|
724
|
-
selectors: [],
|
|
725
|
-
variants: [
|
|
726
|
-
{
|
|
727
|
-
languageTag: "de",
|
|
728
|
-
match: [],
|
|
729
|
-
pattern: [
|
|
730
|
-
{
|
|
731
|
-
type: "Text",
|
|
732
|
-
value: "a de",
|
|
733
|
-
},
|
|
734
|
-
],
|
|
735
|
-
},
|
|
736
|
-
{
|
|
737
|
-
languageTag: "en",
|
|
738
|
-
match: [],
|
|
739
|
-
pattern: [
|
|
740
|
-
{
|
|
741
|
-
type: "Text",
|
|
742
|
-
value: "a en",
|
|
743
|
-
},
|
|
744
|
-
],
|
|
745
|
-
},
|
|
746
|
-
],
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
id: "b",
|
|
750
|
-
alias: {},
|
|
751
|
-
selectors: [],
|
|
752
|
-
variants: [
|
|
753
|
-
{
|
|
754
|
-
languageTag: "de",
|
|
755
|
-
match: [],
|
|
756
|
-
pattern: [
|
|
757
|
-
{
|
|
758
|
-
type: "Text",
|
|
759
|
-
value: "b de",
|
|
760
|
-
},
|
|
761
|
-
],
|
|
762
|
-
},
|
|
763
|
-
{
|
|
764
|
-
languageTag: "en",
|
|
765
|
-
match: [],
|
|
766
|
-
pattern: [
|
|
767
|
-
{
|
|
768
|
-
type: "Text",
|
|
769
|
-
value: "b en",
|
|
770
|
-
},
|
|
771
|
-
],
|
|
772
|
-
},
|
|
773
|
-
],
|
|
774
|
-
},
|
|
775
|
-
]);
|
|
776
|
-
});
|
|
777
|
-
/*
|
|
778
|
-
* Passing all messages to saveMessages() simplifies plugins by an order of magnitude.
|
|
779
|
-
*
|
|
780
|
-
* The alternative would be to pass only the messages that changed to saveMessages().
|
|
781
|
-
* But, this would require plugins to maintain a separate data structure of messages
|
|
782
|
-
* and create optimizations, leading to (unjustified) complexity for plugin authors.
|
|
783
|
-
*
|
|
784
|
-
* Pros:
|
|
785
|
-
* - plugins don't need to transform the data (time complexity).
|
|
786
|
-
* - plugins don't to maintain a separate data structure (space complexity).
|
|
787
|
-
* - plugin authors don't need to deal with optimizations (ecosystem complexity).
|
|
788
|
-
*
|
|
789
|
-
* Cons:
|
|
790
|
-
* - Might be slow for a large number of messages. The requirement hasn't popped up yet though.
|
|
791
|
-
*/
|
|
792
|
-
it("should pass all messages, regardless of which message changed, to saveMessages()", async () => {
|
|
793
|
-
const repo = await mockRepo();
|
|
794
|
-
const fs = repo.nodeishFs;
|
|
795
|
-
const settings = {
|
|
796
|
-
sourceLanguageTag: "en",
|
|
797
|
-
languageTags: ["en", "de"],
|
|
798
|
-
modules: ["plugin.js"],
|
|
799
|
-
"plugin.placeholder.name": {
|
|
800
|
-
pathPattern: "./resources/{languageTag}.json",
|
|
801
|
-
},
|
|
802
|
-
};
|
|
803
|
-
await fs.mkdir("./project.inlang", { recursive: true });
|
|
804
|
-
await fs.writeFile("./project.inlang/settings.json", JSON.stringify(settings));
|
|
805
|
-
const mockSaveFn = vi.fn();
|
|
806
|
-
const _mockPlugin = {
|
|
807
|
-
id: "plugin.placeholder.name",
|
|
808
|
-
description: "Mock plugin description",
|
|
809
|
-
displayName: "Mock Plugin",
|
|
810
|
-
loadMessages: () => [
|
|
811
|
-
createMessage("first", { en: "first message" }),
|
|
812
|
-
createMessage("second", { en: "second message" }),
|
|
813
|
-
createMessage("third", { en: "third message" }),
|
|
814
|
-
],
|
|
815
|
-
saveMessages: mockSaveFn,
|
|
816
|
-
};
|
|
817
|
-
const _import = async () => {
|
|
818
|
-
return {
|
|
819
|
-
default: _mockPlugin,
|
|
820
|
-
};
|
|
821
|
-
};
|
|
822
|
-
const project = await loadProject({
|
|
823
|
-
projectPath: "/project.inlang",
|
|
824
|
-
repo,
|
|
825
|
-
_import,
|
|
826
|
-
});
|
|
827
|
-
project.query.messages.create({ data: createMessage("fourth", { en: "fourth message" }) });
|
|
828
|
-
await new Promise((resolve) => setTimeout(resolve, 510));
|
|
829
|
-
expect(mockSaveFn.mock.calls.length).toBe(1);
|
|
830
|
-
expect(mockSaveFn.mock.calls[0][0].messages).toHaveLength(4);
|
|
831
|
-
project.query.messages.create({ data: createMessage("fifth", { en: "fifth message" }) });
|
|
832
|
-
await new Promise((resolve) => setTimeout(resolve, 510));
|
|
833
|
-
expect(mockSaveFn.mock.calls.length).toBe(2);
|
|
834
|
-
expect(mockSaveFn.mock.calls[1][0].messages).toHaveLength(5);
|
|
835
|
-
project.query.messages.delete({ where: { id: "fourth" } });
|
|
836
|
-
await new Promise((resolve) => setTimeout(resolve, 510));
|
|
837
|
-
expect(mockSaveFn.mock.calls.length).toBe(3);
|
|
838
|
-
expect(mockSaveFn.mock.calls[2][0].messages).toHaveLength(4);
|
|
839
|
-
});
|
|
840
|
-
});
|
|
841
|
-
describe("lint", () => {
|
|
842
|
-
it("should return the message lint reports", async () => {
|
|
843
|
-
const settings = {
|
|
844
|
-
sourceLanguageTag: "en",
|
|
845
|
-
languageTags: ["en"],
|
|
846
|
-
modules: ["lintRule.js"],
|
|
847
|
-
};
|
|
848
|
-
const repo = await mockRepo();
|
|
849
|
-
const fs = repo.nodeishFs;
|
|
850
|
-
await fs.mkdir("/user/project.inlang", { recursive: true });
|
|
851
|
-
await fs.writeFile("/user/project.inlang/settings.json", JSON.stringify(settings));
|
|
852
|
-
const project = await loadProject({
|
|
853
|
-
projectPath: "/user/project.inlang",
|
|
854
|
-
repo,
|
|
855
|
-
_import: async () => ({
|
|
856
|
-
default: mockMessageLintRule,
|
|
857
|
-
}),
|
|
858
|
-
});
|
|
859
|
-
// TODO: test with real lint rules
|
|
860
|
-
const r = await project.query.messageLintReports.getAll.settled();
|
|
861
|
-
expect(r).toEqual([]);
|
|
862
|
-
});
|
|
863
|
-
});
|
|
864
|
-
describe("watcher", () => {
|
|
865
|
-
it("changing files in resources should trigger callback of message query", async () => {
|
|
866
|
-
const repo = await mockRepo();
|
|
867
|
-
const fs = repo.nodeishFs;
|
|
868
|
-
const messages = {
|
|
869
|
-
$schema: "https://inlang.com/schema/inlang-message-format",
|
|
870
|
-
data: [
|
|
871
|
-
{
|
|
872
|
-
id: "test",
|
|
873
|
-
selectors: [],
|
|
874
|
-
variants: [
|
|
875
|
-
{
|
|
876
|
-
match: [],
|
|
877
|
-
languageTag: "en",
|
|
878
|
-
pattern: [
|
|
879
|
-
{
|
|
880
|
-
type: "Text",
|
|
881
|
-
value: "test",
|
|
882
|
-
},
|
|
883
|
-
],
|
|
884
|
-
},
|
|
885
|
-
],
|
|
886
|
-
},
|
|
887
|
-
],
|
|
888
|
-
};
|
|
889
|
-
const newMessage = {
|
|
890
|
-
id: "test2",
|
|
891
|
-
selectors: [],
|
|
892
|
-
variants: [
|
|
893
|
-
{
|
|
894
|
-
match: [],
|
|
895
|
-
languageTag: "en",
|
|
896
|
-
pattern: [
|
|
897
|
-
{
|
|
898
|
-
type: "Text",
|
|
899
|
-
value: "test",
|
|
900
|
-
},
|
|
901
|
-
],
|
|
902
|
-
},
|
|
903
|
-
],
|
|
904
|
-
};
|
|
905
|
-
await fs.writeFile("./messages.json", JSON.stringify(messages));
|
|
906
|
-
const getMessages = async (customFs) => {
|
|
907
|
-
const file = await customFs.readFile("./messages.json", { encoding: "utf-8" });
|
|
908
|
-
return JSON.parse(file.toString()).data;
|
|
909
|
-
};
|
|
910
|
-
const mockMessageFormatPlugin = {
|
|
911
|
-
id: "plugin.inlang.messageFormat",
|
|
912
|
-
description: { en: "Mock plugin description" },
|
|
913
|
-
displayName: { en: "Mock Plugin" },
|
|
914
|
-
loadMessages: async (args) => await getMessages(args.nodeishFs),
|
|
915
|
-
saveMessages: () => undefined,
|
|
916
|
-
};
|
|
917
|
-
const settings = {
|
|
918
|
-
sourceLanguageTag: "en",
|
|
919
|
-
languageTags: ["en"],
|
|
920
|
-
modules: ["plugin.js"],
|
|
921
|
-
"plugin.inlang.messageFormat": {
|
|
922
|
-
filePath: "./messages.json",
|
|
923
|
-
},
|
|
924
|
-
};
|
|
925
|
-
await fs.mkdir("./project.inlang", { recursive: true });
|
|
926
|
-
await fs.writeFile("./project.inlang/settings.json", JSON.stringify(settings));
|
|
927
|
-
// establish watcher
|
|
928
|
-
const project = await loadProject({
|
|
929
|
-
projectPath: normalizePath("/project.inlang"),
|
|
930
|
-
repo,
|
|
931
|
-
_import: async () => ({
|
|
932
|
-
default: mockMessageFormatPlugin,
|
|
933
|
-
}),
|
|
934
|
-
});
|
|
935
|
-
let counter = 0;
|
|
936
|
-
let messageCount = 0;
|
|
937
|
-
project.query.messages.getAll.subscribe((messages) => {
|
|
938
|
-
counter = counter + 1;
|
|
939
|
-
messageCount = messages.length;
|
|
940
|
-
});
|
|
941
|
-
// subscribe fires once
|
|
942
|
-
expect(counter).toBe(1);
|
|
943
|
-
// saving the file without changing should not trigger a message query
|
|
944
|
-
await fs.writeFile("./messages.json", JSON.stringify(messages));
|
|
945
|
-
await new Promise((resolve) => setTimeout(resolve, 200)); // file event will lock a file and be handled sequentially - give it time to pickup the change
|
|
946
|
-
// we didn't change the message we write into message.json - shouldn't change the messages
|
|
947
|
-
expect(counter).toBe(1);
|
|
948
|
-
expect(messageCount).toBe(1);
|
|
949
|
-
// saving the file without changing should trigger a change
|
|
950
|
-
messages.data[0].variants[0].pattern[0].value = "changed";
|
|
951
|
-
await fs.writeFile("./messages.json", JSON.stringify(messages));
|
|
952
|
-
await new Promise((resolve) => setTimeout(resolve, 200)); // file event will lock a file and be handled sequentially - give it time to pickup the change
|
|
953
|
-
expect(counter).toBe(2);
|
|
954
|
-
expect(messageCount).toBe(1);
|
|
955
|
-
messages.data[0].variants[0].pattern[0].value = "changed3";
|
|
956
|
-
// change file - update message
|
|
957
|
-
await fs.writeFile("./messages.json", JSON.stringify(messages));
|
|
958
|
-
await new Promise((resolve) => setTimeout(resolve, 200)); // file event will lock a file and be handled sequentially - give it time to pickup the change
|
|
959
|
-
expect(counter).toBe(3);
|
|
960
|
-
expect(messageCount).toBe(1);
|
|
961
|
-
// change file - add a message
|
|
962
|
-
messages.data.push(newMessage);
|
|
963
|
-
await fs.writeFile("./messages.json", JSON.stringify(messages));
|
|
964
|
-
await new Promise((resolve) => setTimeout(resolve, 200)); // file event will lock a file and be handled sequentially - give it time to pickup the change
|
|
965
|
-
expect(counter).toBe(4);
|
|
966
|
-
expect(messageCount).toBe(2);
|
|
967
|
-
// change file - remove a message
|
|
968
|
-
messages.data.pop();
|
|
969
|
-
await fs.writeFile("./messages.json", JSON.stringify(messages));
|
|
970
|
-
await new Promise((resolve) => setTimeout(resolve, 200)); // file event will lock a file and be handled sequentially - give it time to pickup the change
|
|
971
|
-
expect(counter).toBe(5);
|
|
972
|
-
expect(messageCount).toBe(1);
|
|
973
|
-
});
|
|
974
|
-
});
|
|
975
|
-
});
|