@deot/docs-playground 1.1.8 → 1.1.9

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,4 +1,4 @@
1
- import { a as transformScript, c as createFileIndex, h as resolveEntry, m as normalizeVirtualPath, s as collectReachableFilenames, t as collectCss, u as getExtension, v as compileScssSource, y as extractScssExports } from "./css-C25yWQa_.js";
1
+ import { a as transformScript, c as createFileIndex, h as resolveEntry, m as normalizeVirtualPath, s as collectReachableFilenames, t as collectCss, u as getExtension, v as compileScssSource, y as extractScssExports } from "./css-D47JLekg.js";
2
2
  import { compileString } from "sass";
3
3
  //#region packages/playground/src/core/runtime/local/compile/scss.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_css = require("./css-O1VYXZtT.cjs");
1
+ const require_css = require("./css-DGNVJsLz.cjs");
2
2
  let sass = require("sass");
3
3
  //#region packages/playground/src/core/runtime/local/compile/scss.ts
4
4
  /**
@@ -8,6 +8,7 @@ var DEFAULT_CDN_URL = "https://cdn.jsdelivr.net/npm";
8
8
  var NEW_SFC_CODE = `<script setup lang="ts"><\/script>\n\n<template>\n <div>\n <slot />\n <\/div>\n<\/template>\n`;
9
9
  //#endregion
10
10
  //#region packages/playground/src/cdn.ts
11
+ var DOCS_ESM_ENTRY = /^@deot\/docs-(?:client|locale|markdown|playground|renderer|theme)$/u;
11
12
  var PREVIEW_STYLE_ASSETS = [
12
13
  "@deot/style/dist/index.normalize-only.css",
13
14
  "@deot/vc-components/dist/index.style.css",
@@ -70,7 +71,7 @@ var npmCdnUrl = (value) => {
70
71
  };
71
72
  var cdnModuleName = (url) => {
72
73
  const parsed = npmCdnUrl(url);
73
- return parsed && (!parsed.path || parsed.path === "/+esm" || /^\/(?:es\d+|esnext)\/[^/]+\.m?js$/u.test(parsed.path)) ? parsed.name : null;
74
+ return parsed && (!parsed.path || parsed.path === "/+esm" || DOCS_ESM_ENTRY.test(parsed.name) && parsed.path === "/dist/index.js" || /^\/(?:es\d+|esnext)\/[^/]+\.m?js$/u.test(parsed.path)) ? parsed.name : null;
74
75
  };
75
76
  var isCdnEsmURL = (url) => /\/\+esm(?:[?#]|$)/u.test(url) || npmCdnUrl(url)?.url.hostname === "esm.unpkg.com";
76
77
  var resolveCdnURL = (url, cdnURL, config = docsCdnConfig()) => {
@@ -81,8 +82,10 @@ var resolveCdnURL = (url, cdnURL, config = docsCdnConfig()) => {
81
82
  const origin = normalizeCdnURL(target);
82
83
  const unpkg = new URL(origin).hostname === "esm.unpkg.com";
83
84
  let asset = parsed.asset;
84
- if (unpkg) asset = asset.replace(/\/\+esm$/u, "");
85
- else if (!parsed.path.endsWith("/+esm") && (!parsed.path || !/\.[^/]+$/u.test(parsed.path) || /unpkg\.com$/u.test(parsed.url.hostname) && /\.[cm]?[jt]sx?$/u.test(parsed.path))) asset = `${asset.replace(/\/+$/u, "")}/+esm`;
85
+ if (unpkg) {
86
+ asset = asset.replace(/\/\+esm$/u, "");
87
+ if (DOCS_ESM_ENTRY.test(parsed.name) && (!parsed.path || parsed.path === "/+esm")) asset += "/dist/index.js";
88
+ } else if (!parsed.path.endsWith("/+esm") && (!parsed.path || !/\.[^/]+$/u.test(parsed.path) || /unpkg\.com$/u.test(parsed.url.hostname) && /\.[cm]?[jt]sx?$/u.test(parsed.path))) asset = `${asset.replace(/\/+$/u, "")}/+esm`;
86
89
  converted = `${origin}/${asset}${parsed.url.search}${parsed.url.hash}`;
87
90
  }
88
91
  return config.resolve?.cdn?.({ url: converted }) || converted;
@@ -40,6 +40,7 @@ var DEFAULT_CDN_URL = "https://cdn.jsdelivr.net/npm";
40
40
  var NEW_SFC_CODE = `<script setup lang="ts"><\/script>\n\n<template>\n <div>\n <slot />\n <\/div>\n<\/template>\n`;
41
41
  //#endregion
42
42
  //#region packages/playground/src/cdn.ts
43
+ var DOCS_ESM_ENTRY = /^@deot\/docs-(?:client|locale|markdown|playground|renderer|theme)$/u;
43
44
  var PREVIEW_STYLE_ASSETS = [
44
45
  "@deot/style/dist/index.normalize-only.css",
45
46
  "@deot/vc-components/dist/index.style.css",
@@ -102,7 +103,7 @@ var npmCdnUrl = (value) => {
102
103
  };
103
104
  var cdnModuleName = (url) => {
104
105
  const parsed = npmCdnUrl(url);
105
- return parsed && (!parsed.path || parsed.path === "/+esm" || /^\/(?:es\d+|esnext)\/[^/]+\.m?js$/u.test(parsed.path)) ? parsed.name : null;
106
+ return parsed && (!parsed.path || parsed.path === "/+esm" || DOCS_ESM_ENTRY.test(parsed.name) && parsed.path === "/dist/index.js" || /^\/(?:es\d+|esnext)\/[^/]+\.m?js$/u.test(parsed.path)) ? parsed.name : null;
106
107
  };
107
108
  var isCdnEsmURL = (url) => /\/\+esm(?:[?#]|$)/u.test(url) || npmCdnUrl(url)?.url.hostname === "esm.unpkg.com";
108
109
  var resolveCdnURL = (url, cdnURL, config = docsCdnConfig()) => {
@@ -113,8 +114,10 @@ var resolveCdnURL = (url, cdnURL, config = docsCdnConfig()) => {
113
114
  const origin = normalizeCdnURL(target);
114
115
  const unpkg = new URL(origin).hostname === "esm.unpkg.com";
115
116
  let asset = parsed.asset;
116
- if (unpkg) asset = asset.replace(/\/\+esm$/u, "");
117
- else if (!parsed.path.endsWith("/+esm") && (!parsed.path || !/\.[^/]+$/u.test(parsed.path) || /unpkg\.com$/u.test(parsed.url.hostname) && /\.[cm]?[jt]sx?$/u.test(parsed.path))) asset = `${asset.replace(/\/+$/u, "")}/+esm`;
117
+ if (unpkg) {
118
+ asset = asset.replace(/\/\+esm$/u, "");
119
+ if (DOCS_ESM_ENTRY.test(parsed.name) && (!parsed.path || parsed.path === "/+esm")) asset += "/dist/index.js";
120
+ } else if (!parsed.path.endsWith("/+esm") && (!parsed.path || !/\.[^/]+$/u.test(parsed.path) || /unpkg\.com$/u.test(parsed.url.hostname) && /\.[cm]?[jt]sx?$/u.test(parsed.path))) asset = `${asset.replace(/\/+$/u, "")}/+esm`;
118
121
  converted = `${origin}/${asset}${parsed.url.search}${parsed.url.hash}`;
119
122
  }
120
123
  return config.resolve?.cdn?.({ url: converted }) || converted;
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_css = require("./css-O1VYXZtT.cjs");
2
+ const require_css = require("./css-DGNVJsLz.cjs");
3
3
  let vue = require("vue");
4
4
  vue = require_css.__toESM(vue);
5
5
  let _deot_vc = require("@deot/vc");
@@ -3415,7 +3415,7 @@ var local_sandbox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0
3415
3415
  publishError();
3416
3416
  destroyPreview();
3417
3417
  try {
3418
- const { compilePlayground } = await Promise.resolve().then(() => require("./compile-QZ6cd8o0.cjs"));
3418
+ const { compilePlayground } = await Promise.resolve().then(() => require("./compile-yveCpyT3.cjs"));
3419
3419
  /* istanbul ignore if -- 并发编译时只保留最后一次 */
3420
3420
  if (current !== version) return;
3421
3421
  const compiled = await compilePlayground(props.files, { entry: props.entry });
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as DEFAULT_ENTRY, C as createBuiltinStyles, D as resolveCdnURL, E as normalizeCdnURL, O as resolveNpmImport, S as createBuiltinImports, T as isCdnEsmURL, _ as bindPlaygroundScss, a as transformScript, b as whenSassReady, c as createFileIndex, d as isIgnoredFilename, f as isInsideRoot, g as resolveModulePath, i as rewriteImportMeta, j as NEW_SFC_CODE, k as DEFAULT_CDN_URL, l as getCommonRoot, m as normalizeVirtualPath, n as injectStyle, o as collectBareSpecifiers, p as isRelativeSpecifier, r as removeStyle, s as collectReachableFilenames, w as createCdnResolver, x as cdnModuleName } from "./css-C25yWQa_.js";
1
+ import { A as DEFAULT_ENTRY, C as createBuiltinStyles, D as resolveCdnURL, E as normalizeCdnURL, O as resolveNpmImport, S as createBuiltinImports, T as isCdnEsmURL, _ as bindPlaygroundScss, a as transformScript, b as whenSassReady, c as createFileIndex, d as isIgnoredFilename, f as isInsideRoot, g as resolveModulePath, i as rewriteImportMeta, j as NEW_SFC_CODE, k as DEFAULT_CDN_URL, l as getCommonRoot, m as normalizeVirtualPath, n as injectStyle, o as collectBareSpecifiers, p as isRelativeSpecifier, r as removeStyle, s as collectReachableFilenames, w as createCdnResolver, x as cdnModuleName } from "./css-D47JLekg.js";
2
2
  import * as Vue from "vue";
3
3
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, shallowRef, toDisplayString, unref, vModelText, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
4
4
  import * as Vc from "@deot/vc";
@@ -3414,7 +3414,7 @@ var local_sandbox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
3414
3414
  publishError();
3415
3415
  destroyPreview();
3416
3416
  try {
3417
- const { compilePlayground } = await import("./compile-BHlM2G35.js");
3417
+ const { compilePlayground } = await import("./compile-no-AB7-B.js");
3418
3418
  /* istanbul ignore if -- 并发编译时只保留最后一次 */
3419
3419
  if (current !== version) return;
3420
3420
  const compiled = await compilePlayground(props.files, { entry: props.entry });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/docs-playground",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {