tracker: fix bundling process, export types separately
This commit is contained in:
parent
423d9cb671
commit
ab331d57a4
9 changed files with 27 additions and 34 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@openreplay/network-proxy",
|
"name": "@openreplay/network-proxy",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "this library helps us to create proxy objects for fetch, XHR and beacons for proper request tracking.",
|
"description": "this library helps us to create proxy objects for fetch, XHR and beacons for proper request tracking.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "vitest",
|
"test": "vitest",
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@openreplay/tracker",
|
"name": "@openreplay/tracker",
|
||||||
"description": "The OpenReplay tracker main package",
|
"description": "The OpenReplay tracker main package",
|
||||||
"version": "15.0.0",
|
"version": "15.0.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"logging",
|
"logging",
|
||||||
"replay"
|
"replay"
|
||||||
|
|
@ -26,16 +26,19 @@
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist/lib/**/*",
|
"dist/lib/**/*",
|
||||||
"dist/cjs/**/*"
|
"dist/cjs/**/*",
|
||||||
|
"dist/types/**/*"
|
||||||
],
|
],
|
||||||
"main": "./dist/cjs/index.js",
|
"main": "./dist/cjs/index.js",
|
||||||
"module": "./dist/lib/index.js",
|
"module": "./dist/lib/index.js",
|
||||||
"types": "./dist/lib/main/index.d.ts",
|
"types": "./dist/lib/main/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint src --ext .ts,.js --fix --quiet",
|
"lint": "eslint src --ext .ts,.js --fix --quiet",
|
||||||
"clean": "rm -Rf build && rm -Rf lib && rm -Rf cjs",
|
"clean": "rm -Rf build && rm -Rf dist",
|
||||||
"build:common": "tsc -b src/common",
|
"build:common": "tsc -b src/common",
|
||||||
"build": "yarn run clean && rollup --config rollup.config.js",
|
"compile": "tsc --project src/main/tsconfig.json",
|
||||||
|
"create-types": "mkdir dist/lib/ dist/cjs && cp -r dist/types/* dist/lib/ && cp -r dist/types/* dist/cjs/",
|
||||||
|
"build": "yarn run clean && yarn compile && yarn create-types && rollup --config rollup.config.js",
|
||||||
"lint-front": "lint-staged",
|
"lint-front": "lint-staged",
|
||||||
"test": "jest --coverage=false",
|
"test": "jest --coverage=false",
|
||||||
"test:ci": "jest --coverage=true",
|
"test:ci": "jest --coverage=true",
|
||||||
|
|
@ -46,6 +49,7 @@
|
||||||
"@babel/core": "^7.26.0",
|
"@babel/core": "^7.26.0",
|
||||||
"@jest/globals": "^29.7.0",
|
"@jest/globals": "^29.7.0",
|
||||||
"@rollup/plugin-babel": "^6.0.4",
|
"@rollup/plugin-babel": "^6.0.4",
|
||||||
|
"@rollup/plugin-commonjs": "^28.0.1",
|
||||||
"@rollup/plugin-node-resolve": "^15.3.0",
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
||||||
"@rollup/plugin-replace": "^6.0.1",
|
"@rollup/plugin-replace": "^6.0.1",
|
||||||
"@rollup/plugin-terser": "0.4.4",
|
"@rollup/plugin-terser": "0.4.4",
|
||||||
|
|
@ -67,7 +71,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@medv/finder": "^3.2.0",
|
"@medv/finder": "^3.2.0",
|
||||||
"@openreplay/network-proxy": "^1.0.4",
|
"@openreplay/network-proxy": "^1.0.5",
|
||||||
"error-stack-parser": "^2.0.6",
|
"error-stack-parser": "^2.0.6",
|
||||||
"error-stack-parser-es": "^0.1.5",
|
"error-stack-parser-es": "^0.1.5",
|
||||||
"fflate": "^0.8.2",
|
"fflate": "^0.8.2",
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import typescript from '@rollup/plugin-typescript'
|
||||||
import terser from '@rollup/plugin-terser'
|
import terser from '@rollup/plugin-terser'
|
||||||
import replace from '@rollup/plugin-replace'
|
import replace from '@rollup/plugin-replace'
|
||||||
import { rollup } from 'rollup'
|
import { rollup } from 'rollup'
|
||||||
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
import { createRequire } from 'module'
|
import { createRequire } from 'module'
|
||||||
const require = createRequire(import.meta.url)
|
const require = createRequire(import.meta.url)
|
||||||
const packageConfig = require('./package.json')
|
const packageConfig = require('./package.json')
|
||||||
|
|
@ -12,7 +13,6 @@ export default async () => {
|
||||||
|
|
||||||
const commonPlugins = [
|
const commonPlugins = [
|
||||||
resolve(),
|
resolve(),
|
||||||
// terser(),
|
|
||||||
replace({
|
replace({
|
||||||
preventAssignment: true,
|
preventAssignment: true,
|
||||||
values: {
|
values: {
|
||||||
|
|
@ -23,7 +23,7 @@ export default async () => {
|
||||||
]
|
]
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
input: 'src/main/index.ts',
|
input: 'build/main/index.js',
|
||||||
output: {
|
output: {
|
||||||
dir: 'dist/lib',
|
dir: 'dist/lib',
|
||||||
format: 'es',
|
format: 'es',
|
||||||
|
|
@ -32,13 +32,10 @@ export default async () => {
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
...commonPlugins,
|
...commonPlugins,
|
||||||
typescript({
|
|
||||||
tsconfig: 'src/main/tsconfig.json',
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: 'src/main/index.ts',
|
input: 'build/main/index.js',
|
||||||
output: {
|
output: {
|
||||||
dir: 'dist/cjs',
|
dir: 'dist/cjs',
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
|
|
@ -47,9 +44,7 @@ export default async () => {
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
...commonPlugins,
|
...commonPlugins,
|
||||||
typescript({
|
commonjs(),
|
||||||
tsconfig: 'src/main/tsconfig-cjs.json',
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ function processMapInBatches(
|
||||||
const iterator = map.entries()
|
const iterator = map.entries()
|
||||||
|
|
||||||
function processNextBatch() {
|
function processNextBatch() {
|
||||||
const batch = []
|
const batch: any[] = []
|
||||||
let result = iterator.next()
|
let result = iterator.next()
|
||||||
|
|
||||||
while (!result.done && batch.length < batchSize) {
|
while (!result.done && batch.length < batchSize) {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ function printObject(arg: any): string {
|
||||||
return `Array(${length})[${values}]`
|
return `Array(${length})[${values}]`
|
||||||
}
|
}
|
||||||
if (typeof arg === 'object') {
|
if (typeof arg === 'object') {
|
||||||
const res = []
|
const res: string[] = []
|
||||||
let i = 0
|
let i = 0
|
||||||
for (const k in arg) {
|
for (const k in arg) {
|
||||||
if (++i === 10) {
|
if (++i === 10) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "CommonJS",
|
|
||||||
"moduleResolution": "Node",
|
|
||||||
"declarationDir": "../../dist/cjs"
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -4,6 +4,6 @@
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"lib": ["es2020", "dom"],
|
"lib": ["es2020", "dom"],
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationDir": "../../dist/lib",
|
"declarationDir": "../../dist/types",
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": false,
|
||||||
"noImplicitThis": true,
|
"noImplicitThis": false,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"alwaysStrict": true,
|
"alwaysStrict": false,
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"lib": ["DOM", "ES2020"],
|
"lib": ["DOM", "ES2020"],
|
||||||
"module": "NodeNext",
|
"module": "ES2022",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "node",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"resolveJsonModule": true
|
"resolveJsonModule": true,
|
||||||
|
"outDir": "build"
|
||||||
},
|
},
|
||||||
"exclude": ["**/*.test.ts"],
|
"exclude": ["**/*.test.ts"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue