@backtickjs/core 0.1.3 → 0.1.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/dist/cs.d.ts CHANGED
@@ -4,6 +4,7 @@ import type { Spliceable } from "./Spliceable.js";
4
4
  import type { Spliced } from "./Spliceable.js";
5
5
  declare function lift<T>(_: T): Client<T>;
6
6
  declare function splice<T extends [T] extends [Spliceable] ? unknown : Spliceable>(_: T): unknown extends Spliced<T> ? any : Spliced<T>;
7
+ declare function awaited<T>(_: T): Awaited<T>;
7
8
  /**
8
9
  * The globals a project declares — its libs, `@types`, a `declare global` —
9
10
  * as an ordinary object type: reading one it doesn't declare is an error
@@ -14,6 +15,7 @@ export type GlobalThis = {
14
15
  [Key in keyof typeof globalThis]: (typeof globalThis)[Key];
15
16
  };
16
17
  export declare const cs: ((_strings: TemplateStringsArray, ..._values: unknown[]) => Client<unknown>) & {
18
+ awaited: typeof awaited;
17
19
  create: typeof create;
18
20
  lift: typeof lift;
19
21
  splice: typeof splice;
package/dist/cs.js CHANGED
@@ -13,8 +13,15 @@ function splice(_) {
13
13
  throw new Error("Don't call `cs.splice` directly; it's used to generate virtual " +
14
14
  "code for the typechecker. Write code using cs`...` instead.");
15
15
  }
16
+ // `await`, in a splice the host may await in: what the host's `await` gives,
17
+ // wherever in the script the splice is written.
18
+ function awaited(_) {
19
+ throw new Error("Don't call `cs.awaited` directly; it's used to generate virtual " +
20
+ "code for the typechecker. Write code using cs`...` instead.");
21
+ }
16
22
  // What hangs off the tag.
17
23
  const members = {
24
+ awaited,
18
25
  create,
19
26
  lift,
20
27
  splice,
package/dist/cs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cs.js","sourceRoot":"","sources":["../src/cs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,uBAAuB;AACvB,SAAS,IAAI,CAAI,CAAI;IACnB,MAAM,IAAI,KAAK,CAC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C,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAC7B,CAAC,QAA8B,EAAE,GAAG,OAAkB,EAAmB,EAAE;IACzE,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;AACJ,CAAC,EACD,OAEC,CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backtickjs/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "The cs tag for Backtick client scripts, and the types for the values that cross from server to client",
5
5
  "keywords": [
6
6
  "backtick",
package/src/cs.ts CHANGED
@@ -25,8 +25,18 @@ function splice<T extends [T] extends [Spliceable] ? unknown : Spliceable>(
25
25
  );
26
26
  }
27
27
 
28
+ // `await`, in a splice the host may await in: what the host's `await` gives,
29
+ // wherever in the script the splice is written.
30
+ function awaited<T>(_: T): Awaited<T> {
31
+ throw new Error(
32
+ "Don't call `cs.awaited` directly; it's used to generate virtual " +
33
+ "code for the typechecker. Write code using cs`...` instead.",
34
+ );
35
+ }
36
+
28
37
  // What hangs off the tag.
29
38
  const members = {
39
+ awaited,
30
40
  create,
31
41
  lift,
32
42
  splice,