-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move browser-only rrdom features to the new rrdom package (#913)
- Loading branch information
Showing
31 changed files
with
707 additions
and
554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dist | ||
es | ||
lib | ||
typings |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "rrdom-nodejs", | ||
"version": "0.1.2", | ||
"scripts": { | ||
"dev": "rollup -c -w", | ||
"bundle": "rollup --config", | ||
"bundle:es-only": "cross-env ES_ONLY=true rollup --config", | ||
"check-types": "tsc -noEmit", | ||
"test": "jest", | ||
"prepublish": "npm run bundle", | ||
"lint": "yarn eslint src/**/*.ts" | ||
}, | ||
"keywords": [ | ||
"rrweb", | ||
"rrdom-nodejs" | ||
], | ||
"license": "MIT", | ||
"main": "lib/rrdom-nodejs.js", | ||
"module": "es/rrdom-nodejs.js", | ||
"typings": "es", | ||
"files": [ | ||
"dist", | ||
"lib", | ||
"es", | ||
"typings" | ||
], | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^20.0.0", | ||
"@rollup/plugin-node-resolve": "^13.0.4", | ||
"@types/cssom": "^0.4.1", | ||
"@types/cssstyle": "^2.2.1", | ||
"@types/jest": "^27.4.1", | ||
"@types/nwsapi": "^2.2.2", | ||
"@types/puppeteer": "^5.4.4", | ||
"@typescript-eslint/eslint-plugin": "^5.23.0", | ||
"@typescript-eslint/parser": "^5.23.0", | ||
"compare-versions": "^4.1.3", | ||
"eslint": "^8.15.0", | ||
"jest": "^27.5.1", | ||
"puppeteer": "^9.1.1", | ||
"rollup": "^2.56.3", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.31.2", | ||
"rollup-plugin-web-worker-loader": "^1.6.1", | ||
"ts-jest": "^27.1.3", | ||
"typescript": "^4.6.2" | ||
}, | ||
"dependencies": { | ||
"cssom": "^0.5.0", | ||
"cssstyle": "^2.3.0", | ||
"nwsapi": "^2.2.0", | ||
"rrweb-snapshot": "^1.1.14", | ||
"rrdom": "^0.1.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import webWorkerLoader from 'rollup-plugin-web-worker-loader'; | ||
import pkg from './package.json'; | ||
|
||
function toMinPath(path) { | ||
return path.replace(/\.js$/, '.min.js'); | ||
} | ||
|
||
const basePlugins = [ | ||
resolve({ browser: true }), | ||
commonjs(), | ||
|
||
// supports bundling `web-worker:..filename` from rrweb | ||
webWorkerLoader(), | ||
|
||
typescript({ | ||
tsconfigOverride: { compilerOptions: { module: 'ESNext' } }, | ||
}), | ||
]; | ||
|
||
const baseConfigs = [ | ||
{ | ||
input: './src/index.ts', | ||
name: pkg.name, | ||
path: pkg.name, | ||
}, | ||
{ | ||
input: './src/document-nodejs.ts', | ||
name: 'RRDocument', | ||
path: 'document-nodejs', | ||
}, | ||
]; | ||
|
||
let configs = []; | ||
let extraConfigs = []; | ||
for (let config of baseConfigs) { | ||
configs.push( | ||
// ES module | ||
{ | ||
input: config.input, | ||
plugins: basePlugins, | ||
output: [ | ||
{ | ||
format: 'esm', | ||
file: pkg.module.replace(pkg.name, config.path), | ||
}, | ||
], | ||
}, | ||
); | ||
extraConfigs.push( | ||
// CommonJS | ||
{ | ||
input: config.input, | ||
plugins: basePlugins, | ||
output: [ | ||
{ | ||
format: 'cjs', | ||
file: pkg.main.replace(pkg.name, config.path), | ||
}, | ||
], | ||
}, | ||
// ES module (packed) | ||
{ | ||
input: config.input, | ||
plugins: basePlugins.concat(terser()), | ||
output: [ | ||
{ | ||
format: 'esm', | ||
file: toMinPath(pkg.module).replace(pkg.name, config.path), | ||
sourcemap: true, | ||
}, | ||
], | ||
}, | ||
); | ||
} | ||
|
||
if (!process.env.ES_ONLY) { | ||
configs.push(...extraConfigs); | ||
} | ||
|
||
export default configs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { | ||
polyfillPerformance, | ||
polyfillRAF, | ||
polyfillEvent, | ||
polyfillNode, | ||
polyfillDocument, | ||
} from './polyfill'; | ||
polyfillPerformance(); | ||
polyfillRAF(); | ||
polyfillEvent(); | ||
polyfillNode(); | ||
polyfillDocument(); | ||
export * from './document-nodejs'; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES6", | ||
"module": "commonjs", | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"removeComments": true, | ||
"preserveConstEnums": true, | ||
"sourceMap": true, | ||
"rootDir": "src", | ||
"outDir": "build", | ||
"lib": ["es6", "dom"], | ||
"skipLibCheck": true, | ||
"declaration": true, | ||
"importsNotUsedAsValues": "error" | ||
}, | ||
"compileOnSave": true, | ||
"exclude": ["test"], | ||
"include": ["src", "test.d.ts", "../rrweb/src/record/workers/workers.d.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.