Chore: Move most types from rrweb to @rrweb/types package (#1031)
* Chore: Add move most types from rrweb to @rrweb/types package * Split off type imports * Split off type import to its own line * Get vite to generate type definitions * Apply formatting changes * noEmit not allowed in tsconfig, moved it to build step * Align version of @rrweb/types with main rrweb package Based on @mark-fenng's comments https://github.com/rrweb-io/rrweb/pull/1031/files#r1002298176 * Move up keywords
This commit is contained in:
@@ -10,7 +10,8 @@ import {
|
||||
generateRecordSnippet,
|
||||
ISuite,
|
||||
} from '../utils';
|
||||
import type { recordOptions, eventWithTime } from '../../src/types';
|
||||
import type { recordOptions } from '../../src/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
import { toMatchImageSnapshot } from 'jest-image-snapshot';
|
||||
expect.extend({ toMatchImageSnapshot });
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
const events: eventWithTime[] = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
const events: eventWithTime[] = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
const events: eventWithTime[] = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
const events: eventWithTime[] = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
const events: eventWithTime[] = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { EventType, eventWithTime, IncrementalSource } from '../../src/types';
|
||||
import { EventType, IncrementalSource } from '@rrweb/types';
|
||||
import type { eventWithTime } from '@rrweb/types';
|
||||
|
||||
const now = Date.now();
|
||||
const events: eventWithTime[] = [
|
||||
|
||||
@@ -11,12 +11,8 @@ import {
|
||||
generateRecordSnippet,
|
||||
ISuite,
|
||||
} from './utils';
|
||||
import {
|
||||
recordOptions,
|
||||
eventWithTime,
|
||||
EventType,
|
||||
RecordPlugin,
|
||||
} from '../src/types';
|
||||
import type { recordOptions } from '../src/types';
|
||||
import { eventWithTime, EventType, RecordPlugin } from '@rrweb/types';
|
||||
import { visitSnapshot, NodeType } from 'rrweb-snapshot';
|
||||
|
||||
describe('record integration tests', function (this: ISuite) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { discardPriorSnapshots } from '../src/replay/machine';
|
||||
import { sampleEvents } from './utils';
|
||||
import { EventType } from '../src/types';
|
||||
import { EventType } from '@rrweb/types';
|
||||
|
||||
const events = sampleEvents.filter(
|
||||
(e) => ![EventType.DomContentLoaded, EventType.Load].includes(e.type),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { pack, unpack } from '../src/packer';
|
||||
import { eventWithTime, EventType } from '../src/types';
|
||||
import { eventWithTime, EventType } from '@rrweb/types';
|
||||
import { MARK } from '../src/packer/base';
|
||||
|
||||
const event: eventWithTime = {
|
||||
|
||||
@@ -2,15 +2,15 @@ import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import type * as puppeteer from 'puppeteer';
|
||||
import 'construct-style-sheets-polyfill';
|
||||
import type { recordOptions } from '../src/types';
|
||||
import {
|
||||
recordOptions,
|
||||
listenerHandler,
|
||||
eventWithTime,
|
||||
EventType,
|
||||
IncrementalSource,
|
||||
styleSheetRuleData,
|
||||
selectionData,
|
||||
} from '../src/types';
|
||||
} from '@rrweb/types';
|
||||
import { assertSnapshot, launchPuppeteer, waitForRAF } from './utils';
|
||||
|
||||
interface ISuite {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import type * as puppeteer from 'puppeteer';
|
||||
import type { recordOptions } from '../../src/types';
|
||||
import {
|
||||
recordOptions,
|
||||
listenerHandler,
|
||||
eventWithTime,
|
||||
EventType,
|
||||
IncrementalSource,
|
||||
CanvasContext,
|
||||
} from '../../src/types';
|
||||
} from '@rrweb/types';
|
||||
import {
|
||||
assertSnapshot,
|
||||
launchPuppeteer,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
IncrementalSource,
|
||||
EventType,
|
||||
eventWithTime,
|
||||
} from '../../src/types';
|
||||
} from '@rrweb/types';
|
||||
|
||||
let replayer: Replayer;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { polyfillWebGLGlobals } from '../utils';
|
||||
polyfillWebGLGlobals();
|
||||
|
||||
import webglMutation from '../../src/replay/canvas/webgl';
|
||||
import { CanvasContext } from '../../src/types';
|
||||
import { CanvasContext } from '@rrweb/types';
|
||||
import { variableListFor } from '../../src/replay/canvas/deserialize-args';
|
||||
|
||||
let canvas: HTMLCanvasElement;
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
Optional,
|
||||
mouseInteractionData,
|
||||
event,
|
||||
recordOptions,
|
||||
} from '../src/types';
|
||||
} from '@rrweb/types';
|
||||
import type { recordOptions } from '../src/types';
|
||||
import * as puppeteer from 'puppeteer';
|
||||
import { format } from 'prettier';
|
||||
import * as path from 'path';
|
||||
|
||||
Reference in New Issue
Block a user