mirror of
https://github.com/morluto/rea.git
synced 2026-11-10 16:57:19 +00:00
fix(javascript): preserve native export facts in comparisons
This commit is contained in:
1 parent
c74059d89f
commit
046c4ce353
5 files changed
+295
-40
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { nativeExportCorrespondenceKey } from "./javascriptNativeExportFacts.js";
|
||||
import { canonicalJson } from "../comparisonSemantics.js";
|
||||
import {
|
||||
compareUnicodeCodePoints,
|
||||
@@ -271,21 +272,7 @@ const semanticValue = (
|
||||
exactString(properties.api_key) ??
|
||||
nonEmptyString(properties.api_name)
|
||||
);
|
||||
if (node.kind === "native-export")
|
||||
return (
|
||||
joined(
|
||||
properties.specifier,
|
||||
compositeKey([
|
||||
stringList(properties.requested_members),
|
||||
typeof properties.namespace_access === "boolean"
|
||||
? properties.namespace_access
|
||||
: null,
|
||||
typeof properties.dynamic_member_access === "boolean"
|
||||
? properties.dynamic_member_access
|
||||
: null,
|
||||
]),
|
||||
) ?? firstLabel(node)
|
||||
);
|
||||
if (node.kind === "native-export") return nativeExportCorrespondenceKey(node);
|
||||
if (
|
||||
[
|
||||
"electron-main",
|
||||
@@ -334,13 +321,6 @@ const nonEmptyString = (value: unknown): string | null =>
|
||||
const exactString = (value: unknown): string | null =>
|
||||
typeof value === "string" ? value : null;
|
||||
|
||||
const stringList = (value: unknown): string[] =>
|
||||
Array.isArray(value)
|
||||
? value
|
||||
.filter((item): item is string => typeof item === "string")
|
||||
.sort(compareUnicodeCodePoints)
|
||||
: [];
|
||||
|
||||
const sortedNodes = (nodes: Iterable<ApplicationNode>): ApplicationNode[] =>
|
||||
[...nodes].sort((left, right) =>
|
||||
compareUnicodeCodePoints(left.node_id, right.node_id),
|
||||
|
||||
Reference in new issue
Block a user