diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000..ad49ef8 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,7 @@ +{ + "presets": ["@babel/preset-env", "@babel/preset-typescript"], + "plugins": [["@babel/plugin-transform-react-jsx", { + "pragma": "createElement", + "pragmaFrag": "createFragment" + }]] +} diff --git a/dist/bundle.js b/dist/bundle.js deleted file mode 100644 index ecc1b9f..0000000 --- a/dist/bundle.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{"use strict";const e=(e,t,...c)=>{const n=document.createElement(e);for(const e in t){const c=t[e];if("style"===e)for(const e in c)n.style[e]=c[e];else n[e]=c}return n.append(...c),n};document.getElementById("app").append(e("div",{style:{padding:"30px",backgroundColor:"#ccc"}},e("h1",{style:{color:"green"}},"Привет мир"),e("img",{src:"/dist-off/images/1150e57a6c2fd37e2d0c.jpg"})))})(); \ No newline at end of file diff --git a/dist/main.bundle.js b/dist/main.bundle.js new file mode 100644 index 0000000..5fd9b1b --- /dev/null +++ b/dist/main.bundle.js @@ -0,0 +1,121 @@ +/* + * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). + * This devtool is neither made for production nor for readable output files. + * It uses "eval()" calls to create a separate source file in the browser devtools. + * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) + * or disable the default devtool with "devtool: false". + * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). + */ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./src/bro-view.ts": +/*!*************************!*\ + !*** ./src/bro-view.ts ***! + \*************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createElement: () => (/* binding */ createElement),\n/* harmony export */ createFragment: () => (/* binding */ createFragment)\n/* harmony export */ });\nconst createFragment = _ref => {\n let {\n children\n } = _ref;\n return children;\n};\nconst createElement = function (type, props) {\n for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n children[_key - 2] = arguments[_key];\n }\n if (typeof type === 'function') {\n return type({\n ...props,\n children\n });\n }\n const element = document.createElement(type);\n for (const key in props) {\n const value = props[key];\n if (key === 'style') {\n for (const styleKey in value) {\n element.style[styleKey] = value[styleKey];\n }\n } else {\n element[key] = value;\n }\n }\n const flatChilds = children.reduce((acc, child) => {\n if (Array.isArray(child)) {\n acc.push(...child);\n } else {\n acc.push(child);\n }\n return acc;\n }, []);\n element.append(...flatChilds);\n return element;\n};\n\n//# sourceURL=webpack://webpack-test/./src/bro-view.ts?"); + +/***/ }), + +/***/ "./src/index.tsx": +/*!***********************!*\ + !*** ./src/index.tsx ***! + \***********************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bro_view__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bro-view */ \"./src/bro-view.ts\");\n/* harmony import */ var _assets_cat_jpg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assets/cat.jpg */ \"./src/assets/cat.jpg\");\n/* harmony import */ var _text_txt__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./text.txt */ \"./src/text.txt\");\n/** @jsx createElement */\n/** @jsxFrag createFragment */\n\n\n\nconst app = document.getElementById('app');\nconst Cat = () => (0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(_bro_view__WEBPACK_IMPORTED_MODULE_0__.createFragment, null, (0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(\"img\", {\n src: _assets_cat_jpg__WEBPACK_IMPORTED_MODULE_1__\n}), (0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(\"img\", {\n src: _assets_cat_jpg__WEBPACK_IMPORTED_MODULE_1__\n}));\nconst TagName = 'a';\napp.append((0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(\"div\", {\n style: {\n padding: '30px',\n backgroundColor: '#ccc'\n }\n}, (0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(\"h1\", {\n style: {\n color: 'green'\n }\n}, _text_txt__WEBPACK_IMPORTED_MODULE_2__), (0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(TagName, {\n href: \"#\"\n}, \"adsasdas\"), (0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(Cat, null), (0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(\"ul\", null, [(0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(\"img\", {\n src: _assets_cat_jpg__WEBPACK_IMPORTED_MODULE_1__\n}), (0,_bro_view__WEBPACK_IMPORTED_MODULE_0__.createElement)(\"img\", {\n src: _assets_cat_jpg__WEBPACK_IMPORTED_MODULE_1__\n})])));\n\n// app.append(\n// createElement('div', { style: { padding: '30px', backgroundColor: '#ccc' } },\n// createElement('h1', {\n// style: {\n// color: 'green'\n// }\n// },\n// text\n// ),\n// createElement('img', {\n// src: cat,\n// })\n// )\n// );\n\n//# sourceURL=webpack://webpack-test/./src/index.tsx?"); + +/***/ }), + +/***/ "./src/assets/cat.jpg": +/*!****************************!*\ + !*** ./src/assets/cat.jpg ***! + \****************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("module.exports = __webpack_require__.p + \"images/1150e57a6c2fd37e2d0c.jpg\";\n\n//# sourceURL=webpack://webpack-test/./src/assets/cat.jpg?"); + +/***/ }), + +/***/ "./src/text.txt": +/*!**********************!*\ + !*** ./src/text.txt ***! + \**********************/ +/***/ ((module) => { + +eval("module.exports = \"Привет мир\";\n\n//# sourceURL=webpack://webpack-test/./src/text.txt?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/publicPath */ +/******/ (() => { +/******/ __webpack_require__.p = "/dist/"; +/******/ })(); +/******/ +/************************************************************************/ +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module can't be inlined because the eval devtool is used. +/******/ var __webpack_exports__ = __webpack_require__("./src/index.tsx"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..31e8666 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,9 @@ +declare module '*.jpg' { + const path: string; + export default path; +} + +declare module '*.txt' { + const path: string; + export default path; +} diff --git a/index.html b/index.html index 576266d..d7f2e61 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,6 @@
- +