acrylblends 0.7.4 → 0.7.5
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/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/docs/framework/README.md +2 -1
- package/docs/framework/UPSTREAM.md +1 -1
- package/docs/framework/getting-started/deploy.md +5 -5
- package/docs/framework/getting-started/service-worker.md +5 -3
- package/docs/framework/guides/create-acrylblends.md +2 -2
- package/docs/framework/guides/data.md +202 -0
- package/docs/framework/guides/forms-and-sessions.md +34 -30
- package/docs/framework/upstream.json +3 -3
- package/lib/db/sqlite.d.ts +27 -0
- package/lib/db/sqlite.js +197 -0
- package/lib/db.d.ts +2 -0
- package/lib/db.js +2 -0
- package/lib/index-D4FAsBZu.d.ts +85 -0
- package/lib/src-MWcsMS8i.js +85 -0
- package/package.json +9 -1
- package/plugins/acryl-db/LICENSE +47 -0
- package/plugins/acryl-db/plugin.json +12 -0
- package/plugins/acryl-db/src/cordis.ts +13 -0
- package/plugins/acryl-db/src/facade/database.ts +41 -0
- package/plugins/acryl-db/src/facade/migrations.ts +50 -0
- package/plugins/acryl-db/src/facade/schema.ts +9 -0
- package/plugins/acryl-db/src/index.ts +19 -0
- package/plugins/acryl-db/src/migration-files.ts +31 -0
- package/plugins/acryl-db/upstream.json +18 -0
- package/plugins/acryl-db-sqlite/LICENSE +47 -0
- package/plugins/acryl-db-sqlite/plugin.json +13 -0
- package/plugins/acryl-db-sqlite/src/facade/node.ts +199 -0
- package/plugins/acryl-db-sqlite/src/index.ts +88 -0
- package/plugins/acryl-db-sqlite/src/open.ts +61 -0
- package/plugins/acryl-db-sqlite/upstream.json +21 -0
- package/plugins/acryl-inspect/upstream.json +1 -1
- package/plugins/acryl-node-server/upstream.json +1 -1
- package/plugins/acryl-router/upstream.json +1 -1
- package/plugins/acryl-router-http/upstream.json +1 -1
- package/plugins/acryl-state/upstream.json +1 -1
- package/plugins/desktop/upstream.json +1 -1
- package/plugins/desktop-web/main.ts +13 -3
- package/plugins/desktop-web/upstream.json +1 -1
- package/plugins/tsconfig.json +1 -0
- package/templates/todo/upstream.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The desktop shell of a plain Acryl app: `npm run desktop` serves the app (`src/app.ts
|
|
2
|
+
* The desktop shell of a plain Acryl app: `npm run desktop` serves the app (`src/app.ts`: `export default app`, and optionally `export const close` for a database to close) on a free loopback port from this Electron main process and
|
|
3
3
|
* opens one window on it. Nothing in the app imports electron; every Electron call is in this file and `window.ts`, so a different shell is a change here only.
|
|
4
4
|
*
|
|
5
5
|
* Order matters: the user-data folder is set before anything else (and before the single-instance lock), so one app never shares window state, logs or the lock with
|
|
@@ -36,13 +36,19 @@ if (!app.requestSingleInstanceLock()) {
|
|
|
36
36
|
} else {
|
|
37
37
|
let server: ReturnType<typeof serve> | undefined
|
|
38
38
|
let window: BrowserWindow | undefined
|
|
39
|
+
/** The app module's optional `close`, for an app that owns a database: called once the server has stopped. */
|
|
40
|
+
let closeApp: (() => Promise<void>) | undefined
|
|
39
41
|
|
|
40
42
|
const shutdown = createDesktopShutdown(
|
|
41
43
|
() =>
|
|
42
44
|
new Promise<void>((done) => {
|
|
43
45
|
if (server === undefined) return done()
|
|
44
46
|
server.close(() => {
|
|
45
|
-
|
|
47
|
+
const closing = closeApp?.() ?? Promise.resolve()
|
|
48
|
+
closing.then(
|
|
49
|
+
() => done(),
|
|
50
|
+
() => done(),
|
|
51
|
+
)
|
|
46
52
|
})
|
|
47
53
|
// Open streams and keep-alive connections would hold close() open: end them.
|
|
48
54
|
;(server as { closeAllConnections?: () => void }).closeAllConnections?.()
|
|
@@ -67,7 +73,11 @@ if (!app.requestSingleInstanceLock()) {
|
|
|
67
73
|
|
|
68
74
|
void app.whenReady().then(async () => {
|
|
69
75
|
// The hook above is registered before the app's modules are loaded, so the app may have .tsx pages: they are loaded here, not as a static import.
|
|
70
|
-
const { default: acrylApp } = await import('../../app.ts')
|
|
76
|
+
const { default: acrylApp, close } = (await import('../../app.ts')) as {
|
|
77
|
+
default: { fetch: Parameters<typeof serve>[0]['fetch'] }
|
|
78
|
+
close?: () => Promise<void>
|
|
79
|
+
}
|
|
80
|
+
closeApp = close
|
|
71
81
|
const port = await new Promise<number>((resolve) => {
|
|
72
82
|
server = serve(
|
|
73
83
|
{ fetch: acrylApp.fetch, port: 0, hostname: '127.0.0.1' },
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"apps/acryl-desktop/src/shell/desktop-user-data.ts": "user-data.ts",
|
|
6
6
|
"apps/acryl-desktop/src/shell/shutdown.ts": "shutdown.ts"
|
|
7
7
|
},
|
|
8
|
-
"commit": "
|
|
8
|
+
"commit": "4721bb00960fa4e157e6070c330cf87c148739fc"
|
|
9
9
|
},
|
|
10
10
|
"rewrittenSpecifiers": 0,
|
|
11
11
|
"digest": "sha256:7dfe960a8bbb476c35540d2202a7aaa62b33492c2ac3e34314e2ecfca45f32f2"
|
package/plugins/tsconfig.json
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"acryl-*/src/**/*.case.ts",
|
|
24
24
|
"acryl-node-server/tests/adapter",
|
|
25
25
|
"acryl-router/tests/loader.spec.ts",
|
|
26
|
+
"acryl-db-sqlite/tests/loader.spec.ts",
|
|
26
27
|
"acryl-state/src/react.ts",
|
|
27
28
|
"acryl-state/tests/react.spec.ts",
|
|
28
29
|
"acryl-router-http/tests/adapter.spec.ts",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"examples/acryl-todo/src/index.ts": "src/todo.ts",
|
|
6
6
|
"examples/acryl-todo/src/page.ts": "src/page.ts"
|
|
7
7
|
},
|
|
8
|
-
"commit": "
|
|
8
|
+
"commit": "4721bb00960fa4e157e6070c330cf87c148739fc"
|
|
9
9
|
},
|
|
10
10
|
"rewrittenSpecifiers": 4,
|
|
11
11
|
"digest": "sha256:9093704776563001f7f472f94cc5c2fdd79206342c1cb59c11fce62aa74df3ed"
|