@sanity/export 6.0.4 → 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.
package/bin/detect-corrupt.js
CHANGED
|
@@ -58,7 +58,13 @@ function printReport(filename, corruptions) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
async function main() {
|
|
61
|
-
|
|
61
|
+
let args = process.argv.slice(2)
|
|
62
|
+
|
|
63
|
+
// When called via `npx @sanity/export detect-corrupt`, the command name
|
|
64
|
+
// is passed as the first argument. Skip it if present.
|
|
65
|
+
if (args[0] === 'detect-corrupt') {
|
|
66
|
+
args = args.slice(1)
|
|
67
|
+
}
|
|
62
68
|
|
|
63
69
|
if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
|
|
64
70
|
printUsage()
|
|
@@ -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
|
}
|