@veryfront/ext-content-mdx 0.1.1198 → 0.1.1200-rc.1.10145

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1198",
3
+ "version": "0.1.1200-rc.1",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -102,6 +102,22 @@ export declare function normalizeExtension(path: string, options?: {
102
102
  * Check if a URL is an esm.sh URL.
103
103
  */
104
104
  export declare function isEsmShUrl(url: string): boolean;
105
+ export interface ParsedEsmShUrl {
106
+ readonly origin: string;
107
+ readonly packageName: string;
108
+ readonly version: string | null;
109
+ readonly subpath: string;
110
+ readonly search: string;
111
+ readonly hash: string;
112
+ }
113
+ /**
114
+ * Split an esm.sh URL into its npm coordinates. Returns null for anything that
115
+ * is not a plain `pkg`, `pkg@version`, or `@scope/pkg` path, so callers can
116
+ * leave unfamiliar esm.sh URL shapes exactly as the author wrote them.
117
+ */
118
+ export declare function parseEsmShUrl(url: string): ParsedEsmShUrl | null;
119
+ /** Rebuild an esm.sh URL with an exact version, preserving every other part. */
120
+ export declare function buildPinnedEsmShUrl(parsed: ParsedEsmShUrl, version: string): string;
105
121
  /**
106
122
  * Add deps query param to esm.sh URL if not already present.
107
123
  */
@@ -1 +1 @@
1
- {"version":3,"file":"url-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/url-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,2BAA2B;AAC3B,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,kEAAkE;AAClE,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CA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,EACX,yBAAyB,CAAC,EAAE,MAAM,EAClC,kBAAkB,CAAC,EAAE,MAAM,GAC1B,MAAM,CA8BR;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,MAAM,GACf,8BAA8B,CAmChC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,IAAI,EAAE,MAAM,GACX,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAGhG;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAgDtE"}
1
+ {"version":3,"file":"url-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/url-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,2BAA2B;AAC3B,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,kEAAkE;AAClE,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CA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AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAgDtE"}
@@ -331,6 +331,71 @@ export function normalizeExtension(path, options) {
331
331
  export function isEsmShUrl(url) {
332
332
  return url.startsWith("https://esm.sh/") || url.startsWith("http://esm.sh/");
333
333
  }
334
+ /**
335
+ * esm.sh path prefixes that are not plain npm package names. Rewriting these
336
+ * would corrupt the specifier, so they are declined rather than pinned.
337
+ */
338
+ const ESM_SH_NON_NPM_PREFIX_RE = /^(?:v\d+|stable|gh|jsr|pr|node)$/;
339
+ /**
340
+ * Split an esm.sh URL into its npm coordinates. Returns null for anything that
341
+ * is not a plain `pkg`, `pkg@version`, or `@scope/pkg` path, so callers can
342
+ * leave unfamiliar esm.sh URL shapes exactly as the author wrote them.
343
+ */
344
+ export function parseEsmShUrl(url) {
345
+ if (!isEsmShUrl(url))
346
+ return null;
347
+ let parsed;
348
+ try {
349
+ parsed = new URL(url);
350
+ }
351
+ catch (_) {
352
+ /* expected: a malformed URL is left untouched */
353
+ return null;
354
+ }
355
+ // An empty segment means a doubled or trailing slash. Both are meaningful:
356
+ // a trailing slash is an import-map prefix mapping, not a module URL (see
357
+ // buildEsmShPrefixUrl). Dropping one would rewrite the author's specifier
358
+ // into a different request, so decline instead of normalizing.
359
+ const segments = parsed.pathname.slice(1).split("/");
360
+ if (segments.some((segment) => segment.length === 0))
361
+ return null;
362
+ const first = segments[0];
363
+ if (!first || ESM_SH_NON_NPM_PREFIX_RE.test(first))
364
+ return null;
365
+ // A colon in the leading segment means a scheme-qualified specifier such as
366
+ // `node:crypto`, not an npm package name. Feeding one to the pin resolver
367
+ // would schedule platform resolution and write-back for something npm has
368
+ // never heard of.
369
+ if (first.includes(":"))
370
+ return null;
371
+ const isScoped = first.startsWith("@");
372
+ if (isScoped && segments.length < 2)
373
+ return null;
374
+ const nameSegments = isScoped ? segments.slice(0, 2) : segments.slice(0, 1);
375
+ const subpathSegments = segments.slice(nameSegments.length);
376
+ const last = nameSegments[nameSegments.length - 1];
377
+ const versionIndex = last.lastIndexOf("@");
378
+ // `pkg@` is malformed, not unversioned. Treating it as unversioned would
379
+ // silently promote it to a valid pin the author never wrote.
380
+ if (versionIndex > 0 && versionIndex === last.length - 1)
381
+ return null;
382
+ const version = versionIndex > 0 ? last.slice(versionIndex + 1) : null;
383
+ if (versionIndex > 0) {
384
+ nameSegments[nameSegments.length - 1] = last.slice(0, versionIndex);
385
+ }
386
+ return {
387
+ origin: parsed.origin,
388
+ packageName: arrayJoin(nameSegments, "/"),
389
+ version: version && version.length > 0 ? version : null,
390
+ subpath: subpathSegments.length > 0 ? `/${arrayJoin(subpathSegments, "/")}` : "",
391
+ search: parsed.search,
392
+ hash: parsed.hash,
393
+ };
394
+ }
395
+ /** Rebuild an esm.sh URL with an exact version, preserving every other part. */
396
+ export function buildPinnedEsmShUrl(parsed, version) {
397
+ return `${parsed.origin}/${parsed.packageName}@${version}${parsed.subpath}${parsed.search}${parsed.hash}`;
398
+ }
334
399
  /**
335
400
  * Add deps query param to esm.sh URL if not already present.
336
401
  */
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1198";
2
+ export declare const VERSION = "0.1.1200-rc.1";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-constant.d.ts","sourceRoot":"","sources":["../../../src/src/utils/version-constant.ts"],"names":[],"mappings":"AAEA,4BAA4B;AAC5B,eAAO,MAAM,OAAO,aAAa,CAAC"}
1
+ {"version":3,"file":"version-constant.d.ts","sourceRoot":"","sources":["../../../src/src/utils/version-constant.ts"],"names":[],"mappings":"AAEA,4BAA4B;AAC5B,eAAO,MAAM,OAAO,kBAAkB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1198";
4
+ export const VERSION = "0.1.1200-rc.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veryfront/ext-content-mdx",
3
- "version": "0.1.1198",
3
+ "version": "0.1.1200-rc.1.10145",
4
4
  "description": "Veryfront first-party extension package for ext-content-mdx",
5
5
  "keywords": [
6
6
  "veryfront",
@@ -67,7 +67,7 @@
67
67
  "vfile": "6.0.3"
68
68
  },
69
69
  "peerDependencies": {
70
- "veryfront": "^0.1.1198"
70
+ "veryfront": "^0.1.1200-rc.1.10145"
71
71
  },
72
72
  "type": "module",
73
73
  "types": "./esm/extensions/ext-content-mdx/src/index.d.ts",