@mui/internal-docs-infra 0.11.1-canary.18 → 0.11.1-canary.19
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-docs-infra",
|
|
3
|
-
"version": "0.11.1-canary.
|
|
3
|
+
"version": "0.11.1-canary.19",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "MUI Infra - internal documentation creation tools.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -768,5 +768,5 @@
|
|
|
768
768
|
"bin": {
|
|
769
769
|
"docs-infra": "./cli/index.mjs"
|
|
770
770
|
},
|
|
771
|
-
"gitSha": "
|
|
771
|
+
"gitSha": "5c3a1cfc4629c88f92e1f1c2833ae30c2d53c4cf"
|
|
772
772
|
}
|
|
@@ -273,7 +273,9 @@ async function loadSingleFile(variantName, fileName, source, url, loadSource, so
|
|
|
273
273
|
if (error instanceof Error && (error.message.startsWith('Invalid extraFiles from loadSource:') || error.message.startsWith('Invalid extraDependencies from loadSource:') || error.message.startsWith('Unexpected files discovered via loadSource when allFilesListed=true'))) {
|
|
274
274
|
throw error;
|
|
275
275
|
}
|
|
276
|
-
throw new Error(`Failed to load source code (variant: ${variantName}, file: ${fileName}, url: ${url}): ${
|
|
276
|
+
throw new Error(`Failed to load source code (variant: ${variantName}, file: ${fileName}, url: ${url}): ${error instanceof Error ? error.message : String(error)}`, {
|
|
277
|
+
cause: error
|
|
278
|
+
});
|
|
277
279
|
}
|
|
278
280
|
}
|
|
279
281
|
|
|
@@ -740,7 +742,9 @@ export async function loadIsomorphicCodeVariant(url, variantName, variant, optio
|
|
|
740
742
|
try {
|
|
741
743
|
variant = await loadVariantMeta(variantName, variant);
|
|
742
744
|
} catch (error) {
|
|
743
|
-
throw new Error(`Failed to load variant code (variant: ${variantName}, url: ${variant}): ${
|
|
745
|
+
throw new Error(`Failed to load variant code (variant: ${variantName}, url: ${variant}): ${error instanceof Error ? error.message : String(error)}`, {
|
|
746
|
+
cause: error
|
|
747
|
+
});
|
|
744
748
|
}
|
|
745
749
|
currentMark = performanceMeasure(currentMark, {
|
|
746
750
|
mark: 'Loaded Variant Meta',
|
|
@@ -44,7 +44,26 @@ export const VALUE_IMPORT_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.mdx', '.
|
|
|
44
44
|
/**
|
|
45
45
|
* Static asset extensions that should NOT be resolved as JS modules
|
|
46
46
|
*/
|
|
47
|
-
const STATIC_ASSET_EXTENSIONS = ['.css', '.scss', '.
|
|
47
|
+
const STATIC_ASSET_EXTENSIONS = ['.css', '.scss', '.json', '.svg', '.png', '.jpg', '.jpeg', '.gif', '.webp', '.woff2'];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Asset extensions that are intentionally unsupported.
|
|
51
|
+
* Importing one of these throws so the issue surfaces at build time.
|
|
52
|
+
*/
|
|
53
|
+
const UNSUPPORTED_ASSET_EXTENSIONS = ['.sass',
|
|
54
|
+
// use '.scss' instead
|
|
55
|
+
'.less',
|
|
56
|
+
// legacy
|
|
57
|
+
'.ico',
|
|
58
|
+
// legacy
|
|
59
|
+
'.woff',
|
|
60
|
+
// legacy, use '.woff2' (https://web.dev/articles/font-best-practices#use_woff2)
|
|
61
|
+
'.eot',
|
|
62
|
+
// legacy
|
|
63
|
+
'.ttf',
|
|
64
|
+
// desktop font format
|
|
65
|
+
'.otf' // desktop font format
|
|
66
|
+
];
|
|
48
67
|
|
|
49
68
|
/**
|
|
50
69
|
* Checks if a file path or import path represents a static asset
|
|
@@ -601,6 +620,9 @@ export async function resolveImportResult(importResult, readDirectory, options =
|
|
|
601
620
|
url,
|
|
602
621
|
includeTypeDefs
|
|
603
622
|
}] of Object.entries(importResult)) {
|
|
623
|
+
if (UNSUPPORTED_ASSET_EXTENSIONS.some(ext => importPath.endsWith(ext))) {
|
|
624
|
+
throw new Error(`Unsupported import extension: "${importPath}".`);
|
|
625
|
+
}
|
|
604
626
|
if (isStaticAsset(importPath)) {
|
|
605
627
|
// Static asset - use url as-is
|
|
606
628
|
staticAssets.push(url);
|