@qualcomm-ui/mdx-vite 2.1.0 → 2.1.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"docs-plugin.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/docs-plugin.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAa,YAAY,EAAgB,MAAM,MAAM,CAAA;AAmBjE,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAiKD,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,YAAY,CA4GvE"}
1
+ {"version":3,"file":"docs-plugin.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/docs-plugin.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAa,YAAY,EAAgB,MAAM,MAAM,CAAA;AAmBjE,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAiKD,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,YAAY,CA+GvE"}
@@ -13,7 +13,6 @@ export declare class DocPropsIndexer {
13
13
  private pageDocProps;
14
14
  constructor(props: Record<string, QuiPropTypes>);
15
15
  reset(): void;
16
- private extractNamesFromAttribute;
17
16
  /**
18
17
  * Finds all JSX `<TypeDocProps />` nodes on the current page and adds their names
19
18
  * to an array. Once all nodes have been collected, we process them into
@@ -1 +1 @@
1
- {"version":3,"file":"doc-props-indexer.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/doc-props/doc-props-indexer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,KAAK,MAAM,EAAU,MAAM,SAAS,CAAA;AAG5C,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,eAAe,EAChB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,6BAA6B,CAAA;AAEpC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAA;AAuD/C,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,qBAAa,eAAe;IAC1B,eAAe,EAAE,YAAY,EAAE,CAAK;IACpC,SAAS,EAAE,eAAe,CAAwB;IAClD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IACpD,OAAO,CAAC,YAAY,CAAmB;gBAE3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;IAI/C,KAAK,IAAI,IAAI;IAKb,OAAO,CAAC,yBAAyB;IA0CjC;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,CA6C3B;IAED,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,GAAG,IAAI;IAgFxE,WAAW,IAAI,YAAY;IAY3B,OAAO,CAAC,YAAY;CAyBrB"}
1
+ {"version":3,"file":"doc-props-indexer.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/doc-props/doc-props-indexer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,KAAK,MAAM,EAAU,MAAM,SAAS,CAAA;AAG5C,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,eAAe,EAChB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,6BAA6B,CAAA;AAEpC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAA;AAwD/C,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,qBAAa,eAAe;IAC1B,eAAe,EAAE,YAAY,EAAE,CAAK;IACpC,SAAS,EAAE,eAAe,CAAwB;IAClD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IACpD,OAAO,CAAC,YAAY,CAAmB;gBAE3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;IAI/C,KAAK,IAAI,IAAI;IAKb;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,CA6C3B;IAED,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,GAAG,IAAI;IAgFxE,WAAW,IAAI,YAAY;IAY3B,OAAO,CAAC,YAAY;CAyBrB"}
@@ -0,0 +1,3 @@
1
+ import type { MdxJsxAttribute } from "mdast-util-mdx-jsx";
2
+ export declare function extractNamesFromAttribute(attr: MdxJsxAttribute): string[];
3
+ //# sourceMappingURL=mdx-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-utils.d.ts","sourceRoot":"","sources":["../../../../src/docs-plugin/internal/services/mdx-utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAA;AAEvD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,EAAE,CAkCzE"}
package/dist/index.js CHANGED
@@ -1252,6 +1252,38 @@ import { visit } from "unist-util-visit";
1252
1252
  import {
1253
1253
  UniqueIdService
1254
1254
  } from "@qualcomm-ui/mdx-common";
1255
+
1256
+ // src/docs-plugin/internal/services/mdx-utils.ts
1257
+ function extractNamesFromAttribute(attr) {
1258
+ if (!attr.value) {
1259
+ return [];
1260
+ }
1261
+ if (typeof attr.value === "string") {
1262
+ return [attr.value];
1263
+ }
1264
+ if (attr.value.type === "mdxJsxAttributeValueExpression") {
1265
+ const estree = attr.value.data?.estree;
1266
+ if (!estree?.body?.[0] || estree.body[0].type !== "ExpressionStatement") {
1267
+ return [];
1268
+ }
1269
+ const expression = estree.body[0].expression;
1270
+ if (expression.type === "ArrayExpression") {
1271
+ const names = [];
1272
+ for (const element of expression.elements) {
1273
+ if (element?.type === "Literal" && typeof element.value === "string") {
1274
+ names.push(element.value);
1275
+ }
1276
+ }
1277
+ return names;
1278
+ }
1279
+ if (expression.type === "Literal" && typeof expression.value === "string") {
1280
+ return [expression.value];
1281
+ }
1282
+ }
1283
+ return [];
1284
+ }
1285
+
1286
+ // src/docs-plugin/internal/services/doc-props/doc-props-indexer.ts
1255
1287
  function extractPickPropsRecord(node) {
1256
1288
  if (node.name !== "unionWithPick" || !node.value || typeof node.value === "string") {
1257
1289
  return null;
@@ -1300,34 +1332,6 @@ var DocPropsIndexer = class {
1300
1332
  this.idService.reset();
1301
1333
  this.docPropsEntries = [];
1302
1334
  }
1303
- extractNamesFromAttribute(attr) {
1304
- if (!attr.value) {
1305
- return [];
1306
- }
1307
- if (typeof attr.value === "string") {
1308
- return [attr.value];
1309
- }
1310
- if (attr.value.type === "mdxJsxAttributeValueExpression") {
1311
- const estree = attr.value.data?.estree;
1312
- if (!estree?.body?.[0] || estree.body[0].type !== "ExpressionStatement") {
1313
- return [];
1314
- }
1315
- const expression = estree.body[0].expression;
1316
- if (expression.type === "ArrayExpression") {
1317
- const names = [];
1318
- for (const element of expression.elements) {
1319
- if (element?.type === "Literal" && typeof element.value === "string") {
1320
- names.push(element.value);
1321
- }
1322
- }
1323
- return names;
1324
- }
1325
- if (expression.type === "Literal" && typeof expression.value === "string") {
1326
- return [expression.value];
1327
- }
1328
- }
1329
- return [];
1330
- }
1331
1335
  /**
1332
1336
  * Finds all JSX `<TypeDocProps />` nodes on the current page and adds their names
1333
1337
  * to an array. Once all nodes have been collected, we process them into
@@ -1343,9 +1347,9 @@ var DocPropsIndexer = class {
1343
1347
  const omitFromAttr = node.attributes?.find(
1344
1348
  (attr) => attr.name === "omitFrom"
1345
1349
  );
1346
- const omitFrom = omitFromAttr ? this.extractNamesFromAttribute(omitFromAttr) : void 0;
1350
+ const omitFrom = omitFromAttr ? extractNamesFromAttribute(omitFromAttr) : void 0;
1347
1351
  if (nameAttr) {
1348
- const names = this.extractNamesFromAttribute(nameAttr);
1352
+ const names = extractNamesFromAttribute(nameAttr);
1349
1353
  for (const name of names) {
1350
1354
  this.docPropsEntries.push({ name, omitFrom });
1351
1355
  if (name.endsWith("Props")) {
@@ -2870,7 +2874,10 @@ function quiDocsPlugin(opts) {
2870
2874
  });
2871
2875
  state.servers.push(server);
2872
2876
  },
2873
- handleHotUpdate: async ({ file: updateFile, server }) => {
2877
+ handleHotUpdate: async ({ file: updateFile, modules, server }) => {
2878
+ if (updateFile.endsWith(".css")) {
2879
+ return modules;
2880
+ }
2874
2881
  const file = fixPath(updateFile);
2875
2882
  if ((!config.hotUpdateIgnore || !config.hotUpdateIgnore.test(file)) && // ignore watched files. We watch for these separately.
2876
2883
  file !== state.configFilePath) {