Skip to content

Commit

Permalink
create canvas-manager entry
Browse files Browse the repository at this point in the history
  • Loading branch information
billyvg committed Jan 16, 2025
1 parent 4a21e7e commit 8132b20
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
10 changes: 10 additions & 0 deletions packages/rrweb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@
"default": "./dist/rrweb.cjs"
}
},
"./canvas-manager": {
"import": {
"types": "./dist/canvas-manager.d.ts",
"default": "./dist/canvas-manager.js"
},
"require": {
"types": "./dist/canvas-manager.d.cts",
"default": "./dist/canvas-manager.cjs"
}
},
"./dist/style.css": "./dist/style.css"
},
"files": [
Expand Down
2 changes: 2 additions & 0 deletions packages/rrweb/src/entries/canvas-manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {CanvasManager, CanvasManagerNoop} from '../record/observers/canvas/canvas-manager';
export type {CanvasManagerConstructorOptions, CanvasManagerInterface} from '../record/observers/canvas/canvas-manager';
4 changes: 1 addition & 3 deletions packages/rrweb/src/entries/record.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import record from '../record';

export { record };
export { record } from '../record';
9 changes: 1 addition & 8 deletions packages/rrweb/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import record from './record';
import {
Replayer,
type playerConfig,
Expand Down Expand Up @@ -28,16 +27,10 @@ export type {

export type { recordOptions, ReplayPlugin } from './types';
export { deserializeArg } from './replay/canvas/deserialize-args';
export {
CanvasManager,
addCustomEvent,
freezePage,
takeFullSnapshot,
} from './record';
export { addCustomEvent, freezePage, record, takeFullSnapshot } from './record';
export type { CanvasManagerConstructorOptions } from './record';

export {
record,
Replayer,
type playerConfig,
type PlayerState,
Expand Down
9 changes: 3 additions & 6 deletions packages/rrweb/src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ import {
ShadowDomManagerNoop,
} from './shadow-dom-manager';
import {
CanvasManager,
CanvasManagerConstructorOptions,
CanvasManagerInterface,
type CanvasManagerConstructorOptions,
type CanvasManagerInterface,
CanvasManagerNoop,
} from './observers/canvas/canvas-manager';
import { StylesheetManager } from './stylesheet-manager';
Expand Down Expand Up @@ -725,7 +724,7 @@ export function takeFullSnapshot(isCheckout?: boolean) {
record.mirror = mirror;
record.takeFullSnapshot = takeFullSnapshot;

export default record;
export { record };

function _getCanvasManager(
getCanvasManagerFn:
Expand All @@ -744,5 +743,3 @@ function _getCanvasManager(
return new CanvasManagerNoop();
}
}

export { CanvasManager };
10 changes: 8 additions & 2 deletions packages/rrweb/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import config from '../../vite.config.default';

// export default config('src/index.ts', 'rrweb', { outputDir: 'dist/main' });
export default config('src/index.ts', 'rrweb');
export default config(
{
rrweb: 'src/index.ts',
'canvas-manager': 'src/entries/canvas-manager.ts',
},
'rrweb',
{ outputDir: 'dist' },
);

0 comments on commit 8132b20

Please sign in to comment.