@ecopages/react-router 0.2.0-alpha.47 → 0.2.0-alpha.49
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/package.json +3 -3
- package/src/navigation.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/react-router",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.49",
|
|
4
4
|
"description": "Client-side SPA router for EcoPages React applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ecopages",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"directory": "packages/react-router"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@ecopages/core": "0.2.0-alpha.
|
|
36
|
-
"@ecopages/react": "0.2.0-alpha.
|
|
35
|
+
"@ecopages/core": "0.2.0-alpha.49",
|
|
36
|
+
"@ecopages/react": "0.2.0-alpha.49"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"react": "^19.2.6",
|
package/src/navigation.js
CHANGED
|
@@ -39,6 +39,7 @@ const DEFAULT_IMPORT_REGEX = /import\s+(\w+)\s+from\s*['"]([^'"]+)['"]/;
|
|
|
39
39
|
const NAMESPACE_IMPORT_REGEX = /import\s*\*\s*as\s*(\w+)\s*from\s*['"]([^'"]+)['"]/;
|
|
40
40
|
const PAGE_MODULE_MARKER_REGEX = /__ECO_PAGES__\.page\s*=\s*\{\s*module\s*:\s*['"]([^'"]+)['"]/;
|
|
41
41
|
const PAGE_MODULE_IDENTIFIER_REGEX = /__ECO_PAGES__\.page\s*=\s*\{\s*module\s*:\s*([A-Za-z_$][\w$]*)\s*,/;
|
|
42
|
+
const PAGE_BOOTSTRAP_SELECTOR = 'script[data-eco-page-bootstrap="react-router"]';
|
|
42
43
|
function extractModulePathFromCode(code, fallbackUrl) {
|
|
43
44
|
const markerMatch = code.match(PAGE_MODULE_MARKER_REGEX);
|
|
44
45
|
if (markerMatch) {
|
|
@@ -99,7 +100,7 @@ async function extractComponentUrl(doc) {
|
|
|
99
100
|
if (inlineHydrationScript?.textContent) {
|
|
100
101
|
return extractModulePathFromCode(inlineHydrationScript.textContent);
|
|
101
102
|
}
|
|
102
|
-
const hydrationScript = scripts.find((s) => isReactPageHydrationAssetSrc(s.src ?? ""));
|
|
103
|
+
const hydrationScript = doc.querySelector(PAGE_BOOTSTRAP_SELECTOR) ?? scripts.find((s) => isReactPageHydrationAssetSrc(s.src ?? ""));
|
|
103
104
|
if (!hydrationScript?.src) return null;
|
|
104
105
|
try {
|
|
105
106
|
const scriptUrl = addCacheBuster(hydrationScript.src);
|