unplugin-version-injector 2.1.0-beta.0 → 2.1.0-beta.2

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 CHANGED
@@ -41,9 +41,19 @@ function createVersionInjector(options = {}) {
41
41
  `;
42
42
  const logScript = `
43
43
  <script data-injected="unplugin-version-injector">
44
- console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
45
- console.log("%c Version: ${name} ", "background: #222; color:rgb(0, 128, 255); font-size: 12px; padding: 4px; border-radius: 4px;");
46
- console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
44
+ (function () {
45
+ var isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
46
+ var bg = isDark ? '#ffffff' : '#1e1e1e' ;
47
+ var border = 'border-radius: 4px; padding: 4px; font-size: 12px;';
48
+ var styles = {
49
+ version: \`background: \${bg}; color: #00c853; \${border}\`,
50
+ name: \`background: \${bg}; color: #1e88e5; \${border}\`,
51
+ time: \`background: \${bg}; color: #ffab00; \${border}\`,
52
+ };
53
+ console.log("%c Version: ${version} ", styles.version);
54
+ console.log("%c Project: ${name} ", styles.name);
55
+ console.log("%c Build Time: ${buildTime} ", styles.time);
56
+ })();
47
57
  </script>`;
48
58
  return function processHtml(html) {
49
59
  if (!html.includes('<meta name="version"')) {
package/dist/rollup.mjs CHANGED
@@ -34,9 +34,19 @@ function createVersionInjector(options = {}) {
34
34
  `;
35
35
  const logScript = `
36
36
  <script data-injected="unplugin-version-injector">
37
- console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
38
- console.log("%c Version: ${name} ", "background: #222; color:rgb(0, 128, 255); font-size: 12px; padding: 4px; border-radius: 4px;");
39
- console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
37
+ (function () {
38
+ var isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
39
+ var bg = isDark ? '#ffffff' : '#1e1e1e' ;
40
+ var border = 'border-radius: 4px; padding: 4px; font-size: 12px;';
41
+ var styles = {
42
+ version: \`background: \${bg}; color: #00c853; \${border}\`,
43
+ name: \`background: \${bg}; color: #1e88e5; \${border}\`,
44
+ time: \`background: \${bg}; color: #ffab00; \${border}\`,
45
+ };
46
+ console.log("%c Version: ${version} ", styles.version);
47
+ console.log("%c Project: ${name} ", styles.name);
48
+ console.log("%c Build Time: ${buildTime} ", styles.time);
49
+ })();
40
50
  </script>`;
41
51
  return function processHtml(html) {
42
52
  if (!html.includes('<meta name="version"')) {
package/dist/vite.js CHANGED
@@ -41,9 +41,19 @@ function createVersionInjector(options = {}) {
41
41
  `;
42
42
  const logScript = `
43
43
  <script data-injected="unplugin-version-injector">
44
- console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
45
- console.log("%c Version: ${name} ", "background: #222; color:rgb(0, 128, 255); font-size: 12px; padding: 4px; border-radius: 4px;");
46
- console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
44
+ (function () {
45
+ var isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
46
+ var bg = isDark ? '#ffffff' : '#1e1e1e' ;
47
+ var border = 'border-radius: 4px; padding: 4px; font-size: 12px;';
48
+ var styles = {
49
+ version: \`background: \${bg}; color: #00c853; \${border}\`,
50
+ name: \`background: \${bg}; color: #1e88e5; \${border}\`,
51
+ time: \`background: \${bg}; color: #ffab00; \${border}\`,
52
+ };
53
+ console.log("%c Version: ${version} ", styles.version);
54
+ console.log("%c Project: ${name} ", styles.name);
55
+ console.log("%c Build Time: ${buildTime} ", styles.time);
56
+ })();
47
57
  </script>`;
48
58
  return function processHtml(html) {
49
59
  if (!html.includes('<meta name="version"')) {
package/dist/vite.mjs CHANGED
@@ -34,9 +34,19 @@ function createVersionInjector(options = {}) {
34
34
  `;
35
35
  const logScript = `
36
36
  <script data-injected="unplugin-version-injector">
37
- console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
38
- console.log("%c Version: ${name} ", "background: #222; color:rgb(0, 128, 255); font-size: 12px; padding: 4px; border-radius: 4px;");
39
- console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
37
+ (function () {
38
+ var isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
39
+ var bg = isDark ? '#ffffff' : '#1e1e1e' ;
40
+ var border = 'border-radius: 4px; padding: 4px; font-size: 12px;';
41
+ var styles = {
42
+ version: \`background: \${bg}; color: #00c853; \${border}\`,
43
+ name: \`background: \${bg}; color: #1e88e5; \${border}\`,
44
+ time: \`background: \${bg}; color: #ffab00; \${border}\`,
45
+ };
46
+ console.log("%c Version: ${version} ", styles.version);
47
+ console.log("%c Project: ${name} ", styles.name);
48
+ console.log("%c Build Time: ${buildTime} ", styles.time);
49
+ })();
40
50
  </script>`;
41
51
  return function processHtml(html) {
42
52
  if (!html.includes('<meta name="version"')) {
package/dist/webpack.js CHANGED
@@ -2718,9 +2718,19 @@ function createVersionInjector(options = {}) {
2718
2718
  `;
2719
2719
  const logScript = `
2720
2720
  <script data-injected="unplugin-version-injector">
2721
- console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
2722
- console.log("%c Version: ${name} ", "background: #222; color:rgb(0, 128, 255); font-size: 12px; padding: 4px; border-radius: 4px;");
2723
- console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
2721
+ (function () {
2722
+ var isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
2723
+ var bg = isDark ? '#ffffff' : '#1e1e1e' ;
2724
+ var border = 'border-radius: 4px; padding: 4px; font-size: 12px;';
2725
+ var styles = {
2726
+ version: \`background: \${bg}; color: #00c853; \${border}\`,
2727
+ name: \`background: \${bg}; color: #1e88e5; \${border}\`,
2728
+ time: \`background: \${bg}; color: #ffab00; \${border}\`,
2729
+ };
2730
+ console.log("%c Version: ${version} ", styles.version);
2731
+ console.log("%c Project: ${name} ", styles.name);
2732
+ console.log("%c Build Time: ${buildTime} ", styles.time);
2733
+ })();
2724
2734
  </script>`;
2725
2735
  return function processHtml(html) {
2726
2736
  if (!html.includes('<meta name="version"')) {
package/dist/webpack.mjs CHANGED
@@ -2711,9 +2711,19 @@ function createVersionInjector(options = {}) {
2711
2711
  `;
2712
2712
  const logScript = `
2713
2713
  <script data-injected="unplugin-version-injector">
2714
- console.log("%c Version: ${version} ", "background: #222; color: #00ff00; font-size: 12px; padding: 4px; border-radius: 4px;");
2715
- console.log("%c Version: ${name} ", "background: #222; color:rgb(0, 128, 255); font-size: 12px; padding: 4px; border-radius: 4px;");
2716
- console.log("%c Build Time: ${buildTime} ", "background: #222; color: #ffcc00; font-size: 12px; padding: 4px; border-radius: 4px;");
2714
+ (function () {
2715
+ var isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
2716
+ var bg = isDark ? '#ffffff' : '#1e1e1e' ;
2717
+ var border = 'border-radius: 4px; padding: 4px; font-size: 12px;';
2718
+ var styles = {
2719
+ version: \`background: \${bg}; color: #00c853; \${border}\`,
2720
+ name: \`background: \${bg}; color: #1e88e5; \${border}\`,
2721
+ time: \`background: \${bg}; color: #ffab00; \${border}\`,
2722
+ };
2723
+ console.log("%c Version: ${version} ", styles.version);
2724
+ console.log("%c Project: ${name} ", styles.name);
2725
+ console.log("%c Build Time: ${buildTime} ", styles.time);
2726
+ })();
2717
2727
  </script>`;
2718
2728
  return function processHtml(html) {
2719
2729
  if (!html.includes('<meta name="version"')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-version-injector",
3
- "version": "2.1.0-beta.0",
3
+ "version": "2.1.0-beta.2",
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)",