npm package diff

Package: @forge/manifest

Versions: 7.7.0-next.8-experimental-c7a7d36 - 7.7.0-next.11

File: package/out/utils/module-i18n-helper.js

Index: package/out/utils/module-i18n-helper.js
===================================================================
--- package/out/utils/module-i18n-helper.js
+++ package/out/utils/module-i18n-helper.js
@@ -1,84 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.extractInternalI18nPropertyKeysFromModules = exports.extractI18nKeysFromModules = void 0;
-const isObject = (value) => {
-    return typeof value === 'object' && value !== null && !Array.isArray(value);
-};
-const isI18nValue = (value) => {
-    return typeof value?.i18n === 'string';
-};
-const getI18nKeysFromObject = (obj) => {
-    const visited = new Set();
-    const visit = (value) => {
-        if (!isObject(value) || visited.has(value)) {
-            return [];
-        }
-        visited.add(value);
-        return Object.values(value).flatMap((propValue) => {
-            if (isI18nValue(propValue)) {
-                return [propValue.i18n];
-            }
-            else if (Array.isArray(propValue)) {
-                return propValue.flatMap((item) => visit(item));
-            }
-            return visit(propValue);
-        });
-    };
-    return visit(obj);
-};
-const INTERNAL_I18N_PROPERTY_KEY_SUFFIX = '__i18n';
-const isInternalI18nPropertyKey = (key) => {
-    return key.length > INTERNAL_I18N_PROPERTY_KEY_SUFFIX.length && key.endsWith(INTERNAL_I18N_PROPERTY_KEY_SUFFIX);
-};
-const isI18nProperty = (key, value) => {
-    return isInternalI18nPropertyKey(key) && typeof value === 'string';
-};
-const getInternalI18nPropertyKeysFromObject = (obj) => {
-    const visited = new Set();
-    const visit = (value) => {
-        if (!isObject(value) || visited.has(value)) {
-            return [];
-        }
-        visited.add(value);
-        return Object.entries(value).flatMap(([propKey, propValue]) => {
-            if (isI18nProperty(propKey, propValue)) {
-                return [propKey];
-            }
-            else if (Array.isArray(propValue)) {
-                return propValue.flatMap((item) => visit(item));
-            }
-            return visit(propValue);
-        });
-    };
-    return visit(obj);
-};
-const getAllModuleEntries = (modules) => {
-    return Object.entries(modules).flatMap(([moduleKey, moduleEntries]) => {
-        if (moduleEntries && Array.isArray(moduleEntries) && moduleEntries.length > 0) {
-            return moduleEntries.map((moduleEntry) => [moduleEntry, moduleKey]);
-        }
-        return [];
-    });
-};
-const extractI18nKeysFromModules = (modules) => {
-    const i18nKeys = new Set();
-    for (const moduleEntry of getAllModuleEntries(modules)) {
-        const i18nKeysForEntryValue = getI18nKeysFromObject(moduleEntry[0]);
-        for (const key of i18nKeysForEntryValue) {
-            i18nKeys.add(key);
-        }
-    }
-    return i18nKeys.size > 0 ? Array.from(i18nKeys) : [];
-};
-exports.extractI18nKeysFromModules = extractI18nKeysFromModules;
-const extractInternalI18nPropertyKeysFromModules = (modules) => {
-    const i18nKeys = new Set();
-    for (const [moduleEntryObject, moduleKey] of getAllModuleEntries(modules)) {
-        const i18nKeysForEntryValue = getInternalI18nPropertyKeysFromObject(moduleEntryObject);
-        for (const key of i18nKeysForEntryValue) {
-            i18nKeys.add(`${key},${moduleKey}`);
-        }
-    }
-    return i18nKeys.size > 0 ? Array.from(i18nKeys).map((key) => key.split(',')) : [];
-};
-exports.extractInternalI18nPropertyKeysFromModules = extractInternalI18nPropertyKeysFromModules;