groq 6.7.0-next.36 → 6.7.0-next.4
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/lib/groq.cjs +11 -0
- package/lib/groq.cjs.map +1 -0
- package/{groq.d.ts → lib/groq.d.ts} +3 -4
- package/lib/groq.js +12 -0
- package/lib/groq.js.map +1 -0
- package/package.json +25 -15
- package/groq.cjs +0 -40
- package/groq.d.cts +0 -32
- package/groq.js +0 -34
package/lib/groq.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function defineQuery(query) {
|
|
3
|
+
return query;
|
|
4
|
+
}
|
|
5
|
+
function groq(strings, ...keys) {
|
|
6
|
+
const lastIndex = strings.length - 1;
|
|
7
|
+
return strings.slice(0, lastIndex).reduce((acc, str, i) => acc + str + keys[i], "") + strings[lastIndex];
|
|
8
|
+
}
|
|
9
|
+
module.exports = groq;
|
|
10
|
+
Object.assign(module.exports, { defineQuery });
|
|
11
|
+
//# sourceMappingURL=groq.cjs.map
|
package/lib/groq.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groq.cjs","sources":["../src/define.ts","../src/groq.ts","../src/_exports.cts.ts"],"sourcesContent":["/**\n * Define a GROQ query. This is a no-op, but it helps editor integrations\n * understand that a string represents a GROQ query in order to provide syntax highlighting\n * and other features.\n *\n * Ideally the `groq` template tag would be used, but we cannot infer types from it until\n * microsoft/TypeScript#33304 is resolved. Otherwise, there is no difference between this\n * and the `groq` template tag.\n *\n * @param query - The GROQ query\n * @returns The same string as the input\n * @public\n */\nexport function defineQuery<const Q extends string>(query: Q): Q {\n return query\n}\n","/**\n * Pass-through groq template tag. This is a no-op, but it helps editor integrations\n * understand that a string represents a GROQ query in order to provide syntax highlighting\n * and other features.\n *\n * @param strings - Template string parts\n * @param keys - Template string keys\n * @returns The same string as the input\n * @public\n */\nexport function groq(strings: TemplateStringsArray, ...keys: any[]): string {\n const lastIndex = strings.length - 1\n return (\n strings.slice(0, lastIndex).reduce((acc, str, i) => {\n return acc + str + keys[i]\n }, '') + strings[lastIndex]\n )\n}\n","import {defineQuery} from './define'\nimport {groq} from './groq'\n\nmodule.exports = groq\n\nObject.assign(module.exports, {defineQuery})\n\n/**\n * This is just to fix the typegen for the CJS export, as TS won't pick up on `module.exports` syntax when the package.json has `type: \"module\"`\n */\nexport type {groq as default, defineQuery}\n"],"names":[],"mappings":";AAaO,SAAS,YAAoC,OAAa;AAC/D,SAAO;AACT;ACLO,SAAS,KAAK,YAAkC,MAAqB;AAC1E,QAAM,YAAY,QAAQ,SAAS;AACnC,SACE,QAAQ,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,KAAK,KAAK,MACrC,MAAM,MAAM,KAAK,CAAC,GACxB,EAAE,IAAI,QAAQ,SAAS;AAE9B;ACdA,OAAO,UAAU;AAEjB,OAAO,OAAO,OAAO,SAAS,EAAC,aAAY;"}
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
* @returns The same string as the input
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
declare function defineQuery<const Q extends string>(query: Q): Q;
|
|
16
15
|
/**
|
|
17
16
|
* Pass-through groq template tag. This is a no-op, but it helps editor integrations
|
|
18
17
|
* understand that a string represents a GROQ query in order to provide syntax highlighting
|
|
@@ -23,5 +22,5 @@ export declare function defineQuery<const Q extends string>(query: Q): Q
|
|
|
23
22
|
* @returns The same string as the input
|
|
24
23
|
* @public
|
|
25
24
|
*/
|
|
26
|
-
declare function groq(strings: TemplateStringsArray, ...keys: any[]): string
|
|
27
|
-
export default
|
|
25
|
+
declare function groq(strings: TemplateStringsArray, ...keys: any[]): string;
|
|
26
|
+
export { groq as default, defineQuery };
|
package/lib/groq.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function defineQuery(query) {
|
|
2
|
+
return query;
|
|
3
|
+
}
|
|
4
|
+
function groq(strings, ...keys) {
|
|
5
|
+
const lastIndex = strings.length - 1;
|
|
6
|
+
return strings.slice(0, lastIndex).reduce((acc, str, i) => acc + str + keys[i], "") + strings[lastIndex];
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
groq as default,
|
|
10
|
+
defineQuery
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=groq.js.map
|
package/lib/groq.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groq.js","sources":["../src/define.ts","../src/groq.ts"],"sourcesContent":["/**\n * Define a GROQ query. This is a no-op, but it helps editor integrations\n * understand that a string represents a GROQ query in order to provide syntax highlighting\n * and other features.\n *\n * Ideally the `groq` template tag would be used, but we cannot infer types from it until\n * microsoft/TypeScript#33304 is resolved. Otherwise, there is no difference between this\n * and the `groq` template tag.\n *\n * @param query - The GROQ query\n * @returns The same string as the input\n * @public\n */\nexport function defineQuery<const Q extends string>(query: Q): Q {\n return query\n}\n","/**\n * Pass-through groq template tag. This is a no-op, but it helps editor integrations\n * understand that a string represents a GROQ query in order to provide syntax highlighting\n * and other features.\n *\n * @param strings - Template string parts\n * @param keys - Template string keys\n * @returns The same string as the input\n * @public\n */\nexport function groq(strings: TemplateStringsArray, ...keys: any[]): string {\n const lastIndex = strings.length - 1\n return (\n strings.slice(0, lastIndex).reduce((acc, str, i) => {\n return acc + str + keys[i]\n }, '') + strings[lastIndex]\n )\n}\n"],"names":[],"mappings":"AAaO,SAAS,YAAoC,OAAa;AAC/D,SAAO;AACT;ACLO,SAAS,KAAK,YAAkC,MAAqB;AAC1E,QAAM,YAAY,QAAQ,SAAS;AACnC,SACE,QAAQ,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,KAAK,KAAK,MACrC,MAAM,MAAM,KAAK,CAAC,GACxB,EAAE,IAAI,QAAQ,SAAS;AAE9B;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "groq",
|
|
3
|
-
"version": "6.7.0-next.
|
|
3
|
+
"version": "6.7.0-next.4",
|
|
4
4
|
"description": "Tagged template literal for Sanity.io GROQ-queries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -26,31 +26,41 @@
|
|
|
26
26
|
"directory": "packages/groq"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
|
-
"
|
|
30
|
-
"groq.d.cts",
|
|
31
|
-
"groq.d.ts",
|
|
32
|
-
"groq.js"
|
|
29
|
+
"lib"
|
|
33
30
|
],
|
|
34
31
|
"type": "module",
|
|
35
32
|
"sideEffects": false,
|
|
36
|
-
"main": "./groq.cjs",
|
|
37
|
-
"module": "./groq.js",
|
|
38
|
-
"types": "./groq.d.ts",
|
|
33
|
+
"main": "./lib/groq.cjs",
|
|
34
|
+
"module": "./lib/groq.js",
|
|
35
|
+
"types": "./lib/groq.d.ts",
|
|
39
36
|
"exports": {
|
|
40
37
|
".": {
|
|
41
|
-
"require":
|
|
42
|
-
|
|
43
|
-
"default": "./groq.cjs"
|
|
44
|
-
},
|
|
45
|
-
"types": "./groq.d.ts",
|
|
46
|
-
"default": "./groq.js"
|
|
38
|
+
"require": "./lib/groq.cjs",
|
|
39
|
+
"default": "./lib/groq.js"
|
|
47
40
|
},
|
|
48
41
|
"./package.json": "./package.json"
|
|
49
42
|
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@sanity/pkg-utils": "^11.0.13",
|
|
45
|
+
"@types/node": "^24.13.2",
|
|
46
|
+
"@typescript/native-preview": "beta",
|
|
47
|
+
"rimraf": "^6.1.3",
|
|
48
|
+
"@repo/package.config": "6.7.0-next.4+90f00c55da",
|
|
49
|
+
"@repo/tsconfig": "6.7.0-next.4+90f00c55da"
|
|
50
|
+
},
|
|
51
|
+
"browserslist": [
|
|
52
|
+
"node >=22.12",
|
|
53
|
+
"baseline 2024"
|
|
54
|
+
],
|
|
50
55
|
"engines": {
|
|
51
56
|
"node": ">=22.12"
|
|
52
57
|
},
|
|
53
58
|
"scripts": {
|
|
54
|
-
"
|
|
59
|
+
"build": "pkg-utils build --strict --check --clean && rimraf lib/groq.d.cts",
|
|
60
|
+
"check:types": "(cd ../.. && tsgo --project packages/groq/tsconfig.lib.json --erasableSyntaxOnly)",
|
|
61
|
+
"clean": "rimraf lib",
|
|
62
|
+
"pretest": "run-s build",
|
|
63
|
+
"test": "node --test",
|
|
64
|
+
"watch": "pkg-utils watch"
|
|
55
65
|
}
|
|
56
66
|
}
|
package/groq.cjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Define a GROQ query. This is a no-op, but it helps editor integrations
|
|
5
|
-
* understand that a string represents a GROQ query in order to provide syntax highlighting
|
|
6
|
-
* and other features.
|
|
7
|
-
*
|
|
8
|
-
* Ideally the `groq` template tag would be used, but we cannot infer types from it until
|
|
9
|
-
* microsoft/TypeScript#33304 is resolved. Otherwise, there is no difference between this
|
|
10
|
-
* and the `groq` template tag.
|
|
11
|
-
*
|
|
12
|
-
* @param query - The GROQ query
|
|
13
|
-
* @returns The same string as the input
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
function defineQuery(query) {
|
|
17
|
-
return query
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Pass-through groq template tag. This is a no-op, but it helps editor integrations
|
|
22
|
-
* understand that a string represents a GROQ query in order to provide syntax highlighting
|
|
23
|
-
* and other features.
|
|
24
|
-
*
|
|
25
|
-
* @param strings - Template string parts
|
|
26
|
-
* @param keys - Template string keys
|
|
27
|
-
* @returns The same string as the input
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
function groq(strings, ...keys) {
|
|
31
|
-
const lastIndex = strings.length - 1
|
|
32
|
-
return (
|
|
33
|
-
strings.slice(0, lastIndex).reduce((acc, str, i) => acc + str + keys[i], '') +
|
|
34
|
-
strings[lastIndex]
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// `require('groq')` returns the tag function itself
|
|
39
|
-
module.exports = groq
|
|
40
|
-
module.exports.defineQuery = defineQuery
|
package/groq.d.cts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pass-through groq template tag. This is a no-op, but it helps editor integrations
|
|
3
|
-
* understand that a string represents a GROQ query in order to provide syntax highlighting
|
|
4
|
-
* and other features.
|
|
5
|
-
*
|
|
6
|
-
* `require('groq')` returns this function itself, with {@link groq.defineQuery} attached.
|
|
7
|
-
*
|
|
8
|
-
* @param strings - Template string parts
|
|
9
|
-
* @param keys - Template string keys
|
|
10
|
-
* @returns The same string as the input
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
declare function groq(strings: TemplateStringsArray, ...keys: any[]): string
|
|
14
|
-
|
|
15
|
-
declare namespace groq {
|
|
16
|
-
/**
|
|
17
|
-
* Define a GROQ query. This is a no-op, but it helps editor integrations
|
|
18
|
-
* understand that a string represents a GROQ query in order to provide syntax highlighting
|
|
19
|
-
* and other features.
|
|
20
|
-
*
|
|
21
|
-
* Ideally the `groq` template tag would be used, but we cannot infer types from it until
|
|
22
|
-
* microsoft/TypeScript#33304 is resolved. Otherwise, there is no difference between this
|
|
23
|
-
* and the `groq` template tag.
|
|
24
|
-
*
|
|
25
|
-
* @param query - The GROQ query
|
|
26
|
-
* @returns The same string as the input
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export function defineQuery<const Q extends string>(query: Q): Q
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export = groq
|
package/groq.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Define a GROQ query. This is a no-op, but it helps editor integrations
|
|
3
|
-
* understand that a string represents a GROQ query in order to provide syntax highlighting
|
|
4
|
-
* and other features.
|
|
5
|
-
*
|
|
6
|
-
* Ideally the `groq` template tag would be used, but we cannot infer types from it until
|
|
7
|
-
* microsoft/TypeScript#33304 is resolved. Otherwise, there is no difference between this
|
|
8
|
-
* and the `groq` template tag.
|
|
9
|
-
*
|
|
10
|
-
* @param query - The GROQ query
|
|
11
|
-
* @returns The same string as the input
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export function defineQuery(query) {
|
|
15
|
-
return query
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Pass-through groq template tag. This is a no-op, but it helps editor integrations
|
|
20
|
-
* understand that a string represents a GROQ query in order to provide syntax highlighting
|
|
21
|
-
* and other features.
|
|
22
|
-
*
|
|
23
|
-
* @param strings - Template string parts
|
|
24
|
-
* @param keys - Template string keys
|
|
25
|
-
* @returns The same string as the input
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
export default function groq(strings, ...keys) {
|
|
29
|
-
const lastIndex = strings.length - 1
|
|
30
|
-
return (
|
|
31
|
-
strings.slice(0, lastIndex).reduce((acc, str, i) => acc + str + keys[i], '') +
|
|
32
|
-
strings[lastIndex]
|
|
33
|
-
)
|
|
34
|
-
}
|