@plumeria/utils 19.2.7 → 19.2.8
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/dist/parser.js +51 -9
- package/package.json +1 -1
package/dist/parser.js
CHANGED
|
@@ -1133,7 +1133,46 @@ function stripFileContributions(filePath, cached) {
|
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
|
+
const propEntryKeys = new WeakMap();
|
|
1137
|
+
const propEntryKey = (entry) => JSON.stringify([
|
|
1138
|
+
entry.filePath,
|
|
1139
|
+
entry.spanStart,
|
|
1140
|
+
entry.key,
|
|
1141
|
+
entry.conditions,
|
|
1142
|
+
]);
|
|
1143
|
+
const statMemo = new Map();
|
|
1144
|
+
let scanning = false;
|
|
1145
|
+
function statFile(filePath) {
|
|
1146
|
+
if (!scanning)
|
|
1147
|
+
return fs.statSync(filePath);
|
|
1148
|
+
const memo = statMemo.get(filePath);
|
|
1149
|
+
if (memo) {
|
|
1150
|
+
if (memo instanceof Error)
|
|
1151
|
+
throw memo;
|
|
1152
|
+
return memo;
|
|
1153
|
+
}
|
|
1154
|
+
try {
|
|
1155
|
+
const stats = fs.statSync(filePath);
|
|
1156
|
+
statMemo.set(filePath, stats);
|
|
1157
|
+
return stats;
|
|
1158
|
+
}
|
|
1159
|
+
catch (e) {
|
|
1160
|
+
statMemo.set(filePath, e);
|
|
1161
|
+
throw e;
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1136
1164
|
function scanAll(scanCwd = process.cwd()) {
|
|
1165
|
+
scanning = true;
|
|
1166
|
+
statMemo.clear();
|
|
1167
|
+
try {
|
|
1168
|
+
return runScan(scanCwd);
|
|
1169
|
+
}
|
|
1170
|
+
finally {
|
|
1171
|
+
scanning = false;
|
|
1172
|
+
statMemo.clear();
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
function runScan(scanCwd = process.cwd()) {
|
|
1137
1176
|
const cwd = path.resolve(scanCwd);
|
|
1138
1177
|
if (hasComputedOnce &&
|
|
1139
1178
|
process.env.NODE_ENV === 'production' &&
|
|
@@ -2065,15 +2104,18 @@ function scanAll(scanCwd = process.cwd()) {
|
|
|
2065
2104
|
globalTable[compKey][propName] = [];
|
|
2066
2105
|
}
|
|
2067
2106
|
const entries = localComponentPropsTable[compKey][propName];
|
|
2107
|
+
const collected = globalTable[compKey][propName];
|
|
2108
|
+
let taken = propEntryKeys.get(collected);
|
|
2109
|
+
if (!taken) {
|
|
2110
|
+
taken = new Set(collected.map(propEntryKey));
|
|
2111
|
+
propEntryKeys.set(collected, taken);
|
|
2112
|
+
}
|
|
2068
2113
|
for (const entry of entries) {
|
|
2069
|
-
const
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
if (!exists) {
|
|
2075
|
-
globalTable[compKey][propName].push(entry);
|
|
2076
|
-
}
|
|
2114
|
+
const key = propEntryKey(entry);
|
|
2115
|
+
if (taken.has(key))
|
|
2116
|
+
continue;
|
|
2117
|
+
taken.add(key);
|
|
2118
|
+
collected.push(entry);
|
|
2077
2119
|
}
|
|
2078
2120
|
}
|
|
2079
2121
|
}
|
|
@@ -2305,7 +2347,7 @@ function resolveExport(filePath, exportName, visited = new Set()) {
|
|
|
2305
2347
|
visited.add(key);
|
|
2306
2348
|
{
|
|
2307
2349
|
try {
|
|
2308
|
-
const stats =
|
|
2350
|
+
const stats = statFile(filePath);
|
|
2309
2351
|
if ((!fileCache[filePath]?.exports ||
|
|
2310
2352
|
fileCache[filePath].exportsMtimeMs !== stats.mtimeMs) &&
|
|
2311
2353
|
stats.isFile()) {
|