@qualcomm-ui/mdx-vite 3.7.1 → 3.7.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":"frontmatter-hmr-plugin.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/frontmatter-hmr-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,MAAM,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,GAAE,2BAAgC,GACrC,YAAY,CAoBd"}
1
+ {"version":3,"file":"frontmatter-hmr-plugin.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/frontmatter-hmr-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,MAAM,CAAA;AAOtC;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,GAAE,2BAAgC,GACrC,YAAY,CAoDd"}
@@ -1 +1 @@
1
- {"version":3,"file":"mdx-plugins.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/mdx-plugins.ts"],"names":[],"mappings":"AAGA,OAAoB,EAAC,KAAK,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAWpE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAA;AAW1C,OAAO,EAAe,KAAK,mBAAmB,EAAC,MAAM,UAAU,CAAA;AAa/D,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;CACjD;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,EAAE,CAWzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,sBAA2B,GACnC,aAAa,CA0Bf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAahD"}
1
+ {"version":3,"file":"mdx-plugins.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/mdx-plugins.ts"],"names":[],"mappings":"AAGA,OAAoB,EAAC,KAAK,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAWpE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAA;AAW1C,OAAO,EAAe,KAAK,mBAAmB,EAAC,MAAM,UAAU,CAAA;AAa/D,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;CACjD;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,EAAE,CAWzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,sBAA2B,GACnC,aAAa,CA2Bf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAahD"}
package/dist/index.js CHANGED
@@ -4006,11 +4006,38 @@ function quiDocsPlugin(opts) {
4006
4006
  }
4007
4007
 
4008
4008
  // src/docs-plugin/frontmatter-hmr-plugin.ts
4009
+ var REACT_ROUTER_HMR_RUNTIME_ID = "virtual:react-router/hmr-runtime";
4010
+ var REACT_ROUTER_FULL_RELOAD_PATH = "/__frontmatter-hmr-fix/full-reload";
4011
+ var reactRouterMissingRouteModuleUpdateError = /^(\s*)throw Error\(\s*`\[react-router:hmr\] No module update found for route \$\{route\.id\}`,\s*\);/m;
4009
4012
  function frontmatterHmrPlugin(opts = {}) {
4010
4013
  const { exportName = "frontmatter" } = opts;
4011
4014
  return {
4015
+ configureServer(server) {
4016
+ server.middlewares.use(
4017
+ REACT_ROUTER_FULL_RELOAD_PATH,
4018
+ (req, res, next) => {
4019
+ if (req.method !== "POST") {
4020
+ next();
4021
+ return;
4022
+ }
4023
+ server.ws.send({ type: "full-reload" });
4024
+ res.statusCode = 204;
4025
+ res.end();
4026
+ }
4027
+ );
4028
+ },
4012
4029
  name: "frontmatter-hmr-fix",
4013
- transform(code) {
4030
+ transform(code, id) {
4031
+ if (id.includes(REACT_ROUTER_HMR_RUNTIME_ID)) {
4032
+ return code.replace(
4033
+ reactRouterMissingRouteModuleUpdateError,
4034
+ (_match, indent) => [
4035
+ `${indent}console.debug(\`[react-router:hmr] No module update found for route \${route.id}\`);`,
4036
+ `${indent}void fetch("${REACT_ROUTER_FULL_RELOAD_PATH}", {method: "POST"}).catch(() => window.location.reload());`,
4037
+ `${indent}return;`
4038
+ ].join("\n")
4039
+ );
4040
+ }
4014
4041
  if (code.includes(`export const ${exportName}`)) {
4015
4042
  code += `
4016
4043
  if (typeof ${exportName} === 'object') {
@@ -4394,6 +4421,7 @@ function getRehypePlugins(options = {}) {
4394
4421
  rehypeShiki,
4395
4422
  merge(
4396
4423
  {
4424
+ addLanguageClass: true,
4397
4425
  defaultColor: "light-dark()",
4398
4426
  defaultLanguage: "plaintext",
4399
4427
  fallbackLanguage: "plaintext",