@myst-theme/common 1.1.2 → 1.1.4

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/utils.d.ts CHANGED
@@ -10,5 +10,11 @@ type UpdateUrl = (url: string) => string;
10
10
  export declare function updateSiteManifestStaticLinksInplace(data: SiteManifest, updateUrl: UpdateUrl): SiteManifest;
11
11
  export declare function updatePageStaticLinksInplace(data: PageLoader, updateUrl: UpdateUrl): PageLoader;
12
12
  export declare function isFlatSite(config?: SiteManifest): boolean;
13
+ /**
14
+ * Parse a URL pathname into path segments, handling trailing slashes.
15
+ *
16
+ * e.g. "/project/page/" → ["project", "page"]
17
+ */
18
+ export declare function parsePathname(pathname: string): string[];
13
19
  export {};
14
20
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAkB,UAAU,EAAE,MAAM,YAAY,CAAC;AAQnF,KAAK,eAAe,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAG7D,wBAAgB,UAAU,CACxB,MAAM,CAAC,EAAE,YAAY,EACrB,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,GAAG,SAAS,CAM7B;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,GAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAyB,GAClD,OAAO,EAAE,GAAG,SAAS,CA+BvB;AAeD,wBAAgB,cAAc,CAC5B,MAAM,CAAC,EAAE,YAAY,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,MAAM,GACZ,WAAW,CAab;AAED,KAAK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,EAAE,SAAS,GAAG,UAAU,CA8B/F;AAED,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD"}
package/dist/utils.js CHANGED
@@ -86,6 +86,13 @@ function updateMdastStaticLinksInplace(mdast, updateUrl) {
86
86
  node.urlOptimized = updateUrl(node.urlOptimized);
87
87
  }
88
88
  });
89
+ const widgets = selectAll('anywidget', mdast);
90
+ widgets.forEach((node) => {
91
+ node.esm = updateUrl(node.esm);
92
+ if (node.css) {
93
+ node.css = updateUrl(node.css);
94
+ }
95
+ });
89
96
  const links = selectAll('link,linkBlock,card', mdast);
90
97
  const staticLinks = links === null || links === void 0 ? void 0 : links.filter((node) => node.static);
91
98
  staticLinks.forEach((node) => {
@@ -234,3 +241,11 @@ export function isFlatSite(config) {
234
241
  var _a;
235
242
  return ((_a = config === null || config === void 0 ? void 0 : config.projects) === null || _a === void 0 ? void 0 : _a.length) === 1 && !config.projects[0].slug;
236
243
  }
244
+ /**
245
+ * Parse a URL pathname into path segments, handling trailing slashes.
246
+ *
247
+ * e.g. "/project/page/" → ["project", "page"]
248
+ */
249
+ export function parsePathname(pathname) {
250
+ return pathname.replace(/^\/+|\/+$/g, '').split('/');
251
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myst-theme/common",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "type": "module",
5
5
  "exports": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",