@open-xchange/vite-plugin-project-meta 0.0.2 → 0.0.3
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/CHANGELOG.md +4 -0
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
9
10
|
// constants ==================================================================
|
|
10
11
|
export const PROJECT_NAME = "@open-xchange/vite-plugin-project-meta";
|
|
11
12
|
// plugin =====================================================================
|
|
@@ -49,11 +50,10 @@ export default function vitePluginProjectMeta(options) {
|
|
|
49
50
|
if (!context.bundle) {
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
53
|
+
const hash = createHash("md5").update(metadata.builddate).digest("hex");
|
|
54
|
+
const len = Number.parseInt(hash.slice(0, 4), 16) % 99 + 42;
|
|
55
|
+
const count = Math.ceil(len / hash.length);
|
|
56
|
+
const content = hash.repeat(count).slice(0, len);
|
|
57
57
|
return [{
|
|
58
58
|
tag: "meta",
|
|
59
59
|
attrs: { name: "etag-fix", content },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/vite-plugin-project-meta",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Vite plugin providing a virtual import for project metadata",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://gitlab.open-xchange.com/fspd/npm-packages/vite-plugin-project-meta"
|