diff --git a/webpack-config/.npmrc b/webpack-config/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/webpack-config/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/webpack-config/README.md b/webpack-config/README.md new file mode 100644 index 0000000..eef6e74 --- /dev/null +++ b/webpack-config/README.md @@ -0,0 +1,3 @@ +## webpack config example plugin + +WordPress plugin to showcase how to work with webpack-config package. diff --git a/webpack-config/build/index.js b/webpack-config/build/index.js new file mode 100644 index 0000000..f4df002 --- /dev/null +++ b/webpack-config/build/index.js @@ -0,0 +1,126 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./src/index.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./src/index.js": +/*!**********************!*\ + !*** ./src/index.js ***! + \**********************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); +/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); + + +Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__["registerBlockType"])('blockexample-plugin/block', { + title: 'Love', + icon: 'heart', + category: 'common', + edit: function () { + return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])('p', {}, 'I ♥ Gutenberg.'); + }, + save: function () { + return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])('p', {}, 'I ♥ .'); + } +}); + +/***/ }), + +/***/ "@wordpress/blocks": +/*!*****************************************!*\ + !*** external {"this":["wp","blocks"]} ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["blocks"]; }()); + +/***/ }), + +/***/ "@wordpress/element": +/*!******************************************!*\ + !*** external {"this":["wp","element"]} ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +(function() { module.exports = this["wp"]["element"]; }()); + +/***/ }) + +/******/ }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/webpack-config/build/index.js.map b/webpack-config/build/index.js.map new file mode 100644 index 0000000..0d76afd --- /dev/null +++ b/webpack-config/build/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/index.js","webpack:///external {\"this\":[\"wp\",\"blocks\"]}","webpack:///external {\"this\":[\"wp\",\"element\"]}"],"names":["registerBlockType","title","icon","category","edit","createElement","save"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;ACnEA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAEAA,2EAAiB,CAAE,2BAAF,EAA+B;AAC5CC,OAAK,EAAE,MADqC;AAE5CC,MAAI,EAAE,OAFsC;AAG5CC,UAAQ,EAAE,QAHkC;AAI5CC,MAAI,EAAE,YAAW;AACb,WAASC,wEAAa,CAClB,GADkB,EAElB,EAFkB,EAGlB,gBAHkB,CAAtB;AAKH,GAV2C;AAW5CC,MAAI,EAAE,YAAW;AACb,WAASD,wEAAa,CAClB,GADkB,EAElB,EAFkB,EAGlB,OAHkB,CAAtB;AAKH;AAjB2C,CAA/B,CAAjB,C;;;;;;;;;;;ACHA,aAAa,uCAAuC,EAAE,I;;;;;;;;;;;ACAtD,aAAa,wCAAwC,EAAE,I","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.js\");\n","import { createElement } from '@wordpress/element';\nimport { registerBlockType } from '@wordpress/blocks';\n\nregisterBlockType( 'blockexample-plugin/block', {\n title: 'Love',\n icon: 'heart',\n category: 'common',\n edit: function() {\n return ( createElement(\n 'p',\n {},\n 'I ♥ Gutenberg.'\n ) );\n },\n save: function() {\n return ( createElement(\n 'p',\n {},\n 'I ♥ .'\n ) );\n },\n} );\n","(function() { module.exports = this[\"wp\"][\"blocks\"]; }());","(function() { module.exports = this[\"wp\"][\"element\"]; }());"],"sourceRoot":""} \ No newline at end of file diff --git a/webpack-config/index.php b/webpack-config/index.php new file mode 100644 index 0000000..f0b7a8b --- /dev/null +++ b/webpack-config/index.php @@ -0,0 +1,22 @@ +