CI: add a prettier GitHub action to format code automatically (#988)
* CI: add a prettier GitHub action to format code automatically * improve GitHub Action config and format some files * Apply formatting changes * CI: make the prettier action a standalone action * Apply formatting changes * CI: add push as new trigger event Co-authored-by: Mark-Fenng <Mark-Fenng@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
*Psst — looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)*
|
||||
_Psst — looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)_
|
||||
|
||||
*Looking for a Vue.js version? Go here --> [@preflight-hq/rrweb-player-vue](https://github.com/Preflight-HQ/rrweb-player-vue)*
|
||||
_Looking for a Vue.js version? Go here --> [@preflight-hq/rrweb-player-vue](https://github.com/Preflight-HQ/rrweb-player-vue)_
|
||||
|
||||
---
|
||||
|
||||
@@ -17,8 +17,7 @@ degit sveltejs/template svelte-app
|
||||
cd svelte-app
|
||||
```
|
||||
|
||||
*Note that you will need to have [Node.js](https://nodejs.org) installed.*
|
||||
|
||||
_Note that you will need to have [Node.js](https://nodejs.org) installed._
|
||||
|
||||
## Get started
|
||||
|
||||
@@ -37,7 +36,6 @@ npm run dev
|
||||
|
||||
Navigate to [localhost:5000](http://localhost:5000). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes.
|
||||
|
||||
|
||||
## Deploying to the web
|
||||
|
||||
### With [now](https://zeit.co/now)
|
||||
|
||||
@@ -9,4 +9,4 @@
|
||||
"github": {
|
||||
"release": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +554,8 @@ export default class MutationBuffer {
|
||||
/**
|
||||
* Parent is blocked, ignore all child mutations
|
||||
*/
|
||||
if (isBlocked(m.target, this.blockClass, this.blockSelector, true)) return;
|
||||
if (isBlocked(m.target, this.blockClass, this.blockSelector, true))
|
||||
return;
|
||||
|
||||
m.addedNodes.forEach((n) => this.genAdds(n, m.target));
|
||||
m.removedNodes.forEach((n) => {
|
||||
|
||||
@@ -685,7 +685,10 @@ function initMediaInteractionObserver({
|
||||
const handler = (type: MediaInteractions) =>
|
||||
throttle((event: Event) => {
|
||||
const target = getEventTarget(event);
|
||||
if (!target || isBlocked(target as Node, blockClass, blockSelector, true)) {
|
||||
if (
|
||||
!target ||
|
||||
isBlocked(target as Node, blockClass, blockSelector, true)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const { currentTime, volume, muted } = target as HTMLMediaElement;
|
||||
|
||||
@@ -60,11 +60,17 @@ export class CanvasManager {
|
||||
mutationCb: canvasMutationCallback;
|
||||
win: IWindow;
|
||||
blockClass: blockClass;
|
||||
blockSelector: string | null,
|
||||
blockSelector: string | null;
|
||||
mirror: Mirror;
|
||||
sampling?: 'all' | number;
|
||||
}) {
|
||||
const { sampling = 'all', win, blockClass, blockSelector, recordCanvas } = options;
|
||||
const {
|
||||
sampling = 'all',
|
||||
win,
|
||||
blockClass,
|
||||
blockSelector,
|
||||
recordCanvas,
|
||||
} = options;
|
||||
this.mutationCb = options.mutationCb;
|
||||
this.mirror = options.mirror;
|
||||
|
||||
@@ -97,7 +103,11 @@ export class CanvasManager {
|
||||
blockClass: blockClass,
|
||||
blockSelector: string | null,
|
||||
) {
|
||||
const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector);
|
||||
const canvasContextReset = initCanvasContextObserver(
|
||||
win,
|
||||
blockClass,
|
||||
blockSelector,
|
||||
);
|
||||
const snapshotInProgressMap: Map<number, boolean> = new Map();
|
||||
const worker = new ImageBitmapDataURLWorker() as ImageBitmapDataURLRequestWorker;
|
||||
worker.onmessage = (e) => {
|
||||
@@ -142,11 +152,11 @@ export class CanvasManager {
|
||||
|
||||
const getCanvas = (): HTMLCanvasElement[] => {
|
||||
const matchedCanvas: HTMLCanvasElement[] = [];
|
||||
win.document.querySelectorAll('canvas').forEach(canvas => {
|
||||
win.document.querySelectorAll('canvas').forEach((canvas) => {
|
||||
if (!isBlocked(canvas, blockClass, blockSelector, true)) {
|
||||
matchedCanvas.push(canvas);
|
||||
}
|
||||
})
|
||||
});
|
||||
return matchedCanvas;
|
||||
};
|
||||
|
||||
@@ -215,7 +225,11 @@ export class CanvasManager {
|
||||
this.startRAFTimestamping();
|
||||
this.startPendingCanvasMutationFlusher();
|
||||
|
||||
const canvasContextReset = initCanvasContextObserver(win, blockClass, blockSelector);
|
||||
const canvasContextReset = initCanvasContextObserver(
|
||||
win,
|
||||
blockClass,
|
||||
blockSelector,
|
||||
);
|
||||
const canvas2DReset = initCanvas2DMutationObserver(
|
||||
this.processMutation.bind(this),
|
||||
win,
|
||||
|
||||
@@ -245,7 +245,7 @@ export type recordOptions<T> = {
|
||||
maskInputFn?: MaskInputFn;
|
||||
maskTextFn?: MaskTextFn;
|
||||
slimDOMOptions?: SlimDOMOptions | 'all' | true;
|
||||
ignoreCSSAttributes?:Set<string>;
|
||||
ignoreCSSAttributes?: Set<string>;
|
||||
inlineStylesheet?: boolean;
|
||||
hooks?: hooksParam;
|
||||
packFn?: PackFn;
|
||||
@@ -295,7 +295,7 @@ export type observerParam = {
|
||||
stylesheetManager: StylesheetManager;
|
||||
shadowDomManager: ShadowDomManager;
|
||||
canvasManager: CanvasManager;
|
||||
ignoreCSSAttributes:Set<string>;
|
||||
ignoreCSSAttributes: Set<string>;
|
||||
plugins: Array<{
|
||||
observer: (
|
||||
cb: (...arg: Array<unknown>) => void,
|
||||
|
||||
@@ -205,7 +205,7 @@ export function isBlocked(
|
||||
? (node as HTMLElement)
|
||||
: node.parentElement;
|
||||
if (!el) return false;
|
||||
|
||||
|
||||
if (typeof blockClass === 'string') {
|
||||
if (el.classList.contains(blockClass)) return true;
|
||||
if (checkAncestors && el.closest('.' + blockClass) !== null) return true;
|
||||
|
||||
@@ -80,7 +80,7 @@ const events: eventWithTime[] = [
|
||||
{
|
||||
id: 102,
|
||||
value: 'Intermediate - incorrect',
|
||||
}
|
||||
},
|
||||
],
|
||||
source: IncrementalSource.Mutation,
|
||||
removes: [],
|
||||
@@ -97,7 +97,7 @@ const events: eventWithTime[] = [
|
||||
{
|
||||
id: 102,
|
||||
value: 'Final - correct',
|
||||
}
|
||||
},
|
||||
],
|
||||
source: IncrementalSource.Mutation,
|
||||
removes: [],
|
||||
|
||||
@@ -667,7 +667,7 @@ describe('record integration tests', function (this: ISuite) {
|
||||
const snapshots = await page.evaluate('window.snapshots');
|
||||
assertSnapshot(snapshots);
|
||||
});
|
||||
|
||||
|
||||
// https://github.com/webcomponents/polyfills/tree/master/packages/shadydom
|
||||
it('should record shadow doms polyfilled by shadydom', async () => {
|
||||
const page: puppeteer.Page = await browser.newPage();
|
||||
|
||||
Reference in New Issue
Block a user