Skip to content

Commit bda43d0

Browse files
committed
all packages seem to be installed now time for the errors
1 parent 432b035 commit bda43d0

File tree

9 files changed

+127
-37
lines changed

9 files changed

+127
-37
lines changed

.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"extends": [
3-
"airbnb",
43
"plugin:jest/recommended",
54
"plugin:@typescript-eslint/eslint-recommended",
65
"plugin:@typescript-eslint/recommended",

package.json

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "build web extension bundle.js",
44
"scripts": {
55
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --mode production",
6-
"dev": " webpack --mode development --watch",
6+
"dev": "cross-env NODE_ENV=development webpack --mode development --watch",
77
"buildlegacy": "webpack --mode production",
88
"devlegacy": "webpack --mode development --watch",
99
"test": "jest --verbose --coverage",
@@ -119,21 +119,76 @@
119119
],
120120
"license": "ISC",
121121
"devDependencies": {
122-
"@babel/preset-env": "^7.23.6",
123-
"@babel/preset-react": "^7.23.3",
124-
"@babel/preset-typescript": "^7.23.3",
122+
"@testing-library/jest-dom": "^6.1.5",
123+
"@testing-library/react": "^14.1.2",
124+
"@testing-library/user-event": "^14.5.1",
125125
"@types/chrome": "^0.0.254",
126126
"@types/jest": "^29.5.11",
127127
"@types/node": "^20.10.5",
128-
"babel-loader": "^9.1.3",
128+
"@typescript-eslint/eslint-plugin": "^6.15.0",
129129
"copy-webpack-plugin": "^11.0.0",
130+
"css-loader": "^6.8.1",
131+
"eslint-plugin-jest": "^27.6.0",
132+
"eslint-plugin-jest-dom": "^5.1.0",
133+
"eslint-plugin-react": "^7.33.2",
134+
"eslint-plugin-react-hooks": "^4.6.0",
135+
"eslint-plugin-testing-library": "^6.2.0",
130136
"html-webpack-plugin": "^5.5.4",
137+
"identity-obj-proxy": "^3.0.0",
138+
"jsdom": "^23.0.1",
139+
"react-dom": "^18.2.0",
140+
"react-router-dom": "^6.21.1",
141+
"sass-loader": "^13.3.2",
142+
"style-loader": "^3.3.3",
143+
"ts-loader": "^9.5.1",
131144
"typedoc": "^0.25.4",
132145
"typescript": "^5.3.3",
133146
"webpack": "^5.89.0",
134147
"webpack-cli": "^5.1.4"
135148
},
136149
"dependencies": {
137-
"express": "^4.18.2"
150+
"@emotion/react": "^11.11.1",
151+
"@emotion/styled": "^11.11.0",
152+
"@mui/icons-material": "^5.15.1",
153+
"@mui/material": "^5.15.1",
154+
"@mui/system": "^5.15.1",
155+
"@reduxjs/toolkit": "^2.0.1",
156+
"@visx/axis": "^3.5.0",
157+
"@visx/event": "^3.3.0",
158+
"@visx/gradient": "^3.3.0",
159+
"@visx/grid": "^3.5.0",
160+
"@visx/group": "^3.3.0",
161+
"@visx/hierarchy": "^3.3.0",
162+
"@visx/responsive": "^3.3.0",
163+
"@visx/scale": "^3.5.0",
164+
"@visx/shape": "^3.5.0",
165+
"@visx/text": "^3.3.0",
166+
"@visx/tooltip": "^3.3.0",
167+
"cross-env": "^7.0.3",
168+
"d3": "^7.8.5",
169+
"d3-scale-chromatic": "^3.0.0",
170+
"d3-shape": "^3.2.0",
171+
"dotenv": "^16.3.1",
172+
"express": "^4.18.2",
173+
"html-react-parser": "^5.0.11",
174+
"intro.js": "^7.2.0",
175+
"intro.js-react": "^1.0.0",
176+
"jsondiffpatch": "^0.6.0",
177+
"lodash": "^4.17.21",
178+
"node": "^14.21.3",
179+
"rc-slider": "^10.5.0",
180+
"rc-tooltip": "^6.1.3",
181+
"react": "^18.2.0",
182+
"react-apexcharts": "^1.4.1",
183+
"react-hover": "^3.0.1",
184+
"react-json-tree": "^0.18.0",
185+
"react-redux": "^9.0.4",
186+
"react-select": "^5.8.0",
187+
"react-spinners": "^0.13.8",
188+
"redux": "^5.0.0",
189+
"regenerator-runtime": "^0.14.1",
190+
"sass": "^1.69.5",
191+
"styled-components": "^6.1.2",
192+
"web-vitals": "^3.5.0"
138193
}
139194
}

src/app/__tests__/MainContainer.test.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const mockState = {
1616
},
1717
}; // End
1818

19-
const chrome = require('sinon-chrome');
19+
// const chrome = require('sinon-chrome');
2020

2121
const mockActionContainer = jest.fn();
2222
jest.mock('../containers/ActionContainer', () => (props) => {
@@ -55,17 +55,17 @@ jest.mock('../../../node_modules/intro.js/introjs.css', () => jest.fn());
5555
useDispatch.mockReturnValue(dispatch);
5656
useSelector.mockImplementation((callback) => callback(mockState));
5757

58-
global.chrome = chrome;
59-
const port = {
60-
onMessage: {
61-
addListener: () => {},
62-
hasListener: () => {},
63-
},
64-
onDisconnect: {
65-
addListener: () => {},
66-
},
67-
};
68-
chrome.runtime.connect.returns(port);
58+
// global.chrome = chrome;
59+
// const port = {
60+
// onMessage: {
61+
// addListener: () => {},
62+
// hasListener: () => {},
63+
// },
64+
// onDisconnect: {
65+
// addListener: () => {},
66+
// },
67+
// };
68+
// chrome.runtime.connect.returns(port);
6969

7070
describe('With no snapshots, should not render any containers', () => {
7171
test('With no snapshots, ErrorContainer should render', () => {

src/app/components/Diff.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
2-
import { diff, formatters } from 'jsondiffpatch';
2+
import { diff } from 'jsondiffpatch';
3+
import formatters from 'jsondiffpatch/build/formatters';
34
import HtmlReactParser from 'html-react-parser';
45
import { CurrentTab, DiffProps, MainState, RootState, StatelessCleaning } from '../FrontendTypes';
56
import { useSelector } from 'react-redux';

src/backend/controllers/statePropExtractors.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const acorn = require('acorn');
2-
const jsx = require('acorn-jsx');
3-
const JSXParser = acorn.Parser.extend(jsx());
1+
import parse from 'html-react-parser';
42
import { HookStateItem, Fiber } from '../types/backendTypes';
53
import { exclude } from '../models/filterConditions';
64

@@ -92,7 +90,7 @@ export function getHooksNames(elementType: string): { hookName: string; varName:
9290
// Abstract Syntax Tree
9391
let AST: any;
9492
try {
95-
AST = JSXParser.parse(elementType).body;
93+
AST = parse(elementType).body;
9694
// Begin search for hook names, only if ast has a body property.
9795
// Statements get all the names of the hooks. For example: useCount, useWildcard, ...
9896
const statements: { hookName: string; varName: string }[] = [];

src/backend/module.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,3 @@ declare module 'core-js';
1010
// the resulting code uses regen runtime to run
1111
// https://stackoverflow.com/questions/65378542/what-is-regenerator-runtime-npm-package-used-for
1212
declare module 'regenerator-runtime/runtime';
13-
// Acorn is a jsx parser that was experimental to be faster than than the react.js jsx parser,
14-
// however is not maintained at this time, last update was more than one year ago 10-5-21
15-
declare module 'acorn-jsx';
16-
// Traspiler to traspile code to JSX AST but to use with regular es5 compliant js,
17-
// still needs babel and buble trasnpilers which use acorn-jsx under the hood
18-
declare module 'acorn';

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "ES6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
"jsx": "react", /* Specify what JSX code is generated. */
1717
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
@@ -25,7 +25,7 @@
2525
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
2626

2727
/* Modules */
28-
"module": "commonjs", /* Specify what module code is generated. */
28+
"module": "ES6", /* Specify what module code is generated. */
2929
// "rootDir": "./", /* Specify the root folder within your source files. */
3030
"moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
3131
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
@@ -52,7 +52,7 @@
5252
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
5353
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
5454
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
55+
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
5656
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5757
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
5858
"outDir": "./src/extension/build/bundles/", /* Specify an output folder for all emitted files. */

webpack.config.js

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require('dotenv').config()
12
/* eslint-disable @typescript-eslint/no-var-requires */
23
const path = require('path');
34

@@ -9,7 +10,8 @@ const path = require('path');
910

1011
// const TypedocWebpackPlugin = require('typedoc-webpack-plugin');
1112

12-
const config = {
13+
module.exports = {
14+
mode: process.env.NODE_ENV || "production",
1315
// use a "multi-main entry" to inject multiple dependent files together
1416
// and graph their dependencies into one "chunk"
1517
entry: {
@@ -18,5 +20,49 @@ const config = {
1820
content: './src/extension/contentScript.ts',
1921
backend: './src/backend/index.ts',
2022
},
23+
watchOptions: {
24+
aggregateTimeout: 1000,
25+
ignored: /node_modules/,
26+
},
27+
output: {
28+
path: path.resolve(__dirname, 'src/extension/build/bundles'),
29+
filename: '[name].bundle.js',
30+
},
31+
devtool: "cheap-module-source-map",
32+
module: {
33+
rules: [
34+
/**
35+
* For all files ending in .ts or .tsx, except those in node_modules
36+
* => transpile typescript files into javascript file.
37+
*/
38+
{
39+
test: /\.tsx?$/,
40+
use: 'ts-loader',
41+
exclude: /node_modules/,
42+
resolve: {
43+
extensions: ['.tsx', '.ts', '.js'],
44+
},
45+
},
46+
/**
47+
* For all files ending in .scss or .css files
48+
* Since sass-loader will only works with .scss & .sass files, for any .css file, webpack will skip sass-loader and use css-loader, then style-loader.
49+
*/
50+
{
51+
test: /\.s?css$/,
52+
use: [
53+
// Creates `style` nodes from JS strings
54+
'style-loader',
55+
// Translates CSS into CommonJS
56+
'css-loader',
57+
// Compiles Sass to CSS
58+
'sass-loader',
59+
],
60+
},
61+
]
62+
},
63+
// Add `.ts` and `.tsx` as a resolvable extension.
64+
resolve: {
65+
extensions: ['.ts', '.tsx', '.js', '.jsx'],
66+
},
2167

2268
};

0 commit comments

Comments
 (0)