@qualcomm-ui/mdx-vite 3.3.0 → 3.3.1
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/index.js
CHANGED
|
@@ -6038,8 +6038,10 @@ function reactDemoPlugin({
|
|
|
6038
6038
|
if (file.endsWith(".mdx")) {
|
|
6039
6039
|
return [];
|
|
6040
6040
|
}
|
|
6041
|
+
const updatedDemoNames = [];
|
|
6041
6042
|
if (isDemoFile(file)) {
|
|
6042
6043
|
await handleDemoAdditionOrUpdate({ filePath: file });
|
|
6044
|
+
updatedDemoNames.push(createDemoName(file));
|
|
6043
6045
|
} else {
|
|
6044
6046
|
const normalizedFile = resolve7(file);
|
|
6045
6047
|
const dependentDemos = relativeImportDependents.get(normalizedFile);
|
|
@@ -6052,6 +6054,7 @@ function reactDemoPlugin({
|
|
|
6052
6054
|
await handleDemoAdditionOrUpdate({
|
|
6053
6055
|
filePath: demo.filePath
|
|
6054
6056
|
});
|
|
6057
|
+
updatedDemoNames.push(demoName);
|
|
6055
6058
|
}
|
|
6056
6059
|
}
|
|
6057
6060
|
}
|
|
@@ -6060,7 +6063,16 @@ function reactDemoPlugin({
|
|
|
6060
6063
|
);
|
|
6061
6064
|
if (autoModule) {
|
|
6062
6065
|
server.moduleGraph.invalidateModule(autoModule);
|
|
6063
|
-
|
|
6066
|
+
}
|
|
6067
|
+
for (const demoName of updatedDemoNames) {
|
|
6068
|
+
const demo = demoRegistry2.get(demoName);
|
|
6069
|
+
if (demo) {
|
|
6070
|
+
server.ws.send({
|
|
6071
|
+
data: demo,
|
|
6072
|
+
event: "qui-demo:update",
|
|
6073
|
+
type: "custom"
|
|
6074
|
+
});
|
|
6075
|
+
}
|
|
6064
6076
|
}
|
|
6065
6077
|
return [];
|
|
6066
6078
|
},
|
|
@@ -6202,11 +6214,24 @@ function reactDemoPlugin({
|
|
|
6202
6214
|
}
|
|
6203
6215
|
function generateAutoScopeModule() {
|
|
6204
6216
|
const registryCode = generateDemoRegistry(demoRegistry2);
|
|
6205
|
-
|
|
6206
|
-
"// Auto-generated demo scope resolver
|
|
6217
|
+
const parts = [
|
|
6218
|
+
"// Auto-generated demo scope resolver",
|
|
6207
6219
|
registryCode,
|
|
6208
6220
|
generateExportedFunctions()
|
|
6209
|
-
]
|
|
6221
|
+
];
|
|
6222
|
+
if (process.env.NODE_ENV === "development") {
|
|
6223
|
+
parts.push(generateHmrHandler());
|
|
6224
|
+
}
|
|
6225
|
+
return parts.join("\n\n");
|
|
6226
|
+
}
|
|
6227
|
+
function generateHmrHandler() {
|
|
6228
|
+
return dedent4`
|
|
6229
|
+
if (import.meta.hot) {
|
|
6230
|
+
import.meta.hot.on("qui-demo:update", (data) => {
|
|
6231
|
+
demoRegistry.set(data.demoName, data)
|
|
6232
|
+
})
|
|
6233
|
+
}
|
|
6234
|
+
`;
|
|
6210
6235
|
}
|
|
6211
6236
|
function transformLines(code) {
|
|
6212
6237
|
if (!transformLine) {
|