groq 6.7.0-next.18 → 6.7.0-next.19

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/groq.cjs ADDED
@@ -0,0 +1,40 @@
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 ADDED
@@ -0,0 +1,32 @@
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
@@ -11,7 +11,8 @@
11
11
  * @returns The same string as the input
12
12
  * @public
13
13
  */
14
- declare function defineQuery<const Q extends string>(query: Q): Q;
14
+ export declare function defineQuery<const Q extends string>(query: Q): Q
15
+
15
16
  /**
16
17
  * Pass-through groq template tag. This is a no-op, but it helps editor integrations
17
18
  * understand that a string represents a GROQ query in order to provide syntax highlighting
@@ -22,5 +23,5 @@ declare function defineQuery<const Q extends string>(query: Q): Q;
22
23
  * @returns The same string as the input
23
24
  * @public
24
25
  */
25
- declare function groq(strings: TemplateStringsArray, ...keys: any[]): string;
26
- export { groq as default, defineQuery };
26
+ declare function groq(strings: TemplateStringsArray, ...keys: any[]): string
27
+ export default groq
package/groq.js ADDED
@@ -0,0 +1,34 @@
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groq",
3
- "version": "6.7.0-next.18",
3
+ "version": "6.7.0-next.19",
4
4
  "description": "Tagged template literal for Sanity.io GROQ-queries",
5
5
  "keywords": [
6
6
  "cms",
@@ -26,41 +26,31 @@
26
26
  "directory": "packages/groq"
27
27
  },
28
28
  "files": [
29
- "lib"
29
+ "groq.cjs",
30
+ "groq.d.cts",
31
+ "groq.d.ts",
32
+ "groq.js"
30
33
  ],
31
34
  "type": "module",
32
35
  "sideEffects": false,
33
- "main": "./lib/groq.cjs",
34
- "module": "./lib/groq.js",
35
- "types": "./lib/groq.d.ts",
36
+ "main": "./groq.cjs",
37
+ "module": "./groq.js",
38
+ "types": "./groq.d.ts",
36
39
  "exports": {
37
40
  ".": {
38
- "require": "./lib/groq.cjs",
39
- "default": "./lib/groq.js"
41
+ "require": {
42
+ "types": "./groq.d.cts",
43
+ "default": "./groq.cjs"
44
+ },
45
+ "types": "./groq.d.ts",
46
+ "default": "./groq.js"
40
47
  },
41
48
  "./package.json": "./package.json"
42
49
  },
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.18+5487131ffd",
49
- "@repo/tsconfig": "6.7.0-next.18+5487131ffd"
50
- },
51
- "browserslist": [
52
- "node >=22.12",
53
- "baseline 2024"
54
- ],
55
50
  "engines": {
56
51
  "node": ">=22.12"
57
52
  },
58
53
  "scripts": {
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"
54
+ "test": "node --test"
65
55
  }
66
56
  }
package/lib/groq.cjs DELETED
@@ -1,11 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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;"}
package/lib/groq.js DELETED
@@ -1,12 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
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;"}