@ckeditor/ckeditor5-dev-manual-server 56.3.0 → 56.5.0

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/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
  export { manualTestsPlugin } from "./manual-test-plugin/plugin.js";
6
- export type { ManualData } from "./manual-test-plugin/plugin.js";
6
+ export type { ManualData, ManualTestsPluginOptions } from "./manual-test-plugin/plugin.js";
7
7
  export { refreshPlugin } from "./refresh-plugin/plugin.js";
8
8
  export { rawHtmlPlugin } from "./raw-plugin/plugin.js";
9
9
  export { stringifyValues } from "./utils.js";
package/dist/index.js CHANGED
@@ -106,13 +106,13 @@ function matchFiles(patterns, workspaceRoot) {
106
106
  * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
107
107
  * For licensing, see LICENSE.md.
108
108
  */
109
- const PROCESSED_MANUAL_TEST_EXTENSIONS = new Set([
109
+ const PROCESSED_MANUAL_TEST_EXTENSIONS = /* @__PURE__ */ new Set([
110
110
  ".html",
111
111
  ".js",
112
112
  ".md",
113
113
  ".ts"
114
114
  ]);
115
- const VITE_MODULE_QUERY_PARAMETERS = new Set([
115
+ const VITE_MODULE_QUERY_PARAMETERS = /* @__PURE__ */ new Set([
116
116
  "import",
117
117
  "raw",
118
118
  "url",
@@ -312,13 +312,15 @@ const MANUAL_CATALOG_FILE_PATH = resolve(MANUAL_THEME_ROOT, "catalog.html");
312
312
  const MANUAL_CATALOG_SCRIPT_FILE_PATH = resolve(MANUAL_THEME_ROOT, "catalog.ts");
313
313
  const MANUAL_SHELL_TEMPLATE_FILE_PATH = resolve(MANUAL_THEME_ROOT, "shell.html");
314
314
  const MANUAL_SHELL_SCRIPT_FILE_PATH = resolve(MANUAL_THEME_ROOT, "shell.ts");
315
- function manualTestsPlugin(manualTestPatterns) {
315
+ function manualTestsPlugin(options) {
316
316
  let workspaceRoot = process.cwd();
317
317
  let base = "/";
318
+ const manualTestPatterns = options.paths;
318
319
  const manualPagePatterns = manualTestPatterns.map(toManualPagePattern);
319
- const manualPagesCache = cacheValue(() => collectManualPages(manualPagePatterns, workspaceRoot));
320
- const manualStaticAssetsCache = cacheValue(() => collectManualStaticAssets(manualTestPatterns, workspaceRoot));
320
+ const includePackageNames = (options.include || []).filter(Boolean);
321
+ const manualPagesCache = cacheValue(() => filterManualPages(collectManualPages(manualPagePatterns, workspaceRoot), includePackageNames));
321
322
  const getManualPages = manualPagesCache.get;
323
+ const manualStaticAssetsCache = cacheValue(() => collectManualStaticAssets(getManualStaticAssetPatterns(getManualPages(), manualTestPatterns, includePackageNames), workspaceRoot));
322
324
  const getManualStaticAssets = manualStaticAssetsCache.get;
323
325
  const invalidateManualFileCaches = () => {
324
326
  manualPagesCache.invalidate();
@@ -327,8 +329,8 @@ function manualTestsPlugin(manualTestPatterns) {
327
329
  const getManualPageEntryForFile = (filePath) => {
328
330
  return getManualPages().get(toPublicSpecifier(relative(workspaceRoot, filePath)));
329
331
  };
330
- const getManualCatalogPublicPath = () => toPublicFilePath(MANUAL_CATALOG_FILE_PATH, workspaceRoot);
331
332
  const getManualCatalogBuildInputFilePath = () => resolve(workspaceRoot, "index.html");
333
+ const getManualCatalogPublicPath = () => toPublicFilePath(getManualCatalogBuildInputFilePath(), workspaceRoot);
332
334
  const getManualCatalogScriptPublicPath = () => toPublicFilePath(MANUAL_CATALOG_SCRIPT_FILE_PATH, workspaceRoot);
333
335
  const getManualShellScriptPublicPath = () => toPublicFilePath(MANUAL_SHELL_SCRIPT_FILE_PATH, workspaceRoot);
334
336
  const getManualCatalogClientPath = (entry) => toBaseCatalogPath(base, entry.htmlFilePath);
@@ -429,6 +431,23 @@ function toManualPagePattern(pattern) {
429
431
  if (/\.(?:html|js|md|ts|\{[^}]*\})$/.test(pattern)) return pattern;
430
432
  return `${pattern}.{html,js,md,ts}`;
431
433
  }
434
+ function filterManualPages(manualPages, includePackageNames) {
435
+ if (includePackageNames.length == 0) return manualPages;
436
+ const normalizedIncludePackageNames = new Set(includePackageNames.map(normalizePackageName));
437
+ return new Map([...manualPages].filter(([, entry]) => normalizedIncludePackageNames.has(normalizePackageName(entry.packageName))));
438
+ }
439
+ function normalizePackageName(packageName) {
440
+ return packageName.replace(/^ckeditor5-/, "");
441
+ }
442
+ function getManualStaticAssetPatterns(manualPages, manualTestPatterns, includePackageNames) {
443
+ if (includePackageNames.length == 0) return manualTestPatterns;
444
+ return [...new Set([...manualPages.values()].map(getManualTestRootDirectory))].map((manualTestRootDirectory) => `${manualTestRootDirectory}/**/*`);
445
+ }
446
+ function getManualTestRootDirectory(entry) {
447
+ const htmlFilePath = stripLeadingSlash(entry.htmlFilePath);
448
+ const manualDirectoryIndex = htmlFilePath.indexOf("/tests/manual/");
449
+ return htmlFilePath.slice(0, manualDirectoryIndex + 14 - 1);
450
+ }
432
451
  function isManualCatalogHtmlFile(filePath, catalogBuildInputFilePath) {
433
452
  const normalizedFilePath = toPosixPath(filePath);
434
453
  return normalizedFilePath == toPosixPath(MANUAL_CATALOG_FILE_PATH) || normalizedFilePath == toPosixPath(catalogBuildInputFilePath);
@@ -4,4 +4,8 @@
4
4
  */
5
5
  import type { Plugin } from "vite";
6
6
  export type { ManualData } from "./types.js";
7
- export declare function manualTestsPlugin(manualTestPatterns: Array<string>): Plugin;
7
+ export interface ManualTestsPluginOptions {
8
+ paths: Array<string>;
9
+ include?: Array<string>;
10
+ }
11
+ export declare function manualTestsPlugin(options: ManualTestsPluginOptions): Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-manual-server",
3
- "version": "56.3.0",
3
+ "version": "56.5.0",
4
4
  "description": "Used to extend Vite to create a manual test server for CKEditor 5.",
5
5
  "keywords": [],
6
6
  "author": "CKSource (http://cksource.com/)",