diff --git a/.gitignore b/.gitignore index 82bc7a2..87adec2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ logs npm-debug.log* .eslintcache /coverage -/dist /local /reports /node_modules diff --git a/dist/cjs.js b/dist/cjs.js new file mode 100644 index 0000000..c893ee9 --- /dev/null +++ b/dist/cjs.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = require('./index').default; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..7b135e4 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,652 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = entry; + +var _url = _interopRequireDefault(require("url")); + +var _dom = require("dom5"); + +var _loaderUtils = _interopRequireDefault(require("loader-utils")); + +var _parse = _interopRequireDefault(require("parse5")); + +var _espree = require("espree"); + +var _sourceMap = _interopRequireDefault(require("source-map")); + +var _htmlLoader2 = _interopRequireDefault(require("html-loader")); + +var _cssSelectorTokenizer = _interopRequireDefault(require("css-selector-tokenizer")); + +var _postcss = _interopRequireDefault(require("postcss")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +/** @enum {number} */ +var RuntimeRegistrationType = { + DOM_MODULE: 0, + BODY: 1 +}; +var htmlLoaderDefaultOptions = { + minimize: true, + cacheable: false, + minifyCSS: { + inline: ['none'] + } +}; +var STYLE_ID_PREFIX = '__POLYMER_WEBPACK_LOADER_STYLE_'; +var STYLE_ID_EXPR = new RegExp(`/\\* (${STYLE_ID_PREFIX}\\d+__) \\*/`, 'g'); +var STYLE_URL_PREFIX = '__POLYMER_WEBPACK_LOADER_URL_'; +var STYLE_URL_EXPR = new RegExp(`${STYLE_URL_PREFIX}\\d+__`, 'g'); +var STYLE_URL_IMPORT_EXPR = new RegExp(``, 'g'); +/* eslint class-methods-use-this: ["error", { "exceptMethods": ["scripts"] }] */ + +var ProcessHtml = /*#__PURE__*/function () { + function ProcessHtml(content, loader) { + _classCallCheck(this, ProcessHtml); + + this.content = content; + this.options = _loaderUtils.default.getOptions(loader) || {}; + this.currentFilePath = loader.resourcePath; + this.loader = loader; + this.currentStyleId_ = 0; + this.stylePlaceholders = new Map(); + } + /** + * Process `` tags, `` elements, and any `