@immense/vue-pom-generator 1.0.53 → 1.0.54

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.cjs CHANGED
@@ -32,10 +32,8 @@ const compilerSfc = require("@vue/compiler-sfc");
32
32
  const parser = require("@babel/parser");
33
33
  const compilerCore = require("@vue/compiler-core");
34
34
  const tsMorph = require("ts-morph");
35
- const jsdom = require("jsdom");
36
35
  const types = require("@babel/types");
37
36
  const node_perf_hooks = require("node:perf_hooks");
38
- const virtualImport = require("vite-plugin-virtual");
39
37
  const vue = require("@vitejs/plugin-vue");
40
38
  var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
41
39
  function _interopNamespaceDefault(e) {
@@ -3311,24 +3309,254 @@ function resolveIntrospectedComponentName(componentInfo, componentNaming) {
3311
3309
  }
3312
3310
  return componentInfo.componentName;
3313
3311
  }
3312
+ function hasChildren(parent) {
3313
+ return "children" in parent;
3314
+ }
3315
+ function appendNode(parent, child) {
3316
+ parent.childNodes.push(child);
3317
+ if (hasChildren(parent) && child.nodeType === 1)
3318
+ parent.children.push(child);
3319
+ return child;
3320
+ }
3321
+ function removeNode(parent, child) {
3322
+ const idx = parent.childNodes.indexOf(child);
3323
+ if (idx >= 0)
3324
+ parent.childNodes.splice(idx, 1);
3325
+ if (hasChildren(parent) && child.nodeType === 1) {
3326
+ const childIdx = parent.children.indexOf(child);
3327
+ if (childIdx >= 0)
3328
+ parent.children.splice(childIdx, 1);
3329
+ }
3330
+ return child;
3331
+ }
3332
+ function createMinimalDocument() {
3333
+ const doc = {
3334
+ nodeType: 9,
3335
+ // DOCUMENT_NODE
3336
+ documentElement: null,
3337
+ head: null,
3338
+ body: null,
3339
+ createElement(tag) {
3340
+ const element = {
3341
+ nodeType: 1,
3342
+ tagName: tag.toUpperCase(),
3343
+ childNodes: [],
3344
+ children: [],
3345
+ style: {},
3346
+ dataset: {},
3347
+ setAttribute() {
3348
+ },
3349
+ getAttribute() {
3350
+ return null;
3351
+ },
3352
+ removeAttribute() {
3353
+ },
3354
+ addEventListener() {
3355
+ },
3356
+ removeEventListener() {
3357
+ },
3358
+ appendChild(child) {
3359
+ return appendNode(this, child);
3360
+ },
3361
+ removeChild(child) {
3362
+ return removeNode(this, child);
3363
+ },
3364
+ insertBefore(child) {
3365
+ return appendNode(this, child);
3366
+ },
3367
+ querySelector() {
3368
+ return null;
3369
+ },
3370
+ querySelectorAll() {
3371
+ return [];
3372
+ },
3373
+ contains() {
3374
+ return false;
3375
+ },
3376
+ matches() {
3377
+ return false;
3378
+ },
3379
+ closest() {
3380
+ return null;
3381
+ },
3382
+ getBoundingClientRect() {
3383
+ return { top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0, x: 0, y: 0, toJSON() {
3384
+ return {};
3385
+ } };
3386
+ },
3387
+ cloneNode() {
3388
+ return this;
3389
+ }
3390
+ };
3391
+ return element;
3392
+ },
3393
+ createTextNode(text) {
3394
+ return { nodeType: 3, textContent: text };
3395
+ },
3396
+ createComment(text) {
3397
+ return { nodeType: 8, textContent: text };
3398
+ },
3399
+ createDocumentFragment() {
3400
+ return {
3401
+ nodeType: 11,
3402
+ childNodes: [],
3403
+ appendChild(child) {
3404
+ return appendNode(this, child);
3405
+ }
3406
+ };
3407
+ },
3408
+ getElementById() {
3409
+ return null;
3410
+ },
3411
+ querySelector() {
3412
+ return null;
3413
+ },
3414
+ querySelectorAll() {
3415
+ return [];
3416
+ },
3417
+ addEventListener() {
3418
+ },
3419
+ removeEventListener() {
3420
+ },
3421
+ createEvent() {
3422
+ return {
3423
+ initEvent() {
3424
+ }
3425
+ };
3426
+ },
3427
+ queryCommandSupported() {
3428
+ return false;
3429
+ }
3430
+ };
3431
+ const html = doc.createElement("html");
3432
+ const head = doc.createElement("head");
3433
+ const body = doc.createElement("body");
3434
+ const app = doc.createElement("div");
3435
+ app.id = "app";
3436
+ html.appendChild(head);
3437
+ html.appendChild(body);
3438
+ body.appendChild(app);
3439
+ doc.documentElement = html;
3440
+ doc.head = head;
3441
+ doc.body = body;
3442
+ return Object.assign({}, doc);
3443
+ }
3444
+ function createMinimalLocation() {
3445
+ const url = new URL("https://example.test/");
3446
+ return {
3447
+ get href() {
3448
+ return url.href;
3449
+ },
3450
+ set href(v) {
3451
+ try {
3452
+ Object.assign(url, new URL(v));
3453
+ } catch {
3454
+ }
3455
+ },
3456
+ get origin() {
3457
+ return url.origin;
3458
+ },
3459
+ get protocol() {
3460
+ return url.protocol;
3461
+ },
3462
+ get host() {
3463
+ return url.host;
3464
+ },
3465
+ get hostname() {
3466
+ return url.hostname;
3467
+ },
3468
+ get port() {
3469
+ return url.port;
3470
+ },
3471
+ get pathname() {
3472
+ return url.pathname;
3473
+ },
3474
+ set pathname(v) {
3475
+ url.pathname = v;
3476
+ },
3477
+ get search() {
3478
+ return url.search;
3479
+ },
3480
+ set search(v) {
3481
+ url.search = v;
3482
+ },
3483
+ get hash() {
3484
+ return url.hash;
3485
+ },
3486
+ set hash(v) {
3487
+ url.hash = v;
3488
+ },
3489
+ assign() {
3490
+ },
3491
+ reload() {
3492
+ },
3493
+ replace() {
3494
+ },
3495
+ toString() {
3496
+ return url.href;
3497
+ },
3498
+ ancestorOrigins: { length: 0, contains: () => false, item: () => null, [Symbol.iterator]: [][Symbol.iterator] }
3499
+ };
3500
+ }
3314
3501
  async function ensureDomShim() {
3315
- const domShimHtml = "<!doctype html><html><head></head><body><div id='app'></div></body></html>";
3316
- const domShimUrl = "https://example.test/";
3317
3502
  const g = globalThis;
3318
3503
  if (typeof document !== "undefined" && typeof window !== "undefined")
3319
3504
  return;
3320
- const dom = new jsdom.JSDOM(domShimHtml, { url: domShimUrl });
3321
- g.window = dom.window;
3322
- g.document = dom.window.document;
3323
- g.location = dom.window.location;
3505
+ const minimalDoc = createMinimalDocument();
3506
+ const minimalLocation = createMinimalLocation();
3507
+ const win = {
3508
+ document: minimalDoc,
3509
+ location: minimalLocation,
3510
+ navigator: { userAgent: "node" },
3511
+ history: { pushState() {
3512
+ }, replaceState() {
3513
+ }, go() {
3514
+ }, back() {
3515
+ }, forward() {
3516
+ }, state: null, length: 0, scrollRestoration: "auto" },
3517
+ addEventListener() {
3518
+ },
3519
+ removeEventListener() {
3520
+ },
3521
+ dispatchEvent() {
3522
+ return true;
3523
+ },
3524
+ getComputedStyle() {
3525
+ return {};
3526
+ },
3527
+ scrollTo() {
3528
+ },
3529
+ scroll() {
3530
+ },
3531
+ scrollBy() {
3532
+ },
3533
+ matchMedia() {
3534
+ return { matches: false, media: "", onchange: null, addListener() {
3535
+ }, removeListener() {
3536
+ }, addEventListener() {
3537
+ }, removeEventListener() {
3538
+ }, dispatchEvent() {
3539
+ return true;
3540
+ } };
3541
+ },
3542
+ requestAnimationFrame: (cb) => setTimeout(() => cb(Date.now()), 16),
3543
+ cancelAnimationFrame: (id) => clearTimeout(id),
3544
+ setTimeout,
3545
+ clearTimeout,
3546
+ setInterval,
3547
+ clearInterval,
3548
+ queueMicrotask,
3549
+ performance: globalThis.performance
3550
+ };
3551
+ g.window = win;
3552
+ g.document = minimalDoc;
3553
+ g.location = minimalLocation;
3324
3554
  if (!g.self)
3325
- g.self = dom.window;
3555
+ g.self = win;
3326
3556
  if (!g.navigator)
3327
- g.navigator = dom.window.navigator;
3557
+ g.navigator = win.navigator;
3328
3558
  if (!g.history)
3329
- g.history = { pushState() {
3330
- }, replaceState() {
3331
- } };
3559
+ g.history = win.history;
3332
3560
  if (!g.MutationObserver) {
3333
3561
  g.MutationObserver = class {
3334
3562
  disconnect() {
@@ -3366,10 +3594,6 @@ async function ensureDomShim() {
3366
3594
  if (!g.requestIdleCallback) {
3367
3595
  g.requestIdleCallback = (cb) => setTimeout(() => cb({ didTimeout: false, timeRemaining: () => 0 }), 1);
3368
3596
  }
3369
- const doc = g.document;
3370
- if (doc && typeof doc.queryCommandSupported !== "function") {
3371
- doc.queryCommandSupported = () => false;
3372
- }
3373
3597
  if (!g.localStorage || !g.sessionStorage) {
3374
3598
  const storageFactory = () => {
3375
3599
  const store = /* @__PURE__ */ new Map();
@@ -3395,25 +3619,6 @@ async function ensureDomShim() {
3395
3619
  if (!g.sessionStorage)
3396
3620
  g.sessionStorage = storageFactory();
3397
3621
  }
3398
- const names = Object.getOwnPropertyNames(dom.window);
3399
- const shouldCopyGlobal = (name) => {
3400
- if (name === "Node" || name === "Element" || name === "Document" || name === "Event" || name === "EventTarget")
3401
- return true;
3402
- if (name.endsWith("Event"))
3403
- return true;
3404
- if (name.startsWith("HTML") && name.endsWith("Element"))
3405
- return true;
3406
- if (name.startsWith("SVG") && name.endsWith("Element"))
3407
- return true;
3408
- return false;
3409
- };
3410
- for (const name of names) {
3411
- if (!shouldCopyGlobal(name) || g[name])
3412
- continue;
3413
- const value = Reflect.get(dom.window, name);
3414
- if (value)
3415
- g[name] = value;
3416
- }
3417
3622
  if (!g.requestAnimationFrame)
3418
3623
  g.requestAnimationFrame = (cb) => setTimeout(() => cb(Date.now()), 16);
3419
3624
  }
@@ -4385,7 +4590,7 @@ function generateAggregatedCSharpFiles(componentHierarchyMap, outDir, options =
4385
4590
  " }",
4386
4591
  "",
4387
4592
  " // Minimal vue-select helper mirroring the TS BasePage.selectVSelectByTestId behavior.",
4388
- " // Note: annotationText is currently a no-op in C# output (we don't render a cursor overlay).",
4593
+ " // Note: annotationText is currently a no-op in C# output (we don't render a pointer overlay).",
4389
4594
  " protected async Task SelectVSelectByTestIdAsync(string testId, string value, int timeOut = 500)",
4390
4595
  " {",
4391
4596
  " var root = LocatorByTestId(testId);",
@@ -6345,7 +6550,7 @@ function createTestIdTransform(componentName, componentHierarchyMap, nativeWrapp
6345
6550
  const existingIdBehavior = options.existingIdBehavior ?? "preserve";
6346
6551
  const testIdAttribute = (options.testIdAttribute || "data-testid").trim() || "data-testid";
6347
6552
  const nameCollisionBehavior = options.nameCollisionBehavior ?? "suffix";
6348
- const missingSemanticNameBehavior = options.missingSemanticNameBehavior ?? "ignore";
6553
+ const missingSemanticNameBehavior = options.missingSemanticNameBehavior ?? "error";
6349
6554
  const warn = options.warn;
6350
6555
  const vueFilesPathMap = options.vueFilesPathMap;
6351
6556
  const wrapperSearchRoots = options.wrapperSearchRoots ?? [];
@@ -6848,7 +7053,7 @@ function createBuildProcessorPlugin(options) {
6848
7053
  customPomImportNameCollisionBehavior,
6849
7054
  testIdAttribute,
6850
7055
  nameCollisionBehavior,
6851
- missingSemanticNameBehavior,
7056
+ missingSemanticNameBehavior = "error",
6852
7057
  existingIdBehavior,
6853
7058
  nativeWrappers,
6854
7059
  excludedComponents,
@@ -7034,6 +7239,10 @@ function createBuildProcessorPlugin(options) {
7034
7239
  this.error(`callout.ts not found at ${calloutPath}. Ensure it is included in the build.`);
7035
7240
  }
7036
7241
  this.addWatchFile(calloutPath);
7242
+ const floatingUiCalloutPath = path.resolve(path.dirname(basePageClassPath), "floating-ui-callout.ts");
7243
+ if (fs.existsSync(floatingUiCalloutPath)) {
7244
+ this.addWatchFile(floatingUiCalloutPath);
7245
+ }
7037
7246
  },
7038
7247
  async buildEnd(error) {
7039
7248
  if (error) {
@@ -7097,7 +7306,7 @@ function createDevProcessorPlugin(options) {
7097
7306
  customPomImportAliases,
7098
7307
  customPomImportNameCollisionBehavior,
7099
7308
  nameCollisionBehavior = "suffix",
7100
- missingSemanticNameBehavior,
7309
+ missingSemanticNameBehavior = "error",
7101
7310
  existingIdBehavior,
7102
7311
  testIdAttribute,
7103
7312
  routerAwarePoms,
@@ -7419,7 +7628,8 @@ function createDevProcessorPlugin(options) {
7419
7628
  watchedPluginGlob,
7420
7629
  basePageClassPath,
7421
7630
  path.resolve(runtimeDir, "pointer.ts"),
7422
- path.resolve(runtimeDir, "callout.ts")
7631
+ path.resolve(runtimeDir, "callout.ts"),
7632
+ path.resolve(runtimeDir, "floating-ui-callout.ts")
7423
7633
  ]);
7424
7634
  scheduleVueFileRegenLocal = (filePath, source) => {
7425
7635
  pendingChangedVueFiles.add(filePath);
@@ -7551,12 +7761,20 @@ function generateTestIdsModule(componentTestIds) {
7551
7761
  });
7552
7762
  });
7553
7763
  }
7764
+ const VIRTUAL_ID = "virtual:testids";
7765
+ const RESOLVED_ID = `\0${VIRTUAL_ID}`;
7554
7766
  function createTestIdsVirtualModulesPlugin(componentTestIds) {
7555
- const maybeModule = virtualImport;
7556
- const virtual = maybeModule.default ?? virtualImport;
7557
- return virtual({
7558
- "virtual:testids": () => generateTestIdsModule(componentTestIds)
7559
- });
7767
+ return {
7768
+ name: "vue-pom-generator:virtual-testids",
7769
+ resolveId(id) {
7770
+ if (id === VIRTUAL_ID)
7771
+ return RESOLVED_ID;
7772
+ },
7773
+ load(id) {
7774
+ if (id === RESOLVED_ID)
7775
+ return generateTestIdsModule(componentTestIds);
7776
+ }
7777
+ };
7560
7778
  }
7561
7779
  function createSupportPlugins(options) {
7562
7780
  const {
@@ -7572,7 +7790,7 @@ function createSupportPlugins(options) {
7572
7790
  getSourceDirs,
7573
7791
  getWrapperSearchRoots,
7574
7792
  nameCollisionBehavior = "suffix",
7575
- missingSemanticNameBehavior,
7793
+ missingSemanticNameBehavior = "error",
7576
7794
  existingIdBehavior,
7577
7795
  outDir,
7578
7796
  emitLanguages,
@@ -8087,12 +8305,12 @@ function assertErrorBehavior(value, name) {
8087
8305
  }
8088
8306
  function resolveMissingSemanticNameBehavior(value) {
8089
8307
  if (!value) {
8090
- return "ignore";
8308
+ return "error";
8091
8309
  }
8092
8310
  if (value === "ignore" || value === "error") {
8093
8311
  return value;
8094
8312
  }
8095
- return value.missingSemanticNameBehavior ?? "ignore";
8313
+ return value.missingSemanticNameBehavior ?? "error";
8096
8314
  }
8097
8315
  function readPackageJson(projectRoot) {
8098
8316
  const packageJsonPath = path.join(projectRoot, "package.json");