├── .babelrc
├── .eslintignore
├── .eslintrc
├── .gitignore
├── .prettierrc
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── __tests__
├── fixtures
│ ├── chunked.js
│ ├── import_css.js
│ ├── index.js
│ ├── nested
│ │ └── bar.js
│ ├── styles.css
│ ├── template.html
│ ├── template_inject_css.html
│ └── template_replace.html
└── tests.js
├── coverage
├── clover.xml
├── coverage-final.json
├── coverage.svg
├── lcov-report
│ ├── base.css
│ ├── block-navigation.js
│ ├── index.html
│ ├── index.js.html
│ ├── prettify.css
│ ├── prettify.js
│ ├── rollup-plugin-generate-html-template.js.html
│ ├── sort-arrow-sprite.png
│ └── sorter.js
└── lcov.info
├── jest.config.js
├── package.json
├── rollup.config.js
├── src
└── index.js
├── test_project
├── package.json
├── rollup.config.js
├── src
│ ├── index.js
│ └── main.html
└── yarn.lock
├── yarn-error.log
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "@babel/preset-env",
5 | {
6 | "targets": {
7 | "node": "current"
8 | }
9 | }
10 | ]
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | __tests__
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "plugins": ["jest"],
3 | "env": {
4 | "es6": true,
5 | "node": true,
6 | "jest/globals": true
7 | },
8 | "extends": ["eslint:recommended", "plugin:jest/recommended"],
9 | "globals": {
10 | "Atomics": "readonly",
11 | "SharedArrayBuffer": "readonly"
12 | },
13 | "parserOptions": {
14 | "ecmaVersion": 2018,
15 | "sourceType": "module"
16 | },
17 | "rules": {}
18 | }
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | .vscode
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": false,
3 | "trailingComma": "es5",
4 | "endOfLine": "lf",
5 | "overrides": [
6 | {
7 | "files": [".babelrc", ".prettierrc", "package.json"],
8 | "options": { "parser": "json" }
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js: node
3 |
4 | install: npm install
5 |
6 | cache:
7 | directories:
8 | - "node_modules"
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # rollup-plugin-generate-html-template
2 |
3 | ## 1.8.0
4 |
5 | - Add `embedContent` option (#26, bengsfort/rollup-plugin-generate-html-template@, thanks @lgirma)
6 |
7 | ## 1.7.0
8 |
9 | - Add basic css support (#23, bengsfort/rollup-plugin-generate-html-template@f06f85f, thanks @snellcode, @longrunningprocess)
10 |
11 | ## 1.2.0
12 |
13 | - Ensure output directories exist before creating anything (fixes #5)
14 | - Inject all entry points instead of failing, but does not embed dynamic imports (fixes #7)
15 | - Update to Babel7
16 | - Switch to jest tests
17 | - Updates formatting of project to use prettier + better eslint rules
18 | - Add code coverage checks
19 |
20 | ## 1.1.0
21 |
22 | - Fixed issue where template creation promise would not resolve. (bengsfort/rollup-plugin-generate-html-template@b0bb659)
23 | - Renamed `file` option to `template` . (bengsfort/rollup-plugin-generate-html-template@27a49b2)
24 | - Added integration tests. (bengsfort/rollup-plugin-generate-html-template@bfa7b4b)
25 | - Added option to rename destination file. (bengsfort/rollup-plugin-generate-html-template@33cb1b2)g
26 |
27 | ## 1.0.0
28 |
29 | - Initial release.
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Matt Bengston
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # rollup-plugin-generate-html-template
2 |
3 |  [](https://www.npmjs.com/package/rollup-plugin-generate-html-template) 
4 |
5 | Auto-inject the resulting rollup bundle via `script` and `link` tags into an HTML template.
6 |
7 | ## Installation
8 |
9 | ```shell
10 | npm install --save-dev rollup-plugin-generate-html-template
11 | ```
12 |
13 | ## Usage
14 |
15 | ```js
16 | // rollup.config.js
17 | import htmlTemplate from 'rollup-plugin-generate-html-template';
18 |
19 | export default {
20 | entry: 'src/index.js',
21 | dest: 'dist/js/bundle.js',
22 | plugins: [
23 | htmlTemplate({
24 | template: 'src/template.html',
25 | target: 'index.html',
26 | }),
27 | ],
28 | };
29 | ```
30 |
31 | On final bundle generation the provided template file will have a `script` tag injected directly above the closing `body` tag with a link to the js bundle and similarly a `link` tag above the closing `head` to the css bundle. By default it uses the same file name and places it directly next to the JS bundle.
32 |
33 | ```html
34 |
35 |
36 |
37 | Example
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Example
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | ```
56 |
57 | ### Options
58 |
59 | - `template`: **(required)** The path to the source template.
60 | - `target`: The directory and file name to use for the html file generated with the bundle.
61 | - `attrs`: The attributes provided to the generated bundle script tag. Passed as an array of strings
62 | Example: `attrs: ['async', 'defer]` will generate ``
63 | - `replaceVars`: An object containing variables that will be replaced in the generated html.
64 | Example: `replaceVars: { '__CDN_URL__': process.env.NODE_ENV === 'production' ? 'https://mycdn.com' : '' }` will replace all instances of `__CDN_URL__` with `http://mycdn.com` if the environment is production
65 |
66 | ## License
67 |
68 | MIT
69 |
--------------------------------------------------------------------------------
/__tests__/fixtures/chunked.js:
--------------------------------------------------------------------------------
1 | const chunk = "chunk";
2 | export default chunk;
3 |
--------------------------------------------------------------------------------
/__tests__/fixtures/import_css.js:
--------------------------------------------------------------------------------
1 | import "./styles.css";
2 |
3 | console.log("Hello, world");
4 |
--------------------------------------------------------------------------------
/__tests__/fixtures/index.js:
--------------------------------------------------------------------------------
1 | const foo = "foo";
2 | export default foo;
3 |
--------------------------------------------------------------------------------
/__tests__/fixtures/nested/bar.js:
--------------------------------------------------------------------------------
1 | const bar = "bar";
2 | export default bar;
3 |
4 | export function importChunk() {
5 | import("../chunked.js").then(({ default: chunked }) => console.log(chunked));
6 | }
7 |
--------------------------------------------------------------------------------
/__tests__/fixtures/styles.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bengsfort/rollup-plugin-generate-html-template/d95ddd7f84f72006ae47faf25ac44497aa885eaa/__tests__/fixtures/styles.css
--------------------------------------------------------------------------------
/__tests__/fixtures/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World.
4 |
5 |
--------------------------------------------------------------------------------
/__tests__/fixtures/template_inject_css.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | CSS Injection Test
4 |
5 |
6 | Hello World.
7 |
8 |
9 |
--------------------------------------------------------------------------------
/__tests__/fixtures/template_replace.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World.
4 | __HOME_URL__
5 | __HOME_URL__
6 | __COMPLEX__!@$#{}/()_REPLACEMENT__
7 |
8 |
9 |
--------------------------------------------------------------------------------
/__tests__/tests.js:
--------------------------------------------------------------------------------
1 | import fs from "fs-extra";
2 | import htmlTemplate from "../src";
3 | import os from "os";
4 | import path from "path";
5 | import postcss from "rollup-plugin-postcss";
6 | import { rollup } from "rollup";
7 |
8 | let TEST_DIR;
9 |
10 | // @todo: This should really be broken out into a separate file, it's getting a bit outrageous.
11 | function getHtmlString(
12 | bundle = "bundle.js",
13 | prefix = "",
14 | attrs = [],
15 | replaceValues = [],
16 | title = "",
17 | css = []
18 | ) {
19 | return `
20 | ${
21 | Boolean(css[0])
22 | ? `
23 | ${title}
24 |
25 | `
26 | : ""
27 | }
28 |
29 | Hello World.
30 | ${Boolean(replaceValues[0]) ? `${replaceValues[0]}
` : ""}
31 | ${
32 | Boolean(replaceValues[0])
33 | ? `${replaceValues[0]}`
34 | : ""
35 | }
36 | ${Boolean(replaceValues[1]) ? `${replaceValues[1]}
` : ""}
37 | ${
38 | typeof bundle !== "string" && bundle.length
39 | ? bundle
40 | .map(
41 | b => ``
42 | )
43 | .join("")
44 | : ``
45 | }
46 |
47 |
48 | `.replace(/[\s]/gi, "");
49 | }
50 |
51 | beforeEach(async () => {
52 | TEST_DIR = path.join(os.tmpdir(), "rollup-plugin-generate-html-template");
53 | await fs.emptyDir(TEST_DIR);
54 | });
55 |
56 | afterAll(async () => {
57 | await fs.emptyDir(TEST_DIR);
58 | });
59 |
60 | it("getEntryPoints should return the entry point bundles", () => {
61 | const emptyResult = htmlTemplate.getEntryPoints();
62 | expect(emptyResult).toHaveLength(0);
63 |
64 | const result = htmlTemplate.getEntryPoints({
65 | "styles.css": {
66 | fileName: "styles.css",
67 | isAsset: true,
68 | source: "",
69 | },
70 | "entry-main.js": {
71 | fileName: "entry-main.js",
72 | isDynamicEntry: false,
73 | isEntry: true,
74 | },
75 | "entry-bar.js": {
76 | fileName: "entry-bar.js",
77 | isDynamicEntry: false,
78 | isEntry: true,
79 | },
80 | "chunk-f1e52583.js": {
81 | fileName: "chunk-f1e52583.js",
82 | isDynamicEntry: true,
83 | isEntry: false,
84 | },
85 | });
86 | const expected = ["entry-main.js", "entry-bar.js"];
87 |
88 | expect(result).toHaveLength(2);
89 | expect(result).toEqual(expect.arrayContaining(expected));
90 | });
91 |
92 | it("should correctly add the attributes to the injected script tag", async () => {
93 | const BUNDLE_PATH = path.join(TEST_DIR, "bundle.js");
94 | // Defaults to not renaming the template.
95 | const TEMPLATE_PATH = path.join(TEST_DIR, "template.html");
96 |
97 | const input = {
98 | input: `${__dirname}/fixtures/index.js`,
99 | plugins: [
100 | htmlTemplate({
101 | template: `${__dirname}/fixtures/template.html`,
102 | attrs: ["async", "defer"],
103 | }),
104 | ],
105 | };
106 | const output = {
107 | file: BUNDLE_PATH,
108 | format: "iife",
109 | name: "test",
110 | };
111 | const bundle = await rollup(input);
112 | await bundle.write(output);
113 |
114 | // Ensure files exist
115 | await expect(fs.pathExists(BUNDLE_PATH)).resolves.toEqual(true);
116 | await expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
117 |
118 | // Ensure output has bundle injected
119 | const generatedTemplate = await fs.readFile(TEMPLATE_PATH, "utf8");
120 | expect(generatedTemplate.replace(/[\s]/gi, "")).toEqual(
121 | getHtmlString("bundle.js", "", ["async", "defer"])
122 | );
123 | });
124 |
125 | it("correctly replaces all HTML variables", async () => {
126 | const BUNDLE_PATH = path.join(TEST_DIR, "bundle.js");
127 | // Defaults to not renaming the template.
128 | const TEMPLATE_PATH = path.join(TEST_DIR, "template_replace.html");
129 | const input = {
130 | input: `${__dirname}/fixtures/index.js`,
131 | plugins: [
132 | htmlTemplate({
133 | template: `${__dirname}/fixtures/template_replace.html`,
134 | replaceVars: {
135 | __HOME_URL__: "cool.com",
136 | "__COMPLEX__!@$#{}/()_REPLACEMENT__": "complex replacement",
137 | },
138 | }),
139 | ],
140 | };
141 | const output = {
142 | file: BUNDLE_PATH,
143 | format: "iife",
144 | name: "test",
145 | };
146 | const bundle = await rollup(input);
147 | await bundle.write(output);
148 |
149 | // Ensure files exist
150 | await expect(fs.pathExists(BUNDLE_PATH)).resolves.toEqual(true);
151 | await expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
152 |
153 | // Ensure output has bundle injected
154 | const generatedTemplate = await fs.readFile(TEMPLATE_PATH, "utf8");
155 | expect(generatedTemplate.replace(/[\s]/gi, "")).toEqual(
156 | getHtmlString("bundle.js", "", [], ["cool.com", "complex replacement"])
157 | );
158 | });
159 |
160 | it("should copy the template to the output dir with an injected single bundle", async () => {
161 | const BUNDLE_PATH = path.join(TEST_DIR, "bundle.js");
162 | // Defaults to not renaming the template.
163 | const TEMPLATE_PATH = path.join(TEST_DIR, "template.html");
164 |
165 | const input = {
166 | input: `${__dirname}/fixtures/index.js`,
167 | plugins: [
168 | htmlTemplate({
169 | template: `${__dirname}/fixtures/template.html`,
170 | }),
171 | ],
172 | };
173 | const output = {
174 | file: BUNDLE_PATH,
175 | format: "iife",
176 | name: "test",
177 | };
178 | const bundle = await rollup(input);
179 | await bundle.write(output);
180 |
181 | // Ensure files exist
182 | await expect(fs.pathExists(BUNDLE_PATH)).resolves.toEqual(true);
183 | await expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
184 |
185 | // Ensure output has bundle injected
186 | const generatedTemplate = await fs.readFile(TEMPLATE_PATH, "utf8");
187 | expect(generatedTemplate.replace(/[\s]/gi, "")).toEqual(
188 | getHtmlString("bundle.js")
189 | );
190 | });
191 |
192 | it("should rename templates if provided a target option.", async () => {
193 | const BUNDLE_PATH = path.join(TEST_DIR, "bundle.js");
194 | const TEMPLATE_PATH = path.join(TEST_DIR, "index.html");
195 |
196 | const input = {
197 | input: `${__dirname}/fixtures/index.js`,
198 | plugins: [
199 | htmlTemplate({
200 | template: `${__dirname}/fixtures/template.html`,
201 | target: "index.html",
202 | }),
203 | ],
204 | };
205 | const output = {
206 | file: BUNDLE_PATH,
207 | format: "iife",
208 | name: "test",
209 | };
210 | const bundle = await rollup(input);
211 | await bundle.write(output);
212 |
213 | // Ensure files exist
214 | await expect(fs.pathExists(BUNDLE_PATH)).resolves.toEqual(true);
215 | await expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
216 | });
217 |
218 | it("should save template into directory if provided target option is a directory.", async () => {
219 | const BUNDLE_PATH = path.join(TEST_DIR, "public/build/bundle.js");
220 | const TEMPLATE_PATH = path.join(TEST_DIR, "public/index.html");
221 |
222 | const input = {
223 | input: `${__dirname}/fixtures/index.js`,
224 | plugins: [
225 | htmlTemplate({
226 | template: `${__dirname}/fixtures/template.html`,
227 | target: TEMPLATE_PATH,
228 | }),
229 | ],
230 | };
231 | const output = {
232 | file: BUNDLE_PATH,
233 | format: "iife",
234 | name: "test",
235 | };
236 | const bundle = await rollup(input);
237 | await bundle.write(output);
238 |
239 | // Ensure files exist
240 | expect(fs.pathExists(BUNDLE_PATH)).resolves.toEqual(true);
241 | expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
242 | const resultHtml = await fs.readFile(TEMPLATE_PATH, "utf8");
243 | const [, srcString] = resultHtml.match(//);
244 | expect(srcString).toEqual("build/bundle.js");
245 | });
246 |
247 | it("should work with chunking", async () => {
248 | const BUNDLE_CHUNK_1 = path.join(TEST_DIR, "entry-index.js");
249 | const BUNDLE_CHUNK_2 = path.join(TEST_DIR, "entry-nested/bar.js");
250 | const TEMPLATE_PATH = path.join(TEST_DIR, "index.html");
251 |
252 | const input = {
253 | input: {
254 | index: `${__dirname}/fixtures/index.js`,
255 | "nested/bar": `${__dirname}/fixtures/nested/bar.js`,
256 | },
257 | plugins: [
258 | htmlTemplate({
259 | template: `${__dirname}/fixtures/template.html`,
260 | target: "index.html",
261 | }),
262 | ],
263 | };
264 | const output = {
265 | dir: TEST_DIR,
266 | format: "esm",
267 | entryFileNames: "entry-[name].js",
268 | };
269 | const bundle = await rollup(input);
270 | await bundle.write(output);
271 |
272 | // Ensure files exist
273 | await expect(fs.pathExists(BUNDLE_CHUNK_1)).resolves.toEqual(true);
274 | await expect(fs.pathExists(BUNDLE_CHUNK_2)).resolves.toEqual(true);
275 | await expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
276 |
277 | // Ensure output has bundle injected
278 | const generatedTemplate = await fs.readFile(TEMPLATE_PATH, "utf8");
279 | expect(generatedTemplate.replace(/[\s]/gi, "")).toEqual(
280 | getHtmlString([
281 | "entry-index.js",
282 | "entry-nested/bar.js",
283 | "chunked-603816ba.js",
284 | ])
285 | );
286 | });
287 |
288 | it("should work with non-existent targets", async () => {
289 | // TEST_DIR exists, but does not contain dist/
290 | const BUNDLE_DIR = path.join(TEST_DIR, "dist");
291 | const BUNDLE_PATH = path.join(BUNDLE_DIR, "index.js");
292 | const TEMPLATE_PATH = path.join(BUNDLE_DIR, "template.html");
293 |
294 | const input = {
295 | input: `${__dirname}/fixtures/index.js`,
296 | plugins: [
297 | htmlTemplate({
298 | template: `${__dirname}/fixtures/template.html`,
299 | target: "template.html",
300 | }),
301 | ],
302 | };
303 | const output = {
304 | file: BUNDLE_PATH,
305 | format: "iife",
306 | name: "test",
307 | };
308 |
309 | // It should not exist yet
310 | await expect(fs.pathExists(BUNDLE_DIR)).resolves.toEqual(false);
311 |
312 | // Do a build...
313 | const bundle = await rollup(input);
314 | await bundle.write(output);
315 |
316 | // Ensure files exist
317 | await expect(fs.pathExists(BUNDLE_PATH)).resolves.toEqual(true);
318 | await expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
319 |
320 | // Ensure output has bundle injected properly
321 | const generatedTemplate = await fs.readFile(TEMPLATE_PATH, "utf8");
322 | expect(generatedTemplate.replace(/[\s]/gi, "")).toEqual(
323 | getHtmlString("index.js")
324 | );
325 | });
326 |
327 | it("should append a prefix to script path if specified", async () => {
328 | const BUNDLE_PATH = path.join(TEST_DIR, "bundle.js");
329 | // Defaults to not renaming the template.
330 | const TEMPLATE_PATH = path.join(TEST_DIR, "template.html");
331 |
332 | const input = {
333 | input: `${__dirname}/fixtures/index.js`,
334 | plugins: [
335 | htmlTemplate({
336 | template: `${__dirname}/fixtures/template.html`,
337 | prefix: "/shared/",
338 | }),
339 | ],
340 | };
341 | const output = {
342 | file: BUNDLE_PATH,
343 | format: "iife",
344 | name: "test",
345 | };
346 | const bundle = await rollup(input);
347 | await bundle.write(output);
348 |
349 | // Ensure files exist
350 | await expect(fs.pathExists(BUNDLE_PATH)).resolves.toEqual(true);
351 | await expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
352 |
353 | // Ensure output has bundle injected
354 | const generatedTemplate = await fs.readFile(TEMPLATE_PATH, "utf8");
355 | expect(generatedTemplate.replace(/[\s]/gi, "")).toEqual(
356 | getHtmlString("bundle.js", "/shared/")
357 | );
358 | });
359 |
360 | it("should throw an error if called without the correct props", async () => {
361 | const BUNDLE_PATH = path.join(TEST_DIR, "bundle.js");
362 |
363 | function build() {
364 | const input = {
365 | input: `${__dirname}/fixtures/index.js`,
366 | plugins: [htmlTemplate({})],
367 | };
368 | const output = {
369 | file: BUNDLE_PATH,
370 | format: "iife",
371 | name: "test",
372 | };
373 |
374 | return rollup(input).then(bundle => bundle.write(output));
375 | }
376 |
377 | expect(build()).rejects.toThrow(htmlTemplate.INVALID_ARGS_ERROR);
378 | });
379 |
380 | it("should add any css files to the head of the template", async () => {
381 | const BUNDLE_PATH = path.join(TEST_DIR, "bundle.js");
382 | const TEMPLATE_PATH = path.join(TEST_DIR, "template_inject_css.html");
383 |
384 | const input = {
385 | input: `${__dirname}/fixtures/import_css.js`,
386 | plugins: [
387 | postcss({
388 | extract: true,
389 | minimize: true,
390 | }),
391 | htmlTemplate({
392 | template: `${__dirname}/fixtures/template_inject_css.html`,
393 | }),
394 | ],
395 | };
396 | const output = {
397 | file: BUNDLE_PATH,
398 | format: "iife",
399 | name: "test",
400 | };
401 | const bundle = await rollup(input);
402 | await bundle.write(output);
403 |
404 | // Ensure files exist
405 | await expect(fs.pathExists(BUNDLE_PATH)).resolves.toEqual(true);
406 | await expect(fs.pathExists(TEMPLATE_PATH)).resolves.toEqual(true);
407 |
408 | // Ensure output has bundle injected
409 | const generatedTemplate = await fs.readFile(TEMPLATE_PATH, "utf8");
410 | expect(generatedTemplate.replace(/[\s]/gi, "")).toEqual(
411 | getHtmlString("bundle.js", "", [], [], "CSS Injection Test", ["bundle.css"])
412 | );
413 | });
414 |
--------------------------------------------------------------------------------
/coverage/clover.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/coverage/coverage-final.json:
--------------------------------------------------------------------------------
1 | {
2 | "C:\\Development\\rollup-plugin-generate-html-template\\src\\index.js": {
3 | "path": "C:\\Development\\rollup-plugin-generate-html-template\\src\\index.js",
4 | "statementMap": {
5 | "0": {
6 | "start": { "line": 8, "column": 2 },
7 | "end": { "line": 8, "column": 84 }
8 | },
9 | "1": {
10 | "start": { "line": 16, "column": 59 },
11 | "end": { "line": 16, "column": 66 }
12 | },
13 | "2": {
14 | "start": { "line": 17, "column": 30 },
15 | "end": { "line": 17, "column": 68 }
16 | },
17 | "3": {
18 | "start": { "line": 18, "column": 2 },
19 | "end": { "line": 104, "column": 4 }
20 | },
21 | "4": {
22 | "start": { "line": 22, "column": 25 },
23 | "end": { "line": 22, "column": 48 }
24 | },
25 | "5": {
26 | "start": { "line": 23, "column": 6 },
27 | "end": { "line": 102, "column": 9 }
28 | },
29 | "6": {
30 | "start": { "line": 24, "column": 8 },
31 | "end": { "line": 101, "column": 9 }
32 | },
33 | "7": {
34 | "start": { "line": 25, "column": 10 },
35 | "end": { "line": 25, "column": 72 }
36 | },
37 | "8": {
38 | "start": { "line": 25, "column": 36 },
39 | "end": { "line": 25, "column": 72 }
40 | },
41 | "9": {
42 | "start": { "line": 28, "column": 12 },
43 | "end": { "line": 28, "column": 65 }
44 | },
45 | "10": {
46 | "start": { "line": 30, "column": 26 },
47 | "end": { "line": 30, "column": 35 }
48 | },
49 | "11": {
50 | "start": { "line": 31, "column": 32 },
51 | "end": { "line": 31, "column": 34 }
52 | },
53 | "12": {
54 | "start": { "line": 33, "column": 10 },
55 | "end": { "line": 37, "column": 11 }
56 | },
57 | "13": {
58 | "start": { "line": 34, "column": 12 },
59 | "end": { "line": 34, "column": 45 }
60 | },
61 | "14": {
62 | "start": { "line": 35, "column": 30 },
63 | "end": { "line": 35, "column": 65 }
64 | },
65 | "15": {
66 | "start": { "line": 36, "column": 12 },
67 | "end": { "line": 36, "column": 59 }
68 | },
69 | "16": {
70 | "start": { "line": 40, "column": 29 },
71 | "end": { "line": 40, "column": 62 }
72 | },
73 | "17": {
74 | "start": { "line": 44, "column": 12 },
75 | "end": { "line": 44, "column": 79 }
76 | },
77 | "18": {
78 | "start": { "line": 47, "column": 25 },
79 | "end": { "line": 47, "column": 52 }
80 | },
81 | "19": {
82 | "start": { "line": 50, "column": 21 },
83 | "end": { "line": 50, "column": 44 }
84 | },
85 | "20": {
86 | "start": { "line": 51, "column": 10 },
87 | "end": { "line": 58, "column": 11 }
88 | },
89 | "21": {
90 | "start": { "line": 52, "column": 33 },
91 | "end": { "line": 52, "column": 60 }
92 | },
93 | "22": {
94 | "start": { "line": 53, "column": 12 },
95 | "end": { "line": 57, "column": 15 }
96 | },
97 | "23": {
98 | "start": { "line": 54, "column": 37 },
99 | "end": { "line": 54, "column": 64 }
100 | },
101 | "24": {
102 | "start": { "line": 55, "column": 28 },
103 | "end": { "line": 55, "column": 64 }
104 | },
105 | "25": {
106 | "start": { "line": 56, "column": 14 },
107 | "end": { "line": 56, "column": 54 }
108 | },
109 | "26": {
110 | "start": { "line": 60, "column": 25 },
111 | "end": { "line": 60, "column": 29 }
112 | },
113 | "27": {
114 | "start": { "line": 63, "column": 31 },
115 | "end": { "line": 63, "column": 62 }
116 | },
117 | "28": {
118 | "start": { "line": 66, "column": 10 },
119 | "end": { "line": 76, "column": 21 }
120 | },
121 | "29": {
122 | "start": { "line": 69, "column": 27 },
123 | "end": { "line": 69, "column": 53 }
124 | },
125 | "30": {
126 | "start": { "line": 72, "column": 18 },
127 | "end": { "line": 73, "column": 32 }
128 | },
129 | "31": {
130 | "start": { "line": 78, "column": 31 },
131 | "end": { "line": 78, "column": 62 }
132 | },
133 | "32": {
134 | "start": { "line": 81, "column": 10 },
135 | "end": { "line": 92, "column": 21 }
136 | },
137 | "33": {
138 | "start": { "line": 84, "column": 27 },
139 | "end": { "line": 84, "column": 52 }
140 | },
141 | "34": {
142 | "start": { "line": 87, "column": 18 },
143 | "end": { "line": 89, "column": 77 }
144 | },
145 | "35": {
146 | "start": { "line": 95, "column": 30 },
147 | "end": { "line": 95, "column": 62 }
148 | },
149 | "36": {
150 | "start": { "line": 96, "column": 10 },
151 | "end": { "line": 96, "column": 43 }
152 | },
153 | "37": {
154 | "start": { "line": 97, "column": 10 },
155 | "end": { "line": 97, "column": 52 }
156 | },
157 | "38": {
158 | "start": { "line": 98, "column": 10 },
159 | "end": { "line": 98, "column": 20 }
160 | },
161 | "39": {
162 | "start": { "line": 100, "column": 10 },
163 | "end": { "line": 100, "column": 20 }
164 | },
165 | "40": {
166 | "start": { "line": 108, "column": 18 },
167 | "end": { "line": 108, "column": 41 }
168 | },
169 | "41": {
170 | "start": { "line": 109, "column": 2 },
171 | "end": { "line": 114, "column": 9 }
172 | },
173 | "42": {
174 | "start": { "line": 110, "column": 4 },
175 | "end": { "line": 112, "column": 5 }
176 | },
177 | "43": {
178 | "start": { "line": 111, "column": 6 },
179 | "end": { "line": 111, "column": 31 }
180 | },
181 | "44": {
182 | "start": { "line": 113, "column": 4 },
183 | "end": { "line": 113, "column": 23 }
184 | },
185 | "45": {
186 | "start": { "line": 118, "column": 0 },
187 | "end": { "line": 118, "column": 45 }
188 | },
189 | "46": {
190 | "start": { "line": 119, "column": 0 },
191 | "end": { "line": 119, "column": 53 }
192 | }
193 | },
194 | "fnMap": {
195 | "0": {
196 | "name": "htmlTemplate",
197 | "decl": {
198 | "start": { "line": 15, "column": 24 },
199 | "end": { "line": 15, "column": 36 }
200 | },
201 | "loc": {
202 | "start": { "line": 15, "column": 51 },
203 | "end": { "line": 105, "column": 1 }
204 | },
205 | "line": 15
206 | },
207 | "1": {
208 | "name": "(anonymous_1)",
209 | "decl": {
210 | "start": { "line": 21, "column": 4 },
211 | "end": { "line": 21, "column": 5 }
212 | },
213 | "loc": {
214 | "start": { "line": 21, "column": 52 },
215 | "end": { "line": 103, "column": 5 }
216 | },
217 | "line": 21
218 | },
219 | "2": {
220 | "name": "(anonymous_2)",
221 | "decl": {
222 | "start": { "line": 23, "column": 25 },
223 | "end": { "line": 23, "column": 26 }
224 | },
225 | "loc": {
226 | "start": { "line": 23, "column": 52 },
227 | "end": { "line": 102, "column": 7 }
228 | },
229 | "line": 23
230 | },
231 | "3": {
232 | "name": "(anonymous_3)",
233 | "decl": {
234 | "start": { "line": 53, "column": 33 },
235 | "end": { "line": 53, "column": 34 }
236 | },
237 | "loc": {
238 | "start": { "line": 53, "column": 61 },
239 | "end": { "line": 57, "column": 13 }
240 | },
241 | "line": 53
242 | },
243 | "4": {
244 | "name": "(anonymous_4)",
245 | "decl": {
246 | "start": { "line": 69, "column": 22 },
247 | "end": { "line": 69, "column": 23 }
248 | },
249 | "loc": {
250 | "start": { "line": 69, "column": 27 },
251 | "end": { "line": 69, "column": 53 }
252 | },
253 | "line": 69
254 | },
255 | "5": {
256 | "name": "(anonymous_5)",
257 | "decl": {
258 | "start": { "line": 71, "column": 16 },
259 | "end": { "line": 71, "column": 17 }
260 | },
261 | "loc": {
262 | "start": { "line": 72, "column": 18 },
263 | "end": { "line": 73, "column": 32 }
264 | },
265 | "line": 72
266 | },
267 | "6": {
268 | "name": "(anonymous_6)",
269 | "decl": {
270 | "start": { "line": 84, "column": 22 },
271 | "end": { "line": 84, "column": 23 }
272 | },
273 | "loc": {
274 | "start": { "line": 84, "column": 27 },
275 | "end": { "line": 84, "column": 52 }
276 | },
277 | "line": 84
278 | },
279 | "7": {
280 | "name": "(anonymous_7)",
281 | "decl": {
282 | "start": { "line": 86, "column": 16 },
283 | "end": { "line": 86, "column": 17 }
284 | },
285 | "loc": {
286 | "start": { "line": 87, "column": 18 },
287 | "end": { "line": 89, "column": 77 }
288 | },
289 | "line": 87
290 | },
291 | "8": {
292 | "name": "getEntryPoints",
293 | "decl": {
294 | "start": { "line": 107, "column": 9 },
295 | "end": { "line": 107, "column": 23 }
296 | },
297 | "loc": {
298 | "start": { "line": 107, "column": 41 },
299 | "end": { "line": 115, "column": 1 }
300 | },
301 | "line": 107
302 | },
303 | "9": {
304 | "name": "(anonymous_9)",
305 | "decl": {
306 | "start": { "line": 109, "column": 24 },
307 | "end": { "line": 109, "column": 25 }
308 | },
309 | "loc": {
310 | "start": { "line": 109, "column": 49 },
311 | "end": { "line": 114, "column": 3 }
312 | },
313 | "line": 109
314 | }
315 | },
316 | "branchMap": {
317 | "0": {
318 | "loc": {
319 | "start": { "line": 15, "column": 37 },
320 | "end": { "line": 15, "column": 49 }
321 | },
322 | "type": "default-arg",
323 | "locations": [
324 | {
325 | "start": { "line": 15, "column": 47 },
326 | "end": { "line": 15, "column": 49 }
327 | }
328 | ],
329 | "line": 15
330 | },
331 | "1": {
332 | "loc": {
333 | "start": { "line": 17, "column": 30 },
334 | "end": { "line": 17, "column": 68 }
335 | },
336 | "type": "cond-expr",
337 | "locations": [
338 | {
339 | "start": { "line": 17, "column": 58 },
340 | "end": { "line": 17, "column": 63 }
341 | },
342 | {
343 | "start": { "line": 17, "column": 66 },
344 | "end": { "line": 17, "column": 68 }
345 | }
346 | ],
347 | "line": 17
348 | },
349 | "2": {
350 | "loc": {
351 | "start": { "line": 17, "column": 30 },
352 | "end": { "line": 17, "column": 55 }
353 | },
354 | "type": "binary-expr",
355 | "locations": [
356 | {
357 | "start": { "line": 17, "column": 30 },
358 | "end": { "line": 17, "column": 35 }
359 | },
360 | {
361 | "start": { "line": 17, "column": 39 },
362 | "end": { "line": 17, "column": 55 }
363 | }
364 | ],
365 | "line": 17
366 | },
367 | "3": {
368 | "loc": {
369 | "start": { "line": 25, "column": 10 },
370 | "end": { "line": 25, "column": 72 }
371 | },
372 | "type": "if",
373 | "locations": [
374 | {
375 | "start": { "line": 25, "column": 10 },
376 | "end": { "line": 25, "column": 72 }
377 | },
378 | {
379 | "start": { "line": 25, "column": 10 },
380 | "end": { "line": 25, "column": 72 }
381 | }
382 | ],
383 | "line": 25
384 | },
385 | "4": {
386 | "loc": {
387 | "start": { "line": 25, "column": 14 },
388 | "end": { "line": 25, "column": 34 }
389 | },
390 | "type": "binary-expr",
391 | "locations": [
392 | {
393 | "start": { "line": 25, "column": 14 },
394 | "end": { "line": 25, "column": 21 }
395 | },
396 | {
397 | "start": { "line": 25, "column": 25 },
398 | "end": { "line": 25, "column": 34 }
399 | }
400 | ],
401 | "line": 25
402 | },
403 | "5": {
404 | "loc": {
405 | "start": { "line": 28, "column": 12 },
406 | "end": { "line": 28, "column": 65 }
407 | },
408 | "type": "binary-expr",
409 | "locations": [
410 | {
411 | "start": { "line": 28, "column": 12 },
412 | "end": { "line": 28, "column": 29 }
413 | },
414 | {
415 | "start": { "line": 28, "column": 33 },
416 | "end": { "line": 28, "column": 65 }
417 | }
418 | ],
419 | "line": 28
420 | },
421 | "6": {
422 | "loc": {
423 | "start": { "line": 33, "column": 10 },
424 | "end": { "line": 37, "column": 11 }
425 | },
426 | "type": "if",
427 | "locations": [
428 | {
429 | "start": { "line": 33, "column": 10 },
430 | "end": { "line": 37, "column": 11 }
431 | },
432 | {
433 | "start": { "line": 33, "column": 10 },
434 | "end": { "line": 37, "column": 11 }
435 | }
436 | ],
437 | "line": 33
438 | },
439 | "7": {
440 | "loc": {
441 | "start": { "line": 33, "column": 14 },
442 | "end": { "line": 33, "column": 52 }
443 | },
444 | "type": "binary-expr",
445 | "locations": [
446 | {
447 | "start": { "line": 33, "column": 14 },
448 | "end": { "line": 33, "column": 20 }
449 | },
450 | {
451 | "start": { "line": 33, "column": 24 },
452 | "end": { "line": 33, "column": 52 }
453 | }
454 | ],
455 | "line": 33
456 | },
457 | "8": {
458 | "loc": {
459 | "start": { "line": 36, "column": 30 },
460 | "end": { "line": 36, "column": 58 }
461 | },
462 | "type": "binary-expr",
463 | "locations": [
464 | {
465 | "start": { "line": 36, "column": 30 },
466 | "end": { "line": 36, "column": 39 }
467 | },
468 | {
469 | "start": { "line": 36, "column": 43 },
470 | "end": { "line": 36, "column": 58 }
471 | }
472 | ],
473 | "line": 36
474 | },
475 | "9": {
476 | "loc": {
477 | "start": { "line": 40, "column": 43 },
478 | "end": { "line": 40, "column": 61 }
479 | },
480 | "type": "binary-expr",
481 | "locations": [
482 | {
483 | "start": { "line": 40, "column": 43 },
484 | "end": { "line": 40, "column": 49 }
485 | },
486 | {
487 | "start": { "line": 40, "column": 53 },
488 | "end": { "line": 40, "column": 61 }
489 | }
490 | ],
491 | "line": 40
492 | },
493 | "10": {
494 | "loc": {
495 | "start": { "line": 44, "column": 12 },
496 | "end": { "line": 44, "column": 79 }
497 | },
498 | "type": "cond-expr",
499 | "locations": [
500 | {
501 | "start": { "line": 44, "column": 46 },
502 | "end": { "line": 44, "column": 66 }
503 | },
504 | {
505 | "start": { "line": 44, "column": 69 },
506 | "end": { "line": 44, "column": 79 }
507 | }
508 | ],
509 | "line": 44
510 | },
511 | "11": {
512 | "loc": {
513 | "start": { "line": 51, "column": 10 },
514 | "end": { "line": 58, "column": 11 }
515 | },
516 | "type": "if",
517 | "locations": [
518 | {
519 | "start": { "line": 51, "column": 10 },
520 | "end": { "line": 58, "column": 11 }
521 | },
522 | {
523 | "start": { "line": 51, "column": 10 },
524 | "end": { "line": 58, "column": 11 }
525 | }
526 | ],
527 | "line": 51
528 | },
529 | "12": {
530 | "loc": {
531 | "start": { "line": 72, "column": 66 },
532 | "end": { "line": 73, "column": 22 }
533 | },
534 | "type": "binary-expr",
535 | "locations": [
536 | {
537 | "start": { "line": 72, "column": 66 },
538 | "end": { "line": 72, "column": 72 }
539 | },
540 | {
541 | "start": { "line": 73, "column": 20 },
542 | "end": { "line": 73, "column": 22 }
543 | }
544 | ],
545 | "line": 72
546 | },
547 | "13": {
548 | "loc": {
549 | "start": { "line": 89, "column": 46 },
550 | "end": { "line": 89, "column": 58 }
551 | },
552 | "type": "binary-expr",
553 | "locations": [
554 | {
555 | "start": { "line": 89, "column": 46 },
556 | "end": { "line": 89, "column": 52 }
557 | },
558 | {
559 | "start": { "line": 89, "column": 56 },
560 | "end": { "line": 89, "column": 58 }
561 | }
562 | ],
563 | "line": 89
564 | },
565 | "14": {
566 | "loc": {
567 | "start": { "line": 107, "column": 24 },
568 | "end": { "line": 107, "column": 39 }
569 | },
570 | "type": "default-arg",
571 | "locations": [
572 | {
573 | "start": { "line": 107, "column": 37 },
574 | "end": { "line": 107, "column": 39 }
575 | }
576 | ],
577 | "line": 107
578 | },
579 | "15": {
580 | "loc": {
581 | "start": { "line": 110, "column": 4 },
582 | "end": { "line": 112, "column": 5 }
583 | },
584 | "type": "if",
585 | "locations": [
586 | {
587 | "start": { "line": 110, "column": 4 },
588 | "end": { "line": 112, "column": 5 }
589 | },
590 | {
591 | "start": { "line": 110, "column": 4 },
592 | "end": { "line": 112, "column": 5 }
593 | }
594 | ],
595 | "line": 110
596 | }
597 | },
598 | "s": {
599 | "0": 1,
600 | "1": 10,
601 | "2": 10,
602 | "3": 10,
603 | "4": 10,
604 | "5": 10,
605 | "6": 10,
606 | "7": 10,
607 | "8": 1,
608 | "9": 9,
609 | "10": 9,
610 | "11": 9,
611 | "12": 9,
612 | "13": 1,
613 | "14": 1,
614 | "15": 1,
615 | "16": 9,
616 | "17": 9,
617 | "18": 9,
618 | "19": 9,
619 | "20": 9,
620 | "21": 1,
621 | "22": 1,
622 | "23": 2,
623 | "24": 2,
624 | "25": 2,
625 | "26": 9,
626 | "27": 9,
627 | "28": 9,
628 | "29": 12,
629 | "30": 1,
630 | "31": 9,
631 | "32": 9,
632 | "33": 12,
633 | "34": 11,
634 | "35": 9,
635 | "36": 9,
636 | "37": 9,
637 | "38": 9,
638 | "39": 1,
639 | "40": 2,
640 | "41": 2,
641 | "42": 4,
642 | "43": 2,
643 | "44": 4,
644 | "45": 1,
645 | "46": 1
646 | },
647 | "f": {
648 | "0": 10,
649 | "1": 10,
650 | "2": 10,
651 | "3": 2,
652 | "4": 12,
653 | "5": 1,
654 | "6": 12,
655 | "7": 11,
656 | "8": 2,
657 | "9": 4
658 | },
659 | "b": {
660 | "0": [0],
661 | "1": [1, 9],
662 | "2": [10, 1],
663 | "3": [1, 9],
664 | "4": [10, 6],
665 | "5": [9, 8],
666 | "6": [1, 8],
667 | "7": [9, 4],
668 | "8": [1, 1],
669 | "9": [9, 5],
670 | "10": [0, 9],
671 | "11": [1, 8],
672 | "12": [1, 1],
673 | "13": [11, 10],
674 | "14": [1],
675 | "15": [2, 2]
676 | },
677 | "_coverageSchema": "43e27e138ebf9cfc5966b082cf9a028302ed4184",
678 | "hash": "e4bcdaabd1b1855916b59d9a37e1488dc7c790e3"
679 | }
680 | }
681 |
--------------------------------------------------------------------------------
/coverage/coverage.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/coverage/lcov-report/base.css:
--------------------------------------------------------------------------------
1 | body, html {
2 | margin:0; padding: 0;
3 | height: 100%;
4 | }
5 | body {
6 | font-family: Helvetica Neue, Helvetica, Arial;
7 | font-size: 14px;
8 | color:#333;
9 | }
10 | .small { font-size: 12px; }
11 | *, *:after, *:before {
12 | -webkit-box-sizing:border-box;
13 | -moz-box-sizing:border-box;
14 | box-sizing:border-box;
15 | }
16 | h1 { font-size: 20px; margin: 0;}
17 | h2 { font-size: 14px; }
18 | pre {
19 | font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
20 | margin: 0;
21 | padding: 0;
22 | -moz-tab-size: 2;
23 | -o-tab-size: 2;
24 | tab-size: 2;
25 | }
26 | a { color:#0074D9; text-decoration:none; }
27 | a:hover { text-decoration:underline; }
28 | .strong { font-weight: bold; }
29 | .space-top1 { padding: 10px 0 0 0; }
30 | .pad2y { padding: 20px 0; }
31 | .pad1y { padding: 10px 0; }
32 | .pad2x { padding: 0 20px; }
33 | .pad2 { padding: 20px; }
34 | .pad1 { padding: 10px; }
35 | .space-left2 { padding-left:55px; }
36 | .space-right2 { padding-right:20px; }
37 | .center { text-align:center; }
38 | .clearfix { display:block; }
39 | .clearfix:after {
40 | content:'';
41 | display:block;
42 | height:0;
43 | clear:both;
44 | visibility:hidden;
45 | }
46 | .fl { float: left; }
47 | @media only screen and (max-width:640px) {
48 | .col3 { width:100%; max-width:100%; }
49 | .hide-mobile { display:none!important; }
50 | }
51 |
52 | .quiet {
53 | color: #7f7f7f;
54 | color: rgba(0,0,0,0.5);
55 | }
56 | .quiet a { opacity: 0.7; }
57 |
58 | .fraction {
59 | font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
60 | font-size: 10px;
61 | color: #555;
62 | background: #E8E8E8;
63 | padding: 4px 5px;
64 | border-radius: 3px;
65 | vertical-align: middle;
66 | }
67 |
68 | div.path a:link, div.path a:visited { color: #333; }
69 | table.coverage {
70 | border-collapse: collapse;
71 | margin: 10px 0 0 0;
72 | padding: 0;
73 | }
74 |
75 | table.coverage td {
76 | margin: 0;
77 | padding: 0;
78 | vertical-align: top;
79 | }
80 | table.coverage td.line-count {
81 | text-align: right;
82 | padding: 0 5px 0 20px;
83 | }
84 | table.coverage td.line-coverage {
85 | text-align: right;
86 | padding-right: 10px;
87 | min-width:20px;
88 | }
89 |
90 | table.coverage td span.cline-any {
91 | display: inline-block;
92 | padding: 0 5px;
93 | width: 100%;
94 | }
95 | .missing-if-branch {
96 | display: inline-block;
97 | margin-right: 5px;
98 | border-radius: 3px;
99 | position: relative;
100 | padding: 0 4px;
101 | background: #333;
102 | color: yellow;
103 | }
104 |
105 | .skip-if-branch {
106 | display: none;
107 | margin-right: 10px;
108 | position: relative;
109 | padding: 0 4px;
110 | background: #ccc;
111 | color: white;
112 | }
113 | .missing-if-branch .typ, .skip-if-branch .typ {
114 | color: inherit !important;
115 | }
116 | .coverage-summary {
117 | border-collapse: collapse;
118 | width: 100%;
119 | }
120 | .coverage-summary tr { border-bottom: 1px solid #bbb; }
121 | .keyline-all { border: 1px solid #ddd; }
122 | .coverage-summary td, .coverage-summary th { padding: 10px; }
123 | .coverage-summary tbody { border: 1px solid #bbb; }
124 | .coverage-summary td { border-right: 1px solid #bbb; }
125 | .coverage-summary td:last-child { border-right: none; }
126 | .coverage-summary th {
127 | text-align: left;
128 | font-weight: normal;
129 | white-space: nowrap;
130 | }
131 | .coverage-summary th.file { border-right: none !important; }
132 | .coverage-summary th.pct { }
133 | .coverage-summary th.pic,
134 | .coverage-summary th.abs,
135 | .coverage-summary td.pct,
136 | .coverage-summary td.abs { text-align: right; }
137 | .coverage-summary td.file { white-space: nowrap; }
138 | .coverage-summary td.pic { min-width: 120px !important; }
139 | .coverage-summary tfoot td { }
140 |
141 | .coverage-summary .sorter {
142 | height: 10px;
143 | width: 7px;
144 | display: inline-block;
145 | margin-left: 0.5em;
146 | background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
147 | }
148 | .coverage-summary .sorted .sorter {
149 | background-position: 0 -20px;
150 | }
151 | .coverage-summary .sorted-desc .sorter {
152 | background-position: 0 -10px;
153 | }
154 | .status-line { height: 10px; }
155 | /* yellow */
156 | .cbranch-no { background: yellow !important; color: #111; }
157 | /* dark red */
158 | .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
159 | .low .chart { border:1px solid #C21F39 }
160 | .highlighted,
161 | .highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
162 | background: #C21F39 !important;
163 | }
164 | /* medium red */
165 | .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
166 | /* light red */
167 | .low, .cline-no { background:#FCE1E5 }
168 | /* light green */
169 | .high, .cline-yes { background:rgb(230,245,208) }
170 | /* medium green */
171 | .cstat-yes { background:rgb(161,215,106) }
172 | /* dark green */
173 | .status-line.high, .high .cover-fill { background:rgb(77,146,33) }
174 | .high .chart { border:1px solid rgb(77,146,33) }
175 | /* dark yellow (gold) */
176 | .status-line.medium, .medium .cover-fill { background: #f9cd0b; }
177 | .medium .chart { border:1px solid #f9cd0b; }
178 | /* light yellow */
179 | .medium { background: #fff4c2; }
180 |
181 | .cstat-skip { background: #ddd; color: #111; }
182 | .fstat-skip { background: #ddd; color: #111 !important; }
183 | .cbranch-skip { background: #ddd !important; color: #111; }
184 |
185 | span.cline-neutral { background: #eaeaea; }
186 |
187 | .coverage-summary td.empty {
188 | opacity: .5;
189 | padding-top: 4px;
190 | padding-bottom: 4px;
191 | line-height: 1;
192 | color: #888;
193 | }
194 |
195 | .cover-fill, .cover-empty {
196 | display:inline-block;
197 | height: 12px;
198 | }
199 | .chart {
200 | line-height: 0;
201 | }
202 | .cover-empty {
203 | background: white;
204 | }
205 | .cover-full {
206 | border-right: none !important;
207 | }
208 | pre.prettyprint {
209 | border: none !important;
210 | padding: 0 !important;
211 | margin: 0 !important;
212 | }
213 | .com { color: #999 !important; }
214 | .ignore-none { color: #999; font-weight: normal; }
215 |
216 | .wrapper {
217 | min-height: 100%;
218 | height: auto !important;
219 | height: 100%;
220 | margin: 0 auto -48px;
221 | }
222 | .footer, .push {
223 | height: 48px;
224 | }
225 |
--------------------------------------------------------------------------------
/coverage/lcov-report/block-navigation.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | var jumpToCode = (function init() {
3 | // Classes of code we would like to highlight in the file view
4 | var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
5 |
6 | // Elements to highlight in the file listing view
7 | var fileListingElements = ['td.pct.low'];
8 |
9 | // We don't want to select elements that are direct descendants of another match
10 | var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
11 |
12 | // Selecter that finds elements on the page to which we can jump
13 | var selector =
14 | fileListingElements.join(', ') +
15 | ', ' +
16 | notSelector +
17 | missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
18 |
19 | // The NodeList of matching elements
20 | var missingCoverageElements = document.querySelectorAll(selector);
21 |
22 | var currentIndex;
23 |
24 | function toggleClass(index) {
25 | missingCoverageElements
26 | .item(currentIndex)
27 | .classList.remove('highlighted');
28 | missingCoverageElements.item(index).classList.add('highlighted');
29 | }
30 |
31 | function makeCurrent(index) {
32 | toggleClass(index);
33 | currentIndex = index;
34 | missingCoverageElements.item(index).scrollIntoView({
35 | behavior: 'smooth',
36 | block: 'center',
37 | inline: 'center'
38 | });
39 | }
40 |
41 | function goToPrevious() {
42 | var nextIndex = 0;
43 | if (typeof currentIndex !== 'number' || currentIndex === 0) {
44 | nextIndex = missingCoverageElements.length - 1;
45 | } else if (missingCoverageElements.length > 1) {
46 | nextIndex = currentIndex - 1;
47 | }
48 |
49 | makeCurrent(nextIndex);
50 | }
51 |
52 | function goToNext() {
53 | var nextIndex = 0;
54 |
55 | if (
56 | typeof currentIndex === 'number' &&
57 | currentIndex < missingCoverageElements.length - 1
58 | ) {
59 | nextIndex = currentIndex + 1;
60 | }
61 |
62 | makeCurrent(nextIndex);
63 | }
64 |
65 | return function jump(event) {
66 | switch (event.which) {
67 | case 78: // n
68 | case 74: // j
69 | goToNext();
70 | break;
71 | case 66: // b
72 | case 75: // k
73 | case 80: // p
74 | goToPrevious();
75 | break;
76 | }
77 | };
78 | })();
79 | window.addEventListener('keydown', jumpToCode);
80 |
--------------------------------------------------------------------------------
/coverage/lcov-report/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Code coverage report for All files
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 | All files
20 |
21 |
22 |
23 | 100%
24 | Statements
25 | 47/47
26 |
27 |
28 | 93.33%
29 | Branches
30 | 28/30
31 |
32 |
33 | 100%
34 | Functions
35 | 10/10
36 |
37 |
38 | 100%
39 | Lines
40 | 46/46
41 |
42 |
43 |
44 | Press n or j to go to the next uncovered block, b, p or k for the previous block.
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | File |
53 | |
54 | Statements |
55 | |
56 | Branches |
57 | |
58 | Functions |
59 | |
60 | Lines |
61 | |
62 |
63 |
64 |
65 | index.js |
66 | |
67 | 100% |
68 | 47/47 |
69 | 93.33% |
70 | 28/30 |
71 | 100% |
72 | 10/10 |
73 | 100% |
74 | 46/46 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
85 |
86 |
87 |
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/coverage/lcov-report/index.js.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Code coverage report for index.js
5 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 | All files index.js
20 |
21 |
22 |
23 | 100%
24 | Statements
25 | 47/47
26 |
27 |
28 | 93.33%
29 | Branches
30 | 28/30
31 |
32 |
33 | 100%
34 | Functions
35 | 10/10
36 |
37 |
38 | 100%
39 | Lines
40 | 46/46
41 |
42 |
43 |
44 | Press n or j to go to the next uncovered block, b, p or k for the previous block.
45 |
46 |
47 |
48 |
49 | 1
50 | 2
51 | 3
52 | 4
53 | 5
54 | 6
55 | 7
56 | 8
57 | 9
58 | 10
59 | 11
60 | 12
61 | 13
62 | 14
63 | 15
64 | 16
65 | 17
66 | 18
67 | 19
68 | 20
69 | 21
70 | 22
71 | 23
72 | 24
73 | 25
74 | 26
75 | 27
76 | 28
77 | 29
78 | 30
79 | 31
80 | 32
81 | 33
82 | 34
83 | 35
84 | 36
85 | 37
86 | 38
87 | 39
88 | 40
89 | 41
90 | 42
91 | 43
92 | 44
93 | 45
94 | 46
95 | 47
96 | 48
97 | 49
98 | 50
99 | 51
100 | 52
101 | 53
102 | 54
103 | 55
104 | 56
105 | 57
106 | 58
107 | 59
108 | 60
109 | 61
110 | 62
111 | 63
112 | 64
113 | 65
114 | 66
115 | 67
116 | 68
117 | 69
118 | 70
119 | 71
120 | 72
121 | 73
122 | 74
123 | 75
124 | 76
125 | 77
126 | 78
127 | 79
128 | 80
129 | 81
130 | 82
131 | 83
132 | 84
133 | 85
134 | 86
135 | 87
136 | 88
137 | 89
138 | 90
139 | 91
140 | 92
141 | 93
142 | 94
143 | 95
144 | 96
145 | 97
146 | 98
147 | 99
148 | 100
149 | 101
150 | 102
151 | 103
152 | 104
153 | 105
154 | 106
155 | 107
156 | 108
157 | 109
158 | 110
159 | 111
160 | 112
161 | 113
162 | 114
163 | 115
164 | 116
165 | 117
166 | 118
167 | 119
168 | 120 |
169 |
170 |
171 |
172 |
173 |
174 |
175 | 1x
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 | 10x
184 | 10x
185 | 10x
186 |
187 |
188 |
189 | 10x
190 | 10x
191 | 10x
192 | 10x
193 |
194 |
195 | 9x
196 |
197 | 9x
198 | 9x
199 |
200 | 9x
201 | 1x
202 | 1x
203 | 1x
204 |
205 |
206 |
207 | 9x
208 |
209 |
210 |
211 | 9x
212 |
213 |
214 | 9x
215 |
216 |
217 | 9x
218 | 9x
219 | 1x
220 | 1x
221 | 2x
222 | 2x
223 | 2x
224 |
225 |
226 |
227 | 9x
228 |
229 |
230 | 9x
231 |
232 |
233 | 9x
234 |
235 |
236 | 12x
237 |
238 |
239 | 1x
240 |
241 |
242 |
243 |
244 |
245 | 9x
246 |
247 |
248 | 9x
249 |
250 |
251 | 12x
252 |
253 |
254 | 11x
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 | 9x
263 | 9x
264 | 9x
265 | 9x
266 |
267 | 1x
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 | 2x
276 | 2x
277 | 4x
278 | 2x
279 |
280 | 4x
281 |
282 |
283 |
284 |
285 | 1x
286 | 1x
287 | | "use strict";
288 |
289 | import escapeStringRegexp from "escape-string-regexp";
290 | import fs from "fs-extra";
291 | import path from "path";
292 |
293 | const INVALID_ARGS_ERROR =
294 | "[rollup-plugin-generate-html-template] You did not provide a template or target!";
295 |
296 | /**
297 | * Takes an HTML file as a template then adds the bundle to the final file.
298 | * @param {Object} options The options object.
299 | * @return {Object} The rollup code object.
300 | */
301 | export default function htmlTemplate(options = {}) {
302 | const { template, target, prefix, attrs, replaceVars } = options;
303 | const scriptTagAttributes = attrs && attrs.length > 0 ? attrs : [];
304 | return {
305 | name: "html-template",
306 |
307 | async generateBundle(outputOptions, bundleInfo) {
308 | const bundleKeys = Object.keys(bundleInfo);
309 | return new Promise(async (resolve, reject) => {
310 | try {
311 | if (!target && !template) throw new Error(INVALID_ARGS_ERROR);
312 |
313 | const outputDir =
314 | outputOptions.dir || path.dirname(outputOptions.file);
315 |
316 | let targetDir = outputDir;
317 | let bundleDirString = "";
318 |
319 | if (target && path.dirname(target) !== ".") {
320 | targetDir = path.dirname(target);
321 | const bundleDir = path.relative(targetDir, outputDir);
322 | bundleDirString = bundleDir && `${bundleDir}/`;
323 | }
324 |
325 | // Get the target file name.
326 | const targetName = path.basename(target || template);
327 |
328 | // Add the file suffix if it isn't there.
329 | const targetFile =
330 | targetName.indexOf(".html") < 0 ? `${targetName}.html` : targetName;
331 |
332 | // Read the file
333 | const buffer = await fs.readFile(template);
334 |
335 | // Convert buffer to a string and get the </body> index
336 | let tmpl = buffer.toString("utf8");
337 | if (replaceVars) {
338 | const replacePairs = Object.entries(replaceVars);
339 | replacePairs.forEach(([pattern, replacement]) => {
340 | const escapedPattern = escapeStringRegexp(pattern);
341 | const regex = new RegExp(`${escapedPattern}`, "g");
342 | tmpl = tmpl.replace(regex, replacement);
343 | });
344 | }
345 |
346 | let injected = tmpl;
347 |
348 | // Inject the style tags before the head close tag
349 | const headCloseTag = injected.lastIndexOf("</head>");
350 |
351 | // Inject the script tags before the body close tag
352 | injected = [
353 | injected.slice(0, headCloseTag),
354 | ...bundleKeys
355 | .filter(f => path.extname(f) === ".css")
356 | .map(
357 | b =>
358 | `<link rel="stylesheet" type="text/css" href="${prefix ||
359 | ""}${b}">\n`
360 | ),
361 | injected.slice(headCloseTag, injected.length),
362 | ].join("");
363 |
364 | const bodyCloseTag = injected.lastIndexOf("</body>");
365 |
366 | // Inject the script tags before the body close tag
367 | injected = [
368 | injected.slice(0, bodyCloseTag),
369 | ...bundleKeys
370 | .filter(f => path.extname(f) === ".js")
371 | .map(
372 | b =>
373 | `<script ${scriptTagAttributes.join(
374 | " "
375 | )} src="${bundleDirString}${prefix || ""}${b}"></script>\n`
376 | ),
377 | injected.slice(bodyCloseTag, injected.length),
378 | ].join("");
379 |
380 | // write the injected template to a file
381 | const finalTarget = path.join(targetDir, targetFile);
382 | await fs.ensureFile(finalTarget);
383 | await fs.writeFile(finalTarget, injected);
384 | resolve();
385 | } catch (e) {
386 | reject(e);
387 | }
388 | });
389 | },
390 | };
391 | }
392 |
393 | function getEntryPoints(bundleInfo = {}) {
394 | const bundles = Object.keys(bundleInfo);
395 | return bundles.reduce((entryPoints, bundle) => {
396 | if (bundleInfo[bundle].isEntry === true) {
397 | entryPoints.push(bundle);
398 | }
399 | return entryPoints;
400 | }, []);
401 | }
402 |
403 | // Expose getEntryPoints for testing
404 | htmlTemplate.getEntryPoints = getEntryPoints;
405 | htmlTemplate.INVALID_ARGS_ERROR = INVALID_ARGS_ERROR;
406 | |
407 |
408 |
409 |
410 |
414 |
415 |
416 |
423 |
424 |
425 |
426 |
427 |
--------------------------------------------------------------------------------
/coverage/lcov-report/prettify.css:
--------------------------------------------------------------------------------
1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
2 |
--------------------------------------------------------------------------------
/coverage/lcov-report/prettify.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^\n`
90 | ),
91 | injected.slice(bodyCloseTag, injected.length),
92 | ].join("");
93 |
94 | // write the injected template to a file
95 | const finalTarget = path.join(targetDir, targetFile);
96 | await fs.ensureFile(finalTarget);
97 | await fs.writeFile(finalTarget, injected);
98 | resolve();
99 | } catch (e) {
100 | reject(e);
101 | }
102 | });
103 | },
104 | };
105 | }
106 |
107 | function getEntryPoints(bundleInfo = {}) {
108 | const bundles = Object.keys(bundleInfo);
109 | return bundles.reduce((entryPoints, bundle) => {
110 | if (bundleInfo[bundle].isEntry === true) {
111 | entryPoints.push(bundle);
112 | }
113 | return entryPoints;
114 | }, []);
115 | }
116 |
117 | // Expose getEntryPoints for testing
118 | htmlTemplate.getEntryPoints = getEntryPoints;
119 | htmlTemplate.INVALID_ARGS_ERROR = INVALID_ARGS_ERROR;
120 |
--------------------------------------------------------------------------------
/test_project/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test_project",
3 | "version": "1.0.0",
4 | "scripts": {
5 | "build": "rollup -c",
6 | "prebuild": "yarn clean",
7 | "clean": "rimraf dist/*"
8 | },
9 | "devDependencies": {
10 | "rimraf": "^3.0.0",
11 | "rollup": "^1.22.0"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test_project/rollup.config.js:
--------------------------------------------------------------------------------
1 | import html from "../dist/rollup-plugin-generate-html-template.module";
2 |
3 | export default {
4 | input: "src/index.js",
5 | output: {
6 | dir: "dist",
7 | format: "iife",
8 | name: "__TEST",
9 | },
10 | plugins: [
11 | html({
12 | template: "src/main.html",
13 | target: "index.html",
14 | }),
15 | ],
16 | };
17 |
--------------------------------------------------------------------------------
/test_project/src/index.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line
2 | console.log("Silence is golden");
3 |
--------------------------------------------------------------------------------
/test_project/src/main.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World.
4 |
5 |
--------------------------------------------------------------------------------
/test_project/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | "@types/estree@*":
6 | version "0.0.39"
7 | resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
8 | integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==
9 |
10 | "@types/node@*":
11 | version "12.7.9"
12 | resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.9.tgz#da0210f91096aa67138cf5afd04c4d629f8a406a"
13 | integrity sha512-P57oKTJ/vYivL2BCfxCC5tQjlS8qW31pbOL6qt99Yrjm95YdHgNZwjrTTjMBh+C2/y6PXIX4oz253+jUzxKKfQ==
14 |
15 | acorn@^7.1.0:
16 | version "7.1.0"
17 | resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"
18 | integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==
19 |
20 | balanced-match@^1.0.0:
21 | version "1.0.0"
22 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
23 | integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
24 |
25 | brace-expansion@^1.1.7:
26 | version "1.1.11"
27 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
28 | integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
29 | dependencies:
30 | balanced-match "^1.0.0"
31 | concat-map "0.0.1"
32 |
33 | concat-map@0.0.1:
34 | version "0.0.1"
35 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
36 | integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
37 |
38 | fs.realpath@^1.0.0:
39 | version "1.0.0"
40 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
41 | integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
42 |
43 | glob@^7.1.3:
44 | version "7.1.4"
45 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
46 | integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
47 | dependencies:
48 | fs.realpath "^1.0.0"
49 | inflight "^1.0.4"
50 | inherits "2"
51 | minimatch "^3.0.4"
52 | once "^1.3.0"
53 | path-is-absolute "^1.0.0"
54 |
55 | inflight@^1.0.4:
56 | version "1.0.6"
57 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
58 | integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
59 | dependencies:
60 | once "^1.3.0"
61 | wrappy "1"
62 |
63 | inherits@2:
64 | version "2.0.4"
65 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
66 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
67 |
68 | minimatch@^3.0.4:
69 | version "3.0.4"
70 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
71 | integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
72 | dependencies:
73 | brace-expansion "^1.1.7"
74 |
75 | once@^1.3.0:
76 | version "1.4.0"
77 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
78 | integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
79 | dependencies:
80 | wrappy "1"
81 |
82 | path-is-absolute@^1.0.0:
83 | version "1.0.1"
84 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
85 | integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
86 |
87 | rimraf@^3.0.0:
88 | version "3.0.0"
89 | resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b"
90 | integrity sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg==
91 | dependencies:
92 | glob "^7.1.3"
93 |
94 | rollup@^1.22.0:
95 | version "1.22.0"
96 | resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.22.0.tgz#a5b2672c0eebe9f2b6454220f785dbc09b64b4bc"
97 | integrity sha512-x4l4ZrV/Mr/x/jvFTmwROdEAhbZjx16yDRTVSKWh/i4oJDuW2dVEbECT853mybYCz7BAitU8ElGlhx7dNjw3qQ==
98 | dependencies:
99 | "@types/estree" "*"
100 | "@types/node" "*"
101 | acorn "^7.1.0"
102 |
103 | wrappy@1:
104 | version "1.0.2"
105 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
106 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
107 |
--------------------------------------------------------------------------------