tracker: fix bundling process, export types separately

This commit is contained in:
nick-delirium 2024-11-25 10:11:56 +01:00
parent 423d9cb671
commit ab331d57a4
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
9 changed files with 27 additions and 34 deletions

View file

@ -1,6 +1,6 @@
{
"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.",
"main": "dist/index.js",
"module": "dist/index.js",
@ -8,6 +8,7 @@
"files": [
"dist"
],
"type": "module",
"scripts": {
"build": "tsc",
"test": "vitest",

View file

@ -1,7 +1,7 @@
{
"name": "@openreplay/tracker",
"description": "The OpenReplay tracker main package",
"version": "15.0.0",
"version": "15.0.1",
"keywords": [
"logging",
"replay"
@ -26,16 +26,19 @@
},
"files": [
"dist/lib/**/*",
"dist/cjs/**/*"
"dist/cjs/**/*",
"dist/types/**/*"
],
"main": "./dist/cjs/index.js",
"module": "./dist/lib/index.js",
"types": "./dist/lib/main/index.d.ts",
"scripts": {
"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": "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",
"test": "jest --coverage=false",
"test:ci": "jest --coverage=true",
@ -46,6 +49,7 @@
"@babel/core": "^7.26.0",
"@jest/globals": "^29.7.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-replace": "^6.0.1",
"@rollup/plugin-terser": "0.4.4",
@ -67,7 +71,7 @@
},
"dependencies": {
"@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-es": "^0.1.5",
"fflate": "^0.8.2",

View file

@ -3,6 +3,7 @@ import typescript from '@rollup/plugin-typescript'
import terser from '@rollup/plugin-terser'
import replace from '@rollup/plugin-replace'
import { rollup } from 'rollup'
import commonjs from '@rollup/plugin-commonjs';
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
const packageConfig = require('./package.json')
@ -12,7 +13,6 @@ export default async () => {
const commonPlugins = [
resolve(),
// terser(),
replace({
preventAssignment: true,
values: {
@ -23,7 +23,7 @@ export default async () => {
]
return [
{
input: 'src/main/index.ts',
input: 'build/main/index.js',
output: {
dir: 'dist/lib',
format: 'es',
@ -32,13 +32,10 @@ export default async () => {
},
plugins: [
...commonPlugins,
typescript({
tsconfig: 'src/main/tsconfig.json',
}),
],
},
{
input: 'src/main/index.ts',
input: 'build/main/index.js',
output: {
dir: 'dist/cjs',
format: 'cjs',
@ -47,9 +44,7 @@ export default async () => {
},
plugins: [
...commonPlugins,
typescript({
tsconfig: 'src/main/tsconfig-cjs.json',
}),
commonjs(),
],
},
]

View file

@ -8,7 +8,7 @@ function processMapInBatches(
const iterator = map.entries()
function processNextBatch() {
const batch = []
const batch: any[] = []
let result = iterator.next()
while (!result.done && batch.length < batchSize) {

View file

@ -49,7 +49,7 @@ function printObject(arg: any): string {
return `Array(${length})[${values}]`
}
if (typeof arg === 'object') {
const res = []
const res: string[] = []
let i = 0
for (const k in arg) {
if (++i === 10) {

View file

@ -1,8 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "Node",
"declarationDir": "../../dist/cjs"
},
}

View file

@ -4,6 +4,6 @@
"allowSyntheticDefaultImports": true,
"lib": ["es2020", "dom"],
"declaration": true,
"declarationDir": "../../dist/lib",
},
"declarationDir": "../../dist/types",
}
}

View file

@ -1,17 +1,18 @@
{
"compilerOptions": {
"rootDir": "src",
"noImplicitAny": true,
"noImplicitThis": true,
"noImplicitAny": false,
"noImplicitThis": false,
"strictNullChecks": true,
"alwaysStrict": true,
"alwaysStrict": false,
"target": "es2020",
"lib": ["DOM", "ES2020"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"module": "ES2022",
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true
"resolveJsonModule": true,
"outDir": "build"
},
"exclude": ["**/*.test.ts"],
"exclude": ["**/*.test.ts"]
}