1 | "use strict";
|
2 | const parse = require("html-loader/lib/attributesParser");
|
3 | const _htmlSymbol = Symbol("HTML dependencies");
|
4 | function loader(content) {
|
5 | this.cacheable && this.cacheable();
|
6 | this._module[_htmlSymbol] = loader.modules(content);
|
7 | return content;
|
8 | }
|
9 | (function (loader) {
|
10 | loader.htmlSymbol = _htmlSymbol;
|
11 | loader.attributes = {
|
12 | "require": ["from"],
|
13 | "compose": ["view", "view-model"],
|
14 | "router-view": ["layout-view", "layout-view-model"],
|
15 | };
|
16 | function modules(html) {
|
17 | return parse(html, (tag, attr) => {
|
18 | const attrs = loader.attributes[tag];
|
19 | return attrs && attrs.includes(attr);
|
20 | })
|
21 |
|
22 | .filter(attr => !/(^|[^\\])\$\{/.test(attr.value))
|
23 | .map(attr => attr.value);
|
24 | }
|
25 | loader.modules = modules;
|
26 | })(loader || (loader = {}));
|
27 | module.exports = loader;
|