@lvce-editor/test-with-playwright-worker 22.13.0 → 22.13.1

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.
@@ -215,6 +215,10 @@ var SvgScreenshot = (function (exports) {
215
215
  // correctly by all compliant CSS consumers.
216
216
  const STYLE_TAG = /(<)(\/?style\b)/gi;
217
217
  const COMMENT_OPEN = /(<)(!--)/g;
218
+
219
+ // Characters that end an at-rule name, mirroring RE_AT_END in the tokenizer.
220
+ // Params starting with anything else need a space to stay separate tokens.
221
+ const AT_NAME_END = /[\t\n\f\r "#'()/;[\\\]{}]/;
218
222
  function escapeHTMLInCSS(str) {
219
223
  if (typeof str !== 'string') return str;
220
224
  if (!str.includes('<')) return str;
@@ -240,12 +244,13 @@ var SvgScreenshot = (function (exports) {
240
244
  function atruleStart(str, node) {
241
245
  let name = '@' + node.name;
242
246
  let params = node.params ? str.rawValue(node, 'params') : '';
243
- if (typeof node.raws.afterName !== 'undefined') {
244
- name += node.raws.afterName;
245
- } else if (params) {
246
- name += ' ';
247
+ let afterName = node.raws.afterName;
248
+ if (typeof afterName === 'undefined') {
249
+ afterName = params ? ' ' : '';
250
+ } else if (afterName === '' && params && !AT_NAME_END.test(params[0])) {
251
+ afterName = ' ';
247
252
  }
248
- return name + params;
253
+ return name + afterName + params;
249
254
  }
250
255
  function pushBody(str, stack, node) {
251
256
  let nodes = node.nodes;
@@ -257,10 +262,19 @@ var SvgScreenshot = (function (exports) {
257
262
  let semicolon = str.raw(node, 'semicolon');
258
263
  let isDocument = node.type === 'document';
259
264
  for (let i = nodes.length - 1; i >= 0; i--) {
265
+ let child = nodes[i];
266
+ let childSemicolon = last !== i || semicolon;
267
+ // A childless at-rule or a custom property declaration that still has
268
+ // following siblings must be terminated. Without the semicolon those
269
+ // trailing comments are folded into the at-rule's prelude or the custom
270
+ // property's value and disappear when the output is re-parsed.
271
+ if (!childSemicolon && i < nodes.length - 1 && (child.type === 'atrule' && !child.nodes || child.type === 'decl' && child.prop.startsWith('--'))) {
272
+ childSemicolon = true;
273
+ }
260
274
  stack.push({
261
275
  document: isDocument,
262
- node: nodes[i],
263
- semicolon: last !== i || semicolon
276
+ node: child,
277
+ semicolon: childSemicolon
264
278
  });
265
279
  }
266
280
  }
@@ -1724,15 +1738,12 @@ var SvgScreenshot = (function (exports) {
1724
1738
  }
1725
1739
  loadFile(path, cssFile, trusted) {
1726
1740
  if (!trusted && !this.unsafeMap) {
1727
- if (!/\.map$/i.test(path)) {
1741
+ if (!/\.map$/i.test(path)) return undefined;
1742
+ if (!cssFile) return undefined;
1743
+ let rel = relative(dirname(cssFile), path);
1744
+ if (rel === '..' || rel.startsWith('..' + sep) || isAbsolute(rel)) {
1728
1745
  return undefined;
1729
1746
  }
1730
- if (cssFile) {
1731
- let relativePath = relative(dirname(cssFile), path);
1732
- if (relativePath === '..' || relativePath.startsWith('..' + sep) || isAbsolute(relativePath)) {
1733
- return undefined;
1734
- }
1735
- }
1736
1747
  }
1737
1748
  this.root = dirname(path);
1738
1749
  if (existsSync(path)) {
@@ -3493,11 +3504,22 @@ var SvgScreenshot = (function (exports) {
3493
3504
  if (hasRequiredWarning) return warning;
3494
3505
  hasRequiredWarning = 1;
3495
3506
 
3507
+ let Container = requireContainer();
3508
+ let {
3509
+ my
3510
+ } = requireSymbols();
3496
3511
  class Warning {
3497
3512
  constructor(text, opts = {}) {
3498
3513
  this.type = 'warning';
3499
3514
  this.text = text;
3500
3515
  if (opts.node && opts.node.source) {
3516
+ if (!opts.node[my]) {
3517
+ // The node comes from another PostCSS copy in node_modules, so it does
3518
+ // not have this copy’s methods. Container#normalize() rebuilds such
3519
+ // nodes on insert, but a node passed straight to Result#warn() never
3520
+ // goes through it.
3521
+ Container.rebuild(opts.node);
3522
+ }
3501
3523
  let range = opts.node.rangeBy(opts);
3502
3524
  this.line = range.start.line;
3503
3525
  this.column = range.start.column;
@@ -4242,7 +4264,7 @@ var SvgScreenshot = (function (exports) {
4242
4264
  let Root = requireRoot();
4243
4265
  class Processor {
4244
4266
  constructor(plugins = []) {
4245
- this.version = '8.5.19';
4267
+ this.version = '8.5.23';
4246
4268
  this.plugins = this.normalize(plugins);
4247
4269
  }
4248
4270
  normalize(plugins) {
@@ -514,7 +514,10 @@ const constructError = (message, type, name) => {
514
514
  if (ErrorConstructor === Error) {
515
515
  const error = new Error(message);
516
516
  if (name && name !== 'VError') {
517
- error.name = name;
517
+ Object.defineProperty(error, 'name', {
518
+ configurable: true,
519
+ value: name
520
+ });
518
521
  }
519
522
  return error;
520
523
  }
@@ -545,31 +548,45 @@ const getParentStack = error => {
545
548
  };
546
549
  const MethodNotFound = -32601;
547
550
  const Custom = -32001;
551
+ const setStack = (error, stack) => {
552
+ const descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
553
+ if (descriptor) {
554
+ if (!descriptor.configurable && !descriptor.writable) {
555
+ return;
556
+ }
557
+ if (!descriptor.configurable && descriptor.writable) {
558
+ error.stack = stack;
559
+ return;
560
+ }
561
+ }
562
+ Object.defineProperty(error, 'stack', {
563
+ configurable: true,
564
+ value: stack,
565
+ writable: true
566
+ });
567
+ };
548
568
  const restoreExistingError = (error, currentStack) => {
549
569
  if (typeof error.stack === 'string') {
550
- error.stack = error.stack + NewLine + currentStack;
570
+ setStack(error, `${error.stack}${NewLine}${currentStack}`);
551
571
  }
552
572
  return error;
553
573
  };
554
574
  const restoreMethodNotFoundError = (error, currentStack) => {
555
575
  const restoredError = new JsonRpcError(error.message);
556
576
  const parentStack = getParentStack(error);
557
- restoredError.stack = parentStack + NewLine + currentStack;
577
+ setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
558
578
  return restoredError;
559
579
  };
560
580
  const restoreStackFromData = (restoredError, error, currentStack) => {
561
581
  if (error.data.stack && error.data.type && error.message) {
562
- restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
582
+ setStack(restoredError, `${error.data.type}: ${error.message}${NewLine}${error.data.stack}${NewLine}${currentStack}`);
563
583
  return;
564
584
  }
565
585
  if (error.data.stack) {
566
- restoredError.stack = error.data.stack;
586
+ setStack(restoredError, error.data.stack);
567
587
  }
568
588
  };
569
589
  const applyDataProperties = (restoredError, error) => {
570
- if (!error.data) {
571
- return;
572
- }
573
590
  restoreStackFromData(restoredError, error, getCurrentStack());
574
591
  if (error.data.codeFrame) {
575
592
  // @ts-ignore
@@ -590,7 +607,7 @@ const applyDirectProperties = (restoredError, error) => {
590
607
  const indexNewLine = getNewLineIndex(lowerStack);
591
608
  const parentStack = getParentStack(error);
592
609
  // @ts-ignore
593
- restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
610
+ setStack(restoredError, `${parentStack}${lowerStack.slice(indexNewLine)}`);
594
611
  }
595
612
  if (error.codeFrame) {
596
613
  // @ts-ignore
@@ -1314,6 +1331,11 @@ const getUrlFromTestFile = (absolutePath, port, traceFocus, traceRendererWorker)
1314
1331
  }
1315
1332
  return url.href;
1316
1333
  };
1334
+ const navigateToTest = async (page, url) => {
1335
+ await page.goto(url, {
1336
+ waitUntil: 'domcontentloaded'
1337
+ });
1338
+ };
1317
1339
  const runTest = async ({
1318
1340
  page,
1319
1341
  port,
@@ -1330,9 +1352,7 @@ const runTest = async ({
1330
1352
  expect
1331
1353
  } = await import('@playwright/test');
1332
1354
  const url = getUrlFromTestFile(test, port, traceFocus ?? false, traceRendererWorker ?? false);
1333
- await page.goto(url, {
1334
- waitUntil: 'networkidle'
1335
- });
1355
+ await navigateToTest(page, url);
1336
1356
  const testOverlay = page.locator('#TestOverlay');
1337
1357
  await expect(testOverlay).toBeVisible({
1338
1358
  timeout
@@ -1862,7 +1882,7 @@ const getPort = () => {
1862
1882
  };
1863
1883
 
1864
1884
  const getPossibleServerPaths = cwd => {
1865
- const toTry = ['@lvce-editor/server', pathToFileURL(join(cwd, '..', 'server', 'node_modules', '@lvce-editor', 'server', 'index.js')).toString(), pathToFileURL(join(cwd, '..', 'build', 'node_modules', '@lvce-editor', 'server', 'index.js')).toString(), pathToFileURL(join(cwd, '..', '..', '..', 'packages', 'server', 'node_modules', '@lvce-editor', 'server', 'index.js')).toString()];
1885
+ const toTry = ['@lvce-editor/server', pathToFileURL(join(cwd, '..', '..', 'node_modules', '@lvce-editor', 'server', 'index.js')).toString(), pathToFileURL(join(cwd, '..', 'server', 'node_modules', '@lvce-editor', 'server', 'index.js')).toString(), pathToFileURL(join(cwd, '..', 'build', 'node_modules', '@lvce-editor', 'server', 'index.js')).toString(), pathToFileURL(join(cwd, '..', '..', '..', 'packages', 'server', 'node_modules', '@lvce-editor', 'server', 'index.js')).toString()];
1866
1886
  return toTry;
1867
1887
  };
1868
1888
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-with-playwright-worker",
3
- "version": "22.13.0",
3
+ "version": "22.13.1",
4
4
  "description": "Worker package for test-with-playwright",
5
5
  "repository": {
6
6
  "type": "git",