@ozdao/prometheus-framework 0.2.182 → 0.2.184
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/builder.js +61 -34
- package/dist/builder.mjs +61 -34
- package/package.json +1 -1
- package/src/builder/ssr/ssr-render-html.js +6 -24
- package/src/builder/templates/page.js +39 -0
- package/src/builder/webpack/webpack.config.client.js +1 -1
- package/src/builder/webpack/webpack.config.spa.js +3 -4
- package/src/builder/templates/page.html +0 -37
- package/src/builder/templates/screen.html +0 -33
package/dist/builder.js
CHANGED
@@ -24,21 +24,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
24
24
|
const require$$0 = require("path");
|
25
25
|
const require$$1$1 = require("webpack");
|
26
26
|
const require$$2$1 = require("compression");
|
27
|
-
const require$$3
|
27
|
+
const require$$3 = require("readline");
|
28
28
|
const require$$4 = require("chalk");
|
29
29
|
const require$$5 = require("webpack-dev-middleware");
|
30
30
|
const require$$1 = require("mustache");
|
31
31
|
const require$$2 = require("chokidar");
|
32
|
-
const require$$3 = require("fs");
|
33
32
|
const require$$1$2 = require("express");
|
34
33
|
const require$$6 = require("connect-history-api-fallback");
|
34
|
+
const require$$0$1 = require("fs");
|
35
35
|
const require$$2$2 = require("vue-loader");
|
36
|
-
const require$$3$
|
36
|
+
const require$$3$1 = require("mini-css-extract-plugin");
|
37
37
|
const require$$4$1 = require("clean-webpack-plugin");
|
38
38
|
const require$$5$1 = require("webpack-bundle-analyzer");
|
39
39
|
const require$$6$1 = require("dotenv-webpack");
|
40
40
|
const require$$1$3 = require("glob-all");
|
41
|
-
const require$$3$
|
41
|
+
const require$$3$2 = require("webpack-merge");
|
42
42
|
const require$$4$2 = require("webpack-stats-plugin");
|
43
43
|
const require$$6$2 = require("css-minimizer-webpack-plugin");
|
44
44
|
const require$$7 = require("terser-webpack-plugin");
|
@@ -51,17 +51,51 @@ const require$$4$3 = require("webpack-manifest-plugin");
|
|
51
51
|
function getDefaultExportFromCjs(x) {
|
52
52
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
53
53
|
}
|
54
|
+
var page = `
|
55
|
+
<!-- <!DOCTYPE html> -->
|
56
|
+
<html {{{ meta.htmlAttrs }}}>
|
57
|
+
<head {{{ meta.headAttrs }}}>
|
58
|
+
{{{ meta.head }}}
|
59
|
+
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
|
60
|
+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
|
61
|
+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
|
62
|
+
<link rel="manifest" href="/favicon/site.webmanifest">
|
63
|
+
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
|
64
|
+
<meta name="msapplication-TileColor" content="#000000">
|
65
|
+
<meta name="theme-color" content="#ffffff">
|
66
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
67
|
+
{{{ head }}}
|
68
|
+
<!-- Sign in with Apple -->
|
69
|
+
<!-- <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script> -->
|
70
|
+
</head>
|
71
|
+
<!-- Google tag (gtag.js) -->
|
72
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id={{googleTagId}}"></script>
|
73
|
+
|
74
|
+
<body {{{ meta.bodyAttrs }}}>
|
75
|
+
<div id="app">{{{ appHtml }}}</div>
|
76
|
+
|
77
|
+
<script type="application/json" data-user-state>
|
78
|
+
{{{ userState }}}
|
79
|
+
</script>
|
80
|
+
|
81
|
+
<script>
|
82
|
+
window.dataLayer = window.dataLayer || [];
|
83
|
+
function gtag(){dataLayer.push(arguments);}
|
84
|
+
gtag('js', new Date());
|
85
|
+
|
86
|
+
gtag('config', '{{googleTagId}}');
|
87
|
+
</script>
|
88
|
+
|
89
|
+
{{{ meta.body }}} {{{ body }}}
|
90
|
+
</body>
|
91
|
+
</html>
|
92
|
+
`;
|
54
93
|
const path$9 = require$$0;
|
55
94
|
const Mustache$1 = require$$1;
|
56
95
|
const chokidar = require$$2;
|
57
|
-
const
|
58
|
-
const templatePath
|
59
|
-
let template;
|
96
|
+
const template = page;
|
97
|
+
const templatePath = path$9.resolve(__dirname, "../templates/page.js");
|
60
98
|
const renderHtml$1 = async (stuff) => {
|
61
|
-
if (!template) {
|
62
|
-
const buffer = await readFile(templatePath$1);
|
63
|
-
template = buffer.toString();
|
64
|
-
}
|
65
99
|
const data = {
|
66
100
|
...stuff,
|
67
101
|
googleTagId: process.env.GOOGLE_TAG_ID,
|
@@ -70,20 +104,13 @@ const renderHtml$1 = async (stuff) => {
|
|
70
104
|
return Mustache$1.render(template, data);
|
71
105
|
};
|
72
106
|
const createHtmlRenderer$1 = (onTemplateUpdate) => {
|
73
|
-
let
|
74
|
-
|
75
|
-
|
76
|
-
|
107
|
+
let currentTemplate = template;
|
108
|
+
chokidar.watch(templatePath).on("change", () => {
|
109
|
+
delete require.cache[require.resolve(templatePath)];
|
110
|
+
currentTemplate = require(templatePath);
|
77
111
|
onTemplateUpdate();
|
78
112
|
});
|
79
|
-
const loadTemplate = async () => {
|
80
|
-
if (!shouldReload) return;
|
81
|
-
const buffer = await readFile(templatePath$1);
|
82
|
-
currentTemplate = buffer.toString();
|
83
|
-
shouldReload = false;
|
84
|
-
};
|
85
113
|
return async (stuff) => {
|
86
|
-
await loadTemplate();
|
87
114
|
const data = {
|
88
115
|
...stuff,
|
89
116
|
googleTagId: process.env.GOOGLE_TAG_ID,
|
@@ -132,7 +159,7 @@ var ssrTransformWebpackStats = {
|
|
132
159
|
const path$8 = require$$0;
|
133
160
|
const webpack$6 = require$$1$1;
|
134
161
|
const compression$2 = require$$2$1;
|
135
|
-
const readline$1 = require$$3
|
162
|
+
const readline$1 = require$$3;
|
136
163
|
const chalk$1 = require$$4;
|
137
164
|
const devMiddleware$1 = require$$5;
|
138
165
|
const { createHtmlRenderer } = ssrRenderHtml;
|
@@ -319,7 +346,7 @@ var ssr_prod = function createSsrProdServer(projectRoot, { clientConfig: clientC
|
|
319
346
|
const path$6 = require$$0;
|
320
347
|
const webpack$5 = require$$1$1;
|
321
348
|
const compression$1 = require$$2$1;
|
322
|
-
const readline = require$$3
|
349
|
+
const readline = require$$3;
|
323
350
|
const chalk = require$$4;
|
324
351
|
const devMiddleware = require$$5;
|
325
352
|
const history$1 = require$$6;
|
@@ -387,7 +414,7 @@ var spa_dev = function createSpaDevServer(projectRoot, { spaConfig: spaConfig2,
|
|
387
414
|
createDevRenderer();
|
388
415
|
return startServer;
|
389
416
|
};
|
390
|
-
const fs
|
417
|
+
const fs = require$$0$1;
|
391
418
|
const path$5 = require$$0;
|
392
419
|
const compression = require$$2$1;
|
393
420
|
const express = require$$1$2;
|
@@ -403,7 +430,7 @@ var spa_prod = function createSpaProdServer(projectRoot, { createServerPath }) {
|
|
403
430
|
index: "/index.html"
|
404
431
|
}));
|
405
432
|
app.get("*", (req, res) => {
|
406
|
-
fs
|
433
|
+
fs.readFile(path$5.resolve(projectRoot, "builds/web/spa", "index.html"), "utf-8", (err, content) => {
|
407
434
|
if (err) {
|
408
435
|
console.log('We cannot open "index.html" file.');
|
409
436
|
res.writeHead(500, {
|
@@ -432,7 +459,7 @@ var spa_prod = function createSpaProdServer(projectRoot, { createServerPath }) {
|
|
432
459
|
const path$4 = require$$0;
|
433
460
|
const webpack$4 = require$$1$1;
|
434
461
|
const { VueLoaderPlugin } = require$$2$2;
|
435
|
-
const MiniCssExtractPlugin = require$$3$
|
462
|
+
const MiniCssExtractPlugin = require$$3$1;
|
436
463
|
const { CleanWebpackPlugin } = require$$4$1;
|
437
464
|
const BundleAnalyzerPlugin = require$$5$1.BundleAnalyzerPlugin;
|
438
465
|
const Dotenv = require$$6$1;
|
@@ -554,7 +581,7 @@ var webpack_config_base = (projectRoot) => {
|
|
554
581
|
};
|
555
582
|
const path$3 = require$$0;
|
556
583
|
const glob = require$$1$3;
|
557
|
-
const { merge: merge$2 } = require$$3$
|
584
|
+
const { merge: merge$2 } = require$$3$2;
|
558
585
|
const { StatsWriterPlugin: StatsWriterPlugin$1 } = require$$4$2;
|
559
586
|
const CssMinimizerPlugin$1 = require$$6$2;
|
560
587
|
const TerserPlugin$1 = require$$7;
|
@@ -590,7 +617,7 @@ var webpack_config_client = (projectRoot) => {
|
|
590
617
|
paths: glob.sync([
|
591
618
|
path$3.join(projectRoot, "src/**/*.vue"),
|
592
619
|
path$3.join(projectRoot, "prometheus-framework/src/**/*.vue"),
|
593
|
-
path$3.join(projectRoot, "/node_modules/@ozdao/prometheus-framework/
|
620
|
+
path$3.join(projectRoot, "/node_modules/@ozdao/prometheus-framework/src/**/*.vue")
|
594
621
|
]),
|
595
622
|
safelist: { greedy: [/data-v-.*/] }
|
596
623
|
})
|
@@ -654,16 +681,16 @@ var webpack_config_server = (projectRoot) => {
|
|
654
681
|
};
|
655
682
|
const path$1 = require$$0;
|
656
683
|
const webpack$2 = require$$1$1;
|
657
|
-
const { merge: merge$1 } = require$$3$
|
684
|
+
const { merge: merge$1 } = require$$3$2;
|
658
685
|
const CssMinimizerPlugin = require$$6$2;
|
659
686
|
const CopyWebpackPlugin = require$$6$3;
|
660
687
|
const TerserPlugin = require$$7;
|
661
688
|
const HtmlWebpackPlugin = require$$8$1;
|
662
689
|
const { StatsWriterPlugin } = require$$4$2;
|
663
690
|
const Mustache = require$$1;
|
664
|
-
|
691
|
+
require$$0$1.promises;
|
665
692
|
const getClientConfig = webpack_config_client;
|
666
|
-
|
693
|
+
path$1.resolve(__dirname, "../templates/page.html");
|
667
694
|
const isProd = process.env.NODE_ENV === "production";
|
668
695
|
var webpack_config_spa = (projectRoot) => {
|
669
696
|
const spaConfig2 = {
|
@@ -686,7 +713,7 @@ var webpack_config_spa = (projectRoot) => {
|
|
686
713
|
}),
|
687
714
|
new HtmlWebpackPlugin({
|
688
715
|
templateContent: async () => {
|
689
|
-
const template2 =
|
716
|
+
const template2 = page;
|
690
717
|
const meta = {
|
691
718
|
htmlAttrs: 'lang="en"',
|
692
719
|
headAttrs: "",
|
@@ -721,7 +748,7 @@ var webpack_config_spa = (projectRoot) => {
|
|
721
748
|
const path = require$$0;
|
722
749
|
const webpack$1 = require$$1$1;
|
723
750
|
const nodeExternals = require$$2$3;
|
724
|
-
const { merge } = require$$3$
|
751
|
+
const { merge } = require$$3$2;
|
725
752
|
const { WebpackManifestPlugin } = require$$4$3;
|
726
753
|
const getBaseConfig = webpack_config_base;
|
727
754
|
var webpack_config_ssr = (projectRoot) => {
|
package/dist/builder.mjs
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
import require$$0 from "path";
|
2
2
|
import require$$1$1 from "webpack";
|
3
3
|
import require$$2$1 from "compression";
|
4
|
-
import require$$3
|
4
|
+
import require$$3 from "readline";
|
5
5
|
import require$$4 from "chalk";
|
6
6
|
import require$$5 from "webpack-dev-middleware";
|
7
7
|
import require$$1 from "mustache";
|
8
8
|
import require$$2 from "chokidar";
|
9
|
-
import require$$3 from "fs";
|
10
9
|
import require$$1$2 from "express";
|
11
10
|
import require$$6 from "connect-history-api-fallback";
|
11
|
+
import require$$0$1 from "fs";
|
12
12
|
import require$$2$2 from "vue-loader";
|
13
|
-
import require$$3$
|
13
|
+
import require$$3$1 from "mini-css-extract-plugin";
|
14
14
|
import require$$4$1 from "clean-webpack-plugin";
|
15
15
|
import require$$5$1 from "webpack-bundle-analyzer";
|
16
16
|
import require$$6$1 from "dotenv-webpack";
|
17
17
|
import require$$1$3 from "glob-all";
|
18
|
-
import require$$3$
|
18
|
+
import require$$3$2 from "webpack-merge";
|
19
19
|
import require$$4$2 from "webpack-stats-plugin";
|
20
20
|
import require$$6$2 from "css-minimizer-webpack-plugin";
|
21
21
|
import require$$7 from "terser-webpack-plugin";
|
@@ -28,17 +28,51 @@ import require$$4$3 from "webpack-manifest-plugin";
|
|
28
28
|
function getDefaultExportFromCjs(x) {
|
29
29
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
30
30
|
}
|
31
|
+
var page = `
|
32
|
+
<!-- <!DOCTYPE html> -->
|
33
|
+
<html {{{ meta.htmlAttrs }}}>
|
34
|
+
<head {{{ meta.headAttrs }}}>
|
35
|
+
{{{ meta.head }}}
|
36
|
+
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
|
37
|
+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
|
38
|
+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
|
39
|
+
<link rel="manifest" href="/favicon/site.webmanifest">
|
40
|
+
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
|
41
|
+
<meta name="msapplication-TileColor" content="#000000">
|
42
|
+
<meta name="theme-color" content="#ffffff">
|
43
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
44
|
+
{{{ head }}}
|
45
|
+
<!-- Sign in with Apple -->
|
46
|
+
<!-- <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script> -->
|
47
|
+
</head>
|
48
|
+
<!-- Google tag (gtag.js) -->
|
49
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id={{googleTagId}}"></script>
|
50
|
+
|
51
|
+
<body {{{ meta.bodyAttrs }}}>
|
52
|
+
<div id="app">{{{ appHtml }}}</div>
|
53
|
+
|
54
|
+
<script type="application/json" data-user-state>
|
55
|
+
{{{ userState }}}
|
56
|
+
</script>
|
57
|
+
|
58
|
+
<script>
|
59
|
+
window.dataLayer = window.dataLayer || [];
|
60
|
+
function gtag(){dataLayer.push(arguments);}
|
61
|
+
gtag('js', new Date());
|
62
|
+
|
63
|
+
gtag('config', '{{googleTagId}}');
|
64
|
+
</script>
|
65
|
+
|
66
|
+
{{{ meta.body }}} {{{ body }}}
|
67
|
+
</body>
|
68
|
+
</html>
|
69
|
+
`;
|
31
70
|
const path$9 = require$$0;
|
32
71
|
const Mustache$1 = require$$1;
|
33
72
|
const chokidar = require$$2;
|
34
|
-
const
|
35
|
-
const templatePath
|
36
|
-
let template;
|
73
|
+
const template = page;
|
74
|
+
const templatePath = path$9.resolve(__dirname, "../templates/page.js");
|
37
75
|
const renderHtml$1 = async (stuff) => {
|
38
|
-
if (!template) {
|
39
|
-
const buffer = await readFile(templatePath$1);
|
40
|
-
template = buffer.toString();
|
41
|
-
}
|
42
76
|
const data = {
|
43
77
|
...stuff,
|
44
78
|
googleTagId: process.env.GOOGLE_TAG_ID,
|
@@ -47,20 +81,13 @@ const renderHtml$1 = async (stuff) => {
|
|
47
81
|
return Mustache$1.render(template, data);
|
48
82
|
};
|
49
83
|
const createHtmlRenderer$1 = (onTemplateUpdate) => {
|
50
|
-
let
|
51
|
-
|
52
|
-
|
53
|
-
|
84
|
+
let currentTemplate = template;
|
85
|
+
chokidar.watch(templatePath).on("change", () => {
|
86
|
+
delete require.cache[require.resolve(templatePath)];
|
87
|
+
currentTemplate = require(templatePath);
|
54
88
|
onTemplateUpdate();
|
55
89
|
});
|
56
|
-
const loadTemplate = async () => {
|
57
|
-
if (!shouldReload) return;
|
58
|
-
const buffer = await readFile(templatePath$1);
|
59
|
-
currentTemplate = buffer.toString();
|
60
|
-
shouldReload = false;
|
61
|
-
};
|
62
90
|
return async (stuff) => {
|
63
|
-
await loadTemplate();
|
64
91
|
const data = {
|
65
92
|
...stuff,
|
66
93
|
googleTagId: process.env.GOOGLE_TAG_ID,
|
@@ -109,7 +136,7 @@ var ssrTransformWebpackStats = {
|
|
109
136
|
const path$8 = require$$0;
|
110
137
|
const webpack$6 = require$$1$1;
|
111
138
|
const compression$2 = require$$2$1;
|
112
|
-
const readline$1 = require$$3
|
139
|
+
const readline$1 = require$$3;
|
113
140
|
const chalk$1 = require$$4;
|
114
141
|
const devMiddleware$1 = require$$5;
|
115
142
|
const { createHtmlRenderer } = ssrRenderHtml;
|
@@ -296,7 +323,7 @@ var ssr_prod = function createSsrProdServer(projectRoot, { clientConfig: clientC
|
|
296
323
|
const path$6 = require$$0;
|
297
324
|
const webpack$5 = require$$1$1;
|
298
325
|
const compression$1 = require$$2$1;
|
299
|
-
const readline = require$$3
|
326
|
+
const readline = require$$3;
|
300
327
|
const chalk = require$$4;
|
301
328
|
const devMiddleware = require$$5;
|
302
329
|
const history$1 = require$$6;
|
@@ -364,7 +391,7 @@ var spa_dev = function createSpaDevServer(projectRoot, { spaConfig: spaConfig2,
|
|
364
391
|
createDevRenderer();
|
365
392
|
return startServer;
|
366
393
|
};
|
367
|
-
const fs
|
394
|
+
const fs = require$$0$1;
|
368
395
|
const path$5 = require$$0;
|
369
396
|
const compression = require$$2$1;
|
370
397
|
const express = require$$1$2;
|
@@ -380,7 +407,7 @@ var spa_prod = function createSpaProdServer(projectRoot, { createServerPath }) {
|
|
380
407
|
index: "/index.html"
|
381
408
|
}));
|
382
409
|
app.get("*", (req, res) => {
|
383
|
-
fs
|
410
|
+
fs.readFile(path$5.resolve(projectRoot, "builds/web/spa", "index.html"), "utf-8", (err, content) => {
|
384
411
|
if (err) {
|
385
412
|
console.log('We cannot open "index.html" file.');
|
386
413
|
res.writeHead(500, {
|
@@ -409,7 +436,7 @@ var spa_prod = function createSpaProdServer(projectRoot, { createServerPath }) {
|
|
409
436
|
const path$4 = require$$0;
|
410
437
|
const webpack$4 = require$$1$1;
|
411
438
|
const { VueLoaderPlugin } = require$$2$2;
|
412
|
-
const MiniCssExtractPlugin = require$$3$
|
439
|
+
const MiniCssExtractPlugin = require$$3$1;
|
413
440
|
const { CleanWebpackPlugin } = require$$4$1;
|
414
441
|
const BundleAnalyzerPlugin = require$$5$1.BundleAnalyzerPlugin;
|
415
442
|
const Dotenv = require$$6$1;
|
@@ -531,7 +558,7 @@ var webpack_config_base = (projectRoot) => {
|
|
531
558
|
};
|
532
559
|
const path$3 = require$$0;
|
533
560
|
const glob = require$$1$3;
|
534
|
-
const { merge: merge$2 } = require$$3$
|
561
|
+
const { merge: merge$2 } = require$$3$2;
|
535
562
|
const { StatsWriterPlugin: StatsWriterPlugin$1 } = require$$4$2;
|
536
563
|
const CssMinimizerPlugin$1 = require$$6$2;
|
537
564
|
const TerserPlugin$1 = require$$7;
|
@@ -567,7 +594,7 @@ var webpack_config_client = (projectRoot) => {
|
|
567
594
|
paths: glob.sync([
|
568
595
|
path$3.join(projectRoot, "src/**/*.vue"),
|
569
596
|
path$3.join(projectRoot, "prometheus-framework/src/**/*.vue"),
|
570
|
-
path$3.join(projectRoot, "/node_modules/@ozdao/prometheus-framework/
|
597
|
+
path$3.join(projectRoot, "/node_modules/@ozdao/prometheus-framework/src/**/*.vue")
|
571
598
|
]),
|
572
599
|
safelist: { greedy: [/data-v-.*/] }
|
573
600
|
})
|
@@ -631,16 +658,16 @@ var webpack_config_server = (projectRoot) => {
|
|
631
658
|
};
|
632
659
|
const path$1 = require$$0;
|
633
660
|
const webpack$2 = require$$1$1;
|
634
|
-
const { merge: merge$1 } = require$$3$
|
661
|
+
const { merge: merge$1 } = require$$3$2;
|
635
662
|
const CssMinimizerPlugin = require$$6$2;
|
636
663
|
const CopyWebpackPlugin = require$$6$3;
|
637
664
|
const TerserPlugin = require$$7;
|
638
665
|
const HtmlWebpackPlugin = require$$8$1;
|
639
666
|
const { StatsWriterPlugin } = require$$4$2;
|
640
667
|
const Mustache = require$$1;
|
641
|
-
|
668
|
+
require$$0$1.promises;
|
642
669
|
const getClientConfig = webpack_config_client;
|
643
|
-
|
670
|
+
path$1.resolve(__dirname, "../templates/page.html");
|
644
671
|
const isProd = process.env.NODE_ENV === "production";
|
645
672
|
var webpack_config_spa = (projectRoot) => {
|
646
673
|
const spaConfig2 = {
|
@@ -663,7 +690,7 @@ var webpack_config_spa = (projectRoot) => {
|
|
663
690
|
}),
|
664
691
|
new HtmlWebpackPlugin({
|
665
692
|
templateContent: async () => {
|
666
|
-
const template2 =
|
693
|
+
const template2 = page;
|
667
694
|
const meta = {
|
668
695
|
htmlAttrs: 'lang="en"',
|
669
696
|
headAttrs: "",
|
@@ -698,7 +725,7 @@ var webpack_config_spa = (projectRoot) => {
|
|
698
725
|
const path = require$$0;
|
699
726
|
const webpack$1 = require$$1$1;
|
700
727
|
const nodeExternals = require$$2$3;
|
701
|
-
const { merge } = require$$3$
|
728
|
+
const { merge } = require$$3$2;
|
702
729
|
const { WebpackManifestPlugin } = require$$4$3;
|
703
730
|
const getBaseConfig = webpack_config_base;
|
704
731
|
var webpack_config_ssr = (projectRoot) => {
|
package/package.json
CHANGED
@@ -1,52 +1,34 @@
|
|
1
1
|
const path = require("path");
|
2
2
|
const Mustache = require("mustache");
|
3
3
|
const chokidar = require("chokidar");
|
4
|
-
const
|
4
|
+
const template = require("../templates/page.js");
|
5
5
|
|
6
|
-
const templatePath = path.resolve(__dirname,"../templates/page.
|
7
|
-
|
8
|
-
let template;
|
6
|
+
const templatePath = path.resolve(__dirname, "../templates/page.js");
|
9
7
|
|
10
8
|
const renderHtml = async (stuff) => {
|
11
|
-
if (!template) {
|
12
|
-
const buffer = await readFile(templatePath);
|
13
|
-
template = buffer.toString();
|
14
|
-
}
|
15
|
-
|
16
9
|
const data = {
|
17
10
|
...stuff,
|
18
11
|
googleTagId: process.env.GOOGLE_TAG_ID,
|
19
12
|
googleMapApiKey: process.env.GOOGLE_MAPS_API_KEY
|
20
13
|
};
|
21
|
-
|
22
14
|
return Mustache.render(template, data);
|
23
15
|
};
|
24
16
|
|
25
17
|
const createHtmlRenderer = (onTemplateUpdate) => {
|
26
|
-
let
|
27
|
-
let currentTemplate;
|
18
|
+
let currentTemplate = template;
|
28
19
|
|
29
20
|
chokidar.watch(templatePath).on("change", () => {
|
30
|
-
|
21
|
+
delete require.cache[require.resolve(templatePath)];
|
22
|
+
currentTemplate = require(templatePath);
|
31
23
|
onTemplateUpdate();
|
32
24
|
});
|
33
25
|
|
34
|
-
const loadTemplate = async () => {
|
35
|
-
if (!shouldReload) return;
|
36
|
-
const buffer = await readFile(templatePath);
|
37
|
-
currentTemplate = buffer.toString();
|
38
|
-
shouldReload = false;
|
39
|
-
};
|
40
|
-
|
41
26
|
return async (stuff) => {
|
42
|
-
await loadTemplate();
|
43
|
-
|
44
27
|
const data = {
|
45
28
|
...stuff,
|
46
29
|
googleTagId: process.env.GOOGLE_TAG_ID,
|
47
30
|
googleMapApiKey: process.env.GOOGLE_MAPS_API_KEY
|
48
31
|
};
|
49
|
-
|
50
32
|
return Mustache.render(currentTemplate, data);
|
51
33
|
};
|
52
34
|
};
|
@@ -54,4 +36,4 @@ const createHtmlRenderer = (onTemplateUpdate) => {
|
|
54
36
|
module.exports = {
|
55
37
|
createHtmlRenderer,
|
56
38
|
renderHtml,
|
57
|
-
};
|
39
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module.exports = `
|
2
|
+
<!-- <!DOCTYPE html> -->
|
3
|
+
<html {{{ meta.htmlAttrs }}}>
|
4
|
+
<head {{{ meta.headAttrs }}}>
|
5
|
+
{{{ meta.head }}}
|
6
|
+
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
|
7
|
+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
|
8
|
+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
|
9
|
+
<link rel="manifest" href="/favicon/site.webmanifest">
|
10
|
+
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
|
11
|
+
<meta name="msapplication-TileColor" content="#000000">
|
12
|
+
<meta name="theme-color" content="#ffffff">
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
14
|
+
{{{ head }}}
|
15
|
+
<!-- Sign in with Apple -->
|
16
|
+
<!-- <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script> -->
|
17
|
+
</head>
|
18
|
+
<!-- Google tag (gtag.js) -->
|
19
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id={{googleTagId}}"></script>
|
20
|
+
|
21
|
+
<body {{{ meta.bodyAttrs }}}>
|
22
|
+
<div id="app">{{{ appHtml }}}</div>
|
23
|
+
|
24
|
+
<script type="application/json" data-user-state>
|
25
|
+
{{{ userState }}}
|
26
|
+
</script>
|
27
|
+
|
28
|
+
<script>
|
29
|
+
window.dataLayer = window.dataLayer || [];
|
30
|
+
function gtag(){dataLayer.push(arguments);}
|
31
|
+
gtag('js', new Date());
|
32
|
+
|
33
|
+
gtag('config', '{{googleTagId}}');
|
34
|
+
</script>
|
35
|
+
|
36
|
+
{{{ meta.body }}} {{{ body }}}
|
37
|
+
</body>
|
38
|
+
</html>
|
39
|
+
`;
|
@@ -43,7 +43,7 @@ module.exports = (projectRoot) => {
|
|
43
43
|
paths: glob.sync([
|
44
44
|
path.join(projectRoot, 'src/**/*.vue'),
|
45
45
|
path.join(projectRoot, 'prometheus-framework/src/**/*.vue'),
|
46
|
-
path.join(projectRoot, '/node_modules/@ozdao/prometheus-framework/
|
46
|
+
path.join(projectRoot, '/node_modules/@ozdao/prometheus-framework/src/**/*.vue')
|
47
47
|
]),
|
48
48
|
safelist: { greedy: [ /data-v-.*/ ] }
|
49
49
|
}),
|
@@ -17,9 +17,6 @@ const templatePath = path.resolve(__dirname,"../templates/page.html");
|
|
17
17
|
const isProd = process.env.NODE_ENV === "production";
|
18
18
|
|
19
19
|
module.exports = (projectRoot) => {
|
20
|
-
|
21
|
-
// let mainJS = !isProd ? [path.resolve("../utils/hot-reload.js"), path.resolve(projectRoot, "src/app.js")] : path.resolve(projectRoot, "src/app.js")
|
22
|
-
|
23
20
|
const spaConfig = {
|
24
21
|
mode: !isProd ? "development" : "production",
|
25
22
|
devtool: "source-map",
|
@@ -40,7 +37,8 @@ module.exports = (projectRoot) => {
|
|
40
37
|
}),
|
41
38
|
new HtmlWebpackPlugin({
|
42
39
|
templateContent: async () => {
|
43
|
-
const template =
|
40
|
+
const template = require("../templates/page.js");
|
41
|
+
|
44
42
|
const meta = {
|
45
43
|
htmlAttrs: 'lang="en"',
|
46
44
|
headAttrs: '',
|
@@ -53,6 +51,7 @@ module.exports = (projectRoot) => {
|
|
53
51
|
googleMapApiKey: process.env.GOOGLE_MAPS_API_KEY,
|
54
52
|
meta,
|
55
53
|
};
|
54
|
+
|
56
55
|
return Mustache.render(template, data);
|
57
56
|
},
|
58
57
|
filename: 'index.html',
|
@@ -1,37 +0,0 @@
|
|
1
|
-
<!-- <!DOCTYPE html> -->
|
2
|
-
<html {{{ meta.htmlAttrs }}}>
|
3
|
-
<head {{{ meta.headAttrs }}}>
|
4
|
-
{{{ meta.head }}}
|
5
|
-
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
|
6
|
-
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
|
7
|
-
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
|
8
|
-
<link rel="manifest" href="/favicon/site.webmanifest">
|
9
|
-
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
|
10
|
-
<meta name="msapplication-TileColor" content="#000000">
|
11
|
-
<meta name="theme-color" content="#ffffff">
|
12
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
13
|
-
{{{ head }}}
|
14
|
-
<!-- Sign in with Apple -->
|
15
|
-
<!-- <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script> -->
|
16
|
-
</head>
|
17
|
-
<!-- Google tag (gtag.js) -->
|
18
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id={{googleTagId}}"></script>
|
19
|
-
|
20
|
-
<body {{{ meta.bodyAttrs }}}>
|
21
|
-
<div id="app">{{{ appHtml }}}</div>
|
22
|
-
|
23
|
-
<script type="application/json" data-user-state>
|
24
|
-
{{{ userState }}}
|
25
|
-
</script>
|
26
|
-
|
27
|
-
<script>
|
28
|
-
window.dataLayer = window.dataLayer || [];
|
29
|
-
function gtag(){dataLayer.push(arguments);}
|
30
|
-
gtag('js', new Date());
|
31
|
-
|
32
|
-
gtag('config', '{{googleTagId}}');
|
33
|
-
</script>
|
34
|
-
|
35
|
-
{{{ meta.body }}} {{{ body }}}
|
36
|
-
</body>
|
37
|
-
</html>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
|
5
|
-
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
|
6
|
-
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
|
7
|
-
<!-- <link rel="manifest" href="/favicon/site.webmanifest"> -->
|
8
|
-
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
|
9
|
-
<meta name="msapplication-TileColor" content="#000000">
|
10
|
-
<meta name="theme-color" content="#ffffff">
|
11
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
12
|
-
<title>Weeder</title>
|
13
|
-
<!-- Sign in with Apple -->
|
14
|
-
<script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
|
15
|
-
<!-- Google tag (gtag.js) -->
|
16
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= googleTagId %>"></script>
|
17
|
-
<script>
|
18
|
-
window.dataLayer = window.dataLayer || [];
|
19
|
-
function gtag(){dataLayer.push(arguments);}
|
20
|
-
gtag('js', new Date());
|
21
|
-
|
22
|
-
gtag('config', '<%= googleTagId %>');
|
23
|
-
</script>
|
24
|
-
<!-- Google Map Api -->
|
25
|
-
<script src="https://maps.googleapis.com/maps/api/js?key=<%= googleMapApiKey %>&libraries=places&language=en" async=""></script>
|
26
|
-
<link rel="stylesheet" type="text/css" href="/main.css">
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<div id="app"></div>
|
30
|
-
|
31
|
-
<script src="/main.js"></script>
|
32
|
-
</body>
|
33
|
-
</html>
|