@sanity/export 6.0.5 → 6.0.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserAgent.d.ts","sourceRoot":"","sources":["../src/getUserAgent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getUserAgent.d.ts","sourceRoot":"","sources":["../src/getUserAgent.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,IAAI,MAAM,CASrC"}
|
package/dist/getUserAgent.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join as joinPath } from 'node:path';
|
|
2
|
+
import { dirname, join as joinPath } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
3
4
|
let ua = null;
|
|
4
5
|
export function getUserAgent() {
|
|
5
6
|
if (!ua) {
|
|
6
|
-
const
|
|
7
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const data = readFileSync(joinPath(dir, '..', 'package.json'), 'utf-8');
|
|
7
9
|
const pkg = JSON.parse(data);
|
|
8
10
|
ua = `${pkg.name}@${pkg.version}`;
|
|
9
11
|
}
|
package/dist/getUserAgent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserAgent.js","sourceRoot":"","sources":["../src/getUserAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAA;AACpC,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"getUserAgent.js","sourceRoot":"","sources":["../src/getUserAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAA;AACpC,OAAO,EAAC,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAC,MAAM,WAAW,CAAA;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAOtC,IAAI,EAAE,GAAkB,IAAI,CAAA;AAE5B,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,MAAM,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACnD,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAA;QACvE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAgB,CAAA;QAC3C,EAAE,GAAG,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAA;IACnC,CAAC;IAED,OAAO,EAAE,CAAA;AACX,CAAC"}
|
package/package.json
CHANGED
package/src/getUserAgent.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {readFileSync} from 'node:fs'
|
|
2
|
-
import {join as joinPath} from 'node:path'
|
|
2
|
+
import {dirname, join as joinPath} from 'node:path'
|
|
3
|
+
import {fileURLToPath} from 'node:url'
|
|
3
4
|
|
|
4
5
|
interface PackageJson {
|
|
5
6
|
name: string
|
|
@@ -10,7 +11,8 @@ let ua: string | null = null
|
|
|
10
11
|
|
|
11
12
|
export function getUserAgent(): string {
|
|
12
13
|
if (!ua) {
|
|
13
|
-
const
|
|
14
|
+
const dir = dirname(fileURLToPath(import.meta.url))
|
|
15
|
+
const data = readFileSync(joinPath(dir, '..', 'package.json'), 'utf-8')
|
|
14
16
|
const pkg = JSON.parse(data) as PackageJson
|
|
15
17
|
ua = `${pkg.name}@${pkg.version}`
|
|
16
18
|
}
|