@hyperframes/parsers 0.8.228 → 0.8.230
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/assetResolution.js +16 -2
- package/package.json +2 -2
package/dist/assetResolution.js
CHANGED
|
@@ -89,6 +89,7 @@ function decodeAuthoredAttribute(value) {
|
|
|
89
89
|
// src/assetResolution.ts
|
|
90
90
|
import { closeSync, constants, existsSync, fstatSync, openSync, readFileSync } from "fs";
|
|
91
91
|
import { isAbsolute as isAbsolute2, join as join2, posix as posix2, relative as relative2, resolve as resolve3, sep } from "path";
|
|
92
|
+
import { fileURLToPath } from "url";
|
|
92
93
|
|
|
93
94
|
// src/utils/urlPath.ts
|
|
94
95
|
function decodeUrlPathVariants(path) {
|
|
@@ -222,8 +223,21 @@ function reanchoredCandidates(variant, baseDir, compiledDir) {
|
|
|
222
223
|
if (!stripped || stripped === variant || stripped.startsWith("..")) return [];
|
|
223
224
|
return compiledDir ? [join2(compiledDir, stripped), join2(baseDir, stripped)] : [join2(baseDir, stripped)];
|
|
224
225
|
}
|
|
226
|
+
function fileUrlAsPath(src) {
|
|
227
|
+
if (!/^file:/i.test(src)) return src;
|
|
228
|
+
try {
|
|
229
|
+
return fileURLToPath(src);
|
|
230
|
+
} catch {
|
|
231
|
+
return src;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function gitBashFile(src) {
|
|
235
|
+
if (process.platform !== "win32" || !/^\/[a-zA-Z]\//.test(src)) return void 0;
|
|
236
|
+
const path = resolve3(`${src[1]}:${src.slice(2)}`);
|
|
237
|
+
return existsSync(path) ? path : void 0;
|
|
238
|
+
}
|
|
225
239
|
function resolveProjectRelativeSrc(src, baseDir, compiledDir) {
|
|
226
|
-
const cleanSrc = cleanAssetUrl(src);
|
|
240
|
+
const cleanSrc = fileUrlAsPath(cleanAssetUrl(src));
|
|
227
241
|
if (isAbsolute2(cleanSrc) && existsSync(cleanSrc)) return cleanSrc;
|
|
228
242
|
const candidates = /* @__PURE__ */ new Set();
|
|
229
243
|
for (const variant of decodeUrlPathVariants(cleanSrc)) {
|
|
@@ -233,7 +247,7 @@ function resolveProjectRelativeSrc(src, baseDir, compiledDir) {
|
|
|
233
247
|
if (compiledDir) candidates.add(join2(compiledDir, variant));
|
|
234
248
|
candidates.add(join2(baseDir, variant));
|
|
235
249
|
}
|
|
236
|
-
return [...candidates].find(existsSync) ?? join2(baseDir, cleanSrc);
|
|
250
|
+
return [...candidates].find(existsSync) ?? gitBashFile(cleanSrc) ?? join2(baseDir, cleanSrc);
|
|
237
251
|
}
|
|
238
252
|
function maskRange(src, pattern) {
|
|
239
253
|
return src.replace(pattern, (m) => " ".repeat(m.length));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/parsers",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.230",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"tsx": "^4.21.0",
|
|
140
140
|
"typescript": "^5.0.0",
|
|
141
141
|
"vitest": "^4.1.11",
|
|
142
|
-
"@hyperframes/core": "0.8.
|
|
142
|
+
"@hyperframes/core": "0.8.230"
|
|
143
143
|
},
|
|
144
144
|
"scripts": {
|
|
145
145
|
"build": "tsup",
|