@bleedingdev/modern-js-runtime 3.5.0-ultramodern.32 → 3.5.0-ultramodern.34
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/cjs/boundary-debugger/index.js +13 -3
- package/dist/cjs/router/cli/nestedRoutesSpec.js +3 -1
- package/dist/esm/boundary-debugger/index.mjs +13 -3
- package/dist/esm/router/cli/nestedRoutesSpec.mjs +3 -1
- package/dist/esm-node/boundary-debugger/index.mjs +13 -3
- package/dist/esm-node/router/cli/nestedRoutesSpec.mjs +3 -1
- package/package.json +8 -8
|
@@ -142,9 +142,20 @@ function BoundaryDebugger({ controlMode = 'visible', enabledByDefault = false, l
|
|
|
142
142
|
]);
|
|
143
143
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
144
144
|
if (!enabled) return void setBoxes([]);
|
|
145
|
+
let resizeObserver;
|
|
146
|
+
const observedElements = new Set();
|
|
147
|
+
const observeBoundaryElements = (elements)=>{
|
|
148
|
+
if (void 0 === resizeObserver) return;
|
|
149
|
+
for (const element of elements)if (!observedElements.has(element)) {
|
|
150
|
+
observedElements.add(element);
|
|
151
|
+
resizeObserver.observe(element);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
145
154
|
const readBoxes = ()=>{
|
|
155
|
+
const elements = collectBoundaryElements(legacySelector);
|
|
156
|
+
observeBoundaryElements(elements);
|
|
146
157
|
const seenBoxes = new Set();
|
|
147
|
-
const nextBoxes =
|
|
158
|
+
const nextBoxes = elements.map((element)=>{
|
|
148
159
|
const boundaryId = getBoundaryId(element);
|
|
149
160
|
if (void 0 === boundaryId || '' === boundaryId) return;
|
|
150
161
|
const rect = element.getBoundingClientRect();
|
|
@@ -172,9 +183,8 @@ function BoundaryDebugger({ controlMode = 'visible', enabledByDefault = false, l
|
|
|
172
183
|
}).filter((box)=>void 0 !== box);
|
|
173
184
|
setBoxes(nextBoxes);
|
|
174
185
|
};
|
|
186
|
+
resizeObserver = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(readBoxes);
|
|
175
187
|
readBoxes();
|
|
176
|
-
const resizeObserver = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(readBoxes);
|
|
177
|
-
for (const element of collectBoundaryElements(legacySelector))resizeObserver?.observe(element);
|
|
178
188
|
const mutationObserver = new MutationObserver(readBoxes);
|
|
179
189
|
mutationObserver.observe(document.body, {
|
|
180
190
|
childList: true,
|
|
@@ -43,6 +43,7 @@ const external_node_path_namespaceObject = require("node:path");
|
|
|
43
43
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
44
44
|
const promises_namespaceObject = require("node:timers/promises");
|
|
45
45
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
46
|
+
const lodash_namespaceObject = require("@modern-js/utils/lodash");
|
|
46
47
|
const lockPollIntervalMs = 25;
|
|
47
48
|
const staleLockAgeMs = 120000;
|
|
48
49
|
const pendingUpdates = new Map();
|
|
@@ -85,6 +86,7 @@ async function writeJSONAtomically(filePath, value) {
|
|
|
85
86
|
}
|
|
86
87
|
async function updateNestedRoutesSpec(specPath, nextRoutes) {
|
|
87
88
|
const resolvedSpecPath = external_node_path_default().resolve(specPath);
|
|
89
|
+
const nextRoutesSnapshot = (0, lodash_namespaceObject.cloneDeep)(nextRoutes);
|
|
88
90
|
const previousUpdate = pendingUpdates.get(resolvedSpecPath) ?? Promise.resolve();
|
|
89
91
|
const currentUpdate = previousUpdate.catch(()=>void 0).then(async ()=>{
|
|
90
92
|
const releaseLock = await acquireSpecLock(resolvedSpecPath);
|
|
@@ -92,7 +94,7 @@ async function updateNestedRoutesSpec(specPath, nextRoutes) {
|
|
|
92
94
|
const existingRoutes = await utils_namespaceObject.fs.pathExists(resolvedSpecPath) ? await utils_namespaceObject.fs.readJSON(resolvedSpecPath) : {};
|
|
93
95
|
await writeJSONAtomically(resolvedSpecPath, {
|
|
94
96
|
...existingRoutes,
|
|
95
|
-
...
|
|
97
|
+
...nextRoutesSnapshot
|
|
96
98
|
});
|
|
97
99
|
} finally{
|
|
98
100
|
await releaseLock();
|
|
@@ -109,9 +109,20 @@ function BoundaryDebugger({ controlMode = 'visible', enabledByDefault = false, l
|
|
|
109
109
|
]);
|
|
110
110
|
useEffect(()=>{
|
|
111
111
|
if (!enabled) return void setBoxes([]);
|
|
112
|
+
let resizeObserver;
|
|
113
|
+
const observedElements = new Set();
|
|
114
|
+
const observeBoundaryElements = (elements)=>{
|
|
115
|
+
if (void 0 === resizeObserver) return;
|
|
116
|
+
for (const element of elements)if (!observedElements.has(element)) {
|
|
117
|
+
observedElements.add(element);
|
|
118
|
+
resizeObserver.observe(element);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
112
121
|
const readBoxes = ()=>{
|
|
122
|
+
const elements = collectBoundaryElements(legacySelector);
|
|
123
|
+
observeBoundaryElements(elements);
|
|
113
124
|
const seenBoxes = new Set();
|
|
114
|
-
const nextBoxes =
|
|
125
|
+
const nextBoxes = elements.map((element)=>{
|
|
115
126
|
const boundaryId = getBoundaryId(element);
|
|
116
127
|
if (void 0 === boundaryId || '' === boundaryId) return;
|
|
117
128
|
const rect = element.getBoundingClientRect();
|
|
@@ -139,9 +150,8 @@ function BoundaryDebugger({ controlMode = 'visible', enabledByDefault = false, l
|
|
|
139
150
|
}).filter((box)=>void 0 !== box);
|
|
140
151
|
setBoxes(nextBoxes);
|
|
141
152
|
};
|
|
153
|
+
resizeObserver = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(readBoxes);
|
|
142
154
|
readBoxes();
|
|
143
|
-
const resizeObserver = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(readBoxes);
|
|
144
|
-
for (const element of collectBoundaryElements(legacySelector))resizeObserver?.observe(element);
|
|
145
155
|
const mutationObserver = new MutationObserver(readBoxes);
|
|
146
156
|
mutationObserver.observe(document.body, {
|
|
147
157
|
childList: true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
2
|
import { setTimeout as promises_setTimeout } from "node:timers/promises";
|
|
3
3
|
import { fs } from "@modern-js/utils";
|
|
4
|
+
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
4
5
|
const lockPollIntervalMs = 25;
|
|
5
6
|
const staleLockAgeMs = 120000;
|
|
6
7
|
const pendingUpdates = new Map();
|
|
@@ -43,6 +44,7 @@ async function writeJSONAtomically(filePath, value) {
|
|
|
43
44
|
}
|
|
44
45
|
async function updateNestedRoutesSpec(specPath, nextRoutes) {
|
|
45
46
|
const resolvedSpecPath = node_path.resolve(specPath);
|
|
47
|
+
const nextRoutesSnapshot = cloneDeep(nextRoutes);
|
|
46
48
|
const previousUpdate = pendingUpdates.get(resolvedSpecPath) ?? Promise.resolve();
|
|
47
49
|
const currentUpdate = previousUpdate.catch(()=>void 0).then(async ()=>{
|
|
48
50
|
const releaseLock = await acquireSpecLock(resolvedSpecPath);
|
|
@@ -50,7 +52,7 @@ async function updateNestedRoutesSpec(specPath, nextRoutes) {
|
|
|
50
52
|
const existingRoutes = await fs.pathExists(resolvedSpecPath) ? await fs.readJSON(resolvedSpecPath) : {};
|
|
51
53
|
await writeJSONAtomically(resolvedSpecPath, {
|
|
52
54
|
...existingRoutes,
|
|
53
|
-
...
|
|
55
|
+
...nextRoutesSnapshot
|
|
54
56
|
});
|
|
55
57
|
} finally{
|
|
56
58
|
await releaseLock();
|
|
@@ -110,9 +110,20 @@ function BoundaryDebugger({ controlMode = 'visible', enabledByDefault = false, l
|
|
|
110
110
|
]);
|
|
111
111
|
useEffect(()=>{
|
|
112
112
|
if (!enabled) return void setBoxes([]);
|
|
113
|
+
let resizeObserver;
|
|
114
|
+
const observedElements = new Set();
|
|
115
|
+
const observeBoundaryElements = (elements)=>{
|
|
116
|
+
if (void 0 === resizeObserver) return;
|
|
117
|
+
for (const element of elements)if (!observedElements.has(element)) {
|
|
118
|
+
observedElements.add(element);
|
|
119
|
+
resizeObserver.observe(element);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
113
122
|
const readBoxes = ()=>{
|
|
123
|
+
const elements = collectBoundaryElements(legacySelector);
|
|
124
|
+
observeBoundaryElements(elements);
|
|
114
125
|
const seenBoxes = new Set();
|
|
115
|
-
const nextBoxes =
|
|
126
|
+
const nextBoxes = elements.map((element)=>{
|
|
116
127
|
const boundaryId = getBoundaryId(element);
|
|
117
128
|
if (void 0 === boundaryId || '' === boundaryId) return;
|
|
118
129
|
const rect = element.getBoundingClientRect();
|
|
@@ -140,9 +151,8 @@ function BoundaryDebugger({ controlMode = 'visible', enabledByDefault = false, l
|
|
|
140
151
|
}).filter((box)=>void 0 !== box);
|
|
141
152
|
setBoxes(nextBoxes);
|
|
142
153
|
};
|
|
154
|
+
resizeObserver = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(readBoxes);
|
|
143
155
|
readBoxes();
|
|
144
|
-
const resizeObserver = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(readBoxes);
|
|
145
|
-
for (const element of collectBoundaryElements(legacySelector))resizeObserver?.observe(element);
|
|
146
156
|
const mutationObserver = new MutationObserver(readBoxes);
|
|
147
157
|
mutationObserver.observe(document.body, {
|
|
148
158
|
childList: true,
|
|
@@ -2,6 +2,7 @@ import "node:module";
|
|
|
2
2
|
import node_path from "node:path";
|
|
3
3
|
import { setTimeout as promises_setTimeout } from "node:timers/promises";
|
|
4
4
|
import { fs } from "@modern-js/utils";
|
|
5
|
+
import { cloneDeep } from "@modern-js/utils/lodash";
|
|
5
6
|
const lockPollIntervalMs = 25;
|
|
6
7
|
const staleLockAgeMs = 120000;
|
|
7
8
|
const pendingUpdates = new Map();
|
|
@@ -44,6 +45,7 @@ async function writeJSONAtomically(filePath, value) {
|
|
|
44
45
|
}
|
|
45
46
|
async function updateNestedRoutesSpec(specPath, nextRoutes) {
|
|
46
47
|
const resolvedSpecPath = node_path.resolve(specPath);
|
|
48
|
+
const nextRoutesSnapshot = cloneDeep(nextRoutes);
|
|
47
49
|
const previousUpdate = pendingUpdates.get(resolvedSpecPath) ?? Promise.resolve();
|
|
48
50
|
const currentUpdate = previousUpdate.catch(()=>void 0).then(async ()=>{
|
|
49
51
|
const releaseLock = await acquireSpecLock(resolvedSpecPath);
|
|
@@ -51,7 +53,7 @@ async function updateNestedRoutesSpec(specPath, nextRoutes) {
|
|
|
51
53
|
const existingRoutes = await fs.pathExists(resolvedSpecPath) ? await fs.readJSON(resolvedSpecPath) : {};
|
|
52
54
|
await writeJSONAtomically(resolvedSpecPath, {
|
|
53
55
|
...existingRoutes,
|
|
54
|
-
...
|
|
56
|
+
...nextRoutesSnapshot
|
|
55
57
|
});
|
|
56
58
|
} finally{
|
|
57
59
|
await releaseLock();
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.5.0-ultramodern.
|
|
20
|
+
"version": "3.5.0-ultramodern.34",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
@@ -240,12 +240,12 @@
|
|
|
240
240
|
"react-helmet": "^6.1.0",
|
|
241
241
|
"react-helmet-async": "3.0.0",
|
|
242
242
|
"react-is": "^19.2.7",
|
|
243
|
-
"@modern-js/
|
|
244
|
-
"@modern-js/
|
|
245
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.5.0-ultramodern.
|
|
246
|
-
"@modern-js/plugin
|
|
247
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.
|
|
248
|
-
"@modern-js/
|
|
243
|
+
"@modern-js/render": "npm:@bleedingdev/modern-js-render@3.5.0-ultramodern.34",
|
|
244
|
+
"@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.5.0-ultramodern.34",
|
|
245
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.5.0-ultramodern.34",
|
|
246
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.5.0-ultramodern.34",
|
|
247
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.5.0-ultramodern.34",
|
|
248
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.34"
|
|
249
249
|
},
|
|
250
250
|
"peerDependencies": {
|
|
251
251
|
"react": "^19.2.7",
|
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
"react-dom": "^19.2.7",
|
|
266
266
|
"ts-node": "^10.9.2",
|
|
267
267
|
"typescript": "^6.0.3",
|
|
268
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.5.0-ultramodern.
|
|
268
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.5.0-ultramodern.34",
|
|
269
269
|
"@scripts/rstest-config": "2.66.0"
|
|
270
270
|
},
|
|
271
271
|
"sideEffects": false,
|