@webtypen/webframez-react 0.0.40 → 0.0.42
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/bin/webframez-react.mjs +86 -0
- package/defaults/webpack.client.cjs +51 -0
- package/dist/build-plugin.cjs +44 -1
- package/dist/build-plugin.js +44 -1
- package/dist/http.cjs +24 -6
- package/dist/http.js +24 -6
- package/dist/index.cjs +24 -6
- package/dist/index.js +24 -6
- package/dist/webframez-core.cjs +24 -6
- package/dist/webframez-core.js +24 -6
- package/package.json +1 -1
package/bin/webframez-react.mjs
CHANGED
|
@@ -519,6 +519,84 @@ async function watchRouteTargets(targets, passthroughArgsClean) {
|
|
|
519
519
|
});
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
function getManifestChunkAssetsByName(distRootDir) {
|
|
523
|
+
const chunksDir = path.join(distRootDir, "chunks");
|
|
524
|
+
const assetsByName = new Map();
|
|
525
|
+
if (!fileExists(chunksDir)) {
|
|
526
|
+
return assetsByName;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
for (const fileName of fs.readdirSync(chunksDir)) {
|
|
530
|
+
const match = fileName.match(/^(.*)-[a-f0-9]+\.js$/i);
|
|
531
|
+
if (match && match[1]) {
|
|
532
|
+
assetsByName.set(match[1], path.join("chunks", fileName));
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return assetsByName;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function normalizeRouteManifestChunkFiles(distRootDir) {
|
|
540
|
+
const manifestPath = path.join(distRootDir, "react-client-manifest.json");
|
|
541
|
+
if (!fileExists(manifestPath)) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
const assetsByName = getManifestChunkAssetsByName(distRootDir);
|
|
546
|
+
if (assetsByName.size === 0) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
551
|
+
let changed = false;
|
|
552
|
+
for (const value of Object.values(manifest)) {
|
|
553
|
+
if (!value || typeof value !== "object" || !Array.isArray(value.chunks)) {
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
const nextChunks = value.chunks.map((chunk, index, chunks) => {
|
|
558
|
+
if (index % 2 === 1 && typeof chunks[index - 1] === "string") {
|
|
559
|
+
return assetsByName.get(chunks[index - 1]) || chunk;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return chunk;
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
if (nextChunks.some((chunk, index) => chunk !== value.chunks[index])) {
|
|
566
|
+
value.chunks = nextChunks;
|
|
567
|
+
changed = true;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
if (changed) {
|
|
572
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
function collectMissingManifestChunks(distRootDir) {
|
|
577
|
+
const manifestPath = path.join(distRootDir, "react-client-manifest.json");
|
|
578
|
+
if (!fileExists(manifestPath)) {
|
|
579
|
+
return [];
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
583
|
+
const missing = [];
|
|
584
|
+
for (const value of Object.values(manifest)) {
|
|
585
|
+
if (!value || typeof value !== "object" || !Array.isArray(value.chunks)) {
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
for (let index = 1; index < value.chunks.length; index += 2) {
|
|
590
|
+
const chunk = value.chunks[index];
|
|
591
|
+
if (typeof chunk === "string" && chunk.includes(".") && !fileExists(path.join(distRootDir, chunk))) {
|
|
592
|
+
missing.push(chunk);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
return Array.from(new Set(missing));
|
|
598
|
+
}
|
|
599
|
+
|
|
522
600
|
async function validateRouteBuild(target) {
|
|
523
601
|
const requiredFiles = [
|
|
524
602
|
path.join(target.distRootDir, "client.js"),
|
|
@@ -532,6 +610,13 @@ async function validateRouteBuild(target) {
|
|
|
532
610
|
`Route ${target.path} build is incomplete. Missing: ${missing.join(", ")}`,
|
|
533
611
|
);
|
|
534
612
|
}
|
|
613
|
+
|
|
614
|
+
const missingChunks = collectMissingManifestChunks(target.distRootDir);
|
|
615
|
+
if (missingChunks.length > 0) {
|
|
616
|
+
throw new Error(
|
|
617
|
+
`Route ${target.path} client manifest references missing chunks: ${missingChunks.join(", ")}`,
|
|
618
|
+
);
|
|
619
|
+
}
|
|
535
620
|
}
|
|
536
621
|
|
|
537
622
|
async function main() {
|
|
@@ -631,6 +716,7 @@ async function main() {
|
|
|
631
716
|
return;
|
|
632
717
|
}
|
|
633
718
|
|
|
719
|
+
normalizeRouteManifestChunkFiles(target.distRootDir);
|
|
634
720
|
await validateRouteBuild(target);
|
|
635
721
|
}
|
|
636
722
|
|
|
@@ -34,6 +34,53 @@ const frameworkCacheVersion = frameworkCacheFiles
|
|
|
34
34
|
fs.mkdirSync(distDir, { recursive: true });
|
|
35
35
|
fs.mkdirSync(pagesDir, { recursive: true });
|
|
36
36
|
|
|
37
|
+
function getEmittedChunkAssetsByName() {
|
|
38
|
+
const chunksDir = path.join(distDir, "chunks");
|
|
39
|
+
const assetsByName = new Map();
|
|
40
|
+
if (!fs.existsSync(chunksDir)) {
|
|
41
|
+
return assetsByName;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
for (const fileName of fs.readdirSync(chunksDir)) {
|
|
45
|
+
const match = fileName.match(/^(.*)-[a-f0-9]+\.js$/i);
|
|
46
|
+
if (match && match[1]) {
|
|
47
|
+
assetsByName.set(match[1], "chunks/" + fileName);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return assetsByName;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function normalizeManifestChunkFiles(manifest) {
|
|
55
|
+
const assetsByName = getEmittedChunkAssetsByName();
|
|
56
|
+
if (assetsByName.size === 0) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let changed = false;
|
|
61
|
+
for (const value of Object.values(manifest)) {
|
|
62
|
+
if (!value || typeof value !== "object" || !Array.isArray(value.chunks)) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const nextChunks = value.chunks.map((chunk, index, chunks) => {
|
|
67
|
+
if (index % 2 === 1 && typeof chunks[index - 1] === "string") {
|
|
68
|
+
return assetsByName.get(chunks[index - 1]) || chunk;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return chunk;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if (nextChunks.some((chunk, index) => chunk !== value.chunks[index])) {
|
|
75
|
+
value.chunks = nextChunks;
|
|
76
|
+
changed = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return changed;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
37
84
|
class ClientManifestExportAliasesPlugin {
|
|
38
85
|
apply(compiler) {
|
|
39
86
|
compiler.hooks.done.tap("ClientManifestExportAliasesPlugin", () => {
|
|
@@ -152,6 +199,10 @@ class ClientManifestExportAliasesPlugin {
|
|
|
152
199
|
}
|
|
153
200
|
}
|
|
154
201
|
|
|
202
|
+
if (normalizeManifestChunkFiles(manifest)) {
|
|
203
|
+
changed = true;
|
|
204
|
+
}
|
|
205
|
+
|
|
155
206
|
if (changed) {
|
|
156
207
|
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
157
208
|
}
|
package/dist/build-plugin.cjs
CHANGED
|
@@ -41,6 +41,47 @@ function fileExists(filePath) {
|
|
|
41
41
|
function readJson(filePath) {
|
|
42
42
|
return JSON.parse(import_node_fs.default.readFileSync(filePath, "utf-8"));
|
|
43
43
|
}
|
|
44
|
+
function getEmittedChunkAssetsByName(distRootDir) {
|
|
45
|
+
const chunksDir = import_node_path.default.join(distRootDir, "chunks");
|
|
46
|
+
const assetsByName = /* @__PURE__ */ new Map();
|
|
47
|
+
if (!fileExists(chunksDir)) {
|
|
48
|
+
return assetsByName;
|
|
49
|
+
}
|
|
50
|
+
for (const fileName of import_node_fs.default.readdirSync(chunksDir)) {
|
|
51
|
+
const match = fileName.match(/^(.*)-[a-f0-9]+\.js$/i);
|
|
52
|
+
if (match?.[1]) {
|
|
53
|
+
assetsByName.set(match[1], import_node_path.default.join("chunks", fileName));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return assetsByName;
|
|
57
|
+
}
|
|
58
|
+
function normalizeManifestChunkFiles(distRootDir, manifestPath) {
|
|
59
|
+
const manifest = readJson(manifestPath);
|
|
60
|
+
const assetsByName = getEmittedChunkAssetsByName(distRootDir);
|
|
61
|
+
if (assetsByName.size === 0) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
let changed = false;
|
|
65
|
+
for (const value of Object.values(manifest)) {
|
|
66
|
+
const entry = value;
|
|
67
|
+
if (!entry || !Array.isArray(entry.chunks)) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const nextChunks = entry.chunks.map((chunk, index, chunks) => {
|
|
71
|
+
if (index % 2 === 1 && typeof chunks[index - 1] === "string") {
|
|
72
|
+
return assetsByName.get(chunks[index - 1]) || chunk;
|
|
73
|
+
}
|
|
74
|
+
return chunk;
|
|
75
|
+
});
|
|
76
|
+
if (nextChunks.some((chunk, index) => chunk !== entry.chunks?.[index])) {
|
|
77
|
+
entry.chunks = nextChunks;
|
|
78
|
+
changed = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (changed) {
|
|
82
|
+
import_node_fs.default.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
44
85
|
function collectManifestChunks(manifestPath) {
|
|
45
86
|
const manifest = readJson(manifestPath);
|
|
46
87
|
const chunks = /* @__PURE__ */ new Set();
|
|
@@ -65,7 +106,9 @@ function validateRouteDist(distRootDir) {
|
|
|
65
106
|
throw new Error(`webframez-react build output missing: ${filePath}`);
|
|
66
107
|
}
|
|
67
108
|
}
|
|
68
|
-
|
|
109
|
+
const clientManifestPath = import_node_path.default.join(distRootDir, "react-client-manifest.json");
|
|
110
|
+
normalizeManifestChunkFiles(distRootDir, clientManifestPath);
|
|
111
|
+
for (const chunk of collectManifestChunks(clientManifestPath)) {
|
|
69
112
|
const chunkPath = import_node_path.default.join(distRootDir, chunk);
|
|
70
113
|
if (!fileExists(chunkPath)) {
|
|
71
114
|
throw new Error(`webframez-react manifest references missing chunk: ${chunkPath}`);
|
package/dist/build-plugin.js
CHANGED
|
@@ -7,6 +7,47 @@ function fileExists(filePath) {
|
|
|
7
7
|
function readJson(filePath) {
|
|
8
8
|
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
9
9
|
}
|
|
10
|
+
function getEmittedChunkAssetsByName(distRootDir) {
|
|
11
|
+
const chunksDir = path.join(distRootDir, "chunks");
|
|
12
|
+
const assetsByName = /* @__PURE__ */ new Map();
|
|
13
|
+
if (!fileExists(chunksDir)) {
|
|
14
|
+
return assetsByName;
|
|
15
|
+
}
|
|
16
|
+
for (const fileName of fs.readdirSync(chunksDir)) {
|
|
17
|
+
const match = fileName.match(/^(.*)-[a-f0-9]+\.js$/i);
|
|
18
|
+
if (match?.[1]) {
|
|
19
|
+
assetsByName.set(match[1], path.join("chunks", fileName));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return assetsByName;
|
|
23
|
+
}
|
|
24
|
+
function normalizeManifestChunkFiles(distRootDir, manifestPath) {
|
|
25
|
+
const manifest = readJson(manifestPath);
|
|
26
|
+
const assetsByName = getEmittedChunkAssetsByName(distRootDir);
|
|
27
|
+
if (assetsByName.size === 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let changed = false;
|
|
31
|
+
for (const value of Object.values(manifest)) {
|
|
32
|
+
const entry = value;
|
|
33
|
+
if (!entry || !Array.isArray(entry.chunks)) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const nextChunks = entry.chunks.map((chunk, index, chunks) => {
|
|
37
|
+
if (index % 2 === 1 && typeof chunks[index - 1] === "string") {
|
|
38
|
+
return assetsByName.get(chunks[index - 1]) || chunk;
|
|
39
|
+
}
|
|
40
|
+
return chunk;
|
|
41
|
+
});
|
|
42
|
+
if (nextChunks.some((chunk, index) => chunk !== entry.chunks?.[index])) {
|
|
43
|
+
entry.chunks = nextChunks;
|
|
44
|
+
changed = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (changed) {
|
|
48
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
10
51
|
function collectManifestChunks(manifestPath) {
|
|
11
52
|
const manifest = readJson(manifestPath);
|
|
12
53
|
const chunks = /* @__PURE__ */ new Set();
|
|
@@ -31,7 +72,9 @@ function validateRouteDist(distRootDir) {
|
|
|
31
72
|
throw new Error(`webframez-react build output missing: ${filePath}`);
|
|
32
73
|
}
|
|
33
74
|
}
|
|
34
|
-
|
|
75
|
+
const clientManifestPath = path.join(distRootDir, "react-client-manifest.json");
|
|
76
|
+
normalizeManifestChunkFiles(distRootDir, clientManifestPath);
|
|
77
|
+
for (const chunk of collectManifestChunks(clientManifestPath)) {
|
|
35
78
|
const chunkPath = path.join(distRootDir, chunk);
|
|
36
79
|
if (!fileExists(chunkPath)) {
|
|
37
80
|
throw new Error(`webframez-react manifest references missing chunk: ${chunkPath}`);
|
package/dist/http.cjs
CHANGED
|
@@ -965,13 +965,31 @@ globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
|
965
965
|
};
|
|
966
966
|
function normalizeWebframezRequireCandidate(candidate) {
|
|
967
967
|
const stagingMarker = path.join(".webframez-build", "");
|
|
968
|
-
const
|
|
968
|
+
const runtimeMarkers = [path.join("app", ""), path.join("modules", "")];
|
|
969
969
|
const stagingIndex = candidate.indexOf(stagingMarker);
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
970
|
+
if (stagingIndex >= 0) {
|
|
971
|
+
for (const runtimeMarker of runtimeMarkers) {
|
|
972
|
+
const markerIndex = candidate.indexOf(runtimeMarker, stagingIndex);
|
|
973
|
+
if (markerIndex < 0) {
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
const relativeRuntimePath = candidate.slice(markerIndex);
|
|
978
|
+
const runtimeCandidates = [
|
|
979
|
+
path.resolve(process.cwd(), relativeRuntimePath),
|
|
980
|
+
path.resolve(process.cwd(), "build", relativeRuntimePath)
|
|
981
|
+
];
|
|
982
|
+
const cwdParts = process.cwd().split(path.sep);
|
|
983
|
+
const buildsIndex = cwdParts.lastIndexOf("builds");
|
|
984
|
+
if (buildsIndex > 0) {
|
|
985
|
+
const projectRoot = cwdParts.slice(0, buildsIndex).join(path.sep) || path.sep;
|
|
986
|
+
runtimeCandidates.push(path.resolve(projectRoot, "build", relativeRuntimePath));
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
const runtimeCandidate = runtimeCandidates.find((candidatePath) => fs.existsSync(candidatePath));
|
|
990
|
+
if (runtimeCandidate) {
|
|
991
|
+
return runtimeCandidate;
|
|
992
|
+
}
|
|
975
993
|
}
|
|
976
994
|
}
|
|
977
995
|
|
package/dist/http.js
CHANGED
|
@@ -945,13 +945,31 @@ globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
|
945
945
|
};
|
|
946
946
|
function normalizeWebframezRequireCandidate(candidate) {
|
|
947
947
|
const stagingMarker = path.join(".webframez-build", "");
|
|
948
|
-
const
|
|
948
|
+
const runtimeMarkers = [path.join("app", ""), path.join("modules", "")];
|
|
949
949
|
const stagingIndex = candidate.indexOf(stagingMarker);
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
950
|
+
if (stagingIndex >= 0) {
|
|
951
|
+
for (const runtimeMarker of runtimeMarkers) {
|
|
952
|
+
const markerIndex = candidate.indexOf(runtimeMarker, stagingIndex);
|
|
953
|
+
if (markerIndex < 0) {
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
const relativeRuntimePath = candidate.slice(markerIndex);
|
|
958
|
+
const runtimeCandidates = [
|
|
959
|
+
path.resolve(process.cwd(), relativeRuntimePath),
|
|
960
|
+
path.resolve(process.cwd(), "build", relativeRuntimePath)
|
|
961
|
+
];
|
|
962
|
+
const cwdParts = process.cwd().split(path.sep);
|
|
963
|
+
const buildsIndex = cwdParts.lastIndexOf("builds");
|
|
964
|
+
if (buildsIndex > 0) {
|
|
965
|
+
const projectRoot = cwdParts.slice(0, buildsIndex).join(path.sep) || path.sep;
|
|
966
|
+
runtimeCandidates.push(path.resolve(projectRoot, "build", relativeRuntimePath));
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
const runtimeCandidate = runtimeCandidates.find((candidatePath) => fs.existsSync(candidatePath));
|
|
970
|
+
if (runtimeCandidate) {
|
|
971
|
+
return runtimeCandidate;
|
|
972
|
+
}
|
|
955
973
|
}
|
|
956
974
|
}
|
|
957
975
|
|
package/dist/index.cjs
CHANGED
|
@@ -1005,13 +1005,31 @@ globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
|
1005
1005
|
};
|
|
1006
1006
|
function normalizeWebframezRequireCandidate(candidate) {
|
|
1007
1007
|
const stagingMarker = path.join(".webframez-build", "");
|
|
1008
|
-
const
|
|
1008
|
+
const runtimeMarkers = [path.join("app", ""), path.join("modules", "")];
|
|
1009
1009
|
const stagingIndex = candidate.indexOf(stagingMarker);
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1010
|
+
if (stagingIndex >= 0) {
|
|
1011
|
+
for (const runtimeMarker of runtimeMarkers) {
|
|
1012
|
+
const markerIndex = candidate.indexOf(runtimeMarker, stagingIndex);
|
|
1013
|
+
if (markerIndex < 0) {
|
|
1014
|
+
continue;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
const relativeRuntimePath = candidate.slice(markerIndex);
|
|
1018
|
+
const runtimeCandidates = [
|
|
1019
|
+
path.resolve(process.cwd(), relativeRuntimePath),
|
|
1020
|
+
path.resolve(process.cwd(), "build", relativeRuntimePath)
|
|
1021
|
+
];
|
|
1022
|
+
const cwdParts = process.cwd().split(path.sep);
|
|
1023
|
+
const buildsIndex = cwdParts.lastIndexOf("builds");
|
|
1024
|
+
if (buildsIndex > 0) {
|
|
1025
|
+
const projectRoot = cwdParts.slice(0, buildsIndex).join(path.sep) || path.sep;
|
|
1026
|
+
runtimeCandidates.push(path.resolve(projectRoot, "build", relativeRuntimePath));
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
const runtimeCandidate = runtimeCandidates.find((candidatePath) => fs.existsSync(candidatePath));
|
|
1030
|
+
if (runtimeCandidate) {
|
|
1031
|
+
return runtimeCandidate;
|
|
1032
|
+
}
|
|
1015
1033
|
}
|
|
1016
1034
|
}
|
|
1017
1035
|
|
package/dist/index.js
CHANGED
|
@@ -971,13 +971,31 @@ globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
|
971
971
|
};
|
|
972
972
|
function normalizeWebframezRequireCandidate(candidate) {
|
|
973
973
|
const stagingMarker = path.join(".webframez-build", "");
|
|
974
|
-
const
|
|
974
|
+
const runtimeMarkers = [path.join("app", ""), path.join("modules", "")];
|
|
975
975
|
const stagingIndex = candidate.indexOf(stagingMarker);
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
976
|
+
if (stagingIndex >= 0) {
|
|
977
|
+
for (const runtimeMarker of runtimeMarkers) {
|
|
978
|
+
const markerIndex = candidate.indexOf(runtimeMarker, stagingIndex);
|
|
979
|
+
if (markerIndex < 0) {
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const relativeRuntimePath = candidate.slice(markerIndex);
|
|
984
|
+
const runtimeCandidates = [
|
|
985
|
+
path.resolve(process.cwd(), relativeRuntimePath),
|
|
986
|
+
path.resolve(process.cwd(), "build", relativeRuntimePath)
|
|
987
|
+
];
|
|
988
|
+
const cwdParts = process.cwd().split(path.sep);
|
|
989
|
+
const buildsIndex = cwdParts.lastIndexOf("builds");
|
|
990
|
+
if (buildsIndex > 0) {
|
|
991
|
+
const projectRoot = cwdParts.slice(0, buildsIndex).join(path.sep) || path.sep;
|
|
992
|
+
runtimeCandidates.push(path.resolve(projectRoot, "build", relativeRuntimePath));
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
const runtimeCandidate = runtimeCandidates.find((candidatePath) => fs.existsSync(candidatePath));
|
|
996
|
+
if (runtimeCandidate) {
|
|
997
|
+
return runtimeCandidate;
|
|
998
|
+
}
|
|
981
999
|
}
|
|
982
1000
|
}
|
|
983
1001
|
|
package/dist/webframez-core.cjs
CHANGED
|
@@ -972,13 +972,31 @@ globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
|
972
972
|
};
|
|
973
973
|
function normalizeWebframezRequireCandidate(candidate) {
|
|
974
974
|
const stagingMarker = path.join(".webframez-build", "");
|
|
975
|
-
const
|
|
975
|
+
const runtimeMarkers = [path.join("app", ""), path.join("modules", "")];
|
|
976
976
|
const stagingIndex = candidate.indexOf(stagingMarker);
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
977
|
+
if (stagingIndex >= 0) {
|
|
978
|
+
for (const runtimeMarker of runtimeMarkers) {
|
|
979
|
+
const markerIndex = candidate.indexOf(runtimeMarker, stagingIndex);
|
|
980
|
+
if (markerIndex < 0) {
|
|
981
|
+
continue;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
const relativeRuntimePath = candidate.slice(markerIndex);
|
|
985
|
+
const runtimeCandidates = [
|
|
986
|
+
path.resolve(process.cwd(), relativeRuntimePath),
|
|
987
|
+
path.resolve(process.cwd(), "build", relativeRuntimePath)
|
|
988
|
+
];
|
|
989
|
+
const cwdParts = process.cwd().split(path.sep);
|
|
990
|
+
const buildsIndex = cwdParts.lastIndexOf("builds");
|
|
991
|
+
if (buildsIndex > 0) {
|
|
992
|
+
const projectRoot = cwdParts.slice(0, buildsIndex).join(path.sep) || path.sep;
|
|
993
|
+
runtimeCandidates.push(path.resolve(projectRoot, "build", relativeRuntimePath));
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
const runtimeCandidate = runtimeCandidates.find((candidatePath) => fs.existsSync(candidatePath));
|
|
997
|
+
if (runtimeCandidate) {
|
|
998
|
+
return runtimeCandidate;
|
|
999
|
+
}
|
|
982
1000
|
}
|
|
983
1001
|
}
|
|
984
1002
|
|
package/dist/webframez-core.js
CHANGED
|
@@ -948,13 +948,31 @@ globalThis.__webpack_chunk_load__ = function __webframezNoopChunkLoad() {
|
|
|
948
948
|
};
|
|
949
949
|
function normalizeWebframezRequireCandidate(candidate) {
|
|
950
950
|
const stagingMarker = path.join(".webframez-build", "");
|
|
951
|
-
const
|
|
951
|
+
const runtimeMarkers = [path.join("app", ""), path.join("modules", "")];
|
|
952
952
|
const stagingIndex = candidate.indexOf(stagingMarker);
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
953
|
+
if (stagingIndex >= 0) {
|
|
954
|
+
for (const runtimeMarker of runtimeMarkers) {
|
|
955
|
+
const markerIndex = candidate.indexOf(runtimeMarker, stagingIndex);
|
|
956
|
+
if (markerIndex < 0) {
|
|
957
|
+
continue;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
const relativeRuntimePath = candidate.slice(markerIndex);
|
|
961
|
+
const runtimeCandidates = [
|
|
962
|
+
path.resolve(process.cwd(), relativeRuntimePath),
|
|
963
|
+
path.resolve(process.cwd(), "build", relativeRuntimePath)
|
|
964
|
+
];
|
|
965
|
+
const cwdParts = process.cwd().split(path.sep);
|
|
966
|
+
const buildsIndex = cwdParts.lastIndexOf("builds");
|
|
967
|
+
if (buildsIndex > 0) {
|
|
968
|
+
const projectRoot = cwdParts.slice(0, buildsIndex).join(path.sep) || path.sep;
|
|
969
|
+
runtimeCandidates.push(path.resolve(projectRoot, "build", relativeRuntimePath));
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
const runtimeCandidate = runtimeCandidates.find((candidatePath) => fs.existsSync(candidatePath));
|
|
973
|
+
if (runtimeCandidate) {
|
|
974
|
+
return runtimeCandidate;
|
|
975
|
+
}
|
|
958
976
|
}
|
|
959
977
|
}
|
|
960
978
|
|