create-wirejs-app 2.0.11 → 2.0.13

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ Experimental.
2
+
3
+ If this package interests you, contact the author.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wirejs-app",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "Initializes a wirejs package.",
5
5
  "author": "Jon Wire",
6
6
  "license": "MIT",
@@ -17,6 +17,7 @@
17
17
  "files": [
18
18
  "bin.js",
19
19
  "package.json",
20
+ "README.md",
20
21
  "templates/*"
21
22
  ]
22
- }
23
+ }
@@ -8,7 +8,7 @@
8
8
  "prebuild": "wirejs-scripts prebuild-api"
9
9
  },
10
10
  "exports": {
11
- "wirejs:client": "./index.client.js",
12
- "default": "./index.js"
11
+ "wirejs:client": "./dist/index.client.js",
12
+ "default": "./dist/index.js"
13
13
  }
14
- }
14
+ }
@@ -4,4 +4,5 @@ pre-dist
4
4
  temp
5
5
  src/build_id.json
6
6
  api/index.client.js
7
- api/index.js
7
+ api/index.js
8
+ api/dist
@@ -11,10 +11,10 @@
11
11
  "dompurify": "^3.2.3",
12
12
  "marked": "^15.0.6",
13
13
  "wirejs-dom": "^1.0.38",
14
- "wirejs-resources": "^0.1.9-alpha"
14
+ "wirejs-resources": "^0.1.12"
15
15
  },
16
16
  "devDependencies": {
17
- "wirejs-scripts": "^3.0.8",
17
+ "wirejs-scripts": "^3.0.10",
18
18
  "typescript": "^5.7.3"
19
19
  },
20
20
  "scripts": {
@@ -23,4 +23,4 @@
23
23
  "start": "wirejs-scripts start",
24
24
  "build": "wirejs-scripts build"
25
25
  }
26
- }
26
+ }
@@ -5,6 +5,6 @@
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "wirejs-dom": "*",
8
- "my-api": "*"
8
+ "my-api": "*"
9
9
  }
10
- }
10
+ }
@@ -5,32 +5,32 @@ import type { AuthenticationMachineState, Context } from 'wirejs-resources';
5
5
  import { accountMenu } from '../../components/account-menu.js';
6
6
  import { auth, wiki } from 'my-api';
7
7
 
8
- type WithoutNodes<T> = KindaPretty<{
9
- [K in keyof T]: T[K] extends Node
10
- ? T[K] extends { data: any } ? WithoutNodes<T[K]['data']> : undefined
11
- : WithoutNodes<T[K]>
12
- }>
8
+ type WithoutNodes<T> = undefined | (
9
+ T extends object ? {
10
+ [K in keyof T
11
+ as T[K] extends Node ? never : K]: WithoutNodes<T[K]>
12
+ } : T
13
+ );
13
14
 
14
15
  /**
15
16
  * Shallow check for a `data` hydration property. If present, returns the
16
17
  * argument typed according to the given `T`.
17
18
  */
18
- function initData<T extends { data: any }>(arg0: any): WithoutNodes<T['data']> | undefined {
19
- return arg0?.data ? arg0.data : undefined;
19
+ function initData<T>(arg0: any): WithoutNodes<T> | undefined {
20
+ return arg0;
20
21
  }
21
22
 
22
23
  async function Wiki(init: { context?: Context, data?: any }) {
23
- const { context } = init;
24
+ const { context, data } = init;
24
25
 
25
- const data = initData<typeof self>(init);
26
-
27
- console.log('Wiki init', init);
28
26
  const filepath = (context || window).location.pathname;
29
27
 
30
- const content = data?.content || await wiki.read(context, filepath);
28
+ const content: string =
29
+ data?.content ?? await wiki.read(context, filepath);
30
+
31
31
  const initialState: AuthenticationMachineState =
32
- data?.initialAuthState || await auth.getState(context)
33
- ;
32
+ data?.initialAuthState ?? await auth.getState(context);
33
+
34
34
  const accountMenuNode = accountMenu({ api: auth, initialState });
35
35
 
36
36
  let markdown: string = content ?? `This page doesn't exist yet`;
@@ -82,7 +82,7 @@ async function Wiki(init: { context?: Context, data?: any }) {
82
82
  }
83
83
  ${node('editor', invisibleDiv)}
84
84
  ${node('actions', actionsFor(initialState))}
85
- </div>`.extend(self => ({
85
+ </div>`.extend(_ => ({
86
86
  data: {
87
87
  initialAuthState: initialState
88
88
  }