Skip to content

Commit

Permalink
Merge pull request #266 from TroyAlford/task/remove-webpack
Browse files Browse the repository at this point in the history
Remove Webpack
  • Loading branch information
TroyAlford committed Jul 7, 2024
2 parents 23be3e1 + 795fc56 commit 876c8df
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 270 deletions.
11 changes: 0 additions & 11 deletions babel.config.js

This file was deleted.

16 changes: 0 additions & 16 deletions babel.es5.js

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.
3 changes: 1 addition & 2 deletions source/demo.tsx → demo/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable no-console */
import React from 'react'
import { createRoot } from 'react-dom/client'
// @ts-expect-error - untyped output file
import JsxParser from '../dist/umd/react-jsx-parser.min'
import JsxParser from '../source'

const root = createRoot(document.querySelector('#root')!)

Expand Down
2 changes: 1 addition & 1 deletion source/index.html → demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>react-jsx-parser demo</title>
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script defer src="react-jsx-parser-demo.min.js"></script>
<script defer src="/demo.min.js"></script>
</head>
<body>
<div id="root"></div>
Expand Down
43 changes: 43 additions & 0 deletions demo/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as path from 'path';

const server = Bun.serve({
port: 3000,
async fetch(req) {
const url = new URL(req.url);

switch (url.pathname) {
case '/':
return new Response(
await Bun.file(path.resolve(__dirname, './index.html')).text(),
{ headers: { 'Content-Type': 'text/html' } },
);
case '/demo.min.js':
const build = await Bun.build({
entrypoints: [path.resolve(__dirname, './demo.tsx')],
minify: true,
target: 'browser',
});
if (!build.success) {
const errorMessages = build.logs
.filter(log => log.level === "error")
.map(log => log.message)
.join("\n");

console.error("Build failed:", errorMessages);

return new Response(`Build failed:\n${errorMessages}`, {
status: 500,
headers: { "Content-Type": "text/plain" }
});
}
return new Response(
build.outputs[0],
{ headers: { 'Content-Type': 'application/javascript' } },
);
default:
return new Response('Not Found', { status: 404 });
}
}
});

console.log(`Listening on http://localhost:${server.port}`);
2 changes: 0 additions & 2 deletions dist/cjs/react-jsx-parser.min.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/cjs/react-jsx-parser.min.js.map

This file was deleted.

30 changes: 0 additions & 30 deletions dist/components/JsxParser.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions dist/constants/attributeNames.d.ts

This file was deleted.

4 changes: 0 additions & 4 deletions dist/constants/specialTags.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions dist/es5/react-jsx-parser.min.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/es5/react-jsx-parser.min.js.map

This file was deleted.

7 changes: 0 additions & 7 deletions dist/helpers/camelCase.d.ts

This file was deleted.

10 changes: 0 additions & 10 deletions dist/helpers/hash.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions dist/helpers/parseStyle.d.ts

This file was deleted.

9 changes: 0 additions & 9 deletions dist/helpers/resolvePath.d.ts

This file was deleted.

4 changes: 0 additions & 4 deletions dist/index.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions dist/umd/react-jsx-parser.min.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/umd/react-jsx-parser.min.js.map

This file was deleted.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"jsx"
],
"license": "MIT",
"main": "dist/umd/react-jsx-parser.min.js",
"main": "dist/react-jsx-parser.min.js",
"types": "dist/index.d.ts",
"name": "react-jsx-parser",
"repository": "TroyAlford/react-jsx-parser",
Expand All @@ -31,6 +31,7 @@
"@babel/runtime-corejs3": "^7.24.7",
"@happy-dom/global-registrator": "^14.12.3",
"@types/acorn": "^4.0.6",
"@types/bun": "^1.1.6",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"babel-core": "^7.0.0-bridge.0",
Expand All @@ -45,7 +46,6 @@
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"mkdirp": "^3.0.1",
"postinstall-postinstall": "^2.1.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"source-map-explorer": "^2.5.3",
Expand All @@ -71,14 +71,17 @@
"merge": "^1.2.1"
},
"scripts": {
"build": "npx patch-package && yarn types && cross-env NODE_ENV=production webpack",
"develop": "NODE_ENV=production concurrently -n build,ts,demo -c green,cyan,yellow \"yarn webpack --watch\" \"yarn types --watch\" \"yarn webpack serve --config ./webpack.demo.js\"",
"build": "bun build:types && bun build:code",
"build:code": "bun build --target=browser --outfile=./dist/react-jsx-parser.min.js ./source/index.ts",
"build:types": "bun run tsc -p ./tsconfig.json -d --emitDeclarationOnly",
"develop": "NODE_ENV=production concurrently -n build,ts,demo -c green,cyan,yellow \"bun build:code --watch\" \"bun build:types --watch\" \"bun serve\"",
"lint": "yarn eslint --ext .js,.ts,.tsx source/",
"postinstall": "npx patch-package",
"prebuild": "mkdirp ./dist && rm -rf ./dist/*",
"serve": "bun serve --port=8080 --open",
"sourcemap": "yarn build && source-map-explorer ./dist/es5/react-jsx-parser.min.js",
"test": "lint && test",
"types": "tsc -p ./tsconfig.json -d --emitDeclarationOnly"
"types": ""
},
"contributors": [
{
Expand Down
27 changes: 0 additions & 27 deletions source/dist.test.js

This file was deleted.

74 changes: 0 additions & 74 deletions webpack.config.js

This file was deleted.

51 changes: 0 additions & 51 deletions webpack.demo.js

This file was deleted.

0 comments on commit 876c8df

Please sign in to comment.