Skip to content

Commit

Permalink
feat: publish a unminified esm format (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
otakustay committed Aug 31, 2023
1 parent 9fc7adc commit a6b6acf
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 646 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ typings/
.DS_Store
/es
/cjs
/esm
/style
/dist
/types
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ paint: 6199.848876953125ms
npm install --save react-diff-view
```

Starting from `3.1.0`, you can `import {Diff} from 'react-diff-view/esm` to reference an unminified ESM module.

## Basic usage

### Parse diff text
Expand Down
22 changes: 4 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"classnames": "^2.3.2",
"diff-match-patch": "^1.0.5",
"gitdiff-parser": "^0.3.1",
"lodash": "^4.17.21",
"shallow-equal": "^3.1.0",
"warning": "^4.0.3"
},
Expand Down Expand Up @@ -65,33 +66,22 @@
"@typescript-eslint/parser": "^5.55.0",
"antd": "^5.3.1",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2",
"babel-plugin-add-react-displayname": "0.0.5",
"babel-plugin-import": "^1.13.6",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-react-require": "^3.1.3",
"core-js": "^3.29.1",
"css-loader": "^6.7.3",
"cssnano": "^5.1.15",
"dedent": "^0.7.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.7",
"eslint": "^8.36.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"html-webpack-plugin": "^5.5.0",
"husky": "^8.0.3",
"identity-obj-proxy": "^3.0.0",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"lodash": "^4.17.21",
"nanoid": "^4.0.1",
"postcss": "^8.4.21",
"postcss-cli": "^10.1.0",
"postcss-custom-properties": "^13.1.4",
"prism-color-variables": "^1.0.1",
"prop-types": "^15.8.1",
"raw-loader": "^4.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-infinite-scroller": "^1.2.6",
Expand All @@ -108,17 +98,12 @@
"rollup-plugin-terser": "^7.0.2",
"sha1": "^1.1.1",
"standard-version": "^9.5.0",
"style-loader": "^3.3.2",
"typescript": "^4.9.5",
"unidiff": "^1.0.2",
"vitest": "^0.29.2",
"webpack": "^5.76.1",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1",
"worker-loader": "^3.0.8"
"webpack": "^5.76.1"
},
"peerDependencies": {
"prop-types": ">=15.6",
"react": ">=16.8"
},
"repository": {
Expand All @@ -141,7 +126,8 @@
"es",
"cjs",
"style",
"types"
"types",
"esm"
],
"packageManager": "yarn@3.4.1"
}
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export NODE_ENV=production
node rollup.mjs
node node_modules/.bin/postcss -o style/index.css src/styles/index.css
node scripts/fix-css.js style/index.css
tsc -p tsconfig.types.json
tsc -p tsconfig.build.json
2 changes: 1 addition & 1 deletion src/Diff/__test__/__snapshots__/Diff.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Diff > renders correctly 1`] = `
<table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`toTokenTrees > php will renders __PHP__ 1`] = `
[
Expand Down
2 changes: 1 addition & 1 deletion src/tokenize/__test__/__snapshots__/tokenize.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`tokenize > enhance 1`] = `
{
Expand Down
2 changes: 1 addition & 1 deletion src/utils/__test__/__snapshots__/diff.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`expandCollapsedBlockBy > basic 1`] = `
[
Expand Down
2 changes: 1 addition & 1 deletion src/utils/__test__/__snapshots__/parse.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`parseDiff > ensure test case 1`] = `
[
Expand Down
13 changes: 4 additions & 9 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"extends": "./tsconfig.json",
"extends": "./tsconfig.types.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "types",
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true
},
"include": ["src"],
"exclude": ["**/__tests__"]
"outDir": "esm",
"emitDeclarationOnly": false
}
}
12 changes: 12 additions & 0 deletions tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "types",
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true
},
"include": ["src"],
"exclude": ["**/__tests__"]
}
Loading

0 comments on commit a6b6acf

Please sign in to comment.