@lingo.dev/_compiler 0.3.1 → 0.3.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/build/index.cjs +15 -28
- package/build/index.mjs +15 -28
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var _unplugin = require('unplugin');
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "@lingo.dev/_compiler",
|
|
7
|
-
version: "0.3.
|
|
7
|
+
version: "0.3.2",
|
|
8
8
|
description: "Lingo.dev Compiler",
|
|
9
9
|
private: false,
|
|
10
10
|
publishConfig: {
|
|
@@ -834,9 +834,10 @@ var LCPCache = class {
|
|
|
834
834
|
}
|
|
835
835
|
// merge dictionary with current cache, sort files, entries and locales to minimize diffs
|
|
836
836
|
static _mergeLocaleDictionary(currentCache, dictionary, lcp) {
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
|
|
837
|
+
const files = _lodash2.default.call(void 0, dictionary.files).mapValues((file, fileName) => ({
|
|
838
|
+
...file,
|
|
839
|
+
entries: _lodash2.default.call(void 0, file.entries).mapValues((entry, entryName) => {
|
|
840
|
+
const cachedEntry = _nullishCoalesce(_lodash2.default.get(currentCache, ["files", fileName, "entries", entryName]), () => ( {}));
|
|
840
841
|
const hash = _lodash2.default.get(lcp, [
|
|
841
842
|
"files",
|
|
842
843
|
fileName,
|
|
@@ -844,33 +845,19 @@ var LCPCache = class {
|
|
|
844
845
|
entryName,
|
|
845
846
|
"hash"
|
|
846
847
|
]);
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
entryName
|
|
852
|
-
]) || {
|
|
853
|
-
content: {},
|
|
854
|
-
hash
|
|
855
|
-
};
|
|
856
|
-
const mergedContent = _lodash2.default.call(void 0, {
|
|
857
|
-
...existingEntry.content,
|
|
858
|
-
[dictionary.locale]: entryValue
|
|
848
|
+
const cachedEntryContent = cachedEntry.hash === hash ? cachedEntry.content : {};
|
|
849
|
+
const content = _lodash2.default.call(void 0, {
|
|
850
|
+
...cachedEntryContent,
|
|
851
|
+
[dictionary.locale]: entry
|
|
859
852
|
}).toPairs().sortBy([0]).fromPairs().value();
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
const sortedFiles = _lodash2.default.call(void 0, newCache.files).toPairs().sortBy([0]).map(([fileName, file]) => {
|
|
867
|
-
const sortedEntries = _lodash2.default.call(void 0, file.entries).toPairs().sortBy([0]).fromPairs().value();
|
|
868
|
-
return [fileName, { entries: sortedEntries }];
|
|
869
|
-
}).fromPairs().value();
|
|
870
|
-
return {
|
|
853
|
+
return { content, hash };
|
|
854
|
+
}).toPairs().sortBy([0]).fromPairs().value()
|
|
855
|
+
})).toPairs().sortBy([0]).fromPairs().value();
|
|
856
|
+
const newCache = {
|
|
871
857
|
version: dictionary.version,
|
|
872
|
-
files
|
|
858
|
+
files
|
|
873
859
|
};
|
|
860
|
+
return newCache;
|
|
874
861
|
}
|
|
875
862
|
// extract dictionary from cache for given locale, validate entry hash from LCP schema
|
|
876
863
|
static _extractLocaleDictionary(cache, locale, lcp) {
|
package/build/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createUnplugin } from "unplugin";
|
|
|
4
4
|
// package.json
|
|
5
5
|
var package_default = {
|
|
6
6
|
name: "@lingo.dev/_compiler",
|
|
7
|
-
version: "0.3.
|
|
7
|
+
version: "0.3.2",
|
|
8
8
|
description: "Lingo.dev Compiler",
|
|
9
9
|
private: false,
|
|
10
10
|
publishConfig: {
|
|
@@ -834,9 +834,10 @@ var LCPCache = class {
|
|
|
834
834
|
}
|
|
835
835
|
// merge dictionary with current cache, sort files, entries and locales to minimize diffs
|
|
836
836
|
static _mergeLocaleDictionary(currentCache, dictionary, lcp) {
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
|
|
837
|
+
const files = _3(dictionary.files).mapValues((file, fileName) => ({
|
|
838
|
+
...file,
|
|
839
|
+
entries: _3(file.entries).mapValues((entry, entryName) => {
|
|
840
|
+
const cachedEntry = _3.get(currentCache, ["files", fileName, "entries", entryName]) ?? {};
|
|
840
841
|
const hash = _3.get(lcp, [
|
|
841
842
|
"files",
|
|
842
843
|
fileName,
|
|
@@ -844,33 +845,19 @@ var LCPCache = class {
|
|
|
844
845
|
entryName,
|
|
845
846
|
"hash"
|
|
846
847
|
]);
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
entryName
|
|
852
|
-
]) || {
|
|
853
|
-
content: {},
|
|
854
|
-
hash
|
|
855
|
-
};
|
|
856
|
-
const mergedContent = _3({
|
|
857
|
-
...existingEntry.content,
|
|
858
|
-
[dictionary.locale]: entryValue
|
|
848
|
+
const cachedEntryContent = cachedEntry.hash === hash ? cachedEntry.content : {};
|
|
849
|
+
const content = _3({
|
|
850
|
+
...cachedEntryContent,
|
|
851
|
+
[dictionary.locale]: entry
|
|
859
852
|
}).toPairs().sortBy([0]).fromPairs().value();
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
const sortedFiles = _3(newCache.files).toPairs().sortBy([0]).map(([fileName, file]) => {
|
|
867
|
-
const sortedEntries = _3(file.entries).toPairs().sortBy([0]).fromPairs().value();
|
|
868
|
-
return [fileName, { entries: sortedEntries }];
|
|
869
|
-
}).fromPairs().value();
|
|
870
|
-
return {
|
|
853
|
+
return { content, hash };
|
|
854
|
+
}).toPairs().sortBy([0]).fromPairs().value()
|
|
855
|
+
})).toPairs().sortBy([0]).fromPairs().value();
|
|
856
|
+
const newCache = {
|
|
871
857
|
version: dictionary.version,
|
|
872
|
-
files
|
|
858
|
+
files
|
|
873
859
|
};
|
|
860
|
+
return newCache;
|
|
874
861
|
}
|
|
875
862
|
// extract dictionary from cache for given locale, validate entry hash from LCP schema
|
|
876
863
|
static _extractLocaleDictionary(cache, locale, lcp) {
|