parent
73c6a94725
commit
991ad5aefe
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": [
|
|
||||||
[
|
|
||||||
"@babel/plugin-transform-react-jsx",
|
|
||||||
{
|
|
||||||
"pragma": "justact.createElement"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"@babel/plugin-transform-modules-umd"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"comments": false
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import * as justact from '../src/Example.js';
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
document.write((new justact.Example()).testMethod());
|
|
||||||
|
|
||||||
console.log('jsx test', (
|
|
||||||
<div id='test-div'>
|
|
||||||
<input />
|
|
||||||
</div>
|
|
||||||
));
|
|
||||||
});
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "001-notreact",
|
"name": "justact",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "dist/cjs/index.js",
|
||||||
|
"module": "dist/mjs/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "webpack serve --open",
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node ./script/post-build"
|
||||||
"build-babel": "babel src -d dist/src && babel demo -d dist/demo",
|
|
||||||
"build-webpack": "webpack --config webpack.config.js",
|
|
||||||
"build": "npm run build-babel && npm run build-webpack"
|
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "MIT",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/mjs/index.js",
|
||||||
|
"require": "./dist/cjs/index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/cli": "^7.20.7",
|
|
||||||
"@babel/core": "^7.20.12",
|
|
||||||
"@babel/plugin-transform-modules-umd": "^7.18.6",
|
|
||||||
"@babel/plugin-transform-react-jsx": "^7.20.13"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"typescript": "^4.9.5"
|
||||||
"webpack": "^5.75.0",
|
|
||||||
"webpack-cli": "^5.0.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
function makeTypeManifest(type) {
|
||||||
|
return JSON.stringify({ type }, undefined, ' ') + '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync('./dist/cjs/package.json', makeTypeManifest('commonjs'));
|
||||||
|
fs.writeFileSync('./dist/mjs/package.json', makeTypeManifest('module'));
|
||||||
@ -1,4 +1,4 @@
|
|||||||
export function createElement(tag, attributes, ...children) {
|
export function createElement(tag: string, attributes: { [key: string]: any }, ...children: any[]) {
|
||||||
return {
|
return {
|
||||||
nodeName: tag,
|
nodeName: tag,
|
||||||
attributes,
|
attributes,
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig-common.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"outDir": "dist/cjs",
|
||||||
|
"target": "ES2015"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "./src/",
|
||||||
|
"composite": true,
|
||||||
|
"declarationDir": "dist",
|
||||||
|
"jsx": "react",
|
||||||
|
"jsxFactory": "justact.createElement",
|
||||||
|
"target": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"allowJs": true,
|
||||||
|
"strict": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"esModuleInterop": true
|
||||||
|
},
|
||||||
|
"include": ["./src/"]
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig-common.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "ESNext",
|
||||||
|
"outDir": "dist/mjs",
|
||||||
|
"target": "ESNext"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,15 +0,0 @@
|
|||||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: "./dist/demo/index.js",
|
|
||||||
mode: "development",
|
|
||||||
output: {
|
|
||||||
path: `${__dirname}/build`,
|
|
||||||
filename: "bundle.js",
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: "index.html",
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
Loading…
Reference in new issue