unplugin-version-injector 2.0.0-beta.3 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rollup.js +9 -5
- package/dist/rollup.mjs +9 -5
- package/dist/vite.js +9 -5
- package/dist/vite.mjs +9 -5
- package/dist/webpack.js +9 -5
- package/dist/webpack.mjs +9 -5
- package/package.json +1 -1
package/dist/rollup.js
CHANGED
@@ -35,17 +35,21 @@ function defaultFormatDate(date) {
|
|
35
35
|
function createVersionInjector(options = {}) {
|
36
36
|
var _a, _b;
|
37
37
|
const version = (_a = options.version) != null ? _a : getPackageVersion();
|
38
|
-
((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
38
|
+
const buildTime = ((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
39
39
|
const metaTag = `<meta name="version" content="${version}">
|
40
40
|
`;
|
41
|
-
const logScript =
|
41
|
+
const logScript = `
|
42
|
+
<script data-injected="unplugin-version-injector">
|
43
|
+
console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
44
|
+
console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
45
|
+
</script>`;
|
42
46
|
return function processHtml(html) {
|
43
47
|
if (!html.includes('<meta name="version"')) {
|
44
|
-
html = html.replace(/<head
|
48
|
+
html = html.replace(/<head>/i, `<head>
|
45
49
|
${metaTag}`);
|
46
50
|
}
|
47
|
-
if (!html.includes('
|
48
|
-
html = html.replace(
|
51
|
+
if (options.log !== false && !html.includes('data-injected="unplugin-version-injector"')) {
|
52
|
+
html = html.replace(/<\/body>/i, ` ${logScript}
|
49
53
|
</body>`);
|
50
54
|
}
|
51
55
|
return html;
|
package/dist/rollup.mjs
CHANGED
@@ -28,17 +28,21 @@ function defaultFormatDate(date) {
|
|
28
28
|
function createVersionInjector(options = {}) {
|
29
29
|
var _a, _b;
|
30
30
|
const version = (_a = options.version) != null ? _a : getPackageVersion();
|
31
|
-
((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
31
|
+
const buildTime = ((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
32
32
|
const metaTag = `<meta name="version" content="${version}">
|
33
33
|
`;
|
34
|
-
const logScript =
|
34
|
+
const logScript = `
|
35
|
+
<script data-injected="unplugin-version-injector">
|
36
|
+
console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
37
|
+
console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
38
|
+
</script>`;
|
35
39
|
return function processHtml(html) {
|
36
40
|
if (!html.includes('<meta name="version"')) {
|
37
|
-
html = html.replace(/<head
|
41
|
+
html = html.replace(/<head>/i, `<head>
|
38
42
|
${metaTag}`);
|
39
43
|
}
|
40
|
-
if (!html.includes('
|
41
|
-
html = html.replace(
|
44
|
+
if (options.log !== false && !html.includes('data-injected="unplugin-version-injector"')) {
|
45
|
+
html = html.replace(/<\/body>/i, ` ${logScript}
|
42
46
|
</body>`);
|
43
47
|
}
|
44
48
|
return html;
|
package/dist/vite.js
CHANGED
@@ -35,17 +35,21 @@ function defaultFormatDate(date) {
|
|
35
35
|
function createVersionInjector(options = {}) {
|
36
36
|
var _a, _b;
|
37
37
|
const version = (_a = options.version) != null ? _a : getPackageVersion();
|
38
|
-
((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
38
|
+
const buildTime = ((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
39
39
|
const metaTag = `<meta name="version" content="${version}">
|
40
40
|
`;
|
41
|
-
const logScript =
|
41
|
+
const logScript = `
|
42
|
+
<script data-injected="unplugin-version-injector">
|
43
|
+
console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
44
|
+
console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
45
|
+
</script>`;
|
42
46
|
return function processHtml(html) {
|
43
47
|
if (!html.includes('<meta name="version"')) {
|
44
|
-
html = html.replace(/<head
|
48
|
+
html = html.replace(/<head>/i, `<head>
|
45
49
|
${metaTag}`);
|
46
50
|
}
|
47
|
-
if (!html.includes('
|
48
|
-
html = html.replace(
|
51
|
+
if (options.log !== false && !html.includes('data-injected="unplugin-version-injector"')) {
|
52
|
+
html = html.replace(/<\/body>/i, ` ${logScript}
|
49
53
|
</body>`);
|
50
54
|
}
|
51
55
|
return html;
|
package/dist/vite.mjs
CHANGED
@@ -28,17 +28,21 @@ function defaultFormatDate(date) {
|
|
28
28
|
function createVersionInjector(options = {}) {
|
29
29
|
var _a, _b;
|
30
30
|
const version = (_a = options.version) != null ? _a : getPackageVersion();
|
31
|
-
((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
31
|
+
const buildTime = ((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
32
32
|
const metaTag = `<meta name="version" content="${version}">
|
33
33
|
`;
|
34
|
-
const logScript =
|
34
|
+
const logScript = `
|
35
|
+
<script data-injected="unplugin-version-injector">
|
36
|
+
console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
37
|
+
console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
38
|
+
</script>`;
|
35
39
|
return function processHtml(html) {
|
36
40
|
if (!html.includes('<meta name="version"')) {
|
37
|
-
html = html.replace(/<head
|
41
|
+
html = html.replace(/<head>/i, `<head>
|
38
42
|
${metaTag}`);
|
39
43
|
}
|
40
|
-
if (!html.includes('
|
41
|
-
html = html.replace(
|
44
|
+
if (options.log !== false && !html.includes('data-injected="unplugin-version-injector"')) {
|
45
|
+
html = html.replace(/<\/body>/i, ` ${logScript}
|
42
46
|
</body>`);
|
43
47
|
}
|
44
48
|
return html;
|
package/dist/webpack.js
CHANGED
@@ -2712,17 +2712,21 @@ function defaultFormatDate(date) {
|
|
2712
2712
|
function createVersionInjector(options = {}) {
|
2713
2713
|
var _a, _b;
|
2714
2714
|
const version = (_a = options.version) != null ? _a : getPackageVersion();
|
2715
|
-
((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
2715
|
+
const buildTime = ((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
2716
2716
|
const metaTag = `<meta name="version" content="${version}">
|
2717
2717
|
`;
|
2718
|
-
const logScript =
|
2718
|
+
const logScript = `
|
2719
|
+
<script data-injected="unplugin-version-injector">
|
2720
|
+
console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
2721
|
+
console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
2722
|
+
</script>`;
|
2719
2723
|
return function processHtml(html) {
|
2720
2724
|
if (!html.includes('<meta name="version"')) {
|
2721
|
-
html = html.replace(/<head
|
2725
|
+
html = html.replace(/<head>/i, `<head>
|
2722
2726
|
${metaTag}`);
|
2723
2727
|
}
|
2724
|
-
if (!html.includes('
|
2725
|
-
html = html.replace(
|
2728
|
+
if (options.log !== false && !html.includes('data-injected="unplugin-version-injector"')) {
|
2729
|
+
html = html.replace(/<\/body>/i, ` ${logScript}
|
2726
2730
|
</body>`);
|
2727
2731
|
}
|
2728
2732
|
return html;
|
package/dist/webpack.mjs
CHANGED
@@ -2705,17 +2705,21 @@ function defaultFormatDate(date) {
|
|
2705
2705
|
function createVersionInjector(options = {}) {
|
2706
2706
|
var _a, _b;
|
2707
2707
|
const version = (_a = options.version) != null ? _a : getPackageVersion();
|
2708
|
-
((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
2708
|
+
const buildTime = ((_b = options.formatDate) != null ? _b : defaultFormatDate)(/* @__PURE__ */ new Date());
|
2709
2709
|
const metaTag = `<meta name="version" content="${version}">
|
2710
2710
|
`;
|
2711
|
-
const logScript =
|
2711
|
+
const logScript = `
|
2712
|
+
<script data-injected="unplugin-version-injector">
|
2713
|
+
console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
2714
|
+
console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
|
2715
|
+
</script>`;
|
2712
2716
|
return function processHtml(html) {
|
2713
2717
|
if (!html.includes('<meta name="version"')) {
|
2714
|
-
html = html.replace(/<head
|
2718
|
+
html = html.replace(/<head>/i, `<head>
|
2715
2719
|
${metaTag}`);
|
2716
2720
|
}
|
2717
|
-
if (!html.includes('
|
2718
|
-
html = html.replace(
|
2721
|
+
if (options.log !== false && !html.includes('data-injected="unplugin-version-injector"')) {
|
2722
|
+
html = html.replace(/<\/body>/i, ` ${logScript}
|
2719
2723
|
</body>`);
|
2720
2724
|
}
|
2721
2725
|
return html;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "unplugin-version-injector",
|
3
|
-
"version": "2.0.0-beta.
|
3
|
+
"version": "2.0.0-beta.4",
|
4
4
|
"author": "Nian Yi <nianyi778@gmail.com>",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "A universal plugin to inject version and build time into HTML (supports Webpack, Vite, Rollup)",
|