evolit 0.1.0-alpha.13 → 0.1.0-alpha.14
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 +1 -1
- package/src/client-assets.js +27 -4
package/package.json
CHANGED
package/src/client-assets.js
CHANGED
|
@@ -69,6 +69,19 @@ function resolveRelativeClientImportPath(fromClientModule, specifier) {
|
|
|
69
69
|
.join("/");
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
function normalizeClientMetadataAssetPath(fromClientModule, importedAsset) {
|
|
73
|
+
if (typeof importedAsset !== "string") {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const normalizedAsset = stripImportSearchAndHash(importedAsset);
|
|
78
|
+
if (isRelativeSpecifier(normalizedAsset)) {
|
|
79
|
+
return resolveRelativeClientImportPath(fromClientModule, normalizedAsset);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return path.normalize(normalizedAsset).split(path.sep).join("/");
|
|
83
|
+
}
|
|
84
|
+
|
|
72
85
|
function parsePackageSpecifier(specifier) {
|
|
73
86
|
if (!isBareSpecifier(specifier)) {
|
|
74
87
|
return null;
|
|
@@ -738,10 +751,16 @@ async function collectTransitiveClientModuleMetadata(projectRoot, mode, clientMo
|
|
|
738
751
|
}
|
|
739
752
|
|
|
740
753
|
for (const styleImport of metadata.styleImports) {
|
|
741
|
-
|
|
754
|
+
const normalizedStyleImport = normalizeClientMetadataAssetPath(currentModule, styleImport);
|
|
755
|
+
if (normalizedStyleImport) {
|
|
756
|
+
styleImports.add(normalizedStyleImport);
|
|
757
|
+
}
|
|
742
758
|
}
|
|
743
759
|
for (const assetImport of metadata.assetImports) {
|
|
744
|
-
|
|
760
|
+
const normalizedAssetImport = normalizeClientMetadataAssetPath(currentModule, assetImport);
|
|
761
|
+
if (normalizedAssetImport) {
|
|
762
|
+
assetImports.add(normalizedAssetImport);
|
|
763
|
+
}
|
|
745
764
|
}
|
|
746
765
|
for (const importedModule of metadata.moduleImports) {
|
|
747
766
|
pendingModules.push(importedModule);
|
|
@@ -1395,8 +1414,12 @@ export async function emitHashedClientAssets(projectRoot, options = {}) {
|
|
|
1395
1414
|
if (entry.type === "script") {
|
|
1396
1415
|
try {
|
|
1397
1416
|
const metadata = JSON.parse(await fs.readFile(`${entry.filePath}.meta.json`, "utf8"));
|
|
1398
|
-
styleImports = Array.isArray(metadata?.styleImports) ? metadata.styleImports : []
|
|
1399
|
-
|
|
1417
|
+
styleImports = (Array.isArray(metadata?.styleImports) ? metadata.styleImports : [])
|
|
1418
|
+
.map((importedStyle) => normalizeClientMetadataAssetPath(entry.relativePath, importedStyle))
|
|
1419
|
+
.filter((importedStyle) => typeof importedStyle === "string");
|
|
1420
|
+
assetImports = (Array.isArray(metadata?.assetImports) ? metadata.assetImports : [])
|
|
1421
|
+
.map((importedAsset) => normalizeClientMetadataAssetPath(entry.relativePath, importedAsset))
|
|
1422
|
+
.filter((importedAsset) => typeof importedAsset === "string");
|
|
1400
1423
|
} catch {
|
|
1401
1424
|
styleImports = [];
|
|
1402
1425
|
assetImports = [];
|