@lingo.dev/_compiler 0.8.9 → 0.8.10
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/build/index.cjs +20 -6
- package/build/index.mjs +20 -6
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ var _unplugin = require('unplugin');
|
|
|
27
27
|
// package.json
|
|
28
28
|
var package_default = {
|
|
29
29
|
name: "@lingo.dev/_compiler",
|
|
30
|
-
version: "0.8.
|
|
30
|
+
version: "0.8.10",
|
|
31
31
|
description: "Lingo.dev Compiler",
|
|
32
32
|
private: false,
|
|
33
33
|
repository: {
|
|
@@ -115,7 +115,17 @@ var _nodemachineid = require('node-machine-id'); var machineIdLib = _interopRequ
|
|
|
115
115
|
|
|
116
116
|
// src/utils/repository-id.ts
|
|
117
117
|
var _child_process = require('child_process');
|
|
118
|
+
var _crypto = require('crypto');
|
|
118
119
|
var cachedGitRepoId = void 0;
|
|
120
|
+
function hashProjectName(fullPath) {
|
|
121
|
+
const parts = fullPath.split("/");
|
|
122
|
+
if (parts.length !== 2) {
|
|
123
|
+
return _crypto.createHash.call(void 0, "sha256").update(fullPath).digest("hex").slice(0, 8);
|
|
124
|
+
}
|
|
125
|
+
const [org, project] = parts;
|
|
126
|
+
const hashedProject = _crypto.createHash.call(void 0, "sha256").update(project).digest("hex").slice(0, 8);
|
|
127
|
+
return `${org}/${hashedProject}`;
|
|
128
|
+
}
|
|
119
129
|
function getRepositoryId() {
|
|
120
130
|
const ciRepoId = getCIRepositoryId();
|
|
121
131
|
if (ciRepoId) return ciRepoId;
|
|
@@ -125,13 +135,16 @@ function getRepositoryId() {
|
|
|
125
135
|
}
|
|
126
136
|
function getCIRepositoryId() {
|
|
127
137
|
if (process.env.GITHUB_REPOSITORY) {
|
|
128
|
-
|
|
138
|
+
const hashed = hashProjectName(process.env.GITHUB_REPOSITORY);
|
|
139
|
+
return `github:${hashed}`;
|
|
129
140
|
}
|
|
130
141
|
if (process.env.CI_PROJECT_PATH) {
|
|
131
|
-
|
|
142
|
+
const hashed = hashProjectName(process.env.CI_PROJECT_PATH);
|
|
143
|
+
return `gitlab:${hashed}`;
|
|
132
144
|
}
|
|
133
145
|
if (process.env.BITBUCKET_REPO_FULL_NAME) {
|
|
134
|
-
|
|
146
|
+
const hashed = hashProjectName(process.env.BITBUCKET_REPO_FULL_NAME);
|
|
147
|
+
return `bitbucket:${hashed}`;
|
|
135
148
|
}
|
|
136
149
|
return null;
|
|
137
150
|
}
|
|
@@ -169,10 +182,11 @@ function parseGitUrl(url) {
|
|
|
169
182
|
const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
|
|
170
183
|
const repoPath = _optionalChain([sshMatch, 'optionalAccess', _2 => _2[1]]) || _optionalChain([httpsMatch, 'optionalAccess', _3 => _3[1]]);
|
|
171
184
|
if (!repoPath) return null;
|
|
185
|
+
const hashedPath = hashProjectName(repoPath);
|
|
172
186
|
if (platform) {
|
|
173
|
-
return `${platform}:${
|
|
187
|
+
return `${platform}:${hashedPath}`;
|
|
174
188
|
}
|
|
175
|
-
return `git:${
|
|
189
|
+
return `git:${hashedPath}`;
|
|
176
190
|
}
|
|
177
191
|
|
|
178
192
|
// src/utils/observability.ts
|
package/build/index.mjs
CHANGED
|
@@ -27,7 +27,7 @@ import { createUnplugin } from "unplugin";
|
|
|
27
27
|
// package.json
|
|
28
28
|
var package_default = {
|
|
29
29
|
name: "@lingo.dev/_compiler",
|
|
30
|
-
version: "0.8.
|
|
30
|
+
version: "0.8.10",
|
|
31
31
|
description: "Lingo.dev Compiler",
|
|
32
32
|
private: false,
|
|
33
33
|
repository: {
|
|
@@ -115,7 +115,17 @@ import * as machineIdLib from "node-machine-id";
|
|
|
115
115
|
|
|
116
116
|
// src/utils/repository-id.ts
|
|
117
117
|
import { execSync } from "child_process";
|
|
118
|
+
import { createHash } from "crypto";
|
|
118
119
|
var cachedGitRepoId = void 0;
|
|
120
|
+
function hashProjectName(fullPath) {
|
|
121
|
+
const parts = fullPath.split("/");
|
|
122
|
+
if (parts.length !== 2) {
|
|
123
|
+
return createHash("sha256").update(fullPath).digest("hex").slice(0, 8);
|
|
124
|
+
}
|
|
125
|
+
const [org, project] = parts;
|
|
126
|
+
const hashedProject = createHash("sha256").update(project).digest("hex").slice(0, 8);
|
|
127
|
+
return `${org}/${hashedProject}`;
|
|
128
|
+
}
|
|
119
129
|
function getRepositoryId() {
|
|
120
130
|
const ciRepoId = getCIRepositoryId();
|
|
121
131
|
if (ciRepoId) return ciRepoId;
|
|
@@ -125,13 +135,16 @@ function getRepositoryId() {
|
|
|
125
135
|
}
|
|
126
136
|
function getCIRepositoryId() {
|
|
127
137
|
if (process.env.GITHUB_REPOSITORY) {
|
|
128
|
-
|
|
138
|
+
const hashed = hashProjectName(process.env.GITHUB_REPOSITORY);
|
|
139
|
+
return `github:${hashed}`;
|
|
129
140
|
}
|
|
130
141
|
if (process.env.CI_PROJECT_PATH) {
|
|
131
|
-
|
|
142
|
+
const hashed = hashProjectName(process.env.CI_PROJECT_PATH);
|
|
143
|
+
return `gitlab:${hashed}`;
|
|
132
144
|
}
|
|
133
145
|
if (process.env.BITBUCKET_REPO_FULL_NAME) {
|
|
134
|
-
|
|
146
|
+
const hashed = hashProjectName(process.env.BITBUCKET_REPO_FULL_NAME);
|
|
147
|
+
return `bitbucket:${hashed}`;
|
|
135
148
|
}
|
|
136
149
|
return null;
|
|
137
150
|
}
|
|
@@ -169,10 +182,11 @@ function parseGitUrl(url) {
|
|
|
169
182
|
const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
|
|
170
183
|
const repoPath = sshMatch?.[1] || httpsMatch?.[1];
|
|
171
184
|
if (!repoPath) return null;
|
|
185
|
+
const hashedPath = hashProjectName(repoPath);
|
|
172
186
|
if (platform) {
|
|
173
|
-
return `${platform}:${
|
|
187
|
+
return `${platform}:${hashedPath}`;
|
|
174
188
|
}
|
|
175
|
-
return `git:${
|
|
189
|
+
return `git:${hashedPath}`;
|
|
176
190
|
}
|
|
177
191
|
|
|
178
192
|
// src/utils/observability.ts
|